Skip to content

Commit cb0b753

Browse files
Konstantina MitropoulouKonstantina Mitropoulou
authored andcommitted
[AMDGPU] Add new test.
1 parent c616fdc commit cb0b753

File tree

1 file changed

+109
-0
lines changed

1 file changed

+109
-0
lines changed
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 5
2+
; RUN: llc -mtriple=amdgcn -mcpu=gfx1200 -verify-machineinstrs -stop-after=amdgpu-isel < %s 2>&1 | FileCheck %s
3+
4+
@external_constant1 = external addrspace(4) constant float, align 4
5+
@external_constant2 = external addrspace(1) constant float, align 4
6+
@const.ptr = external addrspace(4) constant ptr, align 4
7+
8+
define void @test() {
9+
; CHECK-LABEL: name: test
10+
; CHECK: bb.0.entry:
11+
; CHECK-NEXT: successors: %bb.1(0x30000000), %bb.3(0x50000000)
12+
; CHECK-NEXT: {{ $}}
13+
; CHECK-NEXT: [[SI_PC_ADD_REL_OFFSET:%[0-9]+]]:sreg_64 = SI_PC_ADD_REL_OFFSET target-flags(amdgpu-gotprel32-lo) @external_constant1, target-flags(amdgpu-gotprel32-hi) @external_constant1, implicit-def dead $scc
14+
; CHECK-NEXT: [[S_LOAD_DWORDX2_IMM:%[0-9]+]]:sreg_64_xexec = S_LOAD_DWORDX2_IMM killed [[SI_PC_ADD_REL_OFFSET]], 0, 0 :: (dereferenceable invariant load (s64) from got, addrspace 4)
15+
; CHECK-NEXT: [[S_LOAD_DWORD_IMM:%[0-9]+]]:sreg_32_xm0_xexec = S_LOAD_DWORD_IMM killed [[S_LOAD_DWORDX2_IMM]], 0, 0 :: (dereferenceable invariant load (s32) from @external_constant1, addrspace 4)
16+
; CHECK-NEXT: [[S_MOV_B32_:%[0-9]+]]:sgpr_32 = S_MOV_B32 0
17+
; CHECK-NEXT: nofpexcept S_CMP_LG_F32 killed [[S_LOAD_DWORD_IMM]], killed [[S_MOV_B32_]], implicit-def $scc, implicit $mode
18+
; CHECK-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $scc
19+
; CHECK-NEXT: [[S_AND_B32_:%[0-9]+]]:sreg_32 = S_AND_B32 $exec_lo, killed [[COPY]], implicit-def dead $scc
20+
; CHECK-NEXT: $vcc_lo = COPY [[S_AND_B32_]]
21+
; CHECK-NEXT: S_CBRANCH_VCCNZ %bb.3, implicit $vcc
22+
; CHECK-NEXT: S_BRANCH %bb.1
23+
; CHECK-NEXT: {{ $}}
24+
; CHECK-NEXT: bb.1.bb1:
25+
; CHECK-NEXT: successors: %bb.2(0x40000000), %bb.4(0x40000000)
26+
; CHECK-NEXT: {{ $}}
27+
; CHECK-NEXT: [[SI_PC_ADD_REL_OFFSET1:%[0-9]+]]:sreg_64 = SI_PC_ADD_REL_OFFSET target-flags(amdgpu-gotprel32-lo) @const.ptr, target-flags(amdgpu-gotprel32-hi) @const.ptr, implicit-def dead $scc
28+
; CHECK-NEXT: [[S_LOAD_DWORDX2_IMM1:%[0-9]+]]:sreg_64_xexec = S_LOAD_DWORDX2_IMM killed [[SI_PC_ADD_REL_OFFSET1]], 0, 0 :: (dereferenceable invariant load (s64) from got, addrspace 4)
29+
; CHECK-NEXT: [[S_LOAD_DWORDX2_IMM2:%[0-9]+]]:sreg_64_xexec_xnull = S_LOAD_DWORDX2_IMM killed [[S_LOAD_DWORDX2_IMM1]], 0, 0 :: (invariant load (s64) from @const.ptr, addrspace 4)
30+
; CHECK-NEXT: [[V_MOV_B32_e32_:%[0-9]+]]:vgpr_32 = V_MOV_B32_e32 0, implicit $exec
31+
; CHECK-NEXT: [[GLOBAL_LOAD_DWORD_SADDR:%[0-9]+]]:vgpr_32 = GLOBAL_LOAD_DWORD_SADDR killed [[S_LOAD_DWORDX2_IMM2]], killed [[V_MOV_B32_e32_]], 0, 0, implicit $exec :: (load (s32) from %ir.0, addrspace 1)
32+
; CHECK-NEXT: [[S_MOV_B32_1:%[0-9]+]]:sgpr_32 = S_MOV_B32 1092616192
33+
; CHECK-NEXT: [[S_MOV_B32_2:%[0-9]+]]:sgpr_32 = S_MOV_B32 1065353216
34+
; CHECK-NEXT: [[COPY1:%[0-9]+]]:sreg_32 = COPY [[GLOBAL_LOAD_DWORD_SADDR]]
35+
; CHECK-NEXT: nofpexcept S_CMP_LT_F32 killed [[COPY1]], killed [[S_MOV_B32_2]], implicit-def $scc, implicit $mode
36+
; CHECK-NEXT: [[COPY2:%[0-9]+]]:sreg_32 = COPY $scc
37+
; CHECK-NEXT: [[S_AND_B32_1:%[0-9]+]]:sreg_32 = S_AND_B32 $exec_lo, killed [[COPY2]], implicit-def dead $scc
38+
; CHECK-NEXT: $vcc_lo = COPY [[S_AND_B32_1]]
39+
; CHECK-NEXT: S_CBRANCH_VCCNZ %bb.4, implicit $vcc
40+
; CHECK-NEXT: S_BRANCH %bb.2
41+
; CHECK-NEXT: {{ $}}
42+
; CHECK-NEXT: bb.2.bb2:
43+
; CHECK-NEXT: successors: %bb.4(0x80000000)
44+
; CHECK-NEXT: {{ $}}
45+
; CHECK-NEXT: [[S_MOV_B32_3:%[0-9]+]]:sgpr_32 = S_MOV_B32 0
46+
; CHECK-NEXT: S_BRANCH %bb.4
47+
; CHECK-NEXT: {{ $}}
48+
; CHECK-NEXT: bb.3.Flow1:
49+
; CHECK-NEXT: successors: %bb.7(0x80000000)
50+
; CHECK-NEXT: {{ $}}
51+
; CHECK-NEXT: S_BRANCH %bb.7
52+
; CHECK-NEXT: {{ $}}
53+
; CHECK-NEXT: bb.4.bb3:
54+
; CHECK-NEXT: successors: %bb.5(0x50000000), %bb.6(0x30000000)
55+
; CHECK-NEXT: {{ $}}
56+
; CHECK-NEXT: [[PHI:%[0-9]+]]:sgpr_32 = PHI [[S_MOV_B32_1]], %bb.1, [[S_MOV_B32_3]], %bb.2
57+
; CHECK-NEXT: [[S_MOV_B32_4:%[0-9]+]]:sgpr_32 = S_MOV_B32 0
58+
; CHECK-NEXT: nofpexcept S_CMP_NEQ_F32 [[PHI]], killed [[S_MOV_B32_4]], implicit-def $scc, implicit $mode
59+
; CHECK-NEXT: [[COPY3:%[0-9]+]]:sreg_32 = COPY $scc
60+
; CHECK-NEXT: [[S_AND_B32_2:%[0-9]+]]:sreg_32 = S_AND_B32 $exec_lo, killed [[COPY3]], implicit-def dead $scc
61+
; CHECK-NEXT: $vcc_lo = COPY [[S_AND_B32_2]]
62+
; CHECK-NEXT: S_CBRANCH_VCCNZ %bb.6, implicit $vcc
63+
; CHECK-NEXT: S_BRANCH %bb.5
64+
; CHECK-NEXT: {{ $}}
65+
; CHECK-NEXT: bb.5.bb4:
66+
; CHECK-NEXT: successors: %bb.6(0x80000000)
67+
; CHECK-NEXT: {{ $}}
68+
; CHECK-NEXT: [[SI_PC_ADD_REL_OFFSET2:%[0-9]+]]:sreg_64 = SI_PC_ADD_REL_OFFSET target-flags(amdgpu-gotprel32-lo) @external_constant2, target-flags(amdgpu-gotprel32-hi) @external_constant2, implicit-def dead $scc
69+
; CHECK-NEXT: [[S_LOAD_DWORDX2_IMM3:%[0-9]+]]:sreg_64_xexec_xnull = S_LOAD_DWORDX2_IMM killed [[SI_PC_ADD_REL_OFFSET2]], 0, 0 :: (dereferenceable invariant load (s64) from got, addrspace 4)
70+
; CHECK-NEXT: [[V_MOV_B32_e32_1:%[0-9]+]]:vgpr_32 = V_MOV_B32_e32 0, implicit $exec
71+
; CHECK-NEXT: [[V_MOV_B32_e32_2:%[0-9]+]]:vgpr_32 = V_MOV_B32_e32 1082130432, implicit $exec
72+
; CHECK-NEXT: GLOBAL_STORE_DWORD_SADDR killed [[V_MOV_B32_e32_1]], killed [[V_MOV_B32_e32_2]], killed [[S_LOAD_DWORDX2_IMM3]], 0, 0, implicit $exec :: (store (s32) into @external_constant2, addrspace 1)
73+
; CHECK-NEXT: {{ $}}
74+
; CHECK-NEXT: bb.6.Flow:
75+
; CHECK-NEXT: successors: %bb.3(0x80000000)
76+
; CHECK-NEXT: {{ $}}
77+
; CHECK-NEXT: S_BRANCH %bb.3
78+
; CHECK-NEXT: {{ $}}
79+
; CHECK-NEXT: bb.7.bb5:
80+
; CHECK-NEXT: SI_RETURN
81+
entry:
82+
%ld1 = load float, ptr addrspace(4) @external_constant1
83+
%cmp1 = fcmp one float %ld1, 0.0
84+
br i1 %cmp1, label %bb5, label %bb1, !amdgpu.uniform !0
85+
86+
bb1:
87+
%ptr = load ptr, ptr addrspace(4) @const.ptr
88+
%ld2 = load float, ptr %ptr, align 4
89+
%cmp2 = fcmp olt float %ld2, 1.0
90+
%or = or i1 %cmp2, false
91+
br i1 %or, label %bb3, label %bb2, !amdgpu.uniform !0
92+
93+
bb2:
94+
br label %bb3
95+
96+
bb3:
97+
%phi = phi float [ 10.0, %bb1 ], [ 0.0, %bb2 ]
98+
%cmp3 = fcmp oeq float %phi, 0.0
99+
br i1 %cmp3, label %bb4, label %bb5, !amdgpu.uniform !0
100+
101+
bb4:
102+
store float 4.0, ptr addrspace(1) @external_constant2
103+
br label %bb5
104+
105+
bb5:
106+
ret void
107+
}
108+
109+
!0 = !{}

0 commit comments

Comments
 (0)