Home | History | Annotate | Download | only in R600
      1 ; RUN: llc < %s -march=r600 -mcpu=redwood | FileCheck %s
      2 
      3 ; XFAIL: *
      4 
      5 ; CHECK: @bfe_def
      6 ; CHECK: BFE_UINT
      7 define void @bfe_def(i32 addrspace(1)* %out, i32 %x) {
      8 entry:
      9   %0 = lshr i32 %x, 5
     10   %1 = and i32 %0, 15 ; 0xf
     11   store i32 %1, i32 addrspace(1)* %out
     12   ret void
     13 }
     14 
     15 ; This program could be implemented using a BFE_UINT instruction, however
     16 ; since the lshr constant + number of bits in the mask is >= 32, it can also be
     17 ; implmented with a LSHR instruction, which is better, because LSHR has less
     18 ; operands and requires less constants.
     19 
     20 ; CHECK: @bfe_shift
     21 ; CHECK-NOT: BFE_UINT
     22 define void @bfe_shift(i32 addrspace(1)* %out, i32 %x) {
     23 entry:
     24   %0 = lshr i32 %x, 16
     25   %1 = and i32 %0, 65535 ; 0xffff
     26   store i32 %1, i32 addrspace(1)* %out
     27   ret void
     28 }
     29