Skip to content

Commit 4bd9d98

Browse files
author
Andrey Tretyakov
committed
[SPIRV] Fix style of LIT tests and remove metadata
Fix style, indentation, comments of LIT tests and remove unnecessary metadata and attributes. Differential Revision: https://reviews.llvm.org/D130664
1 parent 63725eb commit 4bd9d98

40 files changed

+645
-780
lines changed

llvm/test/CodeGen/SPIRV/AtomicCompareExchange.ll

Lines changed: 30 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,27 @@
11
; RUN: llc -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s --check-prefix=CHECK-SPIRV
22

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+
2825
define dso_local spir_func void @test(i32* %ptr, i32* %value_ptr, i32 %comparator) local_unnamed_addr {
2926
entry:
3027
%0 = load i32, i32* %value_ptr, align 4
@@ -41,17 +38,16 @@ cmpxchg.continue: ; preds = %cmpxchg.store_expec
4138
ret void
4239
}
4340

44-
; CHECK-SPIRV: %[[#Ptr:]] = OpFunctionParameter %[[#]]
45-
; CHECK-SPIRV: %[[#Store_ptr:]] = OpFunctionParameter %[[#]]
41+
; CHECK-SPIRV: %[[#Ptr:]] = OpFunctionParameter %[[#]]
42+
; CHECK-SPIRV: %[[#Store_ptr:]] = OpFunctionParameter %[[#]]
4643

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]]
5350

54-
; Function Attrs: nounwind
5551
define dso_local spir_func void @test2(i32* %ptr, {i32, i1}* %store_ptr) local_unnamed_addr {
5652
entry:
5753
%0 = cmpxchg i32* %ptr, i32 128, i32 456 seq_cst acquire

llvm/test/CodeGen/SPIRV/TruncToBool.ll

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@
33
; CHECK-SPIRV: OpBitwiseAnd
44
; CHECK-SPIRV-NEXT: OpINotEqual
55

6-
; Function Attrs: nounwind
76
define spir_kernel void @test(i32 %op1, i32 %op2, i8 %op3) {
87
entry:
98
%0 = trunc i8 %op3 to i1
109
%call = call spir_func i32 @_Z14__spirv_Selectbii(i1 zeroext %0, i32 %op1, i32 %op2)
1110
ret void
1211
}
1312

14-
; Function Attrs: nounwind readnone
1513
declare spir_func i32 @_Z14__spirv_Selectbii(i1 zeroext, i32, i32)

llvm/test/CodeGen/SPIRV/branching/if-merging.ll

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
; RUN: llc -O0 %s -o - | FileCheck %s
1+
; RUN: llc -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s
22

3-
; NOTE: This does not check for structured control-flow operations.
4-
5-
target triple = "spirv32-unknown-unknown"
3+
;; NOTE: This does not check for structured control-flow operations.
64

75
; CHECK-DAG: OpName [[FOO:%.+]] "foo"
86
; CHECK-DAG: OpName [[BAR:%.+]] "bar"

llvm/test/CodeGen/SPIRV/constant/global-constants.ll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ define i32 @getGlobal3() {
1919
ret i32 %g
2020
}
2121

22-
; CHECK: [[INT:%.+]] = OpTypeInt 32
22+
; CHECK: [[INT:%.+]] = OpTypeInt 32
2323

2424
; CHECK-DAG: [[PTR_TO_INT_AS1:%.+]] = OpTypePointer CrossWorkgroup [[INT]]
2525
; CHECK-DAG: [[PTR_TO_INT_AS2:%.+]] = OpTypePointer UniformConstant [[INT]]
@@ -33,6 +33,6 @@ define i32 @getGlobal3() {
3333
; CHECK-DAG: [[GV2:%.+]] = OpVariable [[PTR_TO_INT_AS2]] UniformConstant [[CST_AS2]]
3434
; CHECK-DAG: [[GV3:%.+]] = OpVariable [[PTR_TO_INT_AS3]] Workgroup [[CST_AS3]]
3535

36-
; CHECK: OpLoad [[INT]] [[GV1]]
37-
; CHECK: OpLoad [[INT]] [[GV2]]
38-
; CHECK: OpLoad [[INT]] [[GV3]]
36+
; CHECK: OpLoad [[INT]] [[GV1]]
37+
; CHECK: OpLoad [[INT]] [[GV2]]
38+
; CHECK: OpLoad [[INT]] [[GV3]]

llvm/test/CodeGen/SPIRV/constant/local-aggregate-constant.ll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ define %aggregate @getConstant() {
66
ret %aggregate { i8 1, i32 2 }
77
}
88

9-
; CHECK: OpName [[GET:%.+]] "getConstant"
9+
; CHECK: OpName [[GET:%.+]] "getConstant"
1010

1111
; CHECK-DAG: [[I8:%.+]] = OpTypeInt 8
1212
; CHECK-DAG: [[I32:%.+]] = OpTypeInt 32
@@ -15,6 +15,6 @@ define %aggregate @getConstant() {
1515
; CHECK-DAG: [[CST_I32:%.+]] = OpConstant [[I32]] 2
1616
; CHECK-DAG: [[CST_AGGREGATE:%.+]] = OpConstantComposite [[AGGREGATE]] [[CST_I8]] [[CST_I32]]
1717

18-
; CHECK: [[GET]] = OpFunction [[AGGREGATE]]
19-
; CHECK: OpReturnValue [[CST_AGGREGATE]]
20-
; CHECK: OpFunctionEnd
18+
; CHECK: [[GET]] = OpFunction [[AGGREGATE]]
19+
; CHECK: OpReturnValue [[CST_AGGREGATE]]
20+
; CHECK: OpFunctionEnd

llvm/test/CodeGen/SPIRV/constant/local-bool-constants.ll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ define i1 @getConstantFalse() {
88
ret i1 false
99
}
1010

11-
; CHECK: [[BOOL:%.+]] = OpTypeBool
11+
; CHECK: [[BOOL:%.+]] = OpTypeBool
1212
; CHECK-DAG: [[FN:%.+]] = OpTypeFunction [[BOOL]]
1313
; CHECK-DAG: [[TRUE:%.+]] = OpConstantTrue
1414
; CHECK-DAG: [[FALSE:%.+]] = OpConstantFalse
1515

16-
; CHECK: OpFunction [[BOOL]] None [[FN]]
17-
; CHECK: OpFunction [[BOOL]] None [[FN]]
16+
; CHECK: OpFunction [[BOOL]] None [[FN]]
17+
; CHECK: OpFunction [[BOOL]] None [[FN]]

llvm/test/CodeGen/SPIRV/constant/local-null-constants.ll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
; RUN: llc -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s
22

3-
; OpenCL global memory
3+
;; OpenCL global memory
44
define i32 addrspace(1)* @getConstant1() {
55
ret i32 addrspace(1)* null
66
}
77

8-
; OpenCL constant memory
8+
;; OpenCL constant memory
99
define i32 addrspace(2)* @getConstant2() {
1010
ret i32 addrspace(2)* null
1111
}
1212

13-
; OpenCL local memory
13+
;; OpenCL local memory
1414
define i32 addrspace(3)* @getConstant3() {
1515
ret i32 addrspace(3)* null
1616
}
1717

18-
; CHECK: [[INT:%.+]] = OpTypeInt 32
18+
; CHECK: [[INT:%.+]] = OpTypeInt 32
1919

2020
; CHECK-DAG: [[PTR_AS1:%.+]] = OpTypePointer CrossWorkgroup [[INT]]
2121
; CHECK-DAG: OpConstantNull [[PTR_AS1]]

llvm/test/CodeGen/SPIRV/constant/local-vector-matrix-constants.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
; RUN: llc -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s
22

3-
; TODO: Add test for matrix. But how are they represented in LLVM IR?
3+
;; TODO: Add test for matrix. But how are they represented in LLVM IR?
44

55
define <4 x i8> @getVectorConstant() {
66
ret <4 x i8> <i8 1, i8 1, i8 1, i8 1>

llvm/test/CodeGen/SPIRV/function/alloca-load-store.ll

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
; RUN: llc -O0 %s -o - | FileCheck %s
2-
3-
target triple = "spirv32-unknown-unknown"
1+
; RUN: llc -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s
42

53
; CHECK-DAG: OpName [[BAR:%.+]] "bar"
64
; CHECK-DAG: OpName [[FOO:%.+]] "foo"
75
; CHECK-DAG: OpName [[GOO:%.+]] "goo"
86

9-
; CHECK: [[INT:%.+]] = OpTypeInt 32
7+
; CHECK: [[INT:%.+]] = OpTypeInt 32
108
; CHECK-DAG: [[STACK_PTR:%.+]] = OpTypePointer Function [[INT]]
119
; CHECK-DAG: [[GLOBAL_PTR:%.+]] = OpTypePointer CrossWorkgroup [[INT]]
1210
; CHECK-DAG: [[FN1:%.+]] = OpTypeFunction [[INT]] [[INT]]
@@ -46,7 +44,7 @@ define i32 @foo(i32 %a) {
4644
; CHECK: OpFunctionEnd
4745

4846

49-
; Test load and store in global address space.
47+
;; Test load and store in global address space.
5048
define i32 @goo(i32 %a, i32 addrspace(1)* %p) {
5149
store i32 %a, i32 addrspace(1)* %p
5250
%b = load i32, i32 addrspace(1)* %p

llvm/test/CodeGen/SPIRV/function/identity-function.ll

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
; RUN: llc -O0 %s -o - | FileCheck %s
1+
; RUN: llc -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s
22

3-
target triple = "spirv32-unknown-unknown"
3+
; CHECK-DAG: OpName [[VALUE:%.+]] "value"
4+
; CHECK-DAG: OpName [[IDENTITY:%.+]] "identity"
45

5-
; CHECK-DAG: OpName [[VALUE:%.+]] "value"
6-
; CHECK-DAG: OpName [[IDENTITY:%.+]] "identity"
6+
; CHECK: [[INT:%.+]] = OpTypeInt 32
7+
; CHECK: [[FN:%.+]] = OpTypeFunction [[INT]] [[INT]]
78

8-
; CHECK: [[INT:%.+]] = OpTypeInt 32
9-
; CHECK: [[FN:%.+]] = OpTypeFunction [[INT]] [[INT]]
10-
11-
; CHECK: [[IDENTITY]] = OpFunction [[INT]] None [[FN]]
9+
; CHECK: [[IDENTITY]] = OpFunction [[INT]] None [[FN]]
1210
; CHECK-NEXT: [[VALUE]] = OpFunctionParameter [[INT]]
1311
; CHECK-NEXT: {{%.+}} = OpLabel
1412
; CHECK-NEXT: OpReturnValue [[VALUE]]

0 commit comments

Comments
 (0)