Skip to content

Commit f39a6d2

Browse files
committed
Test amdgpu_gfx i1 cases
1 parent 10e1864 commit f39a6d2

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

llvm/test/Transforms/InstCombine/AMDGPU/trivially-uniform.ll

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,3 +121,43 @@ define amdgpu_ps <32 x i1> @test_graphics_v32i1_negative(<32 x i1> %x) {
121121
%r = call <32 x i1> @llvm.amdgcn.readfirstlane(<32 x i1> %x)
122122
ret <32 x i1> %r
123123
}
124+
125+
; Test i1 arguments in non-entry functions.
126+
127+
define amdgpu_gfx i1 @test_callable_i1(i1 inreg %x) {
128+
; CHECK-LABEL: define amdgpu_gfx i1 @test_callable_i1(
129+
; CHECK-SAME: i1 inreg [[X:%.*]]) #[[ATTR0]] {
130+
; CHECK-NEXT: ret i1 [[X]]
131+
;
132+
%r = call i1 @llvm.amdgcn.readfirstlane(i1 %x)
133+
ret i1 %r
134+
}
135+
136+
define amdgpu_gfx <32 x i1> @test_callable_v32i1(<32 x i1> inreg %x) {
137+
; CHECK-LABEL: define amdgpu_gfx <32 x i1> @test_callable_v32i1(
138+
; CHECK-SAME: <32 x i1> inreg [[X:%.*]]) #[[ATTR0]] {
139+
; CHECK-NEXT: ret <32 x i1> [[X]]
140+
;
141+
%r = call <32 x i1> @llvm.amdgcn.readfirstlane(<32 x i1> %x)
142+
ret <32 x i1> %r
143+
}
144+
145+
define amdgpu_gfx i1 @test_callable_i1_negative(i1 %x) {
146+
; CHECK-LABEL: define amdgpu_gfx i1 @test_callable_i1_negative(
147+
; CHECK-SAME: i1 [[X:%.*]]) #[[ATTR0]] {
148+
; CHECK-NEXT: [[R:%.*]] = call i1 @llvm.amdgcn.readfirstlane.i1(i1 [[X]])
149+
; CHECK-NEXT: ret i1 [[R]]
150+
;
151+
%r = call i1 @llvm.amdgcn.readfirstlane(i1 %x)
152+
ret i1 %r
153+
}
154+
155+
define amdgpu_gfx <32 x i1> @test_callable_v32i1_negative(<32 x i1> %x) {
156+
; CHECK-LABEL: define amdgpu_gfx <32 x i1> @test_callable_v32i1_negative(
157+
; CHECK-SAME: <32 x i1> [[X:%.*]]) #[[ATTR0]] {
158+
; CHECK-NEXT: [[R:%.*]] = call <32 x i1> @llvm.amdgcn.readfirstlane.v32i1(<32 x i1> [[X]])
159+
; CHECK-NEXT: ret <32 x i1> [[R]]
160+
;
161+
%r = call <32 x i1> @llvm.amdgcn.readfirstlane(<32 x i1> %x)
162+
ret <32 x i1> %r
163+
}

0 commit comments

Comments
 (0)