Bruno Cardoso Lopes | 908b6dd | 2010-12-09 17:32:30 +0000 | [diff] [blame] | 1 | ; RUN: llc -march=mips -mcpu=4ke < %s | FileCheck %s |
| 2 | |
| 3 | ; CHECK: rotrv $2, $4, $2 |
| 4 | define i32 @rot0(i32 %a, i32 %b) nounwind readnone { |
| 5 | entry: |
| 6 | %shl = shl i32 %a, %b |
| 7 | %sub = sub i32 32, %b |
| 8 | %shr = lshr i32 %a, %sub |
| 9 | %or = or i32 %shr, %shl |
| 10 | ret i32 %or |
| 11 | } |
| 12 | |
| 13 | ; CHECK: rotr $2, $4, 22 |
| 14 | define i32 @rot1(i32 %a) nounwind readnone { |
| 15 | entry: |
| 16 | %shl = shl i32 %a, 10 |
| 17 | %shr = lshr i32 %a, 22 |
| 18 | %or = or i32 %shl, %shr |
| 19 | ret i32 %or |
| 20 | } |
| 21 | |
| 22 | ; CHECK: rotrv $2, $4, $5 |
| 23 | define i32 @rot2(i32 %a, i32 %b) nounwind readnone { |
| 24 | entry: |
| 25 | %shr = lshr i32 %a, %b |
| 26 | %sub = sub i32 32, %b |
| 27 | %shl = shl i32 %a, %sub |
| 28 | %or = or i32 %shl, %shr |
| 29 | ret i32 %or |
| 30 | } |
| 31 | |
| 32 | ; CHECK: rotr $2, $4, 10 |
| 33 | define i32 @rot3(i32 %a) nounwind readnone { |
| 34 | entry: |
| 35 | %shr = lshr i32 %a, 10 |
| 36 | %shl = shl i32 %a, 22 |
| 37 | %or = or i32 %shr, %shl |
| 38 | ret i32 %or |
| 39 | } |
| 40 | |