1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=amdgcn-amd-amdhsa -verify-machineinstrs -run-pass si-fold-operands,dead-mi-elimination %s -o - | FileCheck -check-prefix=GCN %s
5 name: no_fold_fi_non_stack_rsrc_soffset
6 tracksRegLiveness: true
11 - { id: 0, size: 4, alignment: 4, local-offset: 0 }
14 scratchRSrcReg: '$sgpr96_sgpr97_sgpr98_sgpr99'
15 scratchWaveOffsetReg: '$sgpr6'
16 frameOffsetReg: '$sgpr6'
17 stackPtrOffsetReg: '$sgpr6'
20 liveins: $sgpr12_sgpr13_sgpr14_sgpr15
22 ; GCN-LABEL: name: no_fold_fi_non_stack_rsrc_soffset
23 ; GCN: liveins: $sgpr12_sgpr13_sgpr14_sgpr15
24 ; GCN: [[COPY:%[0-9]+]]:sgpr_128 = COPY $sgpr12_sgpr13_sgpr14_sgpr15
25 ; GCN: [[V_MOV_B32_e32_:%[0-9]+]]:vgpr_32 = V_MOV_B32_e32 %stack.0, implicit $exec
26 ; GCN: [[BUFFER_LOAD_DWORD_IDXEN:%[0-9]+]]:vgpr_32 = BUFFER_LOAD_DWORD_IDXEN [[V_MOV_B32_e32_]], [[COPY]], 0, 0, 0, 0, 0, 0, 0, implicit $exec
27 ; GCN: $vgpr0 = COPY [[BUFFER_LOAD_DWORD_IDXEN]]
28 ; GCN: SI_RETURN_TO_EPILOG $vgpr0
29 %0:sgpr_128 = COPY $sgpr12_sgpr13_sgpr14_sgpr15
30 %1:sreg_32_xm0 = S_MOV_B32 0
31 %2:vgpr_32 = V_MOV_B32_e32 %stack.0, implicit $exec
32 %3:vgpr_32 = BUFFER_LOAD_DWORD_IDXEN %2, %0, %1, 0, 0, 0, 0, 0, 0, implicit $exec
34 SI_RETURN_TO_EPILOG $vgpr0
39 name: no_fold_fi_non_stack_rsrc
40 tracksRegLiveness: true
45 - { id: 0, size: 4, alignment: 4, local-offset: 0 }
48 scratchRSrcReg: '$sgpr96_sgpr97_sgpr98_sgpr99'
49 scratchWaveOffsetReg: '$sgpr6'
50 frameOffsetReg: '$sgpr6'
51 stackPtrOffsetReg: '$sgpr32'
54 liveins: $sgpr12_sgpr13_sgpr14_sgpr15
56 ; GCN-LABEL: name: no_fold_fi_non_stack_rsrc
57 ; GCN: liveins: $sgpr12_sgpr13_sgpr14_sgpr15
58 ; GCN: [[COPY:%[0-9]+]]:sgpr_128 = COPY $sgpr12_sgpr13_sgpr14_sgpr15
59 ; GCN: [[V_MOV_B32_e32_:%[0-9]+]]:vgpr_32 = V_MOV_B32_e32 %stack.0, implicit $exec
60 ; GCN: [[BUFFER_LOAD_DWORD_IDXEN:%[0-9]+]]:vgpr_32 = BUFFER_LOAD_DWORD_IDXEN [[V_MOV_B32_e32_]], [[COPY]], $sgpr32, 0, 0, 0, 0, 0, 0, implicit $exec
61 ; GCN: $vgpr0 = COPY [[BUFFER_LOAD_DWORD_IDXEN]]
62 ; GCN: SI_RETURN_TO_EPILOG $vgpr0
63 %0:sgpr_128 = COPY $sgpr12_sgpr13_sgpr14_sgpr15
64 %2:vgpr_32 = V_MOV_B32_e32 %stack.0, implicit $exec
65 %3:vgpr_32 = BUFFER_LOAD_DWORD_IDXEN %2, %0, $sgpr32, 0, 0, 0, 0, 0, 0, implicit $exec
67 SI_RETURN_TO_EPILOG $vgpr0
71 # Offset is from global scratch wave offset.
73 name: fold_fi_mubuf_scratch_scratch_wave_offset
74 tracksRegLiveness: true
79 - { id: 0, size: 4, alignment: 4, local-offset: 0 }
82 scratchRSrcReg: '$sgpr0_sgpr1_sgpr2_sgpr3'
83 scratchWaveOffsetReg: '$sgpr33'
84 stackPtrOffsetReg: '$sgpr32'
88 ; GCN-LABEL: name: fold_fi_mubuf_scratch_scratch_wave_offset
89 ; GCN: [[V_MOV_B32_e32_:%[0-9]+]]:vgpr_32 = V_MOV_B32_e32 7, implicit $exec
90 ; GCN: BUFFER_STORE_DWORD_OFFEN [[V_MOV_B32_e32_]], %stack.0, $sgpr0_sgpr1_sgpr2_sgpr3, $sgpr32, 0, 0, 0, 0, 0, 0, implicit $exec
91 ; GCN: [[BUFFER_LOAD_DWORD_OFFEN:%[0-9]+]]:vgpr_32 = BUFFER_LOAD_DWORD_OFFEN %stack.0, $sgpr0_sgpr1_sgpr2_sgpr3, $sgpr32, 0, 0, 0, 0, 0, 0, implicit $exec
92 ; GCN: $vgpr0 = COPY [[BUFFER_LOAD_DWORD_OFFEN]]
93 ; GCN: S_ENDPGM 0, implicit $vgpr0
94 %0:vgpr_32 = V_MOV_B32_e32 %stack.0, implicit $exec
95 %1:vgpr_32 = V_MOV_B32_e32 7, implicit $exec
97 BUFFER_STORE_DWORD_OFFEN %1:vgpr_32, %0:vgpr_32, $sgpr0_sgpr1_sgpr2_sgpr3, $sgpr33, 0, 0, 0, 0, 0, 0, implicit $exec
98 %2:vgpr_32 = BUFFER_LOAD_DWORD_OFFEN %0:vgpr_32, $sgpr0_sgpr1_sgpr2_sgpr3, $sgpr33, 0, 0, 0, 0, 0, 0, implicit $exec
100 S_ENDPGM 0, implicit $vgpr0
105 name: no_fold_fi_mubuf_scratch_sp_offset
106 tracksRegLiveness: true
111 - { id: 0, size: 4, alignment: 4, local-offset: 0 }
113 isEntryFunction: true
114 scratchRSrcReg: '$sgpr0_sgpr1_sgpr2_sgpr3'
115 scratchWaveOffsetReg: '$sgpr33'
116 stackPtrOffsetReg: '$sgpr32'
120 ; GCN-LABEL: name: no_fold_fi_mubuf_scratch_sp_offset
121 ; GCN: [[V_MOV_B32_e32_:%[0-9]+]]:vgpr_32 = V_MOV_B32_e32 7, implicit $exec
122 ; GCN: BUFFER_STORE_DWORD_OFFEN [[V_MOV_B32_e32_]], %stack.0, $sgpr0_sgpr1_sgpr2_sgpr3, $sgpr32, 0, 0, 0, 0, 0, 0, implicit $exec
123 ; GCN: [[BUFFER_LOAD_DWORD_OFFEN:%[0-9]+]]:vgpr_32 = BUFFER_LOAD_DWORD_OFFEN %stack.0, $sgpr0_sgpr1_sgpr2_sgpr3, $sgpr32, 0, 0, 0, 0, 0, 0, implicit $exec
124 ; GCN: $vgpr0 = COPY [[BUFFER_LOAD_DWORD_OFFEN]]
125 ; GCN: S_ENDPGM 0, implicit $vgpr0
126 %0:vgpr_32 = V_MOV_B32_e32 %stack.0, implicit $exec
127 %1:vgpr_32 = V_MOV_B32_e32 7, implicit $exec
129 BUFFER_STORE_DWORD_OFFEN %1:vgpr_32, %0:vgpr_32, $sgpr0_sgpr1_sgpr2_sgpr3, $sgpr32, 0, 0, 0, 0, 0, 0, implicit $exec
130 %2:vgpr_32 = BUFFER_LOAD_DWORD_OFFEN %0:vgpr_32, $sgpr0_sgpr1_sgpr2_sgpr3, $sgpr32, 0, 0, 0, 0, 0, 0, implicit $exec
132 S_ENDPGM 0, implicit $vgpr0