2013-05-10 10:09:45 +08:00
|
|
|
; RUN: llc < %s -march=r600 -mcpu=redwood | FileCheck %s
|
|
|
|
|
2014-10-02 01:15:17 +08:00
|
|
|
; CHECK: {{^}}bfe_def:
|
2013-05-10 10:09:45 +08:00
|
|
|
; CHECK: BFE_UINT
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @bfe_def(i32 addrspace(1)* %out, i32 %x) {
|
2013-05-10 10:09:45 +08:00
|
|
|
entry:
|
|
|
|
%0 = lshr i32 %x, 5
|
|
|
|
%1 = and i32 %0, 15 ; 0xf
|
|
|
|
store i32 %1, i32 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; This program could be implemented using a BFE_UINT instruction, however
|
|
|
|
; since the lshr constant + number of bits in the mask is >= 32, it can also be
|
|
|
|
; implmented with a LSHR instruction, which is better, because LSHR has less
|
|
|
|
; operands and requires less constants.
|
|
|
|
|
2014-10-02 01:15:17 +08:00
|
|
|
; CHECK: {{^}}bfe_shift:
|
2013-05-10 10:09:45 +08:00
|
|
|
; CHECK-NOT: BFE_UINT
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @bfe_shift(i32 addrspace(1)* %out, i32 %x) {
|
2013-05-10 10:09:45 +08:00
|
|
|
entry:
|
|
|
|
%0 = lshr i32 %x, 16
|
|
|
|
%1 = and i32 %0, 65535 ; 0xffff
|
|
|
|
store i32 %1, i32 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|