blob: 6fe23e91295272411890b48f7aa65b158856062b [file] [log] [blame]
Tom Stellard2b971eb2013-05-10 02:09:45 +00001; RUN: llc < %s -march=r600 -mcpu=redwood | FileCheck %s
2
Tom Stellarda2a4b8e2014-01-23 18:49:33 +00003; XFAIL: *
4
Tom Stellard79243d92014-10-01 17:15:17 +00005; CHECK: {{^}}bfe_def:
Tom Stellard2b971eb2013-05-10 02:09:45 +00006; CHECK: BFE_UINT
7define void @bfe_def(i32 addrspace(1)* %out, i32 %x) {
8entry:
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
Tom Stellard79243d92014-10-01 17:15:17 +000020; CHECK: {{^}}bfe_shift:
Tom Stellard2b971eb2013-05-10 02:09:45 +000021; CHECK-NOT: BFE_UINT
22define void @bfe_shift(i32 addrspace(1)* %out, i32 %x) {
23entry:
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}