Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1 | ;test all the shifted and signextending adds and subs with and without consts |
| 2 | ; |
Dan Gohman | da594cf | 2009-09-09 00:09:15 +0000 | [diff] [blame] | 3 | ; RUN: llc < %s -march=alpha -o %t.s |
Dan Gohman | 8c89a50 | 2007-08-15 13:36:28 +0000 | [diff] [blame] | 4 | ; RUN: grep { addl} %t.s | count 2 |
| 5 | ; RUN: grep { addq} %t.s | count 2 |
| 6 | ; RUN: grep { subl} %t.s | count 2 |
Chris Lattner | 14b8583 | 2010-03-01 22:09:11 +0000 | [diff] [blame] | 7 | ; RUN: grep { subq} %t.s | count 2 |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 8 | ; |
Dan Gohman | 8c89a50 | 2007-08-15 13:36:28 +0000 | [diff] [blame] | 9 | ; RUN: grep {s4addl} %t.s | count 2 |
| 10 | ; RUN: grep {s8addl} %t.s | count 2 |
| 11 | ; RUN: grep {s4addq} %t.s | count 2 |
| 12 | ; RUN: grep {s8addq} %t.s | count 2 |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 13 | ; |
Dan Gohman | 8c89a50 | 2007-08-15 13:36:28 +0000 | [diff] [blame] | 14 | ; RUN: grep {s4subl} %t.s | count 2 |
| 15 | ; RUN: grep {s8subl} %t.s | count 2 |
| 16 | ; RUN: grep {s4subq} %t.s | count 2 |
| 17 | ; RUN: grep {s8subq} %t.s | count 2 |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 18 | |
| 19 | |
Reid Spencer | f234bed | 2007-07-19 23:13:04 +0000 | [diff] [blame] | 20 | define i32 @al(i32 signext %x.s, i32 signext %y.s) signext { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 21 | entry: |
| 22 | %tmp.3.s = add i32 %y.s, %x.s ; <i32> [#uses=1] |
| 23 | ret i32 %tmp.3.s |
| 24 | } |
| 25 | |
Reid Spencer | f234bed | 2007-07-19 23:13:04 +0000 | [diff] [blame] | 26 | define i32 @ali(i32 signext %x.s) signext { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 27 | entry: |
| 28 | %tmp.3.s = add i32 100, %x.s ; <i32> [#uses=1] |
| 29 | ret i32 %tmp.3.s |
| 30 | } |
| 31 | |
Reid Spencer | f234bed | 2007-07-19 23:13:04 +0000 | [diff] [blame] | 32 | define i64 @aq(i64 signext %x.s, i64 signext %y.s) signext { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 33 | entry: |
| 34 | %tmp.3.s = add i64 %y.s, %x.s ; <i64> [#uses=1] |
| 35 | ret i64 %tmp.3.s |
| 36 | } |
| 37 | |
| 38 | define i64 @aqi(i64 %x.s) { |
| 39 | entry: |
| 40 | %tmp.3.s = add i64 100, %x.s ; <i64> [#uses=1] |
| 41 | ret i64 %tmp.3.s |
| 42 | } |
| 43 | |
Reid Spencer | f234bed | 2007-07-19 23:13:04 +0000 | [diff] [blame] | 44 | define i32 @sl(i32 signext %x.s, i32 signext %y.s) signext { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 45 | entry: |
| 46 | %tmp.3.s = sub i32 %y.s, %x.s ; <i32> [#uses=1] |
| 47 | ret i32 %tmp.3.s |
| 48 | } |
| 49 | |
Reid Spencer | f234bed | 2007-07-19 23:13:04 +0000 | [diff] [blame] | 50 | define i32 @sli(i32 signext %x.s) signext { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 51 | entry: |
| 52 | %tmp.3.s = sub i32 %x.s, 100 ; <i32> [#uses=1] |
| 53 | ret i32 %tmp.3.s |
| 54 | } |
| 55 | |
| 56 | define i64 @sq(i64 %x.s, i64 %y.s) { |
| 57 | entry: |
| 58 | %tmp.3.s = sub i64 %y.s, %x.s ; <i64> [#uses=1] |
| 59 | ret i64 %tmp.3.s |
| 60 | } |
| 61 | |
| 62 | define i64 @sqi(i64 %x.s) { |
| 63 | entry: |
| 64 | %tmp.3.s = sub i64 %x.s, 100 ; <i64> [#uses=1] |
| 65 | ret i64 %tmp.3.s |
| 66 | } |
| 67 | |
Reid Spencer | f234bed | 2007-07-19 23:13:04 +0000 | [diff] [blame] | 68 | define i32 @a4l(i32 signext %x.s, i32 signext %y.s) signext { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 69 | entry: |
| 70 | %tmp.1.s = shl i32 %y.s, 2 ; <i32> [#uses=1] |
| 71 | %tmp.3.s = add i32 %tmp.1.s, %x.s ; <i32> [#uses=1] |
| 72 | ret i32 %tmp.3.s |
| 73 | } |
| 74 | |
Reid Spencer | f234bed | 2007-07-19 23:13:04 +0000 | [diff] [blame] | 75 | define i32 @a8l(i32 signext %x.s, i32 signext %y.s) signext { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 76 | entry: |
| 77 | %tmp.1.s = shl i32 %y.s, 3 ; <i32> [#uses=1] |
| 78 | %tmp.3.s = add i32 %tmp.1.s, %x.s ; <i32> [#uses=1] |
| 79 | ret i32 %tmp.3.s |
| 80 | } |
| 81 | |
| 82 | define i64 @a4q(i64 %x.s, i64 %y.s) { |
| 83 | entry: |
| 84 | %tmp.1.s = shl i64 %y.s, 2 ; <i64> [#uses=1] |
| 85 | %tmp.3.s = add i64 %tmp.1.s, %x.s ; <i64> [#uses=1] |
| 86 | ret i64 %tmp.3.s |
| 87 | } |
| 88 | |
| 89 | define i64 @a8q(i64 %x.s, i64 %y.s) { |
| 90 | entry: |
| 91 | %tmp.1.s = shl i64 %y.s, 3 ; <i64> [#uses=1] |
| 92 | %tmp.3.s = add i64 %tmp.1.s, %x.s ; <i64> [#uses=1] |
| 93 | ret i64 %tmp.3.s |
| 94 | } |
| 95 | |
Reid Spencer | f234bed | 2007-07-19 23:13:04 +0000 | [diff] [blame] | 96 | define i32 @a4li(i32 signext %y.s) signext { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 97 | entry: |
| 98 | %tmp.1.s = shl i32 %y.s, 2 ; <i32> [#uses=1] |
| 99 | %tmp.3.s = add i32 100, %tmp.1.s ; <i32> [#uses=1] |
| 100 | ret i32 %tmp.3.s |
| 101 | } |
| 102 | |
Reid Spencer | f234bed | 2007-07-19 23:13:04 +0000 | [diff] [blame] | 103 | define i32 @a8li(i32 signext %y.s) signext { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 104 | entry: |
| 105 | %tmp.1.s = shl i32 %y.s, 3 ; <i32> [#uses=1] |
| 106 | %tmp.3.s = add i32 100, %tmp.1.s ; <i32> [#uses=1] |
| 107 | ret i32 %tmp.3.s |
| 108 | } |
| 109 | |
| 110 | define i64 @a4qi(i64 %y.s) { |
| 111 | entry: |
| 112 | %tmp.1.s = shl i64 %y.s, 2 ; <i64> [#uses=1] |
| 113 | %tmp.3.s = add i64 100, %tmp.1.s ; <i64> [#uses=1] |
| 114 | ret i64 %tmp.3.s |
| 115 | } |
| 116 | |
| 117 | define i64 @a8qi(i64 %y.s) { |
| 118 | entry: |
| 119 | %tmp.1.s = shl i64 %y.s, 3 ; <i64> [#uses=1] |
| 120 | %tmp.3.s = add i64 100, %tmp.1.s ; <i64> [#uses=1] |
| 121 | ret i64 %tmp.3.s |
| 122 | } |
| 123 | |
Reid Spencer | f234bed | 2007-07-19 23:13:04 +0000 | [diff] [blame] | 124 | define i32 @s4l(i32 signext %x.s, i32 signext %y.s) signext { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 125 | entry: |
| 126 | %tmp.1.s = shl i32 %y.s, 2 ; <i32> [#uses=1] |
| 127 | %tmp.3.s = sub i32 %tmp.1.s, %x.s ; <i32> [#uses=1] |
| 128 | ret i32 %tmp.3.s |
| 129 | } |
| 130 | |
Reid Spencer | f234bed | 2007-07-19 23:13:04 +0000 | [diff] [blame] | 131 | define i32 @s8l(i32 signext %x.s, i32 signext %y.s) signext { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 132 | entry: |
| 133 | %tmp.1.s = shl i32 %y.s, 3 ; <i32> [#uses=1] |
| 134 | %tmp.3.s = sub i32 %tmp.1.s, %x.s ; <i32> [#uses=1] |
| 135 | ret i32 %tmp.3.s |
| 136 | } |
| 137 | |
| 138 | define i64 @s4q(i64 %x.s, i64 %y.s) { |
| 139 | entry: |
| 140 | %tmp.1.s = shl i64 %y.s, 2 ; <i64> [#uses=1] |
| 141 | %tmp.3.s = sub i64 %tmp.1.s, %x.s ; <i64> [#uses=1] |
| 142 | ret i64 %tmp.3.s |
| 143 | } |
| 144 | |
| 145 | define i64 @s8q(i64 %x.s, i64 %y.s) { |
| 146 | entry: |
| 147 | %tmp.1.s = shl i64 %y.s, 3 ; <i64> [#uses=1] |
| 148 | %tmp.3.s = sub i64 %tmp.1.s, %x.s ; <i64> [#uses=1] |
| 149 | ret i64 %tmp.3.s |
| 150 | } |
| 151 | |
Reid Spencer | f234bed | 2007-07-19 23:13:04 +0000 | [diff] [blame] | 152 | define i32 @s4li(i32 signext %y.s) signext { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 153 | entry: |
| 154 | %tmp.1.s = shl i32 %y.s, 2 ; <i32> [#uses=1] |
| 155 | %tmp.3.s = sub i32 %tmp.1.s, 100 ; <i32> [#uses=1] |
| 156 | ret i32 %tmp.3.s |
| 157 | } |
| 158 | |
Reid Spencer | f234bed | 2007-07-19 23:13:04 +0000 | [diff] [blame] | 159 | define i32 @s8li(i32 signext %y.s) signext { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 160 | entry: |
| 161 | %tmp.1.s = shl i32 %y.s, 3 ; <i32> [#uses=1] |
| 162 | %tmp.3.s = sub i32 %tmp.1.s, 100 ; <i32> [#uses=1] |
| 163 | ret i32 %tmp.3.s |
| 164 | } |
| 165 | |
| 166 | define i64 @s4qi(i64 %y.s) { |
| 167 | entry: |
| 168 | %tmp.1.s = shl i64 %y.s, 2 ; <i64> [#uses=1] |
| 169 | %tmp.3.s = sub i64 %tmp.1.s, 100 ; <i64> [#uses=1] |
| 170 | ret i64 %tmp.3.s |
| 171 | } |
| 172 | |
| 173 | define i64 @s8qi(i64 %y.s) { |
| 174 | entry: |
| 175 | %tmp.1.s = shl i64 %y.s, 3 ; <i64> [#uses=1] |
| 176 | %tmp.3.s = sub i64 %tmp.1.s, 100 ; <i64> [#uses=1] |
| 177 | ret i64 %tmp.3.s |
| 178 | } |