1; NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py 2; RUN: llc -global-isel -mtriple=amdgcn-mesa-mesa3d -mcpu=fiji -stop-after=instruction-select -verify-machineinstrs -o - %s | FileCheck %s 3 4; Natural mapping 5define amdgpu_ps float @struct_buffer_atomic_add_i32__vgpr_val__sgpr_rsrc__vgpr_voffset__sgpr_soffset(i32 %val, <4 x i32> inreg %rsrc, i32 %vindex, i32 %voffset, i32 inreg %soffset) { 6 ; CHECK-LABEL: name: struct_buffer_atomic_add_i32__vgpr_val__sgpr_rsrc__vgpr_voffset__sgpr_soffset 7 ; CHECK: bb.1 (%ir-block.0): 8 ; CHECK: liveins: $sgpr2, $sgpr3, $sgpr4, $sgpr5, $sgpr6, $vgpr0, $vgpr1, $vgpr2 9 ; CHECK: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0 10 ; CHECK: [[COPY1:%[0-9]+]]:sreg_32 = COPY $sgpr2 11 ; CHECK: [[COPY2:%[0-9]+]]:sreg_32 = COPY $sgpr3 12 ; CHECK: [[COPY3:%[0-9]+]]:sreg_32 = COPY $sgpr4 13 ; CHECK: [[COPY4:%[0-9]+]]:sreg_32 = COPY $sgpr5 14 ; CHECK: [[COPY5:%[0-9]+]]:vgpr_32 = COPY $vgpr1 15 ; CHECK: [[COPY6:%[0-9]+]]:vgpr_32 = COPY $vgpr2 16 ; CHECK: [[COPY7:%[0-9]+]]:sreg_32 = COPY $sgpr6 17 ; CHECK: [[REG_SEQUENCE:%[0-9]+]]:sgpr_128 = REG_SEQUENCE [[COPY1]], %subreg.sub0, [[COPY2]], %subreg.sub1, [[COPY3]], %subreg.sub2, [[COPY4]], %subreg.sub3 18 ; CHECK: [[REG_SEQUENCE1:%[0-9]+]]:vreg_64 = REG_SEQUENCE [[COPY5]], %subreg.sub0, [[COPY6]], %subreg.sub1 19 ; CHECK: [[BUFFER_ATOMIC_ADD_BOTHEN_RTN:%[0-9]+]]:vgpr_32 = BUFFER_ATOMIC_ADD_BOTHEN_RTN [[COPY]], [[REG_SEQUENCE1]], [[REG_SEQUENCE]], [[COPY7]], 0, 1, 0, implicit $exec :: (volatile dereferenceable load store 4 on custom "TargetCustom7", align 1, addrspace 4) 20 ; CHECK: $vgpr0 = COPY [[BUFFER_ATOMIC_ADD_BOTHEN_RTN]] 21 ; CHECK: SI_RETURN_TO_EPILOG implicit $vgpr0 22 %ret = call i32 @llvm.amdgcn.struct.buffer.atomic.add.i32(i32 %val, <4 x i32> %rsrc, i32 %vindex, i32 %voffset, i32 %soffset, i32 0) 23 %cast = bitcast i32 %ret to float 24 ret float %cast 25} 26 27define amdgpu_ps float @struct_buffer_atomic_add_i32_noret__vgpr_val__sgpr_rsrc__vgpr_voffset__sgpr_soffset(i32 %val, <4 x i32> inreg %rsrc, i32 %vindex, i32 %voffset, i32 inreg %soffset) { 28 ; CHECK-LABEL: name: struct_buffer_atomic_add_i32_noret__vgpr_val__sgpr_rsrc__vgpr_voffset__sgpr_soffset 29 ; CHECK: bb.1 (%ir-block.0): 30 ; CHECK: liveins: $sgpr2, $sgpr3, $sgpr4, $sgpr5, $sgpr6, $vgpr0, $vgpr1, $vgpr2 31 ; CHECK: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0 32 ; CHECK: [[COPY1:%[0-9]+]]:sreg_32 = COPY $sgpr2 33 ; CHECK: [[COPY2:%[0-9]+]]:sreg_32 = COPY $sgpr3 34 ; CHECK: [[COPY3:%[0-9]+]]:sreg_32 = COPY $sgpr4 35 ; CHECK: [[COPY4:%[0-9]+]]:sreg_32 = COPY $sgpr5 36 ; CHECK: [[COPY5:%[0-9]+]]:vgpr_32 = COPY $vgpr1 37 ; CHECK: [[COPY6:%[0-9]+]]:vgpr_32 = COPY $vgpr2 38 ; CHECK: [[COPY7:%[0-9]+]]:sreg_32 = COPY $sgpr6 39 ; CHECK: [[REG_SEQUENCE:%[0-9]+]]:sgpr_128 = REG_SEQUENCE [[COPY1]], %subreg.sub0, [[COPY2]], %subreg.sub1, [[COPY3]], %subreg.sub2, [[COPY4]], %subreg.sub3 40 ; CHECK: [[REG_SEQUENCE1:%[0-9]+]]:vreg_64 = REG_SEQUENCE [[COPY5]], %subreg.sub0, [[COPY6]], %subreg.sub1 41 ; CHECK: [[BUFFER_ATOMIC_ADD_BOTHEN_RTN:%[0-9]+]]:vgpr_32 = BUFFER_ATOMIC_ADD_BOTHEN_RTN [[COPY]], [[REG_SEQUENCE1]], [[REG_SEQUENCE]], [[COPY7]], 0, 1, 0, implicit $exec :: (volatile dereferenceable load store 4 on custom "TargetCustom7", align 1, addrspace 4) 42 ; CHECK: $vgpr0 = COPY [[BUFFER_ATOMIC_ADD_BOTHEN_RTN]] 43 ; CHECK: SI_RETURN_TO_EPILOG implicit $vgpr0 44 %ret = call i32 @llvm.amdgcn.struct.buffer.atomic.add.i32(i32 %val, <4 x i32> %rsrc, i32 %vindex, i32 %voffset, i32 %soffset, i32 0) 45 %cast = bitcast i32 %ret to float 46 ret float %cast 47} 48 49define amdgpu_ps <2 x float> @struct_buffer_atomic_add_i64__vgpr_val__sgpr_rsrc__vgpr_voffset__sgpr_soffset(i64 %val, <4 x i32> inreg %rsrc, i32 %vindex, i32 %voffset, i32 inreg %soffset) { 50 ; CHECK-LABEL: name: struct_buffer_atomic_add_i64__vgpr_val__sgpr_rsrc__vgpr_voffset__sgpr_soffset 51 ; CHECK: bb.1 (%ir-block.0): 52 ; CHECK: liveins: $sgpr2, $sgpr3, $sgpr4, $sgpr5, $sgpr6, $vgpr0, $vgpr1, $vgpr2, $vgpr3 53 ; CHECK: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0 54 ; CHECK: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1 55 ; CHECK: [[COPY2:%[0-9]+]]:sreg_32 = COPY $sgpr2 56 ; CHECK: [[COPY3:%[0-9]+]]:sreg_32 = COPY $sgpr3 57 ; CHECK: [[COPY4:%[0-9]+]]:sreg_32 = COPY $sgpr4 58 ; CHECK: [[COPY5:%[0-9]+]]:sreg_32 = COPY $sgpr5 59 ; CHECK: [[COPY6:%[0-9]+]]:vgpr_32 = COPY $vgpr2 60 ; CHECK: [[COPY7:%[0-9]+]]:vgpr_32 = COPY $vgpr3 61 ; CHECK: [[COPY8:%[0-9]+]]:sreg_32 = COPY $sgpr6 62 ; CHECK: [[REG_SEQUENCE:%[0-9]+]]:vreg_64 = REG_SEQUENCE [[COPY]], %subreg.sub0, [[COPY1]], %subreg.sub1 63 ; CHECK: [[REG_SEQUENCE1:%[0-9]+]]:sgpr_128 = REG_SEQUENCE [[COPY2]], %subreg.sub0, [[COPY3]], %subreg.sub1, [[COPY4]], %subreg.sub2, [[COPY5]], %subreg.sub3 64 ; CHECK: [[REG_SEQUENCE2:%[0-9]+]]:vreg_64 = REG_SEQUENCE [[COPY6]], %subreg.sub0, [[COPY7]], %subreg.sub1 65 ; CHECK: [[BUFFER_ATOMIC_ADD_X2_BOTHEN_RTN:%[0-9]+]]:vreg_64 = BUFFER_ATOMIC_ADD_X2_BOTHEN_RTN [[REG_SEQUENCE]], [[REG_SEQUENCE2]], [[REG_SEQUENCE1]], [[COPY8]], 0, 1, 0, implicit $exec :: (volatile dereferenceable load store 8 on custom "TargetCustom7", align 1, addrspace 4) 66 ; CHECK: [[COPY9:%[0-9]+]]:vgpr_32 = COPY [[BUFFER_ATOMIC_ADD_X2_BOTHEN_RTN]].sub0 67 ; CHECK: [[COPY10:%[0-9]+]]:vgpr_32 = COPY [[BUFFER_ATOMIC_ADD_X2_BOTHEN_RTN]].sub1 68 ; CHECK: $vgpr0 = COPY [[COPY9]] 69 ; CHECK: $vgpr1 = COPY [[COPY10]] 70 ; CHECK: SI_RETURN_TO_EPILOG implicit $vgpr0, implicit $vgpr1 71 %ret = call i64 @llvm.amdgcn.struct.buffer.atomic.add.i64(i64 %val, <4 x i32> %rsrc, i32 %vindex, i32 %voffset, i32 %soffset, i32 0) 72 %cast = bitcast i64 %ret to <2 x float> 73 ret <2 x float> %cast 74} 75 76define amdgpu_ps void @struct_buffer_atomic_add_i64_noret__vgpr_val__sgpr_rsrc__vgpr_voffset__sgpr_soffset(i64 %val, <4 x i32> inreg %rsrc, i32 %vindex, i32 %voffset, i32 inreg %soffset) { 77 ; CHECK-LABEL: name: struct_buffer_atomic_add_i64_noret__vgpr_val__sgpr_rsrc__vgpr_voffset__sgpr_soffset 78 ; CHECK: bb.1 (%ir-block.0): 79 ; CHECK: liveins: $sgpr2, $sgpr3, $sgpr4, $sgpr5, $sgpr6, $vgpr0, $vgpr1, $vgpr2, $vgpr3 80 ; CHECK: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0 81 ; CHECK: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1 82 ; CHECK: [[COPY2:%[0-9]+]]:sreg_32 = COPY $sgpr2 83 ; CHECK: [[COPY3:%[0-9]+]]:sreg_32 = COPY $sgpr3 84 ; CHECK: [[COPY4:%[0-9]+]]:sreg_32 = COPY $sgpr4 85 ; CHECK: [[COPY5:%[0-9]+]]:sreg_32 = COPY $sgpr5 86 ; CHECK: [[COPY6:%[0-9]+]]:vgpr_32 = COPY $vgpr2 87 ; CHECK: [[COPY7:%[0-9]+]]:vgpr_32 = COPY $vgpr3 88 ; CHECK: [[COPY8:%[0-9]+]]:sreg_32 = COPY $sgpr6 89 ; CHECK: [[REG_SEQUENCE:%[0-9]+]]:vreg_64 = REG_SEQUENCE [[COPY]], %subreg.sub0, [[COPY1]], %subreg.sub1 90 ; CHECK: [[REG_SEQUENCE1:%[0-9]+]]:sgpr_128 = REG_SEQUENCE [[COPY2]], %subreg.sub0, [[COPY3]], %subreg.sub1, [[COPY4]], %subreg.sub2, [[COPY5]], %subreg.sub3 91 ; CHECK: [[REG_SEQUENCE2:%[0-9]+]]:vreg_64 = REG_SEQUENCE [[COPY6]], %subreg.sub0, [[COPY7]], %subreg.sub1 92 ; CHECK: [[BUFFER_ATOMIC_ADD_X2_BOTHEN_RTN:%[0-9]+]]:vreg_64 = BUFFER_ATOMIC_ADD_X2_BOTHEN_RTN [[REG_SEQUENCE]], [[REG_SEQUENCE2]], [[REG_SEQUENCE1]], [[COPY8]], 0, 1, 0, implicit $exec :: (volatile dereferenceable load store 8 on custom "TargetCustom7", align 1, addrspace 4) 93 ; CHECK: S_ENDPGM 0 94 %ret = call i64 @llvm.amdgcn.struct.buffer.atomic.add.i64(i64 %val, <4 x i32> %rsrc, i32 %vindex, i32 %voffset, i32 %soffset, i32 0) 95 ret void 96} 97 98; All register operands need legalization 99define amdgpu_ps float @struct_buffer_atomic_add_i32__sgpr_val__vgpr_rsrc__sgpr_voffset__vgpr_soffset(i32 inreg %val, <4 x i32> %rsrc, i32 inreg %vindex, i32 inreg %voffset, i32 %soffset) { 100 ; CHECK-LABEL: name: struct_buffer_atomic_add_i32__sgpr_val__vgpr_rsrc__sgpr_voffset__vgpr_soffset 101 ; CHECK: bb.1 (%ir-block.0): 102 ; CHECK: successors: %bb.2(0x80000000) 103 ; CHECK: liveins: $sgpr2, $sgpr3, $sgpr4, $vgpr0, $vgpr1, $vgpr2, $vgpr3, $vgpr4 104 ; CHECK: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr2 105 ; CHECK: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr0 106 ; CHECK: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr1 107 ; CHECK: [[COPY3:%[0-9]+]]:vgpr_32 = COPY $vgpr2 108 ; CHECK: [[COPY4:%[0-9]+]]:vgpr_32 = COPY $vgpr3 109 ; CHECK: [[COPY5:%[0-9]+]]:sreg_32 = COPY $sgpr3 110 ; CHECK: [[COPY6:%[0-9]+]]:sreg_32 = COPY $sgpr4 111 ; CHECK: [[COPY7:%[0-9]+]]:vgpr_32 = COPY $vgpr4 112 ; CHECK: [[REG_SEQUENCE:%[0-9]+]]:vreg_128 = REG_SEQUENCE [[COPY1]], %subreg.sub0, [[COPY2]], %subreg.sub1, [[COPY3]], %subreg.sub2, [[COPY4]], %subreg.sub3 113 ; CHECK: [[COPY8:%[0-9]+]]:vgpr_32 = COPY [[COPY]] 114 ; CHECK: [[COPY9:%[0-9]+]]:vgpr_32 = COPY [[COPY5]] 115 ; CHECK: [[COPY10:%[0-9]+]]:vgpr_32 = COPY [[COPY6]] 116 ; CHECK: [[COPY11:%[0-9]+]]:vreg_64 = COPY [[REG_SEQUENCE]].sub0_sub1 117 ; CHECK: [[COPY12:%[0-9]+]]:vreg_64 = COPY [[REG_SEQUENCE]].sub2_sub3 118 ; CHECK: [[S_MOV_B64_term:%[0-9]+]]:sreg_64_xexec = S_MOV_B64_term $exec 119 ; CHECK: bb.2: 120 ; CHECK: successors: %bb.3(0x40000000), %bb.2(0x40000000) 121 ; CHECK: [[V_READFIRSTLANE_B32_:%[0-9]+]]:sreg_32_xm0 = V_READFIRSTLANE_B32 [[COPY11]].sub0, implicit $exec 122 ; CHECK: [[V_READFIRSTLANE_B32_1:%[0-9]+]]:sreg_32_xm0 = V_READFIRSTLANE_B32 [[COPY11]].sub1, implicit $exec 123 ; CHECK: [[REG_SEQUENCE1:%[0-9]+]]:sreg_64_xexec = REG_SEQUENCE [[V_READFIRSTLANE_B32_]], %subreg.sub0, [[V_READFIRSTLANE_B32_1]], %subreg.sub1 124 ; CHECK: [[V_CMP_EQ_U64_e64_:%[0-9]+]]:sreg_64_xexec = V_CMP_EQ_U64_e64 [[REG_SEQUENCE1]], [[COPY11]], implicit $exec 125 ; CHECK: [[V_READFIRSTLANE_B32_2:%[0-9]+]]:sreg_32_xm0 = V_READFIRSTLANE_B32 [[COPY12]].sub0, implicit $exec 126 ; CHECK: [[V_READFIRSTLANE_B32_3:%[0-9]+]]:sreg_32_xm0 = V_READFIRSTLANE_B32 [[COPY12]].sub1, implicit $exec 127 ; CHECK: [[REG_SEQUENCE2:%[0-9]+]]:sreg_64_xexec = REG_SEQUENCE [[V_READFIRSTLANE_B32_2]], %subreg.sub0, [[V_READFIRSTLANE_B32_3]], %subreg.sub1 128 ; CHECK: [[V_CMP_EQ_U64_e64_1:%[0-9]+]]:sreg_64_xexec = V_CMP_EQ_U64_e64 [[REG_SEQUENCE2]], [[COPY12]], implicit $exec 129 ; CHECK: [[S_AND_B64_:%[0-9]+]]:sreg_64_xexec = S_AND_B64 [[V_CMP_EQ_U64_e64_1]], [[V_CMP_EQ_U64_e64_]], implicit-def $scc 130 ; CHECK: [[REG_SEQUENCE3:%[0-9]+]]:sgpr_128 = REG_SEQUENCE [[V_READFIRSTLANE_B32_]], %subreg.sub0, [[V_READFIRSTLANE_B32_1]], %subreg.sub1, [[V_READFIRSTLANE_B32_2]], %subreg.sub2, [[V_READFIRSTLANE_B32_3]], %subreg.sub3 131 ; CHECK: [[V_READFIRSTLANE_B32_4:%[0-9]+]]:sreg_32_xm0 = V_READFIRSTLANE_B32 [[COPY7]], implicit $exec 132 ; CHECK: [[V_CMP_EQ_U32_e64_:%[0-9]+]]:sreg_64_xexec = V_CMP_EQ_U32_e64 [[V_READFIRSTLANE_B32_4]], [[COPY7]], implicit $exec 133 ; CHECK: [[S_AND_B64_1:%[0-9]+]]:sreg_64_xexec = S_AND_B64 [[V_CMP_EQ_U32_e64_]], [[S_AND_B64_]], implicit-def $scc 134 ; CHECK: [[REG_SEQUENCE4:%[0-9]+]]:vreg_64 = REG_SEQUENCE [[COPY9]], %subreg.sub0, [[COPY10]], %subreg.sub1 135 ; CHECK: [[BUFFER_ATOMIC_ADD_BOTHEN_RTN:%[0-9]+]]:vgpr_32 = BUFFER_ATOMIC_ADD_BOTHEN_RTN [[COPY8]], [[REG_SEQUENCE4]], [[REG_SEQUENCE3]], [[V_READFIRSTLANE_B32_4]], 0, 1, 0, implicit $exec :: (volatile dereferenceable load store 4 on custom "TargetCustom7", align 1, addrspace 4) 136 ; CHECK: [[S_AND_SAVEEXEC_B64_:%[0-9]+]]:sreg_64_xexec = S_AND_SAVEEXEC_B64 killed [[S_AND_B64_1]], implicit-def $exec, implicit-def $scc, implicit $exec 137 ; CHECK: $exec = S_XOR_B64_term $exec, [[S_AND_SAVEEXEC_B64_]], implicit-def $scc 138 ; CHECK: S_CBRANCH_EXECNZ %bb.2, implicit $exec 139 ; CHECK: bb.3: 140 ; CHECK: successors: %bb.4(0x80000000) 141 ; CHECK: $exec = S_MOV_B64_term [[S_MOV_B64_term]] 142 ; CHECK: bb.4: 143 ; CHECK: $vgpr0 = COPY [[BUFFER_ATOMIC_ADD_BOTHEN_RTN]] 144 ; CHECK: SI_RETURN_TO_EPILOG implicit $vgpr0 145 %ret = call i32 @llvm.amdgcn.struct.buffer.atomic.add.i32(i32 %val, <4 x i32> %rsrc, i32 %vindex, i32 %voffset, i32 %soffset, i32 0) 146 %cast = bitcast i32 %ret to float 147 ret float %cast 148} 149 150; All register operands need legalization 151define amdgpu_ps void @struct_buffer_atomic_add_i32_noret__sgpr_val__vgpr_rsrc__sgpr_voffset__vgpr_soffset(i32 inreg %val, <4 x i32> %rsrc, i32 inreg %vindex, i32 inreg %voffset, i32 %soffset) { 152 ; CHECK-LABEL: name: struct_buffer_atomic_add_i32_noret__sgpr_val__vgpr_rsrc__sgpr_voffset__vgpr_soffset 153 ; CHECK: bb.1 (%ir-block.0): 154 ; CHECK: successors: %bb.2(0x80000000) 155 ; CHECK: liveins: $sgpr2, $sgpr3, $sgpr4, $vgpr0, $vgpr1, $vgpr2, $vgpr3, $vgpr4 156 ; CHECK: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr2 157 ; CHECK: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr0 158 ; CHECK: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr1 159 ; CHECK: [[COPY3:%[0-9]+]]:vgpr_32 = COPY $vgpr2 160 ; CHECK: [[COPY4:%[0-9]+]]:vgpr_32 = COPY $vgpr3 161 ; CHECK: [[COPY5:%[0-9]+]]:sreg_32 = COPY $sgpr3 162 ; CHECK: [[COPY6:%[0-9]+]]:sreg_32 = COPY $sgpr4 163 ; CHECK: [[COPY7:%[0-9]+]]:vgpr_32 = COPY $vgpr4 164 ; CHECK: [[REG_SEQUENCE:%[0-9]+]]:vreg_128 = REG_SEQUENCE [[COPY1]], %subreg.sub0, [[COPY2]], %subreg.sub1, [[COPY3]], %subreg.sub2, [[COPY4]], %subreg.sub3 165 ; CHECK: [[COPY8:%[0-9]+]]:vgpr_32 = COPY [[COPY]] 166 ; CHECK: [[COPY9:%[0-9]+]]:vgpr_32 = COPY [[COPY5]] 167 ; CHECK: [[COPY10:%[0-9]+]]:vgpr_32 = COPY [[COPY6]] 168 ; CHECK: [[COPY11:%[0-9]+]]:vreg_64 = COPY [[REG_SEQUENCE]].sub0_sub1 169 ; CHECK: [[COPY12:%[0-9]+]]:vreg_64 = COPY [[REG_SEQUENCE]].sub2_sub3 170 ; CHECK: [[S_MOV_B64_term:%[0-9]+]]:sreg_64_xexec = S_MOV_B64_term $exec 171 ; CHECK: bb.2: 172 ; CHECK: successors: %bb.3(0x40000000), %bb.2(0x40000000) 173 ; CHECK: [[V_READFIRSTLANE_B32_:%[0-9]+]]:sreg_32_xm0 = V_READFIRSTLANE_B32 [[COPY11]].sub0, implicit $exec 174 ; CHECK: [[V_READFIRSTLANE_B32_1:%[0-9]+]]:sreg_32_xm0 = V_READFIRSTLANE_B32 [[COPY11]].sub1, implicit $exec 175 ; CHECK: [[REG_SEQUENCE1:%[0-9]+]]:sreg_64_xexec = REG_SEQUENCE [[V_READFIRSTLANE_B32_]], %subreg.sub0, [[V_READFIRSTLANE_B32_1]], %subreg.sub1 176 ; CHECK: [[V_CMP_EQ_U64_e64_:%[0-9]+]]:sreg_64_xexec = V_CMP_EQ_U64_e64 [[REG_SEQUENCE1]], [[COPY11]], implicit $exec 177 ; CHECK: [[V_READFIRSTLANE_B32_2:%[0-9]+]]:sreg_32_xm0 = V_READFIRSTLANE_B32 [[COPY12]].sub0, implicit $exec 178 ; CHECK: [[V_READFIRSTLANE_B32_3:%[0-9]+]]:sreg_32_xm0 = V_READFIRSTLANE_B32 [[COPY12]].sub1, implicit $exec 179 ; CHECK: [[REG_SEQUENCE2:%[0-9]+]]:sreg_64_xexec = REG_SEQUENCE [[V_READFIRSTLANE_B32_2]], %subreg.sub0, [[V_READFIRSTLANE_B32_3]], %subreg.sub1 180 ; CHECK: [[V_CMP_EQ_U64_e64_1:%[0-9]+]]:sreg_64_xexec = V_CMP_EQ_U64_e64 [[REG_SEQUENCE2]], [[COPY12]], implicit $exec 181 ; CHECK: [[S_AND_B64_:%[0-9]+]]:sreg_64_xexec = S_AND_B64 [[V_CMP_EQ_U64_e64_1]], [[V_CMP_EQ_U64_e64_]], implicit-def $scc 182 ; CHECK: [[REG_SEQUENCE3:%[0-9]+]]:sgpr_128 = REG_SEQUENCE [[V_READFIRSTLANE_B32_]], %subreg.sub0, [[V_READFIRSTLANE_B32_1]], %subreg.sub1, [[V_READFIRSTLANE_B32_2]], %subreg.sub2, [[V_READFIRSTLANE_B32_3]], %subreg.sub3 183 ; CHECK: [[V_READFIRSTLANE_B32_4:%[0-9]+]]:sreg_32_xm0 = V_READFIRSTLANE_B32 [[COPY7]], implicit $exec 184 ; CHECK: [[V_CMP_EQ_U32_e64_:%[0-9]+]]:sreg_64_xexec = V_CMP_EQ_U32_e64 [[V_READFIRSTLANE_B32_4]], [[COPY7]], implicit $exec 185 ; CHECK: [[S_AND_B64_1:%[0-9]+]]:sreg_64_xexec = S_AND_B64 [[V_CMP_EQ_U32_e64_]], [[S_AND_B64_]], implicit-def $scc 186 ; CHECK: [[REG_SEQUENCE4:%[0-9]+]]:vreg_64 = REG_SEQUENCE [[COPY9]], %subreg.sub0, [[COPY10]], %subreg.sub1 187 ; CHECK: [[BUFFER_ATOMIC_ADD_BOTHEN_RTN:%[0-9]+]]:vgpr_32 = BUFFER_ATOMIC_ADD_BOTHEN_RTN [[COPY8]], [[REG_SEQUENCE4]], [[REG_SEQUENCE3]], [[V_READFIRSTLANE_B32_4]], 0, 1, 0, implicit $exec :: (volatile dereferenceable load store 4 on custom "TargetCustom7", align 1, addrspace 4) 188 ; CHECK: [[S_AND_SAVEEXEC_B64_:%[0-9]+]]:sreg_64_xexec = S_AND_SAVEEXEC_B64 killed [[S_AND_B64_1]], implicit-def $exec, implicit-def $scc, implicit $exec 189 ; CHECK: $exec = S_XOR_B64_term $exec, [[S_AND_SAVEEXEC_B64_]], implicit-def $scc 190 ; CHECK: S_CBRANCH_EXECNZ %bb.2, implicit $exec 191 ; CHECK: bb.3: 192 ; CHECK: successors: %bb.4(0x80000000) 193 ; CHECK: $exec = S_MOV_B64_term [[S_MOV_B64_term]] 194 ; CHECK: bb.4: 195 ; CHECK: S_ENDPGM 0 196 %ret = call i32 @llvm.amdgcn.struct.buffer.atomic.add.i32(i32 %val, <4 x i32> %rsrc, i32 %vindex, i32 %voffset, i32 %soffset, i32 0) 197 ret void 198} 199 200; Natural mapping + slc 201define amdgpu_ps float @struct_buffer_atomic_add_i32__vgpr_val__sgpr_rsrc__vgpr_voffset__sgpr_soffset_slc(i32 %val, <4 x i32> inreg %rsrc, i32 %vindex, i32 %voffset, i32 inreg %soffset) { 202 ; CHECK-LABEL: name: struct_buffer_atomic_add_i32__vgpr_val__sgpr_rsrc__vgpr_voffset__sgpr_soffset_slc 203 ; CHECK: bb.1 (%ir-block.0): 204 ; CHECK: liveins: $sgpr2, $sgpr3, $sgpr4, $sgpr5, $sgpr6, $vgpr0, $vgpr1, $vgpr2 205 ; CHECK: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0 206 ; CHECK: [[COPY1:%[0-9]+]]:sreg_32 = COPY $sgpr2 207 ; CHECK: [[COPY2:%[0-9]+]]:sreg_32 = COPY $sgpr3 208 ; CHECK: [[COPY3:%[0-9]+]]:sreg_32 = COPY $sgpr4 209 ; CHECK: [[COPY4:%[0-9]+]]:sreg_32 = COPY $sgpr5 210 ; CHECK: [[COPY5:%[0-9]+]]:vgpr_32 = COPY $vgpr1 211 ; CHECK: [[COPY6:%[0-9]+]]:vgpr_32 = COPY $vgpr2 212 ; CHECK: [[COPY7:%[0-9]+]]:sreg_32 = COPY $sgpr6 213 ; CHECK: [[REG_SEQUENCE:%[0-9]+]]:sgpr_128 = REG_SEQUENCE [[COPY1]], %subreg.sub0, [[COPY2]], %subreg.sub1, [[COPY3]], %subreg.sub2, [[COPY4]], %subreg.sub3 214 ; CHECK: [[REG_SEQUENCE1:%[0-9]+]]:vreg_64 = REG_SEQUENCE [[COPY5]], %subreg.sub0, [[COPY6]], %subreg.sub1 215 ; CHECK: [[BUFFER_ATOMIC_ADD_BOTHEN_RTN:%[0-9]+]]:vgpr_32 = BUFFER_ATOMIC_ADD_BOTHEN_RTN [[COPY]], [[REG_SEQUENCE1]], [[REG_SEQUENCE]], [[COPY7]], 0, 1, 1, implicit $exec :: (volatile dereferenceable load store 4 on custom "TargetCustom7", align 1, addrspace 4) 216 ; CHECK: $vgpr0 = COPY [[BUFFER_ATOMIC_ADD_BOTHEN_RTN]] 217 ; CHECK: SI_RETURN_TO_EPILOG implicit $vgpr0 218 %ret = call i32 @llvm.amdgcn.struct.buffer.atomic.add.i32(i32 %val, <4 x i32> %rsrc, i32 %vindex, i32 %voffset, i32 %soffset, i32 2) 219 %cast = bitcast i32 %ret to float 220 ret float %cast 221} 222 223declare i32 @llvm.amdgcn.struct.buffer.atomic.add.i32(i32, <4 x i32>, i32, i32, i32, i32 immarg) #0 224declare i64 @llvm.amdgcn.struct.buffer.atomic.add.i64(i64, <4 x i32>, i32, i32, i32, i32 immarg) #0 225 226attributes #0 = { nounwind } 227