Matt Arsenault | 4c53717 | 2014-03-31 18:21:18 +0000 | [diff] [blame] | 1 | ; RUN: llc -march=r600 -mcpu=SI -verify-machineinstrs < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s |
| 2 | ; RUN: llc -march=r600 -mcpu=redwood -verify-machineinstrs < %s | FileCheck -check-prefix=EG -check-prefix=FUNC %s |
| 3 | |
| 4 | declare i32 @llvm.AMDGPU.bfe.u32(i32, i32, i32) nounwind readnone |
| 5 | |
| 6 | ; FUNC-LABEL: @bfe_u32_arg_arg_arg |
| 7 | ; SI: V_BFE_U32 |
| 8 | ; EG: BFE_UINT |
| 9 | define void @bfe_u32_arg_arg_arg(i32 addrspace(1)* %out, i32 %src0, i32 %src1, i32 %src2) nounwind { |
| 10 | %bfe_u32 = call i32 @llvm.AMDGPU.bfe.u32(i32 %src0, i32 %src1, i32 %src1) nounwind readnone |
| 11 | store i32 %bfe_u32, i32 addrspace(1)* %out, align 4 |
| 12 | ret void |
| 13 | } |
| 14 | |
| 15 | ; FUNC-LABEL: @bfe_u32_arg_arg_imm |
| 16 | ; SI: V_BFE_U32 |
| 17 | ; EG: BFE_UINT |
| 18 | define void @bfe_u32_arg_arg_imm(i32 addrspace(1)* %out, i32 %src0, i32 %src1) nounwind { |
| 19 | %bfe_u32 = call i32 @llvm.AMDGPU.bfe.u32(i32 %src0, i32 %src1, i32 123) nounwind readnone |
| 20 | store i32 %bfe_u32, i32 addrspace(1)* %out, align 4 |
| 21 | ret void |
| 22 | } |
| 23 | |
| 24 | ; FUNC-LABEL: @bfe_u32_arg_imm_arg |
| 25 | ; SI: V_BFE_U32 |
| 26 | ; EG: BFE_UINT |
| 27 | define void @bfe_u32_arg_imm_arg(i32 addrspace(1)* %out, i32 %src0, i32 %src2) nounwind { |
| 28 | %bfe_u32 = call i32 @llvm.AMDGPU.bfe.u32(i32 %src0, i32 123, i32 %src2) nounwind readnone |
| 29 | store i32 %bfe_u32, i32 addrspace(1)* %out, align 4 |
| 30 | ret void |
| 31 | } |
| 32 | |
| 33 | ; FUNC-LABEL: @bfe_u32_imm_arg_arg |
| 34 | ; SI: V_BFE_U32 |
| 35 | ; EG: BFE_UINT |
| 36 | define void @bfe_u32_imm_arg_arg(i32 addrspace(1)* %out, i32 %src1, i32 %src2) nounwind { |
| 37 | %bfe_u32 = call i32 @llvm.AMDGPU.bfe.u32(i32 123, i32 %src1, i32 %src2) nounwind readnone |
| 38 | store i32 %bfe_u32, i32 addrspace(1)* %out, align 4 |
| 39 | ret void |
| 40 | } |
Matt Arsenault | 5565f65e | 2014-05-22 18:09:07 +0000 | [diff] [blame^] | 41 | |
| 42 | ; FUNC-LABEL: @bfe_u32_arg_0_width_reg_offset |
| 43 | ; SI-NOT: BFE |
| 44 | ; SI: S_ENDPGM |
| 45 | ; EG-NOT: BFE |
| 46 | define void @bfe_u32_arg_0_width_reg_offset(i32 addrspace(1)* %out, i32 %src0, i32 %src1) nounwind { |
| 47 | %bfe_u32 = call i32 @llvm.AMDGPU.bfe.u32(i32 %src0, i32 %src1, i32 0) nounwind readnone |
| 48 | store i32 %bfe_u32, i32 addrspace(1)* %out, align 4 |
| 49 | ret void |
| 50 | } |
| 51 | |
| 52 | ; FUNC-LABEL: @bfe_u32_arg_0_width_imm_offset |
| 53 | ; SI-NOT: BFE |
| 54 | ; SI: S_ENDPGM |
| 55 | ; EG-NOT: BFE |
| 56 | define void @bfe_u32_arg_0_width_imm_offset(i32 addrspace(1)* %out, i32 %src0, i32 %src1) nounwind { |
| 57 | %bfe_u32 = call i32 @llvm.AMDGPU.bfe.u32(i32 %src0, i32 8, i32 0) nounwind readnone |
| 58 | store i32 %bfe_u32, i32 addrspace(1)* %out, align 4 |
| 59 | ret void |
| 60 | } |
| 61 | |
| 62 | ; FUNC-LABEL: @bfe_u32_zextload_i8 |
| 63 | ; SI: BUFFER_LOAD_UBYTE |
| 64 | ; SI-NOT: BFE |
| 65 | ; SI: S_ENDPGM |
| 66 | define void @bfe_u32_zextload_i8(i32 addrspace(1)* %out, i8 addrspace(1)* %in) nounwind { |
| 67 | %load = load i8 addrspace(1)* %in |
| 68 | %ext = zext i8 %load to i32 |
| 69 | %bfe = call i32 @llvm.AMDGPU.bfe.u32(i32 %ext, i32 0, i32 8) |
| 70 | store i32 %bfe, i32 addrspace(1)* %out, align 4 |
| 71 | ret void |
| 72 | } |
| 73 | |
| 74 | ; FUNC-LABEL: @bfe_u32_zext_in_reg_i8 |
| 75 | ; SI: BUFFER_LOAD_DWORD |
| 76 | ; SI: V_ADD_I32 |
| 77 | ; SI-NEXT: V_AND_B32_e32 |
| 78 | ; SI-NOT: BFE |
| 79 | ; SI: S_ENDPGM |
| 80 | define void @bfe_u32_zext_in_reg_i8(i32 addrspace(1)* %out, i32 addrspace(1)* %in) nounwind { |
| 81 | %load = load i32 addrspace(1)* %in, align 4 |
| 82 | %add = add i32 %load, 1 |
| 83 | %ext = and i32 %add, 255 |
| 84 | %bfe = call i32 @llvm.AMDGPU.bfe.u32(i32 %ext, i32 0, i32 8) |
| 85 | store i32 %bfe, i32 addrspace(1)* %out, align 4 |
| 86 | ret void |
| 87 | } |
| 88 | |
| 89 | ; FUNC-LABEL: @bfe_u32_zext_in_reg_i16 |
| 90 | ; SI: BUFFER_LOAD_DWORD |
| 91 | ; SI: V_ADD_I32 |
| 92 | ; SI-NEXT: V_AND_B32_e32 |
| 93 | ; SI-NOT: BFE |
| 94 | ; SI: S_ENDPGM |
| 95 | define void @bfe_u32_zext_in_reg_i16(i32 addrspace(1)* %out, i32 addrspace(1)* %in) nounwind { |
| 96 | %load = load i32 addrspace(1)* %in, align 4 |
| 97 | %add = add i32 %load, 1 |
| 98 | %ext = and i32 %add, 65535 |
| 99 | %bfe = call i32 @llvm.AMDGPU.bfe.u32(i32 %ext, i32 0, i32 16) |
| 100 | store i32 %bfe, i32 addrspace(1)* %out, align 4 |
| 101 | ret void |
| 102 | } |
| 103 | |
| 104 | ; FUNC-LABEL: @bfe_u32_zext_in_reg_i8_offset_1 |
| 105 | ; SI: BUFFER_LOAD_DWORD |
| 106 | ; SI: V_ADD_I32 |
| 107 | ; SI: BFE |
| 108 | ; SI: S_ENDPGM |
| 109 | define void @bfe_u32_zext_in_reg_i8_offset_1(i32 addrspace(1)* %out, i32 addrspace(1)* %in) nounwind { |
| 110 | %load = load i32 addrspace(1)* %in, align 4 |
| 111 | %add = add i32 %load, 1 |
| 112 | %ext = and i32 %add, 255 |
| 113 | %bfe = call i32 @llvm.AMDGPU.bfe.u32(i32 %ext, i32 1, i32 8) |
| 114 | store i32 %bfe, i32 addrspace(1)* %out, align 4 |
| 115 | ret void |
| 116 | } |
| 117 | |
| 118 | ; FUNC-LABEL: @bfe_u32_zext_in_reg_i8_offset_3 |
| 119 | ; SI: BUFFER_LOAD_DWORD |
| 120 | ; SI: V_ADD_I32 |
| 121 | ; SI-NEXT: V_AND_B32_e32 {{v[0-9]+}}, 0xf8 |
| 122 | ; SI-NEXT: BFE |
| 123 | ; SI: S_ENDPGM |
| 124 | define void @bfe_u32_zext_in_reg_i8_offset_3(i32 addrspace(1)* %out, i32 addrspace(1)* %in) nounwind { |
| 125 | %load = load i32 addrspace(1)* %in, align 4 |
| 126 | %add = add i32 %load, 1 |
| 127 | %ext = and i32 %add, 255 |
| 128 | %bfe = call i32 @llvm.AMDGPU.bfe.u32(i32 %ext, i32 3, i32 8) |
| 129 | store i32 %bfe, i32 addrspace(1)* %out, align 4 |
| 130 | ret void |
| 131 | } |
| 132 | |
| 133 | ; FUNC-LABEL: @bfe_u32_zext_in_reg_i8_offset_7 |
| 134 | ; SI: BUFFER_LOAD_DWORD |
| 135 | ; SI: V_ADD_I32 |
| 136 | ; SI-NEXT: V_AND_B32_e32 {{v[0-9]+}}, 0x80 |
| 137 | ; SI-NEXT: BFE |
| 138 | ; SI: S_ENDPGM |
| 139 | define void @bfe_u32_zext_in_reg_i8_offset_7(i32 addrspace(1)* %out, i32 addrspace(1)* %in) nounwind { |
| 140 | %load = load i32 addrspace(1)* %in, align 4 |
| 141 | %add = add i32 %load, 1 |
| 142 | %ext = and i32 %add, 255 |
| 143 | %bfe = call i32 @llvm.AMDGPU.bfe.u32(i32 %ext, i32 7, i32 8) |
| 144 | store i32 %bfe, i32 addrspace(1)* %out, align 4 |
| 145 | ret void |
| 146 | } |
| 147 | |
| 148 | ; FUNC-LABEL: @bfe_u32_zext_in_reg_i16_offset_8 |
| 149 | ; SI: BUFFER_LOAD_DWORD |
| 150 | ; SI: V_ADD_I32 |
| 151 | ; SI-NEXT: BFE |
| 152 | ; SI: S_ENDPGM |
| 153 | define void @bfe_u32_zext_in_reg_i16_offset_8(i32 addrspace(1)* %out, i32 addrspace(1)* %in) nounwind { |
| 154 | %load = load i32 addrspace(1)* %in, align 4 |
| 155 | %add = add i32 %load, 1 |
| 156 | %ext = and i32 %add, 65535 |
| 157 | %bfe = call i32 @llvm.AMDGPU.bfe.u32(i32 %ext, i32 8, i32 8) |
| 158 | store i32 %bfe, i32 addrspace(1)* %out, align 4 |
| 159 | ret void |
| 160 | } |
| 161 | |
| 162 | ; FUNC-LABEL: @bfe_u32_test_1 |
| 163 | ; SI: BUFFER_LOAD_DWORD |
| 164 | ; SI: V_BFE_U32 {{v[0-9]+}}, {{v[0-9]+}}, 0, 1 |
| 165 | ; SI: S_ENDPGM |
| 166 | ; EG: BFE_UINT |
| 167 | define void @bfe_u32_test_1(i32 addrspace(1)* %out, i32 addrspace(1)* %in) nounwind { |
| 168 | %x = load i32 addrspace(1)* %in, align 4 |
| 169 | %bfe = call i32 @llvm.AMDGPU.bfe.u32(i32 %x, i32 0, i32 1) |
| 170 | store i32 %bfe, i32 addrspace(1)* %out, align 4 |
| 171 | ret void |
| 172 | } |
| 173 | |
| 174 | define void @bfe_u32_test_2(i32 addrspace(1)* %out, i32 addrspace(1)* %in) nounwind { |
| 175 | %x = load i32 addrspace(1)* %in, align 4 |
| 176 | %shl = shl i32 %x, 31 |
| 177 | %bfe = call i32 @llvm.AMDGPU.bfe.u32(i32 %shl, i32 0, i32 8) |
| 178 | store i32 %bfe, i32 addrspace(1)* %out, align 4 |
| 179 | ret void |
| 180 | } |
| 181 | |
| 182 | define void @bfe_u32_test_3(i32 addrspace(1)* %out, i32 addrspace(1)* %in) nounwind { |
| 183 | %x = load i32 addrspace(1)* %in, align 4 |
| 184 | %shl = shl i32 %x, 31 |
| 185 | %bfe = call i32 @llvm.AMDGPU.bfe.u32(i32 %shl, i32 0, i32 1) |
| 186 | store i32 %bfe, i32 addrspace(1)* %out, align 4 |
| 187 | ret void |
| 188 | } |
| 189 | |
| 190 | ; FUNC-LABEL: @bfe_u32_test_4 |
| 191 | ; SI-NOT: LSHL |
| 192 | ; SI-NOT: SHR |
| 193 | ; SI-NOT: BFE |
| 194 | ; SI: V_MOV_B32_e32 [[VREG:v[0-9]+]], 0 |
| 195 | ; SI: BUFFER_STORE_DWORD [[VREG]], |
| 196 | ; SI: S_ENDPGM |
| 197 | define void @bfe_u32_test_4(i32 addrspace(1)* %out, i32 addrspace(1)* %in) nounwind { |
| 198 | %x = load i32 addrspace(1)* %in, align 4 |
| 199 | %shl = shl i32 %x, 31 |
| 200 | %shr = lshr i32 %shl, 31 |
| 201 | %bfe = call i32 @llvm.AMDGPU.bfe.u32(i32 %shr, i32 31, i32 1) |
| 202 | store i32 %bfe, i32 addrspace(1)* %out, align 4 |
| 203 | ret void |
| 204 | } |
| 205 | |
| 206 | ; FUNC-LABEL: @bfe_u32_test_5 |
| 207 | ; SI: BUFFER_LOAD_DWORD |
| 208 | ; SI-NOT: LSHL |
| 209 | ; SI-NOT: SHR |
| 210 | ; SI: V_BFE_I32 {{v[0-9]+}}, {{v[0-9]+}}, 0, 1 |
| 211 | ; SI: S_ENDPGM |
| 212 | define void @bfe_u32_test_5(i32 addrspace(1)* %out, i32 addrspace(1)* %in) nounwind { |
| 213 | %x = load i32 addrspace(1)* %in, align 4 |
| 214 | %shl = shl i32 %x, 31 |
| 215 | %shr = ashr i32 %shl, 31 |
| 216 | %bfe = call i32 @llvm.AMDGPU.bfe.u32(i32 %shr, i32 0, i32 1) |
| 217 | store i32 %bfe, i32 addrspace(1)* %out, align 4 |
| 218 | ret void |
| 219 | } |
| 220 | |
| 221 | ; FUNC-LABEL: @bfe_u32_test_6 |
| 222 | ; SI: V_LSHLREV_B32_e32 v{{[0-9]+}}, 31, v{{[0-9]+}} |
| 223 | ; SI: V_BFE_U32 {{v[0-9]+}}, {{v[0-9]+}}, 1, 31 |
| 224 | ; SI: S_ENDPGM |
| 225 | define void @bfe_u32_test_6(i32 addrspace(1)* %out, i32 addrspace(1)* %in) nounwind { |
| 226 | %x = load i32 addrspace(1)* %in, align 4 |
| 227 | %shl = shl i32 %x, 31 |
| 228 | %bfe = call i32 @llvm.AMDGPU.bfe.u32(i32 %shl, i32 1, i32 31) |
| 229 | store i32 %bfe, i32 addrspace(1)* %out, align 4 |
| 230 | ret void |
| 231 | } |
| 232 | |
| 233 | ; FUNC-LABEL: @bfe_u32_test_7 |
| 234 | ; SI: V_LSHLREV_B32_e32 v{{[0-9]+}}, 31, v{{[0-9]+}} |
| 235 | ; SI-NOT: BFE |
| 236 | ; SI: S_ENDPGM |
| 237 | define void @bfe_u32_test_7(i32 addrspace(1)* %out, i32 addrspace(1)* %in) nounwind { |
| 238 | %x = load i32 addrspace(1)* %in, align 4 |
| 239 | %shl = shl i32 %x, 31 |
| 240 | %bfe = call i32 @llvm.AMDGPU.bfe.u32(i32 %shl, i32 0, i32 31) |
| 241 | store i32 %bfe, i32 addrspace(1)* %out, align 4 |
| 242 | ret void |
| 243 | } |
| 244 | |
| 245 | ; FUNC-LABEL: @bfe_u32_test_8 |
| 246 | ; SI: V_LSHLREV_B32_e32 v{{[0-9]+}}, 31, v{{[0-9]+}} |
| 247 | ; SI: V_BFE_U32 {{v[0-9]+}}, {{v[0-9]+}}, 31, 1 |
| 248 | ; SI: S_ENDPGM |
| 249 | define void @bfe_u32_test_8(i32 addrspace(1)* %out, i32 addrspace(1)* %in) nounwind { |
| 250 | %x = load i32 addrspace(1)* %in, align 4 |
| 251 | %shl = shl i32 %x, 31 |
| 252 | %bfe = call i32 @llvm.AMDGPU.bfe.u32(i32 %shl, i32 31, i32 1) |
| 253 | store i32 %bfe, i32 addrspace(1)* %out, align 4 |
| 254 | ret void |
| 255 | } |
| 256 | |
| 257 | ; FUNC-LABEL: @bfe_u32_constant_fold_test_0 |
| 258 | ; SI-NOT: BFE |
| 259 | ; SI: V_MOV_B32_e32 [[VREG:v[0-9]+]], 0 |
| 260 | ; SI: BUFFER_STORE_DWORD [[VREG]], |
| 261 | ; SI: S_ENDPGM |
| 262 | ; EG-NOT: BFE |
| 263 | define void @bfe_u32_constant_fold_test_0(i32 addrspace(1)* %out) nounwind { |
| 264 | %bfe_u32 = call i32 @llvm.AMDGPU.bfe.u32(i32 0, i32 0, i32 0) nounwind readnone |
| 265 | store i32 %bfe_u32, i32 addrspace(1)* %out, align 4 |
| 266 | ret void |
| 267 | } |
| 268 | |
| 269 | ; FUNC-LABEL: @bfe_u32_constant_fold_test_1 |
| 270 | ; SI-NOT: BFE |
| 271 | ; SI: V_MOV_B32_e32 [[VREG:v[0-9]+]], 0 |
| 272 | ; SI: BUFFER_STORE_DWORD [[VREG]], |
| 273 | ; SI: S_ENDPGM |
| 274 | ; EG-NOT: BFE |
| 275 | define void @bfe_u32_constant_fold_test_1(i32 addrspace(1)* %out) nounwind { |
| 276 | %bfe_u32 = call i32 @llvm.AMDGPU.bfe.u32(i32 12334, i32 0, i32 0) nounwind readnone |
| 277 | store i32 %bfe_u32, i32 addrspace(1)* %out, align 4 |
| 278 | ret void |
| 279 | } |
| 280 | |
| 281 | ; FUNC-LABEL: @bfe_u32_constant_fold_test_2 |
| 282 | ; SI-NOT: BFE |
| 283 | ; SI: V_MOV_B32_e32 [[VREG:v[0-9]+]], 0 |
| 284 | ; SI: BUFFER_STORE_DWORD [[VREG]], |
| 285 | ; SI: S_ENDPGM |
| 286 | ; EG-NOT: BFE |
| 287 | define void @bfe_u32_constant_fold_test_2(i32 addrspace(1)* %out) nounwind { |
| 288 | %bfe_u32 = call i32 @llvm.AMDGPU.bfe.u32(i32 0, i32 0, i32 1) nounwind readnone |
| 289 | store i32 %bfe_u32, i32 addrspace(1)* %out, align 4 |
| 290 | ret void |
| 291 | } |
| 292 | |
| 293 | ; FUNC-LABEL: @bfe_u32_constant_fold_test_3 |
| 294 | ; SI-NOT: BFE |
| 295 | ; SI: V_MOV_B32_e32 [[VREG:v[0-9]+]], 1 |
| 296 | ; SI: BUFFER_STORE_DWORD [[VREG]], |
| 297 | ; SI: S_ENDPGM |
| 298 | ; EG-NOT: BFE |
| 299 | define void @bfe_u32_constant_fold_test_3(i32 addrspace(1)* %out) nounwind { |
| 300 | %bfe_u32 = call i32 @llvm.AMDGPU.bfe.u32(i32 1, i32 0, i32 1) nounwind readnone |
| 301 | store i32 %bfe_u32, i32 addrspace(1)* %out, align 4 |
| 302 | ret void |
| 303 | } |
| 304 | |
| 305 | ; FUNC-LABEL: @bfe_u32_constant_fold_test_4 |
| 306 | ; SI-NOT: BFE |
| 307 | ; SI: V_MOV_B32_e32 [[VREG:v[0-9]+]], -1 |
| 308 | ; SI: BUFFER_STORE_DWORD [[VREG]], |
| 309 | ; SI: S_ENDPGM |
| 310 | ; EG-NOT: BFE |
| 311 | define void @bfe_u32_constant_fold_test_4(i32 addrspace(1)* %out) nounwind { |
| 312 | %bfe_u32 = call i32 @llvm.AMDGPU.bfe.u32(i32 4294967295, i32 0, i32 1) nounwind readnone |
| 313 | store i32 %bfe_u32, i32 addrspace(1)* %out, align 4 |
| 314 | ret void |
| 315 | } |
| 316 | |
| 317 | ; FUNC-LABEL: @bfe_u32_constant_fold_test_5 |
| 318 | ; SI-NOT: BFE |
| 319 | ; SI: V_MOV_B32_e32 [[VREG:v[0-9]+]], 1 |
| 320 | ; SI: BUFFER_STORE_DWORD [[VREG]], |
| 321 | ; SI: S_ENDPGM |
| 322 | ; EG-NOT: BFE |
| 323 | define void @bfe_u32_constant_fold_test_5(i32 addrspace(1)* %out) nounwind { |
| 324 | %bfe_u32 = call i32 @llvm.AMDGPU.bfe.u32(i32 128, i32 7, i32 1) nounwind readnone |
| 325 | store i32 %bfe_u32, i32 addrspace(1)* %out, align 4 |
| 326 | ret void |
| 327 | } |
| 328 | |
| 329 | ; FUNC-LABEL: @bfe_u32_constant_fold_test_6 |
| 330 | ; SI-NOT: BFE |
| 331 | ; SI: V_MOV_B32_e32 [[VREG:v[0-9]+]], 0x80 |
| 332 | ; SI: BUFFER_STORE_DWORD [[VREG]], |
| 333 | ; SI: S_ENDPGM |
| 334 | ; EG-NOT: BFE |
| 335 | define void @bfe_u32_constant_fold_test_6(i32 addrspace(1)* %out) nounwind { |
| 336 | %bfe_u32 = call i32 @llvm.AMDGPU.bfe.u32(i32 128, i32 0, i32 8) nounwind readnone |
| 337 | store i32 %bfe_u32, i32 addrspace(1)* %out, align 4 |
| 338 | ret void |
| 339 | } |
| 340 | |
| 341 | ; FUNC-LABEL: @bfe_u32_constant_fold_test_7 |
| 342 | ; SI-NOT: BFE |
| 343 | ; SI: V_MOV_B32_e32 [[VREG:v[0-9]+]], 0x7f |
| 344 | ; SI: BUFFER_STORE_DWORD [[VREG]], |
| 345 | ; SI: S_ENDPGM |
| 346 | ; EG-NOT: BFE |
| 347 | define void @bfe_u32_constant_fold_test_7(i32 addrspace(1)* %out) nounwind { |
| 348 | %bfe_u32 = call i32 @llvm.AMDGPU.bfe.u32(i32 127, i32 0, i32 8) nounwind readnone |
| 349 | store i32 %bfe_u32, i32 addrspace(1)* %out, align 4 |
| 350 | ret void |
| 351 | } |
| 352 | |
| 353 | ; FUNC-LABEL: @bfe_u32_constant_fold_test_8 |
| 354 | ; SI-NOT: BFE |
| 355 | ; SI: V_MOV_B32_e32 [[VREG:v[0-9]+]], 1 |
| 356 | ; SI: BUFFER_STORE_DWORD [[VREG]], |
| 357 | ; SI: S_ENDPGM |
| 358 | ; EG-NOT: BFE |
| 359 | define void @bfe_u32_constant_fold_test_8(i32 addrspace(1)* %out) nounwind { |
| 360 | %bfe_u32 = call i32 @llvm.AMDGPU.bfe.u32(i32 127, i32 6, i32 8) nounwind readnone |
| 361 | store i32 %bfe_u32, i32 addrspace(1)* %out, align 4 |
| 362 | ret void |
| 363 | } |
| 364 | |
| 365 | ; FUNC-LABEL: @bfe_u32_constant_fold_test_9 |
| 366 | ; SI-NOT: BFE |
| 367 | ; SI: V_MOV_B32_e32 [[VREG:v[0-9]+]], 1 |
| 368 | ; SI: BUFFER_STORE_DWORD [[VREG]], |
| 369 | ; SI: S_ENDPGM |
| 370 | ; EG-NOT: BFEfppppppppppppp |
| 371 | define void @bfe_u32_constant_fold_test_9(i32 addrspace(1)* %out) nounwind { |
| 372 | %bfe_u32 = call i32 @llvm.AMDGPU.bfe.u32(i32 65536, i32 16, i32 8) nounwind readnone |
| 373 | store i32 %bfe_u32, i32 addrspace(1)* %out, align 4 |
| 374 | ret void |
| 375 | } |
| 376 | |
| 377 | ; FUNC-LABEL: @bfe_u32_constant_fold_test_10 |
| 378 | ; SI-NOT: BFE |
| 379 | ; SI: V_MOV_B32_e32 [[VREG:v[0-9]+]], 0 |
| 380 | ; SI: BUFFER_STORE_DWORD [[VREG]], |
| 381 | ; SI: S_ENDPGM |
| 382 | ; EG-NOT: BFE |
| 383 | define void @bfe_u32_constant_fold_test_10(i32 addrspace(1)* %out) nounwind { |
| 384 | %bfe_u32 = call i32 @llvm.AMDGPU.bfe.u32(i32 65535, i32 16, i32 16) nounwind readnone |
| 385 | store i32 %bfe_u32, i32 addrspace(1)* %out, align 4 |
| 386 | ret void |
| 387 | } |
| 388 | |
| 389 | ; FUNC-LABEL: @bfe_u32_constant_fold_test_11 |
| 390 | ; SI-NOT: BFE |
| 391 | ; SI: V_MOV_B32_e32 [[VREG:v[0-9]+]], 10 |
| 392 | ; SI: BUFFER_STORE_DWORD [[VREG]], |
| 393 | ; SI: S_ENDPGM |
| 394 | ; EG-NOT: BFE |
| 395 | define void @bfe_u32_constant_fold_test_11(i32 addrspace(1)* %out) nounwind { |
| 396 | %bfe_u32 = call i32 @llvm.AMDGPU.bfe.u32(i32 160, i32 4, i32 4) nounwind readnone |
| 397 | store i32 %bfe_u32, i32 addrspace(1)* %out, align 4 |
| 398 | ret void |
| 399 | } |
| 400 | |
| 401 | ; FUNC-LABEL: @bfe_u32_constant_fold_test_12 |
| 402 | ; SI-NOT: BFE |
| 403 | ; SI: V_MOV_B32_e32 [[VREG:v[0-9]+]], 0 |
| 404 | ; SI: BUFFER_STORE_DWORD [[VREG]], |
| 405 | ; SI: S_ENDPGM |
| 406 | ; EG-NOT: BFE |
| 407 | define void @bfe_u32_constant_fold_test_12(i32 addrspace(1)* %out) nounwind { |
| 408 | %bfe_u32 = call i32 @llvm.AMDGPU.bfe.u32(i32 160, i32 31, i32 1) nounwind readnone |
| 409 | store i32 %bfe_u32, i32 addrspace(1)* %out, align 4 |
| 410 | ret void |
| 411 | } |
| 412 | |
| 413 | ; FUNC-LABEL: @bfe_u32_constant_fold_test_13 |
| 414 | ; SI-NOT: BFE |
| 415 | ; SI: V_MOV_B32_e32 [[VREG:v[0-9]+]], 1 |
| 416 | ; SI: BUFFER_STORE_DWORD [[VREG]], |
| 417 | ; SI: S_ENDPGM |
| 418 | ; EG-NOT: BFE |
| 419 | define void @bfe_u32_constant_fold_test_13(i32 addrspace(1)* %out) nounwind { |
| 420 | %bfe_u32 = call i32 @llvm.AMDGPU.bfe.u32(i32 131070, i32 16, i32 16) nounwind readnone |
| 421 | store i32 %bfe_u32, i32 addrspace(1)* %out, align 4 |
| 422 | ret void |
| 423 | } |
| 424 | |
| 425 | ; FUNC-LABEL: @bfe_u32_constant_fold_test_14 |
| 426 | ; SI-NOT: BFE |
| 427 | ; SI: V_MOV_B32_e32 [[VREG:v[0-9]+]], 40 |
| 428 | ; SI: BUFFER_STORE_DWORD [[VREG]], |
| 429 | ; SI: S_ENDPGM |
| 430 | ; EG-NOT: BFE |
| 431 | define void @bfe_u32_constant_fold_test_14(i32 addrspace(1)* %out) nounwind { |
| 432 | %bfe_u32 = call i32 @llvm.AMDGPU.bfe.u32(i32 160, i32 2, i32 30) nounwind readnone |
| 433 | store i32 %bfe_u32, i32 addrspace(1)* %out, align 4 |
| 434 | ret void |
| 435 | } |
| 436 | |
| 437 | ; FUNC-LABEL: @bfe_u32_constant_fold_test_15 |
| 438 | ; SI-NOT: BFE |
| 439 | ; SI: V_MOV_B32_e32 [[VREG:v[0-9]+]], 10 |
| 440 | ; SI: BUFFER_STORE_DWORD [[VREG]], |
| 441 | ; SI: S_ENDPGM |
| 442 | ; EG-NOT: BFE |
| 443 | define void @bfe_u32_constant_fold_test_15(i32 addrspace(1)* %out) nounwind { |
| 444 | %bfe_u32 = call i32 @llvm.AMDGPU.bfe.u32(i32 160, i32 4, i32 28) nounwind readnone |
| 445 | store i32 %bfe_u32, i32 addrspace(1)* %out, align 4 |
| 446 | ret void |
| 447 | } |
| 448 | |
| 449 | ; FUNC-LABEL: @bfe_u32_constant_fold_test_16 |
| 450 | ; SI-NOT: BFE |
| 451 | ; SI: V_MOV_B32_e32 [[VREG:v[0-9]+]], 0x7f |
| 452 | ; SI: BUFFER_STORE_DWORD [[VREG]], |
| 453 | ; SI: S_ENDPGM |
| 454 | ; EG-NOT: BFE |
| 455 | define void @bfe_u32_constant_fold_test_16(i32 addrspace(1)* %out) nounwind { |
| 456 | %bfe_u32 = call i32 @llvm.AMDGPU.bfe.u32(i32 4294967295, i32 1, i32 7) nounwind readnone |
| 457 | store i32 %bfe_u32, i32 addrspace(1)* %out, align 4 |
| 458 | ret void |
| 459 | } |