1 # RUN: llc -mtriple=amdgcn -mcpu=gfx900 -start-before=twoaddressinstruction %s -o - | FileCheck %s -check-prefix=GCN
3 # Wait to sxpand SI_INDIRECT sequences that use VGPR indexing until after
4 # register allocation. We don’t want to reschedule the mode switching or to
5 # have any instructions inserted within the sequence. The Two-Address
6 # instruction pass could insert bad copies here if it is expanded too early.
9 # GCN-LABEL: expand_si_indirect
10 # GCN: s_set_gpr_idx_on
11 # GCN-NEXT: v_mov_b32_e32
12 # GCN-NEXT: s_set_gpr_idx_off
14 # GCN: s_set_gpr_idx_on
15 # GCN-NEXT: v_mov_b32_e32
16 # GCN-NOT: v_mov_b32_e32
17 # GCN-NEXT: s_set_gpr_idx_off
19 name: expand_si_indirect
20 tracksRegLiveness: true
25 %0:sgpr_64 = COPY killed $sgpr0_sgpr1
26 %1:vgpr_32 = V_MOV_B32_e32 0, implicit $exec
27 %2:sreg_64_xexec = S_LOAD_DWORDX2_IMM %0(p4), 36, 0
28 %3:sreg_32_xm0_xexec = S_LOAD_DWORD_IMM killed %0(p4), 44, 0
29 %4:sreg_32 = S_ADD_I32 %3, 1, implicit-def dead $scc
30 %5:vgpr_32 = V_MOV_B32_e32 1065353216, implicit $exec
31 %6:vgpr_32 = V_MOV_B32_e32 1073741824, implicit $exec
32 %7:vgpr_32 = V_MOV_B32_e32 1077936128, implicit $exec
33 %8:vgpr_32 = V_MOV_B32_e32 1082130432, implicit $exec
34 %9:vgpr_32 = V_MOV_B32_e32 1084227584, implicit $exec
35 %10:vgpr_32 = V_MOV_B32_e32 1086324736, implicit $exec
36 %11:vgpr_32 = V_MOV_B32_e32 1088421888, implicit $exec
37 %12:vgpr_32 = V_MOV_B32_e32 1090519040, implicit $exec
38 %13:vgpr_32 = V_MOV_B32_e32 1091567616, implicit $exec
39 %14:vgpr_32 = V_MOV_B32_e32 1092616192, implicit $exec
40 %15:vgpr_32 = V_MOV_B32_e32 1093664768, implicit $exec
41 %16:vgpr_32 = V_MOV_B32_e32 1094713344, implicit $exec
42 %17:vgpr_32 = V_MOV_B32_e32 1095761920, implicit $exec
43 %18:vgpr_32 = V_MOV_B32_e32 1096810496, implicit $exec
44 %19:vgpr_32 = V_MOV_B32_e32 1097859072, implicit $exec
45 %20:vgpr_32 = V_MOV_B32_e32 1098907648, implicit $exec
46 %21:vreg_512 = REG_SEQUENCE killed %5, %subreg.sub0, killed %6, %subreg.sub1, killed %7, %subreg.sub2, killed %8, %subreg.sub3, killed %9, %subreg.sub4, killed %10, %subreg.sub5, killed %11, %subreg.sub6, killed %12, %subreg.sub7, killed %13, %subreg.sub8, killed %14, %subreg.sub9, killed %15, %subreg.sub10, killed %16, %subreg.sub11, killed %17, %subreg.sub12, killed %18, %subreg.sub13, killed %19, %subreg.sub14, killed %20, %subreg.sub15
47 %22:vgpr_32 = V_MOV_B32_e32 1099431936, implicit $exec
48 %23:vreg_512 = V_INDIRECT_REG_WRITE_GPR_IDX_B32_V16 killed %21, %22, killed %4, 3, implicit-def $m0, implicit $m0, implicit $exec
49 %24:sreg_32 = S_ADD_I32 killed %3, 2, implicit-def dead $scc
50 %25:vreg_512 = V_INDIRECT_REG_WRITE_GPR_IDX_B32_V16 %23, killed %22, killed %24, 3, implicit-def $m0, implicit $m0, implicit $exec
51 %26:vgpr_32 = COPY %23.sub15
52 %27:vgpr_32 = COPY %23.sub14
53 %28:vgpr_32 = COPY %23.sub13
54 %29:vgpr_32 = COPY %23.sub12
55 %30:vreg_128 = REG_SEQUENCE killed %29, %subreg.sub0, killed %28, %subreg.sub1, killed %27, %subreg.sub2, killed %26, %subreg.sub3
56 GLOBAL_STORE_DWORDX4_SADDR %1, killed %30, %2, 48, 0, implicit $exec
57 %31:vgpr_32 = COPY %23.sub11
58 %32:vgpr_32 = COPY %23.sub10
59 %33:vgpr_32 = COPY %23.sub9
60 %34:vgpr_32 = COPY %23.sub8
61 %35:vreg_128 = REG_SEQUENCE killed %34, %subreg.sub0, killed %33, %subreg.sub1, killed %32, %subreg.sub2, killed %31, %subreg.sub3
62 GLOBAL_STORE_DWORDX4_SADDR %1, killed %35, %2, 32, 0, implicit $exec
63 %36:vgpr_32 = COPY %23.sub7
64 %37:vgpr_32 = COPY %23.sub6
65 %38:vgpr_32 = COPY %23.sub5
66 %39:vgpr_32 = COPY %23.sub4
67 %40:vreg_128 = REG_SEQUENCE killed %39, %subreg.sub0, killed %38, %subreg.sub1, killed %37, %subreg.sub2, killed %36, %subreg.sub3
68 GLOBAL_STORE_DWORDX4_SADDR %1, killed %40, %2, 16, 0, implicit $exec
69 %41:vgpr_32 = COPY %23.sub3
70 %42:vgpr_32 = COPY %23.sub2
71 %43:vgpr_32 = COPY %23.sub1
72 %44:vgpr_32 = COPY killed %23.sub0
73 %45:vreg_128 = REG_SEQUENCE killed %44, %subreg.sub0, killed %43, %subreg.sub1, killed %42, %subreg.sub2, killed %41, %subreg.sub3
74 GLOBAL_STORE_DWORDX4_SADDR %1, killed %45, %2, 0, 0, implicit $exec
75 %46:vgpr_32 = COPY %25.sub15
76 %47:vgpr_32 = COPY %25.sub14
77 %48:vgpr_32 = COPY %25.sub13
78 %49:vgpr_32 = COPY %25.sub12
79 %50:vreg_128 = REG_SEQUENCE killed %49, %subreg.sub0, killed %48, %subreg.sub1, killed %47, %subreg.sub2, killed %46, %subreg.sub3
80 GLOBAL_STORE_DWORDX4_SADDR %1, killed %50, %2, 112, 0, implicit $exec
81 %51:vgpr_32 = COPY %25.sub11
82 %52:vgpr_32 = COPY %25.sub10
83 %53:vgpr_32 = COPY %25.sub9
84 %54:vgpr_32 = COPY %25.sub8
85 %55:vreg_128 = REG_SEQUENCE killed %54, %subreg.sub0, killed %53, %subreg.sub1, killed %52, %subreg.sub2, killed %51, %subreg.sub3
86 GLOBAL_STORE_DWORDX4_SADDR %1, killed %55, %2, 96, 0, implicit $exec
87 %56:vgpr_32 = COPY %25.sub7
88 %57:vgpr_32 = COPY %25.sub6
89 %58:vgpr_32 = COPY %25.sub5
90 %59:vgpr_32 = COPY %25.sub4
91 %60:vreg_128 = REG_SEQUENCE killed %59, %subreg.sub0, killed %58, %subreg.sub1, killed %57, %subreg.sub2, killed %56, %subreg.sub3
92 GLOBAL_STORE_DWORDX4_SADDR %1, killed %60, %2, 80, 0, implicit $exec
93 %61:vgpr_32 = COPY %25.sub3
94 %62:vgpr_32 = COPY %25.sub2
95 %63:vgpr_32 = COPY %25.sub1
96 %64:vgpr_32 = COPY killed %25.sub0
97 %65:vreg_128 = REG_SEQUENCE killed %64, %subreg.sub0, killed %63, %subreg.sub1, killed %62, %subreg.sub2, killed %61, %subreg.sub3
98 GLOBAL_STORE_DWORDX4_SADDR killed %1, killed %65, killed %2, 64, 0, implicit $exec