Ehsan Amiri | a538b0f | 2016-08-03 18:17:35 +0000 | [diff] [blame] | 1 | ; RUN: llc -verify-machineinstrs < %s -mtriple=powerpc64-unknown-linux-gnu -mcpu=a2 | FileCheck %s |
Hal Finkel | 22498fa | 2013-11-20 01:10:15 +0000 | [diff] [blame] | 2 | target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f128:128:128-v128:128:128-n32:64" |
| 3 | target triple = "powerpc64-unknown-linux-gnu" |
| 4 | |
| 5 | define i64 @foo(i64 %x) #0 { |
| 6 | entry: |
| 7 | ; CHECK-LABEL: @foo |
| 8 | %a = lshr i64 %x, 35 |
| 9 | %b = and i64 %a, 65535 |
| 10 | ; CHECK: rldicl 3, 3, 29, 48 |
| 11 | ret i64 %b |
| 12 | ; CHECK: blr |
| 13 | } |
| 14 | |
Nemanja Ivanovic | 82d53ed | 2017-02-24 18:03:16 +0000 | [diff] [blame] | 15 | ; for AND with an immediate like (x & ~0xFFFF) |
| 16 | ; we should use rldicl instruction |
| 17 | define i64 @bar(i64 %x) #0 { |
| 18 | entry: |
| 19 | ; CHECK-LABEL: @bar |
| 20 | %a = and i64 %x, 18446744073709486080 |
| 21 | ; CHECK: rldicr 3, 3, 0, 47 |
| 22 | ret i64 %a |
| 23 | ; CHECK: blr |
| 24 | } |
| 25 | |
Hal Finkel | 22498fa | 2013-11-20 01:10:15 +0000 | [diff] [blame] | 26 | attributes #0 = { nounwind } |
| 27 | |