Dan Gohman | 0cb2f67 | 2009-09-11 18:36:27 +0000 | [diff] [blame] | 1 | ; RUN: llc < %s -march=cellspu > %t1.s |
Evan Cheng | 7d8baee | 2009-12-17 00:40:05 +0000 | [diff] [blame] | 2 | ; RUN: grep and %t1.s | count 234 |
Scott Michel | 7b5f7ed | 2007-12-15 00:38:50 +0000 | [diff] [blame] | 3 | ; RUN: grep andc %t1.s | count 85 |
Evan Cheng | 7d8baee | 2009-12-17 00:40:05 +0000 | [diff] [blame] | 4 | ; RUN: grep andi %t1.s | count 37 |
| 5 | ; RUN: grep andhi %t1.s | count 30 |
| 6 | ; RUN: grep andbi %t1.s | count 4 |
Scott Michel | e26d9a6 | 2008-03-05 23:00:19 +0000 | [diff] [blame] | 7 | |
Scott Michel | dbac4cf | 2008-01-11 02:53:15 +0000 | [diff] [blame] | 8 | target datalayout = "E-p:32:32:128-f64:64:128-f32:32:128-i64:32:128-i32:32:128-i16:16:128-i8:8:128-i1:8:128-a0:0:128-v128:128:128-s0:128:128" |
| 9 | target triple = "spu" |
Scott Michel | 7b5f7ed | 2007-12-15 00:38:50 +0000 | [diff] [blame] | 10 | |
| 11 | ; AND instruction generation: |
| 12 | define <4 x i32> @and_v4i32_1(<4 x i32> %arg1, <4 x i32> %arg2) { |
| 13 | %A = and <4 x i32> %arg1, %arg2 |
| 14 | ret <4 x i32> %A |
| 15 | } |
| 16 | |
| 17 | define <4 x i32> @and_v4i32_2(<4 x i32> %arg1, <4 x i32> %arg2) { |
| 18 | %A = and <4 x i32> %arg2, %arg1 |
| 19 | ret <4 x i32> %A |
| 20 | } |
| 21 | |
| 22 | define <8 x i16> @and_v8i16_1(<8 x i16> %arg1, <8 x i16> %arg2) { |
| 23 | %A = and <8 x i16> %arg1, %arg2 |
| 24 | ret <8 x i16> %A |
| 25 | } |
| 26 | |
| 27 | define <8 x i16> @and_v8i16_2(<8 x i16> %arg1, <8 x i16> %arg2) { |
| 28 | %A = and <8 x i16> %arg2, %arg1 |
| 29 | ret <8 x i16> %A |
| 30 | } |
| 31 | |
| 32 | define <16 x i8> @and_v16i8_1(<16 x i8> %arg1, <16 x i8> %arg2) { |
| 33 | %A = and <16 x i8> %arg2, %arg1 |
| 34 | ret <16 x i8> %A |
| 35 | } |
| 36 | |
| 37 | define <16 x i8> @and_v16i8_2(<16 x i8> %arg1, <16 x i8> %arg2) { |
| 38 | %A = and <16 x i8> %arg1, %arg2 |
| 39 | ret <16 x i8> %A |
| 40 | } |
| 41 | |
| 42 | define i32 @and_i32_1(i32 %arg1, i32 %arg2) { |
Scott Michel | e26d9a6 | 2008-03-05 23:00:19 +0000 | [diff] [blame] | 43 | %A = and i32 %arg2, %arg1 |
| 44 | ret i32 %A |
Scott Michel | 7b5f7ed | 2007-12-15 00:38:50 +0000 | [diff] [blame] | 45 | } |
| 46 | |
| 47 | define i32 @and_i32_2(i32 %arg1, i32 %arg2) { |
Scott Michel | e26d9a6 | 2008-03-05 23:00:19 +0000 | [diff] [blame] | 48 | %A = and i32 %arg1, %arg2 |
| 49 | ret i32 %A |
Scott Michel | 7b5f7ed | 2007-12-15 00:38:50 +0000 | [diff] [blame] | 50 | } |
| 51 | |
| 52 | define i16 @and_i16_1(i16 %arg1, i16 %arg2) { |
Scott Michel | e26d9a6 | 2008-03-05 23:00:19 +0000 | [diff] [blame] | 53 | %A = and i16 %arg2, %arg1 |
| 54 | ret i16 %A |
Scott Michel | 7b5f7ed | 2007-12-15 00:38:50 +0000 | [diff] [blame] | 55 | } |
| 56 | |
| 57 | define i16 @and_i16_2(i16 %arg1, i16 %arg2) { |
Scott Michel | e26d9a6 | 2008-03-05 23:00:19 +0000 | [diff] [blame] | 58 | %A = and i16 %arg1, %arg2 |
| 59 | ret i16 %A |
Scott Michel | 7b5f7ed | 2007-12-15 00:38:50 +0000 | [diff] [blame] | 60 | } |
| 61 | |
| 62 | define i8 @and_i8_1(i8 %arg1, i8 %arg2) { |
Scott Michel | e26d9a6 | 2008-03-05 23:00:19 +0000 | [diff] [blame] | 63 | %A = and i8 %arg2, %arg1 |
| 64 | ret i8 %A |
Scott Michel | 7b5f7ed | 2007-12-15 00:38:50 +0000 | [diff] [blame] | 65 | } |
| 66 | |
| 67 | define i8 @and_i8_2(i8 %arg1, i8 %arg2) { |
Scott Michel | e26d9a6 | 2008-03-05 23:00:19 +0000 | [diff] [blame] | 68 | %A = and i8 %arg1, %arg2 |
| 69 | ret i8 %A |
Scott Michel | 7b5f7ed | 2007-12-15 00:38:50 +0000 | [diff] [blame] | 70 | } |
| 71 | |
| 72 | ; ANDC instruction generation: |
| 73 | define <4 x i32> @andc_v4i32_1(<4 x i32> %arg1, <4 x i32> %arg2) { |
| 74 | %A = xor <4 x i32> %arg2, < i32 -1, i32 -1, i32 -1, i32 -1 > |
| 75 | %B = and <4 x i32> %arg1, %A |
| 76 | ret <4 x i32> %B |
| 77 | } |
| 78 | |
| 79 | define <4 x i32> @andc_v4i32_2(<4 x i32> %arg1, <4 x i32> %arg2) { |
| 80 | %A = xor <4 x i32> %arg1, < i32 -1, i32 -1, i32 -1, i32 -1 > |
| 81 | %B = and <4 x i32> %arg2, %A |
| 82 | ret <4 x i32> %B |
| 83 | } |
| 84 | |
| 85 | define <4 x i32> @andc_v4i32_3(<4 x i32> %arg1, <4 x i32> %arg2) { |
| 86 | %A = xor <4 x i32> %arg1, < i32 -1, i32 -1, i32 -1, i32 -1 > |
| 87 | %B = and <4 x i32> %A, %arg2 |
| 88 | ret <4 x i32> %B |
| 89 | } |
| 90 | |
| 91 | define <8 x i16> @andc_v8i16_1(<8 x i16> %arg1, <8 x i16> %arg2) { |
| 92 | %A = xor <8 x i16> %arg2, < i16 -1, i16 -1, i16 -1, i16 -1, |
| 93 | i16 -1, i16 -1, i16 -1, i16 -1 > |
| 94 | %B = and <8 x i16> %arg1, %A |
| 95 | ret <8 x i16> %B |
| 96 | } |
| 97 | |
| 98 | define <8 x i16> @andc_v8i16_2(<8 x i16> %arg1, <8 x i16> %arg2) { |
| 99 | %A = xor <8 x i16> %arg1, < i16 -1, i16 -1, i16 -1, i16 -1, |
| 100 | i16 -1, i16 -1, i16 -1, i16 -1 > |
| 101 | %B = and <8 x i16> %arg2, %A |
| 102 | ret <8 x i16> %B |
| 103 | } |
| 104 | |
| 105 | define <16 x i8> @andc_v16i8_1(<16 x i8> %arg1, <16 x i8> %arg2) { |
| 106 | %A = xor <16 x i8> %arg1, < i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, |
| 107 | i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, |
| 108 | i8 -1, i8 -1, i8 -1, i8 -1 > |
| 109 | %B = and <16 x i8> %arg2, %A |
| 110 | ret <16 x i8> %B |
| 111 | } |
| 112 | |
| 113 | define <16 x i8> @andc_v16i8_2(<16 x i8> %arg1, <16 x i8> %arg2) { |
| 114 | %A = xor <16 x i8> %arg2, < i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, |
| 115 | i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, |
| 116 | i8 -1, i8 -1, i8 -1, i8 -1 > |
| 117 | %B = and <16 x i8> %arg1, %A |
| 118 | ret <16 x i8> %B |
| 119 | } |
| 120 | |
| 121 | define <16 x i8> @andc_v16i8_3(<16 x i8> %arg1, <16 x i8> %arg2) { |
| 122 | %A = xor <16 x i8> %arg2, < i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, |
| 123 | i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, |
| 124 | i8 -1, i8 -1, i8 -1, i8 -1 > |
| 125 | %B = and <16 x i8> %A, %arg1 |
| 126 | ret <16 x i8> %B |
| 127 | } |
| 128 | |
| 129 | define i32 @andc_i32_1(i32 %arg1, i32 %arg2) { |
Scott Michel | e26d9a6 | 2008-03-05 23:00:19 +0000 | [diff] [blame] | 130 | %A = xor i32 %arg2, -1 |
| 131 | %B = and i32 %A, %arg1 |
| 132 | ret i32 %B |
Scott Michel | 7b5f7ed | 2007-12-15 00:38:50 +0000 | [diff] [blame] | 133 | } |
| 134 | |
| 135 | define i32 @andc_i32_2(i32 %arg1, i32 %arg2) { |
Scott Michel | e26d9a6 | 2008-03-05 23:00:19 +0000 | [diff] [blame] | 136 | %A = xor i32 %arg1, -1 |
| 137 | %B = and i32 %A, %arg2 |
| 138 | ret i32 %B |
Scott Michel | 7b5f7ed | 2007-12-15 00:38:50 +0000 | [diff] [blame] | 139 | } |
| 140 | |
| 141 | define i32 @andc_i32_3(i32 %arg1, i32 %arg2) { |
Scott Michel | e26d9a6 | 2008-03-05 23:00:19 +0000 | [diff] [blame] | 142 | %A = xor i32 %arg2, -1 |
| 143 | %B = and i32 %arg1, %A |
| 144 | ret i32 %B |
Scott Michel | 7b5f7ed | 2007-12-15 00:38:50 +0000 | [diff] [blame] | 145 | } |
| 146 | |
| 147 | define i16 @andc_i16_1(i16 %arg1, i16 %arg2) { |
Scott Michel | e26d9a6 | 2008-03-05 23:00:19 +0000 | [diff] [blame] | 148 | %A = xor i16 %arg2, -1 |
| 149 | %B = and i16 %A, %arg1 |
| 150 | ret i16 %B |
Scott Michel | 7b5f7ed | 2007-12-15 00:38:50 +0000 | [diff] [blame] | 151 | } |
| 152 | |
| 153 | define i16 @andc_i16_2(i16 %arg1, i16 %arg2) { |
Scott Michel | e26d9a6 | 2008-03-05 23:00:19 +0000 | [diff] [blame] | 154 | %A = xor i16 %arg1, -1 |
| 155 | %B = and i16 %A, %arg2 |
| 156 | ret i16 %B |
Scott Michel | 7b5f7ed | 2007-12-15 00:38:50 +0000 | [diff] [blame] | 157 | } |
| 158 | |
| 159 | define i16 @andc_i16_3(i16 %arg1, i16 %arg2) { |
Scott Michel | e26d9a6 | 2008-03-05 23:00:19 +0000 | [diff] [blame] | 160 | %A = xor i16 %arg2, -1 |
| 161 | %B = and i16 %arg1, %A |
| 162 | ret i16 %B |
Scott Michel | 7b5f7ed | 2007-12-15 00:38:50 +0000 | [diff] [blame] | 163 | } |
| 164 | |
| 165 | define i8 @andc_i8_1(i8 %arg1, i8 %arg2) { |
Scott Michel | e26d9a6 | 2008-03-05 23:00:19 +0000 | [diff] [blame] | 166 | %A = xor i8 %arg2, -1 |
| 167 | %B = and i8 %A, %arg1 |
| 168 | ret i8 %B |
Scott Michel | 7b5f7ed | 2007-12-15 00:38:50 +0000 | [diff] [blame] | 169 | } |
| 170 | |
| 171 | define i8 @andc_i8_2(i8 %arg1, i8 %arg2) { |
Scott Michel | e26d9a6 | 2008-03-05 23:00:19 +0000 | [diff] [blame] | 172 | %A = xor i8 %arg1, -1 |
| 173 | %B = and i8 %A, %arg2 |
| 174 | ret i8 %B |
Scott Michel | 7b5f7ed | 2007-12-15 00:38:50 +0000 | [diff] [blame] | 175 | } |
| 176 | |
| 177 | define i8 @andc_i8_3(i8 %arg1, i8 %arg2) { |
Scott Michel | e26d9a6 | 2008-03-05 23:00:19 +0000 | [diff] [blame] | 178 | %A = xor i8 %arg2, -1 |
| 179 | %B = and i8 %arg1, %A |
| 180 | ret i8 %B |
Scott Michel | 7b5f7ed | 2007-12-15 00:38:50 +0000 | [diff] [blame] | 181 | } |
| 182 | |
| 183 | ; ANDI instruction generation (i32 data type): |
| 184 | define <4 x i32> @andi_v4i32_1(<4 x i32> %in) { |
| 185 | %tmp2 = and <4 x i32> %in, < i32 511, i32 511, i32 511, i32 511 > |
| 186 | ret <4 x i32> %tmp2 |
| 187 | } |
| 188 | |
| 189 | define <4 x i32> @andi_v4i32_2(<4 x i32> %in) { |
| 190 | %tmp2 = and <4 x i32> %in, < i32 510, i32 510, i32 510, i32 510 > |
| 191 | ret <4 x i32> %tmp2 |
| 192 | } |
| 193 | |
| 194 | define <4 x i32> @andi_v4i32_3(<4 x i32> %in) { |
| 195 | %tmp2 = and <4 x i32> %in, < i32 -1, i32 -1, i32 -1, i32 -1 > |
| 196 | ret <4 x i32> %tmp2 |
| 197 | } |
| 198 | |
| 199 | define <4 x i32> @andi_v4i32_4(<4 x i32> %in) { |
| 200 | %tmp2 = and <4 x i32> %in, < i32 -512, i32 -512, i32 -512, i32 -512 > |
| 201 | ret <4 x i32> %tmp2 |
| 202 | } |
| 203 | |
| 204 | define i32 @andi_u32(i32 zeroext %in) zeroext { |
| 205 | %tmp37 = and i32 %in, 37 |
| 206 | ret i32 %tmp37 |
| 207 | } |
| 208 | |
| 209 | define i32 @andi_i32(i32 signext %in) signext { |
| 210 | %tmp38 = and i32 %in, 37 |
| 211 | ret i32 %tmp38 |
| 212 | } |
| 213 | |
| 214 | define i32 @andi_i32_1(i32 %in) { |
| 215 | %tmp37 = and i32 %in, 37 |
| 216 | ret i32 %tmp37 |
| 217 | } |
| 218 | |
| 219 | ; ANDHI instruction generation (i16 data type): |
| 220 | define <8 x i16> @andhi_v8i16_1(<8 x i16> %in) { |
| 221 | %tmp2 = and <8 x i16> %in, < i16 511, i16 511, i16 511, i16 511, |
| 222 | i16 511, i16 511, i16 511, i16 511 > |
| 223 | ret <8 x i16> %tmp2 |
| 224 | } |
| 225 | |
| 226 | define <8 x i16> @andhi_v8i16_2(<8 x i16> %in) { |
| 227 | %tmp2 = and <8 x i16> %in, < i16 510, i16 510, i16 510, i16 510, |
| 228 | i16 510, i16 510, i16 510, i16 510 > |
| 229 | ret <8 x i16> %tmp2 |
| 230 | } |
| 231 | |
| 232 | define <8 x i16> @andhi_v8i16_3(<8 x i16> %in) { |
| 233 | %tmp2 = and <8 x i16> %in, < i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, |
| 234 | i16 -1, i16 -1, i16 -1 > |
| 235 | ret <8 x i16> %tmp2 |
| 236 | } |
| 237 | |
| 238 | define <8 x i16> @andhi_v8i16_4(<8 x i16> %in) { |
| 239 | %tmp2 = and <8 x i16> %in, < i16 -512, i16 -512, i16 -512, i16 -512, |
| 240 | i16 -512, i16 -512, i16 -512, i16 -512 > |
| 241 | ret <8 x i16> %tmp2 |
| 242 | } |
| 243 | |
| 244 | define i16 @andhi_u16(i16 zeroext %in) zeroext { |
| 245 | %tmp37 = and i16 %in, 37 ; <i16> [#uses=1] |
| 246 | ret i16 %tmp37 |
| 247 | } |
| 248 | |
| 249 | define i16 @andhi_i16(i16 signext %in) signext { |
| 250 | %tmp38 = and i16 %in, 37 ; <i16> [#uses=1] |
| 251 | ret i16 %tmp38 |
| 252 | } |
| 253 | |
| 254 | ; i8 data type (s/b ANDBI if 8-bit registers were supported): |
| 255 | define <16 x i8> @and_v16i8(<16 x i8> %in) { |
Scott Michel | e26d9a6 | 2008-03-05 23:00:19 +0000 | [diff] [blame] | 256 | ; ANDBI generated for vector types |
Scott Michel | 7b5f7ed | 2007-12-15 00:38:50 +0000 | [diff] [blame] | 257 | %tmp2 = and <16 x i8> %in, < i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, |
| 258 | i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, |
| 259 | i8 42, i8 42, i8 42, i8 42 > |
| 260 | ret <16 x i8> %tmp2 |
| 261 | } |
| 262 | |
| 263 | define i8 @and_u8(i8 zeroext %in) zeroext { |
Scott Michel | e26d9a6 | 2008-03-05 23:00:19 +0000 | [diff] [blame] | 264 | ; ANDBI generated: |
Scott Michel | 438be25 | 2007-12-17 22:32:34 +0000 | [diff] [blame] | 265 | %tmp37 = and i8 %in, 37 |
Scott Michel | 7b5f7ed | 2007-12-15 00:38:50 +0000 | [diff] [blame] | 266 | ret i8 %tmp37 |
| 267 | } |
| 268 | |
Scott Michel | 438be25 | 2007-12-17 22:32:34 +0000 | [diff] [blame] | 269 | define i8 @and_sext8(i8 signext %in) signext { |
Scott Michel | e26d9a6 | 2008-03-05 23:00:19 +0000 | [diff] [blame] | 270 | ; ANDBI generated |
Scott Michel | 438be25 | 2007-12-17 22:32:34 +0000 | [diff] [blame] | 271 | %tmp38 = and i8 %in, 37 |
| 272 | ret i8 %tmp38 |
| 273 | } |
| 274 | |
| 275 | define i8 @and_i8(i8 %in) { |
Scott Michel | e26d9a6 | 2008-03-05 23:00:19 +0000 | [diff] [blame] | 276 | ; ANDBI generated |
Scott Michel | 438be25 | 2007-12-17 22:32:34 +0000 | [diff] [blame] | 277 | %tmp38 = and i8 %in, 205 |
Scott Michel | 7b5f7ed | 2007-12-15 00:38:50 +0000 | [diff] [blame] | 278 | ret i8 %tmp38 |
| 279 | } |