This repository was archived by the owner on Feb 21, 2026. It is now read-only.
[CIR] Add support for ExtVectorBoolType element assignment, comparisons, and logical NOT#2004
Draft
lanza wants to merge 3 commits intogh/lanza/8/basefrom
Draft
[CIR] Add support for ExtVectorBoolType element assignment, comparisons, and logical NOT#2004lanza wants to merge 3 commits intogh/lanza/8/basefrom
lanza wants to merge 3 commits intogh/lanza/8/basefrom
Conversation
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
lanza
added a commit
that referenced
this pull request
Nov 25, 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 25, 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 26, 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 26, 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 26, 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 26, 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 27, 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
to lanza/llvm-project
that referenced
this pull request
Dec 4, 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: a9c5e91e3c3a09851ca93fe56ab929304d7e7941 Pull-Request: llvm/clangir#2004
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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.