C++: Add tests for logical vector operations

This commit is contained in:
Jeroen Ketema
2026-01-08 11:06:26 +01:00
parent 1ebf623541
commit 89c11b8daf
11 changed files with 44 additions and 15 deletions

View File

@@ -13331,7 +13331,21 @@ ir.cpp:
# 1216| getRightOperand(): [VariableAccess] vi4_shuffle
# 1216| Type = [SpecifiedType] __attribute((vector_size(16UL))) int
# 1216| ValueCategory = prvalue(load)
# 1219| getStmt(5): [ReturnStmt] return ...
# 1217| getStmt(5): [ExprStmt] ExprStmt
# 1217| getExpr(): [AssignExpr] ... = ...
# 1217| Type = [SpecifiedType] __attribute((vector_size(16UL))) int
# 1217| ValueCategory = lvalue
# 1217| getLValue(): [VariableAccess] vi4
# 1217| Type = [SpecifiedType] __attribute((vector_size(16UL))) int
# 1217| ValueCategory = lvalue
# 1218| getStmt(6): [ExprStmt] ExprStmt
# 1218| getExpr(): [AssignExpr] ... = ...
# 1218| Type = [SpecifiedType] __attribute((vector_size(16UL))) int
# 1218| ValueCategory = lvalue
# 1218| getLValue(): [VariableAccess] vi4
# 1218| Type = [SpecifiedType] __attribute((vector_size(16UL))) int
# 1218| ValueCategory = lvalue
# 1219| getStmt(7): [ReturnStmt] return ...
# 1221| [TopLevelFunction] void* memcpy(void*, void*, int)
# 1221| <params>:
# 1221| getParameter(0): [Parameter] dst

View File

@@ -10486,10 +10486,6 @@ ir.cpp:
# 1216| r1216_5(__attribute((vector_size(16UL))) int) = Add : r1216_2, r1216_4
# 1216| r1216_6(glval<__attribute((vector_size(16UL))) int>) = VariableAddress[vi4] :
# 1216| m1216_7(__attribute((vector_size(16UL))) int) = Store[vi4] : &:r1216_6, r1216_5
# 1219| v1219_1(void) = NoOp :
# 1211| v1211_7(void) = ReturnVoid :
# 1211| v1211_8(void) = AliasedUse : m1211_3
# 1211| v1211_9(void) = ExitFunction :
# 1223| int ModeledCallTarget(int)
# 1223| Block 0

View File

@@ -6,6 +6,7 @@ missingOperandType
duplicateChiOperand
sideEffectWithoutPrimary
instructionWithoutSuccessor
| ir.cpp:1216:3:1216:25 | Store: ... = ... | Instruction 'Store: ... = ...' has no successors in function '$@'. | ir.cpp:1211:6:1211:16 | void VectorTypes(int) | void VectorTypes(int) |
ambiguousSuccessors
unexplainedLoop
unnecessaryPhiInstruction

View File

@@ -6,6 +6,7 @@ missingOperandType
duplicateChiOperand
sideEffectWithoutPrimary
instructionWithoutSuccessor
| ir.cpp:1216:3:1216:25 | Store: ... = ... | Instruction 'Store: ... = ...' has no successors in function '$@'. | ir.cpp:1211:6:1211:16 | void VectorTypes(int) | void VectorTypes(int) |
ambiguousSuccessors
unexplainedLoop
unnecessaryPhiInstruction

View File

@@ -1214,8 +1214,8 @@ void VectorTypes(int i) {
vi4[i] = x;
vector(4, int) vi4_shuffle = __builtin_shufflevector(vi4, vi4, 3+0, 2, 1, 0);
vi4 = vi4 + vi4_shuffle;
vi4 = vi4 && vi4_shuffle;
vi4 = vi4 || vi4_shuffle;
}
void *memcpy(void *dst, void *src, int size);

View File

