~pali/+junk/llvm-toolchain-3.7

« back to all changes in this revision

Viewing changes to test/CodeGen/AMDGPU/bfe_uint.ll

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2015-07-15 17:51:08 UTC
  • Revision ID: package-import@ubuntu.com-20150715175108-l8mynwovkx4zx697
Tags: upstream-3.7~+rc2
ImportĀ upstreamĀ versionĀ 3.7~+rc2

Show diffs side-by-side

added added

removed removed

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