Ehsan Amiri | a538b0f | 2016-08-03 18:17:35 +0000 | [diff] [blame] | 1 | ; RUN: llc -verify-machineinstrs -mcpu=pwr7 < %s | FileCheck %s |
Hal Finkel | 4c6658f | 2014-12-12 23:59:36 +0000 | [diff] [blame] | 2 | target datalayout = "E-m:e-i64:64-n32:64" |
| 3 | target triple = "powerpc64-unknown-linux-gnu" |
| 4 | |
| 5 | ; Function Attrs: nounwind readnone |
| 6 | define signext i32 @foo(i32 signext %a) #0 { |
| 7 | entry: |
| 8 | %mul = mul nsw i32 %a, %a |
| 9 | %shr2 = lshr i32 %mul, 5 |
| 10 | ret i32 %shr2 |
| 11 | |
Jonathan Roelofs | 49e46ce | 2015-08-10 19:01:27 +0000 | [diff] [blame] | 12 | ; CHECK-LABEL: @foo |
Hal Finkel | 4c6658f | 2014-12-12 23:59:36 +0000 | [diff] [blame] | 13 | ; CHECK-NOT: rldicl 3, {{[0-9]+}}, 0, 32 |
| 14 | ; CHECK: blr |
| 15 | } |
| 16 | |
| 17 | define zeroext i32 @test6(i32 zeroext %x) #0 { |
| 18 | entry: |
| 19 | %and = lshr i32 %x, 16 |
| 20 | %shr = and i32 %and, 255 |
| 21 | %and1 = shl i32 %x, 16 |
| 22 | %shl = and i32 %and1, 16711680 |
| 23 | %or = or i32 %shr, %shl |
| 24 | ret i32 %or |
| 25 | |
Jonathan Roelofs | 49e46ce | 2015-08-10 19:01:27 +0000 | [diff] [blame] | 26 | ; CHECK-LABEL: @test6 |
Hal Finkel | 4c6658f | 2014-12-12 23:59:36 +0000 | [diff] [blame] | 27 | ; CHECK-NOT: rldicl 3, {{[0-9]+}}, 0, 32 |
| 28 | ; CHECK: blr |
| 29 | } |
| 30 | |
Hal Finkel | 4104a1a | 2014-12-14 05:53:19 +0000 | [diff] [blame] | 31 | define zeroext i32 @min(i32 zeroext %a, i32 zeroext %b) #0 { |
| 32 | entry: |
| 33 | %cmp = icmp ule i32 %a, %b |
| 34 | %cond = select i1 %cmp, i32 %a, i32 %b |
| 35 | ret i32 %cond |
| 36 | |
Jonathan Roelofs | 49e46ce | 2015-08-10 19:01:27 +0000 | [diff] [blame] | 37 | ; CHECK-LABEL: @min |
Hal Finkel | 4104a1a | 2014-12-14 05:53:19 +0000 | [diff] [blame] | 38 | ; CHECK-NOT: rldicl 3, {{[0-9]+}}, 0, 32 |
| 39 | ; CHECK: blr |
| 40 | } |
| 41 | |
Hal Finkel | 4e2c782 | 2015-01-05 18:09:06 +0000 | [diff] [blame] | 42 | ; Function Attrs: nounwind readnone |
Hal Finkel | 49557f1 | 2015-01-05 18:52:29 +0000 | [diff] [blame] | 43 | declare i32 @llvm.bswap.i32(i32) #0 |
Hal Finkel | 4e2c782 | 2015-01-05 18:09:06 +0000 | [diff] [blame] | 44 | |
| 45 | ; Function Attrs: nounwind readonly |
Hal Finkel | 49557f1 | 2015-01-05 18:52:29 +0000 | [diff] [blame] | 46 | define zeroext i32 @bs32(i32* nocapture readonly %x) #1 { |
Hal Finkel | 4e2c782 | 2015-01-05 18:09:06 +0000 | [diff] [blame] | 47 | entry: |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 48 | %0 = load i32, i32* %x, align 4 |
Hal Finkel | 4e2c782 | 2015-01-05 18:09:06 +0000 | [diff] [blame] | 49 | %1 = tail call i32 @llvm.bswap.i32(i32 %0) |
| 50 | ret i32 %1 |
| 51 | |
| 52 | ; CHECK-LABEL: @bs32 |
| 53 | ; CHECK-NOT: rldicl 3, {{[0-9]+}}, 0, 32 |
| 54 | ; CHECK: blr |
| 55 | } |
| 56 | |
| 57 | ; Function Attrs: nounwind readonly |
Hal Finkel | 49557f1 | 2015-01-05 18:52:29 +0000 | [diff] [blame] | 58 | define zeroext i16 @bs16(i16* nocapture readonly %x) #1 { |
Hal Finkel | 4e2c782 | 2015-01-05 18:09:06 +0000 | [diff] [blame] | 59 | entry: |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 60 | %0 = load i16, i16* %x, align 2 |
Hal Finkel | 4e2c782 | 2015-01-05 18:09:06 +0000 | [diff] [blame] | 61 | %1 = tail call i16 @llvm.bswap.i16(i16 %0) |
| 62 | ret i16 %1 |
| 63 | |
| 64 | ; CHECK-LABEL: @bs16 |
| 65 | ; CHECK-NOT: rldicl 3, {{[0-9]+}}, 0, 32 |
| 66 | ; CHECK: blr |
| 67 | } |
| 68 | |
| 69 | ; Function Attrs: nounwind readnone |
Hal Finkel | 49557f1 | 2015-01-05 18:52:29 +0000 | [diff] [blame] | 70 | declare i16 @llvm.bswap.i16(i16) #0 |
| 71 | |
| 72 | ; Function Attrs: nounwind readnone |
| 73 | define zeroext i32 @ctlz32(i32 zeroext %x) #0 { |
| 74 | entry: |
| 75 | %0 = tail call i32 @llvm.ctlz.i32(i32 %x, i1 false) |
| 76 | ret i32 %0 |
| 77 | |
| 78 | ; CHECK-LABEL: @ctlz32 |
| 79 | ; CHECK-NOT: rldicl 3, {{[0-9]+}}, 0, 32 |
| 80 | ; CHECK: blr |
| 81 | } |
| 82 | |
| 83 | ; Function Attrs: nounwind readnone |
| 84 | declare i32 @llvm.ctlz.i32(i32, i1) #0 |
| 85 | |
Hal Finkel | 4e2c782 | 2015-01-05 18:09:06 +0000 | [diff] [blame] | 86 | |
Hal Finkel | 4c6658f | 2014-12-12 23:59:36 +0000 | [diff] [blame] | 87 | attributes #0 = { nounwind readnone } |
Hal Finkel | 49557f1 | 2015-01-05 18:52:29 +0000 | [diff] [blame] | 88 | attributes #1 = { nounwind readonly } |
Hal Finkel | 4c6658f | 2014-12-12 23:59:36 +0000 | [diff] [blame] | 89 | |