Evan Cheng | da3a8a6 | 2010-04-28 01:53:13 +0000 | [diff] [blame] | 1 | ; RUN: llc < %s -march=x86 | FileCheck %s |
Dan Gohman | 74feef2 | 2008-10-17 01:23:35 +0000 | [diff] [blame] | 2 | |
| 3 | define i32 @foo(i32 %x, i32 %y, i32 %z) nounwind readnone { |
| 4 | entry: |
Evan Cheng | da3a8a6 | 2010-04-28 01:53:13 +0000 | [diff] [blame] | 5 | ; CHECK: foo: |
| 6 | ; CHECK: roll %cl |
Dan Gohman | 74feef2 | 2008-10-17 01:23:35 +0000 | [diff] [blame] | 7 | %0 = shl i32 %x, %z |
| 8 | %1 = sub i32 32, %z |
| 9 | %2 = lshr i32 %x, %1 |
| 10 | %3 = or i32 %2, %0 |
| 11 | ret i32 %3 |
| 12 | } |
| 13 | |
| 14 | define i32 @bar(i32 %x, i32 %y, i32 %z) nounwind readnone { |
| 15 | entry: |
Evan Cheng | da3a8a6 | 2010-04-28 01:53:13 +0000 | [diff] [blame] | 16 | ; CHECK: bar: |
| 17 | ; CHECK: shldl %cl |
Dan Gohman | 74feef2 | 2008-10-17 01:23:35 +0000 | [diff] [blame] | 18 | %0 = shl i32 %y, %z |
| 19 | %1 = sub i32 32, %z |
| 20 | %2 = lshr i32 %x, %1 |
| 21 | %3 = or i32 %2, %0 |
| 22 | ret i32 %3 |
| 23 | } |
| 24 | |
| 25 | define i32 @un(i32 %x, i32 %y, i32 %z) nounwind readnone { |
| 26 | entry: |
Evan Cheng | da3a8a6 | 2010-04-28 01:53:13 +0000 | [diff] [blame] | 27 | ; CHECK: un: |
| 28 | ; CHECK: rorl %cl |
Dan Gohman | 74feef2 | 2008-10-17 01:23:35 +0000 | [diff] [blame] | 29 | %0 = lshr i32 %x, %z |
| 30 | %1 = sub i32 32, %z |
| 31 | %2 = shl i32 %x, %1 |
| 32 | %3 = or i32 %2, %0 |
| 33 | ret i32 %3 |
| 34 | } |
| 35 | |
| 36 | define i32 @bu(i32 %x, i32 %y, i32 %z) nounwind readnone { |
| 37 | entry: |
Evan Cheng | da3a8a6 | 2010-04-28 01:53:13 +0000 | [diff] [blame] | 38 | ; CHECK: bu: |
| 39 | ; CHECK: shrdl %cl |
Dan Gohman | 74feef2 | 2008-10-17 01:23:35 +0000 | [diff] [blame] | 40 | %0 = lshr i32 %y, %z |
| 41 | %1 = sub i32 32, %z |
| 42 | %2 = shl i32 %x, %1 |
| 43 | %3 = or i32 %2, %0 |
| 44 | ret i32 %3 |
| 45 | } |
| 46 | |
| 47 | define i32 @xfoo(i32 %x, i32 %y, i32 %z) nounwind readnone { |
| 48 | entry: |
Evan Cheng | da3a8a6 | 2010-04-28 01:53:13 +0000 | [diff] [blame] | 49 | ; CHECK: xfoo: |
| 50 | ; CHECK: roll $7 |
Dan Gohman | 74feef2 | 2008-10-17 01:23:35 +0000 | [diff] [blame] | 51 | %0 = lshr i32 %x, 25 |
| 52 | %1 = shl i32 %x, 7 |
| 53 | %2 = or i32 %0, %1 |
| 54 | ret i32 %2 |
| 55 | } |
| 56 | |
| 57 | define i32 @xbar(i32 %x, i32 %y, i32 %z) nounwind readnone { |
| 58 | entry: |
Evan Cheng | da3a8a6 | 2010-04-28 01:53:13 +0000 | [diff] [blame] | 59 | ; CHECK: xbar: |
| 60 | ; CHECK: shldl $7 |
Dan Gohman | 74feef2 | 2008-10-17 01:23:35 +0000 | [diff] [blame] | 61 | %0 = shl i32 %y, 7 |
| 62 | %1 = lshr i32 %x, 25 |
| 63 | %2 = or i32 %0, %1 |
| 64 | ret i32 %2 |
| 65 | } |
| 66 | |
| 67 | define i32 @xun(i32 %x, i32 %y, i32 %z) nounwind readnone { |
| 68 | entry: |
Evan Cheng | da3a8a6 | 2010-04-28 01:53:13 +0000 | [diff] [blame] | 69 | ; CHECK: xun: |
| 70 | ; CHECK: roll $25 |
Dan Gohman | 74feef2 | 2008-10-17 01:23:35 +0000 | [diff] [blame] | 71 | %0 = lshr i32 %x, 7 |
| 72 | %1 = shl i32 %x, 25 |
| 73 | %2 = or i32 %0, %1 |
| 74 | ret i32 %2 |
| 75 | } |
| 76 | |
| 77 | define i32 @xbu(i32 %x, i32 %y, i32 %z) nounwind readnone { |
| 78 | entry: |
Evan Cheng | da3a8a6 | 2010-04-28 01:53:13 +0000 | [diff] [blame] | 79 | ; CHECK: xbu: |
| 80 | ; CHECK: shldl |
Dan Gohman | 74feef2 | 2008-10-17 01:23:35 +0000 | [diff] [blame] | 81 | %0 = lshr i32 %y, 7 |
| 82 | %1 = shl i32 %x, 25 |
| 83 | %2 = or i32 %0, %1 |
| 84 | ret i32 %2 |
| 85 | } |