-
Notifications
You must be signed in to change notification settings - Fork 182
[CIR] Add support for ExtVectorBoolType element assignment, comparisons, and logical NOT #2004
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
lanza
wants to merge
3
commits into
gh/lanza/8/base
Choose a base branch
from
gh/lanza/8/head
base: gh/lanza/8/base
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+280
−20
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lanza
added a commit
that referenced
this pull request
Nov 22, 2025
…ns, and logical NOT This commit implements three previously missing operations for ExtVectorBoolType: 1. Element assignment (v[i] = value): Converts the packed integer representation to a padded vector, performs the element insertion, and converts back to integer form while preserving padding bits. 2. Vector comparisons (==, !=, etc.): Extracts actual elements from padded storage using shufflevector, performs element-wise comparison, then pads the result back to storage size with undef for padding bits. 3. Logical NOT (!v): Implemented as element-wise comparison with zero vector, following the same extract-operate-pad pattern as other comparisons. All operations follow the ExtVectorBoolType storage model where N bool elements are stored in an integer padded to at least 8 bits (1 byte). The implementation: - Bitcasts the integer storage to <P x i1> vector (P = padded storage size) - Uses shufflevector to extract <N x i1> (actual elements) - Performs the operation on actual elements - Uses shufflevector to pad result back to <P x i1> (undef for padding) - Bitcasts back to integer storage This approach ensures padding bits remain undefined/unchanged and mirrors how LLVM CodeGen handles these operations. Test Plan: - Added comprehensive tests for element assignment, comparisons, and logical NOT - Tests verify both CIR output and LLVM lowering - All existing CIR CodeGen tests pass (395 tests, 380 passed, 14 unsupported, 1 expected fail) - Specific vector tests pass: vector.cpp, vectype.cpp, vectype-issized.c, vectype-ext.cpp The implementation closely follows CodeGen patterns in CGExprScalar.cpp and CGExpr.cpp, maintaining consistency with the original implementation approach. ghstack-source-id: f80584c Pull-Request: #2004
This was referenced Nov 22, 2025
lanza
added a commit
that referenced
this pull request
Nov 22, 2025
…ns, and logical NOT This commit implements three previously missing operations for ExtVectorBoolType: 1. Element assignment (v[i] = value): Converts the packed integer representation to a padded vector, performs the element insertion, and converts back to integer form while preserving padding bits. 2. Vector comparisons (==, !=, etc.): Extracts actual elements from padded storage using shufflevector, performs element-wise comparison, then pads the result back to storage size with undef for padding bits. 3. Logical NOT (!v): Implemented as element-wise comparison with zero vector, following the same extract-operate-pad pattern as other comparisons. All operations follow the ExtVectorBoolType storage model where N bool elements are stored in an integer padded to at least 8 bits (1 byte). The implementation: - Bitcasts the integer storage to <P x i1> vector (P = padded storage size) - Uses shufflevector to extract <N x i1> (actual elements) - Performs the operation on actual elements - Uses shufflevector to pad result back to <P x i1> (undef for padding) - Bitcasts back to integer storage This approach ensures padding bits remain undefined/unchanged and mirrors how LLVM CodeGen handles these operations. Test Plan: - Added comprehensive tests for element assignment, comparisons, and logical NOT - Tests verify both CIR output and LLVM lowering - All existing CIR CodeGen tests pass (395 tests, 380 passed, 14 unsupported, 1 expected fail) - Specific vector tests pass: vector.cpp, vectype.cpp, vectype-issized.c, vectype-ext.cpp The implementation closely follows CodeGen patterns in CGExprScalar.cpp and CGExpr.cpp, maintaining consistency with the original implementation approach. ghstack-source-id: a9c5e91 Pull-Request: #2004
lanza
added a commit
that referenced
this pull request
Nov 22, 2025
…ns, and logical NOT This commit implements three previously missing operations for ExtVectorBoolType: 1. Element assignment (v[i] = value): Converts the packed integer representation to a padded vector, performs the element insertion, and converts back to integer form while preserving padding bits. 2. Vector comparisons (==, !=, etc.): Extracts actual elements from padded storage using shufflevector, performs element-wise comparison, then pads the result back to storage size with undef for padding bits. 3. Logical NOT (!v): Implemented as element-wise comparison with zero vector, following the same extract-operate-pad pattern as other comparisons. All operations follow the ExtVectorBoolType storage model where N bool elements are stored in an integer padded to at least 8 bits (1 byte). The implementation: - Bitcasts the integer storage to <P x i1> vector (P = padded storage size) - Uses shufflevector to extract <N x i1> (actual elements) - Performs the operation on actual elements - Uses shufflevector to pad result back to <P x i1> (undef for padding) - Bitcasts back to integer storage This approach ensures padding bits remain undefined/unchanged and mirrors how LLVM CodeGen handles these operations. Test Plan: - Added comprehensive tests for element assignment, comparisons, and logical NOT - Tests verify both CIR output and LLVM lowering - All existing CIR CodeGen tests pass (395 tests, 380 passed, 14 unsupported, 1 expected fail) - Specific vector tests pass: vector.cpp, vectype.cpp, vectype-issized.c, vectype-ext.cpp The implementation closely follows CodeGen patterns in CGExprScalar.cpp and CGExpr.cpp, maintaining consistency with the original implementation approach. ghstack-source-id: a9c5e91 Pull-Request: #2004
This was referenced Nov 23, 2025
lanza
added a commit
that referenced
this pull request
Nov 24, 2025
…ns, and logical NOT This commit implements three previously missing operations for ExtVectorBoolType: 1. Element assignment (v[i] = value): Converts the packed integer representation to a padded vector, performs the element insertion, and converts back to integer form while preserving padding bits. 2. Vector comparisons (==, !=, etc.): Extracts actual elements from padded storage using shufflevector, performs element-wise comparison, then pads the result back to storage size with undef for padding bits. 3. Logical NOT (!v): Implemented as element-wise comparison with zero vector, following the same extract-operate-pad pattern as other comparisons. All operations follow the ExtVectorBoolType storage model where N bool elements are stored in an integer padded to at least 8 bits (1 byte). The implementation: - Bitcasts the integer storage to <P x i1> vector (P = padded storage size) - Uses shufflevector to extract <N x i1> (actual elements) - Performs the operation on actual elements - Uses shufflevector to pad result back to <P x i1> (undef for padding) - Bitcasts back to integer storage This approach ensures padding bits remain undefined/unchanged and mirrors how LLVM CodeGen handles these operations. Test Plan: - Added comprehensive tests for element assignment, comparisons, and logical NOT - Tests verify both CIR output and LLVM lowering - All existing CIR CodeGen tests pass (395 tests, 380 passed, 14 unsupported, 1 expected fail) - Specific vector tests pass: vector.cpp, vectype.cpp, vectype-issized.c, vectype-ext.cpp The implementation closely follows CodeGen patterns in CGExprScalar.cpp and CGExpr.cpp, maintaining consistency with the original implementation approach. ghstack-source-id: a9c5e91 Pull-Request: #2004
This was referenced Nov 24, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Stack from ghstack (oldest at bottom):
This commit implements three previously missing operations for ExtVectorBoolType:
Element assignment (v[i] = value): Converts the packed integer representation
to a padded vector, performs the element insertion, and converts back to
integer form while preserving padding bits.
Vector comparisons (==, !=, etc.): Extracts actual elements from padded
storage using shufflevector, performs element-wise comparison, then pads
the result back to storage size with undef for padding bits.
Logical NOT (!v): Implemented as element-wise comparison with zero vector,
following the same extract-operate-pad pattern as other comparisons.
All operations follow the ExtVectorBoolType storage model where N bool elements
are stored in an integer padded to at least 8 bits (1 byte). The implementation:
vector (P = padded storage size)
(undef for padding)
This approach ensures padding bits remain undefined/unchanged and mirrors how
LLVM CodeGen handles these operations.
Test Plan:
The implementation closely follows CodeGen patterns in CGExprScalar.cpp and
CGExpr.cpp, maintaining consistency with the original implementation approach.