1
1
; RUN: llc -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s --check-prefix=CHECK-SPIRV
2
2
3
- ; CHECK-SPIRV: %[[#Int:]] = OpTypeInt 32 0
4
- ; CHECK-SPIRV-DAG: %[[#MemScope_Device:]] = OpConstant %[[#Int]] 1
5
- ; CHECK-SPIRV-DAG: %[[#MemSemEqual_SeqCst:]] = OpConstant %[[#Int]] 16
6
- ; CHECK-SPIRV-DAG: %[[#MemSemUnequal_Acquire:]] = OpConstant %[[#Int]] 2
7
- ; CHECK-SPIRV-DAG: %[[#Constant_456:]] = OpConstant %[[#Int]] 456
8
- ; CHECK-SPIRV-DAG: %[[#Constant_128:]] = OpConstant %[[#Int]] 128
9
- ; CHECK-SPIRV-DAG: %[[#Bool:]] = OpTypeBool
10
- ; CHECK-SPIRV-DAG: %[[#Struct:]] = OpTypeStruct %[[#Int]] %[[#Bool]]
11
- ; CHECK-SPIRV-DAG: %[[#UndefStruct:]] = OpUndef %[[#Struct]]
12
-
13
- ; CHECK-SPIRV: %[[#Pointer:]] = OpFunctionParameter %[[#]]
14
- ; CHECK-SPIRV: %[[#Value_ptr:]] = OpFunctionParameter %[[#]]
15
- ; CHECK-SPIRV: %[[#Comparator:]] = OpFunctionParameter %[[#]]
16
-
17
- ; CHECK-SPIRV: %[[#Value:]] = OpLoad %[[#Int]] %[[#Value_ptr]]
18
- ; CHECK-SPIRV: %[[#Res:]] = OpAtomicCompareExchange %[[#Int]] %[[#Pointer]] %[[#MemScope_Device]]
19
- ; CHECK-SPIRV-SAME: %[[#MemSemEqual_SeqCst]] %[[#MemSemUnequal_Acquire]] %[[#Value]] %[[#Comparator]]
20
- ; CHECK-SPIRV: %[[#Success:]] = OpIEqual %[[#]] %[[#Res]] %[[#Comparator]]
21
- ; CHECK-SPIRV: %[[#Composite_0:]] = OpCompositeInsert %[[#Struct]] %[[#Res]] %[[#UndefStruct]] 0
22
- ; CHECK-SPIRV: %[[#Composite_1:]] = OpCompositeInsert %[[#Struct]] %[[#Success]] %[[#Composite_0]] 1
23
- ; CHECK-SPIRV: %[[#]] = OpCompositeExtract %[[#Bool]] %[[#Composite_1]] 1
24
-
25
- target datalayout = "e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024"
26
-
27
- ; Function Attrs: nounwind
3
+ ; CHECK-SPIRV: %[[#Int:]] = OpTypeInt 32 0
4
+ ; CHECK-SPIRV-DAG: %[[#MemScope_Device:]] = OpConstant %[[#Int]] 1
5
+ ; CHECK-SPIRV-DAG: %[[#MemSemEqual_SeqCst:]] = OpConstant %[[#Int]] 16
6
+ ; CHECK-SPIRV-DAG: %[[#MemSemUnequal_Acquire:]] = OpConstant %[[#Int]] 2
7
+ ; CHECK-SPIRV-DAG: %[[#Constant_456:]] = OpConstant %[[#Int]] 456
8
+ ; CHECK-SPIRV-DAG: %[[#Constant_128:]] = OpConstant %[[#Int]] 128
9
+ ; CHECK-SPIRV-DAG: %[[#Bool:]] = OpTypeBool
10
+ ; CHECK-SPIRV-DAG: %[[#Struct:]] = OpTypeStruct %[[#Int]] %[[#Bool]]
11
+ ; CHECK-SPIRV-DAG: %[[#UndefStruct:]] = OpUndef %[[#Struct]]
12
+
13
+ ; CHECK-SPIRV: %[[#Pointer:]] = OpFunctionParameter %[[#]]
14
+ ; CHECK-SPIRV: %[[#Value_ptr:]] = OpFunctionParameter %[[#]]
15
+ ; CHECK-SPIRV: %[[#Comparator:]] = OpFunctionParameter %[[#]]
16
+
17
+ ; CHECK-SPIRV: %[[#Value:]] = OpLoad %[[#Int]] %[[#Value_ptr]]
18
+ ; CHECK-SPIRV: %[[#Res:]] = OpAtomicCompareExchange %[[#Int]] %[[#Pointer]] %[[#MemScope_Device]]
19
+ ; CHECK-SPIRV-SAME: %[[#MemSemEqual_SeqCst]] %[[#MemSemUnequal_Acquire]] %[[#Value]] %[[#Comparator]]
20
+ ; CHECK-SPIRV: %[[#Success:]] = OpIEqual %[[#]] %[[#Res]] %[[#Comparator]]
21
+ ; CHECK-SPIRV: %[[#Composite_0:]] = OpCompositeInsert %[[#Struct]] %[[#Res]] %[[#UndefStruct]] 0
22
+ ; CHECK-SPIRV: %[[#Composite_1:]] = OpCompositeInsert %[[#Struct]] %[[#Success]] %[[#Composite_0]] 1
23
+ ; CHECK-SPIRV: %[[#]] = OpCompositeExtract %[[#Bool]] %[[#Composite_1]] 1
24
+
28
25
define dso_local spir_func void @test (i32* %ptr , i32* %value_ptr , i32 %comparator ) local_unnamed_addr {
29
26
entry:
30
27
%0 = load i32 , i32* %value_ptr , align 4
@@ -41,17 +38,16 @@ cmpxchg.continue: ; preds = %cmpxchg.store_expec
41
38
ret void
42
39
}
43
40
44
- ; CHECK-SPIRV: %[[#Ptr:]] = OpFunctionParameter %[[#]]
45
- ; CHECK-SPIRV: %[[#Store_ptr:]] = OpFunctionParameter %[[#]]
41
+ ; CHECK-SPIRV: %[[#Ptr:]] = OpFunctionParameter %[[#]]
42
+ ; CHECK-SPIRV: %[[#Store_ptr:]] = OpFunctionParameter %[[#]]
46
43
47
- ; CHECK-SPIRV: %[[#Res_1:]] = OpAtomicCompareExchange %[[#Int]] %[[#Ptr]] %[[#MemScope_Device]]
48
- ; CHECK-SPIRV-SAME: %[[#MemSemEqual_SeqCst]] %[[#MemSemUnequal_Acquire]] %[[#Constant_456]] %[[#Constant_128]]
49
- ; CHECK-SPIRV: %[[#Success_1:]] = OpIEqual %[[#]] %[[#Res_1]] %[[#Constant_128]]
50
- ; CHECK-SPIRV: %[[#Composite:]] = OpCompositeInsert %[[#Struct]] %[[#Res_1]] %[[#UndefStruct]] 0
51
- ; CHECK-SPIRV: %[[#Composite_1:]] = OpCompositeInsert %[[#Struct]] %[[#Success_1]] %[[#Composite]] 1
52
- ; CHECK-SPIRV: OpStore %[[#Store_ptr]] %[[#Composite_1]]
44
+ ; CHECK-SPIRV: %[[#Res_1:]] = OpAtomicCompareExchange %[[#Int]] %[[#Ptr]] %[[#MemScope_Device]]
45
+ ; CHECK-SPIRV-SAME: %[[#MemSemEqual_SeqCst]] %[[#MemSemUnequal_Acquire]] %[[#Constant_456]] %[[#Constant_128]]
46
+ ; CHECK-SPIRV: %[[#Success_1:]] = OpIEqual %[[#]] %[[#Res_1]] %[[#Constant_128]]
47
+ ; CHECK-SPIRV: %[[#Composite:]] = OpCompositeInsert %[[#Struct]] %[[#Res_1]] %[[#UndefStruct]] 0
48
+ ; CHECK-SPIRV: %[[#Composite_1:]] = OpCompositeInsert %[[#Struct]] %[[#Success_1]] %[[#Composite]] 1
49
+ ; CHECK-SPIRV: OpStore %[[#Store_ptr]] %[[#Composite_1]]
53
50
54
- ; Function Attrs: nounwind
55
51
define dso_local spir_func void @test2 (i32* %ptr , {i32 , i1 }* %store_ptr ) local_unnamed_addr {
56
52
entry:
57
53
%0 = cmpxchg i32* %ptr , i32 128 , i32 456 seq_cst acquire
0 commit comments