llvm.org GIT mirror llvm / 1b84bf2
[PowerPC] Add a test for truncating a shifted load We now produce the desired code as noted in the README.txt file. Remove the README entry and add a regression test. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225209 91177308-0d34-0410-b5e6-96231b3b80d8 Hal Finkel 5 years ago
2 changed file(s) with 18 addition(s) and 18 deletion(s). Raw diff Collapse all Expand all
251251 if (b) t = *a;
252252 if (c) *a = t;
253253 }
254
255 ===-------------------------------------------------------------------------===
256
257 This:
258 int test(unsigned *P) { return *P >> 24; }
259
260 Should compile to:
261
262 _test:
263 lbz r3,0(r3)
264 blr
265
266 not:
267
268 _test:
269 lwz r2, 0(r3)
270 srwi r3, r2, 24
271 blr
272254
273255 ===-------------------------------------------------------------------------===
274256
0 ; RUN: llc -mcpu=ppc64 < %s | FileCheck %s
1 target datalayout = "E-m:e-i64:64-n32:64"
2 target triple = "powerpc64-unknown-linux-gnu"
3
4 ; Function Attrs: nounwind readonly
5 define signext i32 @test(i32* nocapture readonly %P) #0 {
6 entry:
7 %0 = load i32* %P, align 4
8 %shr = lshr i32 %0, 24
9 ret i32 %shr
10
11 ; CHECK-LABEL: @test
12 ; CHECK: lbz 3, 0(3)
13 ; CHECK: blr
14 }
15
16 attributes #0 = { nounwind readonly }
17