1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -march=amdgcn -mcpu=tahiti -run-pass=regallocfast -o - %s | FileCheck -check-prefix=SPILLED %s
3 # RUN: llc -march=amdgcn -mcpu=tahiti -run-pass=regallocfast,si-lower-sgpr-spills -o - %s | FileCheck -check-prefix=EXPANDED %s
5 # Make sure spill/restore of 320 bit registers works.
8 name: spill_restore_sgpr320
9 tracksRegLiveness: true
11 scratchRSrcReg: $sgpr0_sgpr1_sgpr2_sgpr3
12 stackPtrOffsetReg: $sgpr32
14 ; SPILLED-LABEL: name: spill_restore_sgpr320
16 ; SPILLED-NEXT: successors: %bb.1(0x80000000)
17 ; SPILLED-NEXT: {{ $}}
18 ; SPILLED-NEXT: S_NOP 0, implicit-def renamable $sgpr4_sgpr5_sgpr6_sgpr7_sgpr8_sgpr9_sgpr10_sgpr11_sgpr12_sgpr13
19 ; SPILLED-NEXT: SI_SPILL_S320_SAVE killed $sgpr4_sgpr5_sgpr6_sgpr7_sgpr8_sgpr9_sgpr10_sgpr11_sgpr12_sgpr13, %stack.0, implicit $exec, implicit $sgpr32 :: (store (s320) into %stack.0, align 4, addrspace 5)
20 ; SPILLED-NEXT: S_CBRANCH_SCC1 %bb.1, implicit undef $scc
21 ; SPILLED-NEXT: {{ $}}
23 ; SPILLED-NEXT: successors: %bb.2(0x80000000)
24 ; SPILLED-NEXT: {{ $}}
25 ; SPILLED-NEXT: S_NOP 1
26 ; SPILLED-NEXT: {{ $}}
28 ; SPILLED-NEXT: $sgpr4_sgpr5_sgpr6_sgpr7_sgpr8_sgpr9_sgpr10_sgpr11_sgpr12_sgpr13 = SI_SPILL_S320_RESTORE %stack.0, implicit $exec, implicit $sgpr32 :: (load (s320) from %stack.0, align 4, addrspace 5)
29 ; SPILLED-NEXT: S_NOP 0, implicit killed renamable $sgpr4_sgpr5_sgpr6_sgpr7_sgpr8_sgpr9_sgpr10_sgpr11_sgpr12_sgpr13
30 ; EXPANDED-LABEL: name: spill_restore_sgpr320
32 ; EXPANDED-NEXT: successors: %bb.1(0x80000000)
33 ; EXPANDED-NEXT: {{ $}}
34 ; EXPANDED-NEXT: [[DEF:%[0-9]+]]:vgpr_32 = IMPLICIT_DEF
35 ; EXPANDED-NEXT: S_NOP 0, implicit-def renamable $sgpr4_sgpr5_sgpr6_sgpr7_sgpr8_sgpr9_sgpr10_sgpr11_sgpr12_sgpr13
36 ; EXPANDED-NEXT: [[V_WRITELANE_B32_:%[0-9]+]]:vgpr_32 = V_WRITELANE_B32 $sgpr4, 0, [[V_WRITELANE_B32_]], implicit-def $sgpr4_sgpr5_sgpr6_sgpr7_sgpr8_sgpr9_sgpr10_sgpr11_sgpr12_sgpr13, implicit $sgpr4_sgpr5_sgpr6_sgpr7_sgpr8_sgpr9_sgpr10_sgpr11_sgpr12_sgpr13
37 ; EXPANDED-NEXT: [[V_WRITELANE_B32_1:%[0-9]+]]:vgpr_32 = V_WRITELANE_B32 $sgpr5, 1, [[V_WRITELANE_B32_1]]
38 ; EXPANDED-NEXT: [[V_WRITELANE_B32_1:%[0-9]+]]:vgpr_32 = V_WRITELANE_B32 $sgpr6, 2, [[V_WRITELANE_B32_1]]
39 ; EXPANDED-NEXT: [[V_WRITELANE_B32_1:%[0-9]+]]:vgpr_32 = V_WRITELANE_B32 $sgpr7, 3, [[V_WRITELANE_B32_1]]
40 ; EXPANDED-NEXT: [[V_WRITELANE_B32_1:%[0-9]+]]:vgpr_32 = V_WRITELANE_B32 $sgpr8, 4, [[V_WRITELANE_B32_1]]
41 ; EXPANDED-NEXT: [[V_WRITELANE_B32_1:%[0-9]+]]:vgpr_32 = V_WRITELANE_B32 $sgpr9, 5, [[V_WRITELANE_B32_1]]
42 ; EXPANDED-NEXT: [[V_WRITELANE_B32_1:%[0-9]+]]:vgpr_32 = V_WRITELANE_B32 $sgpr10, 6, [[V_WRITELANE_B32_1]]
43 ; EXPANDED-NEXT: [[V_WRITELANE_B32_1:%[0-9]+]]:vgpr_32 = V_WRITELANE_B32 $sgpr11, 7, [[V_WRITELANE_B32_1]]
44 ; EXPANDED-NEXT: [[V_WRITELANE_B32_1:%[0-9]+]]:vgpr_32 = V_WRITELANE_B32 $sgpr12, 8, [[V_WRITELANE_B32_1]]
45 ; EXPANDED-NEXT: [[V_WRITELANE_B32_1:%[0-9]+]]:vgpr_32 = V_WRITELANE_B32 killed $sgpr13, 9, [[V_WRITELANE_B32_1]], implicit killed $sgpr4_sgpr5_sgpr6_sgpr7_sgpr8_sgpr9_sgpr10_sgpr11_sgpr12_sgpr13
46 ; EXPANDED-NEXT: S_CBRANCH_SCC1 %bb.1, implicit undef $scc
47 ; EXPANDED-NEXT: {{ $}}
48 ; EXPANDED-NEXT: bb.1:
49 ; EXPANDED-NEXT: successors: %bb.2(0x80000000)
50 ; EXPANDED-NEXT: {{ $}}
51 ; EXPANDED-NEXT: S_NOP 1
52 ; EXPANDED-NEXT: {{ $}}
53 ; EXPANDED-NEXT: bb.2:
54 ; EXPANDED-NEXT: $sgpr4 = V_READLANE_B32 [[V_WRITELANE_B32_1]], 0, implicit-def $sgpr4_sgpr5_sgpr6_sgpr7_sgpr8_sgpr9_sgpr10_sgpr11_sgpr12_sgpr13
55 ; EXPANDED-NEXT: $sgpr5 = V_READLANE_B32 [[V_WRITELANE_B32_1]], 1
56 ; EXPANDED-NEXT: $sgpr6 = V_READLANE_B32 [[V_WRITELANE_B32_1]], 2
57 ; EXPANDED-NEXT: $sgpr7 = V_READLANE_B32 [[V_WRITELANE_B32_1]], 3
58 ; EXPANDED-NEXT: $sgpr8 = V_READLANE_B32 [[V_WRITELANE_B32_1]], 4
59 ; EXPANDED-NEXT: $sgpr9 = V_READLANE_B32 [[V_WRITELANE_B32_1]], 5
60 ; EXPANDED-NEXT: $sgpr10 = V_READLANE_B32 [[V_WRITELANE_B32_1]], 6
61 ; EXPANDED-NEXT: $sgpr11 = V_READLANE_B32 [[V_WRITELANE_B32_1]], 7
62 ; EXPANDED-NEXT: $sgpr12 = V_READLANE_B32 [[V_WRITELANE_B32_1]], 8
63 ; EXPANDED-NEXT: $sgpr13 = V_READLANE_B32 [[V_WRITELANE_B32_1]], 9
64 ; EXPANDED-NEXT: S_NOP 0, implicit killed renamable $sgpr4_sgpr5_sgpr6_sgpr7_sgpr8_sgpr9_sgpr10_sgpr11_sgpr12_sgpr13
66 S_NOP 0, implicit-def %0:sgpr_320
67 S_CBRANCH_SCC1 implicit undef $scc, %bb.1
77 name: spill_restore_vgpr320
78 tracksRegLiveness: true
80 scratchRSrcReg: $sgpr0_sgpr1_sgpr2_sgpr3
81 stackPtrOffsetReg: $sgpr32
83 ; SPILLED-LABEL: name: spill_restore_vgpr320
85 ; SPILLED-NEXT: successors: %bb.1(0x80000000)
86 ; SPILLED-NEXT: {{ $}}
87 ; SPILLED-NEXT: S_NOP 0, implicit-def renamable $vgpr0_vgpr1_vgpr2_vgpr3_vgpr4_vgpr5_vgpr6_vgpr7_vgpr8_vgpr9
88 ; SPILLED-NEXT: SI_SPILL_V320_SAVE killed $vgpr0_vgpr1_vgpr2_vgpr3_vgpr4_vgpr5_vgpr6_vgpr7_vgpr8_vgpr9, %stack.0, $sgpr32, 0, implicit $exec :: (store (s320) into %stack.0, align 4, addrspace 5)
89 ; SPILLED-NEXT: S_CBRANCH_SCC1 %bb.1, implicit undef $scc
90 ; SPILLED-NEXT: {{ $}}
92 ; SPILLED-NEXT: successors: %bb.2(0x80000000)
93 ; SPILLED-NEXT: {{ $}}
94 ; SPILLED-NEXT: S_NOP 1
95 ; SPILLED-NEXT: {{ $}}
97 ; SPILLED-NEXT: $vgpr0_vgpr1_vgpr2_vgpr3_vgpr4_vgpr5_vgpr6_vgpr7_vgpr8_vgpr9 = SI_SPILL_V320_RESTORE %stack.0, $sgpr32, 0, implicit $exec :: (load (s320) from %stack.0, align 4, addrspace 5)
98 ; SPILLED-NEXT: S_NOP 0, implicit killed renamable $vgpr0_vgpr1_vgpr2_vgpr3_vgpr4_vgpr5_vgpr6_vgpr7_vgpr8_vgpr9
99 ; EXPANDED-LABEL: name: spill_restore_vgpr320
101 ; EXPANDED-NEXT: successors: %bb.1(0x80000000)
102 ; EXPANDED-NEXT: {{ $}}
103 ; EXPANDED-NEXT: S_NOP 0, implicit-def renamable $vgpr0_vgpr1_vgpr2_vgpr3_vgpr4_vgpr5_vgpr6_vgpr7_vgpr8_vgpr9
104 ; EXPANDED-NEXT: SI_SPILL_V320_SAVE killed $vgpr0_vgpr1_vgpr2_vgpr3_vgpr4_vgpr5_vgpr6_vgpr7_vgpr8_vgpr9, %stack.0, $sgpr32, 0, implicit $exec :: (store (s320) into %stack.0, align 4, addrspace 5)
105 ; EXPANDED-NEXT: S_CBRANCH_SCC1 %bb.1, implicit undef $scc
106 ; EXPANDED-NEXT: {{ $}}
107 ; EXPANDED-NEXT: bb.1:
108 ; EXPANDED-NEXT: successors: %bb.2(0x80000000)
109 ; EXPANDED-NEXT: {{ $}}
110 ; EXPANDED-NEXT: S_NOP 1
111 ; EXPANDED-NEXT: {{ $}}
112 ; EXPANDED-NEXT: bb.2:
113 ; EXPANDED-NEXT: $vgpr0_vgpr1_vgpr2_vgpr3_vgpr4_vgpr5_vgpr6_vgpr7_vgpr8_vgpr9 = SI_SPILL_V320_RESTORE %stack.0, $sgpr32, 0, implicit $exec :: (load (s320) from %stack.0, align 4, addrspace 5)
114 ; EXPANDED-NEXT: S_NOP 0, implicit killed renamable $vgpr0_vgpr1_vgpr2_vgpr3_vgpr4_vgpr5_vgpr6_vgpr7_vgpr8_vgpr9
116 S_NOP 0, implicit-def %0:vreg_320
117 S_CBRANCH_SCC1 implicit undef $scc, %bb.1