Krzysztof Parzyszek | 33fd0bb | 2017-02-28 23:27:33 +0000 | [diff] [blame] | 1 | ; RUN: llc -march=hexagon < %s | FileCheck %s |
| 2 | |
| 3 | target triple = "hexagon" |
| 4 | |
| 5 | ; CHECK-LABEL: ua |
| 6 | ; CHECK: extractu(r0,#26,#0) |
| 7 | define i32 @ua(i32 %x) local_unnamed_addr #0 { |
| 8 | entry: |
| 9 | %shl = and i32 %x, 67108863 |
| 10 | ret i32 %shl |
| 11 | } |
| 12 | |
| 13 | ; CHECK-LABEL: ub |
| 14 | ; CHECK: extractu(r0,#16,#4) |
| 15 | define i32 @ub(i32 %x) local_unnamed_addr #0 { |
| 16 | entry: |
| 17 | %0 = lshr i32 %x, 4 |
| 18 | %shr = and i32 %0, 65535 |
| 19 | ret i32 %shr |
| 20 | } |
| 21 | |
| 22 | ; CHECK-LABEL: uc |
| 23 | ; CHECK: extractu(r0,#24,#0) |
| 24 | define i32 @uc(i32 %x) local_unnamed_addr #0 { |
| 25 | entry: |
| 26 | %shl = and i32 %x, 16777215 |
| 27 | ret i32 %shl |
| 28 | } |
| 29 | |
| 30 | ; CHECK-LABEL: ud |
| 31 | ; CHECK: extractu(r0,#16,#8) |
| 32 | define i32 @ud(i32 %x) local_unnamed_addr #0 { |
| 33 | entry: |
| 34 | %bf.lshr = lshr i32 %x, 8 |
| 35 | %bf.clear = and i32 %bf.lshr, 65535 |
| 36 | ret i32 %bf.clear |
| 37 | } |
| 38 | |
| 39 | ; CHECK-LABEL: sa |
| 40 | ; CHECK: extract(r0,#26,#0) |
| 41 | define i32 @sa(i32 %x) local_unnamed_addr #0 { |
| 42 | entry: |
| 43 | %shl = shl i32 %x, 6 |
| 44 | %shr = ashr exact i32 %shl, 6 |
| 45 | ret i32 %shr |
| 46 | } |
| 47 | |
| 48 | ; CHECK-LABEL: sb |
| 49 | ; CHECK: extract(r0,#16,#4) |
| 50 | define i32 @sb(i32 %x) local_unnamed_addr #0 { |
| 51 | entry: |
| 52 | %shl = shl i32 %x, 12 |
| 53 | %shr = ashr i32 %shl, 16 |
| 54 | ret i32 %shr |
| 55 | } |
| 56 | |
| 57 | ; CHECK-LABEL: sc |
| 58 | ; CHECK: extract(r0,#24,#0) |
| 59 | define i32 @sc(i32 %x) local_unnamed_addr #0 { |
| 60 | entry: |
| 61 | %shl = shl i32 %x, 8 |
| 62 | %shr = ashr exact i32 %shl, 8 |
| 63 | ret i32 %shr |
| 64 | } |
| 65 | |
| 66 | ; CHECK-LABEL: sd |
| 67 | ; CHECK: extract(r0,#16,#8) |
| 68 | define i32 @sd(i32 %x) local_unnamed_addr #0 { |
| 69 | entry: |
| 70 | %bf.shl = shl i32 %x, 8 |
| 71 | %bf.ashr = ashr i32 %bf.shl, 16 |
| 72 | ret i32 %bf.ashr |
| 73 | } |
| 74 | |
Sumanth Gundapaneni | e1983bc | 2017-10-18 18:07:07 +0000 | [diff] [blame] | 75 | attributes #0 = { noinline norecurse nounwind readnone "target-cpu"="hexagonv60" "target-features"="-hvx,-long-calls" } |