Scott Michel | 0a92af4 | 2007-12-19 20:50:49 +0000 | [diff] [blame^] | 1 | ; RUN: llvm-as -o - %s | llc -march=cellspu > %t1.s |
| 2 | ; RUN: grep shlh %t1.s | count 84 |
| 3 | ; RUN: grep shlhi %t1.s | count 51 |
| 4 | ; RUN: grep shl %t1.s | count 168 |
| 5 | ; RUN: grep shli %t1.s | count 51 |
| 6 | ; RUN: grep xshw %t1.s | count 5 |
| 7 | ; RUN: grep and %t1.s | count 5 |
| 8 | |
| 9 | ; Vector shifts are not currently supported in gcc or llvm assembly. These are |
| 10 | ; not tested. |
| 11 | |
| 12 | ; Shift left i16 via register, note that the second operand to shl is promoted |
| 13 | ; to a 32-bit type: |
| 14 | |
| 15 | define i16 @shlh_i16_1(i16 %arg1, i16 %arg2) { |
| 16 | %A = shl i16 %arg1, %arg2 |
| 17 | ret i16 %A |
| 18 | } |
| 19 | |
| 20 | define i16 @shlh_i16_2(i16 %arg1, i16 %arg2) { |
| 21 | %A = shl i16 %arg2, %arg1 |
| 22 | ret i16 %A |
| 23 | } |
| 24 | |
| 25 | define i16 @shlh_i16_3(i16 signext %arg1, i16 signext %arg2) signext { |
| 26 | %A = shl i16 %arg1, %arg2 |
| 27 | ret i16 %A |
| 28 | } |
| 29 | |
| 30 | define i16 @shlh_i16_4(i16 signext %arg1, i16 signext %arg2) signext { |
| 31 | %A = shl i16 %arg2, %arg1 |
| 32 | ret i16 %A |
| 33 | } |
| 34 | |
| 35 | define i16 @shlh_i16_5(i16 zeroext %arg1, i16 zeroext %arg2) zeroext { |
| 36 | %A = shl i16 %arg1, %arg2 |
| 37 | ret i16 %A |
| 38 | } |
| 39 | |
| 40 | define i16 @shlh_i16_6(i16 zeroext %arg1, i16 zeroext %arg2) zeroext { |
| 41 | %A = shl i16 %arg2, %arg1 |
| 42 | ret i16 %A |
| 43 | } |
| 44 | |
| 45 | ; Shift left i16 with immediate: |
| 46 | define i16 @shlhi_i16_1(i16 %arg1) { |
| 47 | %A = shl i16 %arg1, 12 |
| 48 | ret i16 %A |
| 49 | } |
| 50 | |
| 51 | ; Should not generate anything other than the return, arg1 << 0 = arg1 |
| 52 | define i16 @shlhi_i16_2(i16 %arg1) { |
| 53 | %A = shl i16 %arg1, 0 |
| 54 | ret i16 %A |
| 55 | } |
| 56 | |
| 57 | define i16 @shlhi_i16_3(i16 %arg1) { |
| 58 | %A = shl i16 16383, %arg1 |
| 59 | ret i16 %A |
| 60 | } |
| 61 | |
| 62 | ; Should generate 0, 0 << arg1 = 0 |
| 63 | define i16 @shlhi_i16_4(i16 %arg1) { |
| 64 | %A = shl i16 0, %arg1 |
| 65 | ret i16 %A |
| 66 | } |
| 67 | |
| 68 | define i16 @shlhi_i16_5(i16 signext %arg1) signext { |
| 69 | %A = shl i16 %arg1, 12 |
| 70 | ret i16 %A |
| 71 | } |
| 72 | |
| 73 | ; Should not generate anything other than the return, arg1 << 0 = arg1 |
| 74 | define i16 @shlhi_i16_6(i16 signext %arg1) signext { |
| 75 | %A = shl i16 %arg1, 0 |
| 76 | ret i16 %A |
| 77 | } |
| 78 | |
| 79 | define i16 @shlhi_i16_7(i16 signext %arg1) signext { |
| 80 | %A = shl i16 16383, %arg1 |
| 81 | ret i16 %A |
| 82 | } |
| 83 | |
| 84 | ; Should generate 0, 0 << arg1 = 0 |
| 85 | define i16 @shlhi_i16_8(i16 signext %arg1) signext { |
| 86 | %A = shl i16 0, %arg1 |
| 87 | ret i16 %A |
| 88 | } |
| 89 | |
| 90 | define i16 @shlhi_i16_9(i16 zeroext %arg1) zeroext { |
| 91 | %A = shl i16 %arg1, 12 |
| 92 | ret i16 %A |
| 93 | } |
| 94 | |
| 95 | ; Should not generate anything other than the return, arg1 << 0 = arg1 |
| 96 | define i16 @shlhi_i16_10(i16 zeroext %arg1) zeroext { |
| 97 | %A = shl i16 %arg1, 0 |
| 98 | ret i16 %A |
| 99 | } |
| 100 | |
| 101 | define i16 @shlhi_i16_11(i16 zeroext %arg1) zeroext { |
| 102 | %A = shl i16 16383, %arg1 |
| 103 | ret i16 %A |
| 104 | } |
| 105 | |
| 106 | ; Should generate 0, 0 << arg1 = 0 |
| 107 | define i16 @shlhi_i16_12(i16 zeroext %arg1) zeroext { |
| 108 | %A = shl i16 0, %arg1 |
| 109 | ret i16 %A |
| 110 | } |
| 111 | |
| 112 | ; Shift left i32 via register, note that the second operand to shl is promoted |
| 113 | ; to a 32-bit type: |
| 114 | |
| 115 | define i32 @shl_i32_1(i32 %arg1, i32 %arg2) { |
| 116 | %A = shl i32 %arg1, %arg2 |
| 117 | ret i32 %A |
| 118 | } |
| 119 | |
| 120 | define i32 @shl_i32_2(i32 %arg1, i32 %arg2) { |
| 121 | %A = shl i32 %arg2, %arg1 |
| 122 | ret i32 %A |
| 123 | } |
| 124 | |
| 125 | define i32 @shl_i32_3(i32 signext %arg1, i32 signext %arg2) signext { |
| 126 | %A = shl i32 %arg1, %arg2 |
| 127 | ret i32 %A |
| 128 | } |
| 129 | |
| 130 | define i32 @shl_i32_4(i32 signext %arg1, i32 signext %arg2) signext { |
| 131 | %A = shl i32 %arg2, %arg1 |
| 132 | ret i32 %A |
| 133 | } |
| 134 | |
| 135 | define i32 @shl_i32_5(i32 zeroext %arg1, i32 zeroext %arg2) zeroext { |
| 136 | %A = shl i32 %arg1, %arg2 |
| 137 | ret i32 %A |
| 138 | } |
| 139 | |
| 140 | define i32 @shl_i32_6(i32 zeroext %arg1, i32 zeroext %arg2) zeroext { |
| 141 | %A = shl i32 %arg2, %arg1 |
| 142 | ret i32 %A |
| 143 | } |
| 144 | |
| 145 | ; Shift left i32 with immediate: |
| 146 | define i32 @shli_i32_1(i32 %arg1) { |
| 147 | %A = shl i32 %arg1, 12 |
| 148 | ret i32 %A |
| 149 | } |
| 150 | |
| 151 | ; Should not generate anything other than the return, arg1 << 0 = arg1 |
| 152 | define i32 @shli_i32_2(i32 %arg1) { |
| 153 | %A = shl i32 %arg1, 0 |
| 154 | ret i32 %A |
| 155 | } |
| 156 | |
| 157 | define i32 @shli_i32_3(i32 %arg1) { |
| 158 | %A = shl i32 16383, %arg1 |
| 159 | ret i32 %A |
| 160 | } |
| 161 | |
| 162 | ; Should generate 0, 0 << arg1 = 0 |
| 163 | define i32 @shli_i32_4(i32 %arg1) { |
| 164 | %A = shl i32 0, %arg1 |
| 165 | ret i32 %A |
| 166 | } |
| 167 | |
| 168 | define i32 @shli_i32_5(i32 signext %arg1) signext { |
| 169 | %A = shl i32 %arg1, 12 |
| 170 | ret i32 %A |
| 171 | } |
| 172 | |
| 173 | ; Should not generate anything other than the return, arg1 << 0 = arg1 |
| 174 | define i32 @shli_i32_6(i32 signext %arg1) signext { |
| 175 | %A = shl i32 %arg1, 0 |
| 176 | ret i32 %A |
| 177 | } |
| 178 | |
| 179 | define i32 @shli_i32_7(i32 signext %arg1) signext { |
| 180 | %A = shl i32 16383, %arg1 |
| 181 | ret i32 %A |
| 182 | } |
| 183 | |
| 184 | ; Should generate 0, 0 << arg1 = 0 |
| 185 | define i32 @shli_i32_8(i32 signext %arg1) signext { |
| 186 | %A = shl i32 0, %arg1 |
| 187 | ret i32 %A |
| 188 | } |
| 189 | |
| 190 | define i32 @shli_i32_9(i32 zeroext %arg1) zeroext { |
| 191 | %A = shl i32 %arg1, 12 |
| 192 | ret i32 %A |
| 193 | } |
| 194 | |
| 195 | ; Should not generate anything other than the return, arg1 << 0 = arg1 |
| 196 | define i32 @shli_i32_10(i32 zeroext %arg1) zeroext { |
| 197 | %A = shl i32 %arg1, 0 |
| 198 | ret i32 %A |
| 199 | } |
| 200 | |
| 201 | define i32 @shli_i32_11(i32 zeroext %arg1) zeroext { |
| 202 | %A = shl i32 16383, %arg1 |
| 203 | ret i32 %A |
| 204 | } |
| 205 | |
| 206 | ; Should generate 0, 0 << arg1 = 0 |
| 207 | define i32 @shli_i32_12(i32 zeroext %arg1) zeroext { |
| 208 | %A = shl i32 0, %arg1 |
| 209 | ret i32 %A |
| 210 | } |