Skip to content

Commit 38497ad

Browse files
committed
add array test
1 parent feb15ec commit 38497ad

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

clang/test/CodeGenHLSL/builtins/select.hlsl

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,26 @@ int test_select_bool_int(bool cond0, int tVal, int fVal) {
1010
}
1111

1212
struct S { int a; };
13-
// CHECK-LABEL: test_select_infer
13+
// CHECK-LABEL: test_select_infer_struct
1414
// CHECK: [[TRUE_VAL:%.*]] = load %struct.S, ptr {{%.*}}, align 1
1515
// CHECK: [[FALSE_VAL:%.*]] = load %struct.S, ptr {{%.*}}, align 1
1616
// CHECK: [[SELECT:%.*]] = select i1 {{%.*}}, %struct.S [[TRUE_VAL]], %struct.S [[FALSE_VAL]]
1717
// CHECK: store %struct.S [[SELECT]], ptr {{%.*}}, align 1
1818
// CHECK: ret void
19-
struct S test_select_infer(bool cond0, struct S tVal, struct S fVal) {
19+
struct S test_select_infer_struct(bool cond0, struct S tVal, struct S fVal) {
2020
return select(cond0, tVal, fVal);
2121
}
2222

23+
// CHECK-LABEL: test_select_infer_array
24+
// CHECK: [[TRUE_VAL:%.*]] = load [3 x i32], ptr {{%.*}}, align 4
25+
// CHECK: [[FALSE_VAL:%.*]] = load [3 x i32], ptr {{%.*}}, align 4
26+
// CHECK: [[SELECT:%.*]] = select i1 {{%.*}}, [3 x i32] [[TRUE_VAL]], [3 x i32] [[FALSE_VAL]]
27+
// CHECK: store [3 x i32] [[SELECT]], ptr {{%.*}}, align 4
28+
// CHECK: ret void
29+
int test_select_infer_array(bool cond, int tVal[3], int fVal[3])[3] {
30+
return select(cond, tVal, fVal);
31+
}
32+
2333
// CHECK-LABEL: test_select_bool_vector
2434
// CHECK: [[SELECT:%.*]] = select i1 {{%.*}}, <2 x i32> {{%.*}}, <2 x i32> {{%.*}}
2535
// CHECK: ret <2 x i32> [[SELECT]]

0 commit comments

Comments
 (0)