@@ -1,4 +1,6 @@
missingOperand
| ir.cpp:1217:3:1217:26 | Store: ... = ... | Instruction 'Store' is missing an expected operand with tag 'StoreValue' in function '$@'. | ir.cpp:1211:6:1211:16 | void VectorTypes(int) | void VectorTypes(int) |
| ir.cpp:1218:3:1218:26 | Store: ... = ... | Instruction 'Store' is missing an expected operand with tag 'StoreValue' in function '$@'. | ir.cpp:1211:6:1211:16 | void VectorTypes(int) | void VectorTypes(int) |
unexpectedOperand
duplicateOperand
missingPhiOperand
@@ -6,6 +8,8 @@ missingOperandType
duplicateChiOperand
sideEffectWithoutPrimary
instructionWithoutSuccessor
| ir.cpp:1216:3:1216:25 | Store: ... = ... | Instruction 'Store: ... = ...' has no successors in function '$@'. | ir.cpp:1211:6:1211:16 | void VectorTypes(int) | void VectorTypes(int) |
| ir.cpp:1217:3:1217:26 | Store: ... = ... | Instruction 'Store: ... = ...' has no successors in function '$@'. | ir.cpp:1211:6:1211:16 | void VectorTypes(int) | void VectorTypes(int) |
ambiguousSuccessors
unexplainedLoop
unnecessaryPhiInstruction

View File

@@ -9692,10 +9692,18 @@ ir.cpp:
# 1216| r1216_5(__attribute((vector_size(16UL))) int) = Add : r1216_2, r1216_4
# 1216| r1216_6(glval<__attribute((vector_size(16UL))) int>) = VariableAddress[vi4] :
# 1216| mu1216_7(__attribute((vector_size(16UL))) int) = Store[vi4] : &:r1216_6, r1216_5
# 1219| v1219_1(void) = NoOp :
# 1211| v1211_6(void) = ReturnVoid :
# 1211| v1211_7(void) = AliasedUse : ~m?
# 1211| v1211_8(void) = ExitFunction :
# 1217| Block 1
# 1217| r1217_1(glval<__attribute((vector_size(16UL))) int>) = VariableAddress[vi4] :
# 1217| mu1217_2(__attribute((vector_size(16UL))) int) = Store[vi4] : &:r1217_1
# 1218| Block 2
# 1218| r1218_1(glval<__attribute((vector_size(16UL))) int>) = VariableAddress[vi4] :
# 1218| mu1218_2(__attribute((vector_size(16UL))) int) = Store[vi4] : &:r1218_1
# 1219| v1219_1(void) = NoOp :
# 1211| v1211_6(void) = ReturnVoid :
# 1211| v1211_7(void) = AliasedUse : ~m?
# 1211| v1211_8(void) = ExitFunction :
# 1223| int ModeledCallTarget(int)
# 1223| Block 0

View File

@@ -6,6 +6,7 @@ missingOperandType
duplicateChiOperand
sideEffectWithoutPrimary
instructionWithoutSuccessor
| ir.cpp:1216:3:1216:25 | Store: ... = ... | Instruction 'Store: ... = ...' has no successors in function '$@'. | ir.cpp:1211:6:1211:16 | void VectorTypes(int) | void VectorTypes(int) |
ambiguousSuccessors
unexplainedLoop
unnecessaryPhiInstruction

View File

@@ -6,6 +6,7 @@ missingOperandType
duplicateChiOperand
sideEffectWithoutPrimary
instructionWithoutSuccessor
| ir.cpp:1216:3:1216:25 | Store: ... = ... | Instruction 'Store: ... = ...' has no successors in function '$@'. | ir.cpp:1211:6:1211:16 | void VectorTypes(int) | void VectorTypes(int) |
ambiguousSuccessors
unexplainedLoop
unnecessaryPhiInstruction

View File

@@ -34,4 +34,7 @@
| vector_types.cpp:47:23:47:25 | dst | dst | file://:0:0:0:0 | v16i * | 8 |
| vector_types.cpp:47:34:47:36 | src | src | file://:0:0:0:0 | v16i * | 8 |
| vector_types.cpp:47:43:47:43 | n | n | file://:0:0:0:0 | int | 4 |
| vector_types.cpp:54:20:54:22 | dst | dst | file://:0:0:0:0 | v16i * | 8 |
| vector_types.cpp:54:31:54:34 | src1 | src1 | file://:0:0:0:0 | v16i * | 8 |
| vector_types.cpp:54:43:54:46 | src2 | src2 | file://:0:0:0:0 | v16i * | 8 |
| vector_types.cpp:62:43:62:44 | vf | vf | vector_types.cpp:60:16:60:27 | vector4float | 16 |

View File

@@ -51,10 +51,10 @@ void shift_left(v16i *dst, v16i *src, int n) {
*dst = *src << n;
}
void logical(v16i *dst, v16i *src1, v16i *src2) {
*dst = *src1 && *src2;
*dst = *src1 || *src2;
}
typedef double vector4double __attribute__((__vector_size__(32)));
typedef float vector4float __attribute__((__vector_size__(16)));