27 lines · plain
1; RUN: llc < %s -mtriple=r600 -mcpu=redwood | FileCheck %s2 3; CHECK: {{^}}bfe_def:4; CHECK: BFE_UINT5define amdgpu_kernel void @bfe_def(ptr addrspace(1) %out, i32 %x) {6entry:7 %0 = lshr i32 %x, 58 %1 = and i32 %0, 15 ; 0xf9 store i32 %1, ptr addrspace(1) %out10 ret void11}12 13; This program could be implemented using a BFE_UINT instruction, however14; since the lshr constant + number of bits in the mask is >= 32, it can also be15; implmented with a LSHR instruction, which is better, because LSHR has less16; operands and requires less constants.17 18; CHECK: {{^}}bfe_shift:19; CHECK-NOT: BFE_UINT20define amdgpu_kernel void @bfe_shift(ptr addrspace(1) %out, i32 %x) {21entry:22 %0 = lshr i32 %x, 1623 %1 = and i32 %0, 65535 ; 0xffff24 store i32 %1, ptr addrspace(1) %out25 ret void26}27