Dan Gohman | a080159 | 2009-09-11 18:36:27 +0000 | [diff] [blame] | 1 | ; RUN: llc < %s -march=cellspu > %t1.s |
Evan Cheng | 2e9f42b | 2009-03-25 20:20:11 +0000 | [diff] [blame] | 2 | ; RUN: grep and %t1.s | count 2 |
Scott Michel | 098c113 | 2007-12-19 20:15:47 +0000 | [diff] [blame] | 3 | ; RUN: grep orc %t1.s | count 85 |
Kalle Raiskila | f5769c1 | 2011-09-02 10:05:01 +0000 | [diff] [blame] | 4 | ; RUN: grep ori %t1.s | count 34 |
Scott Michel | 098c113 | 2007-12-19 20:15:47 +0000 | [diff] [blame] | 5 | ; RUN: grep orhi %t1.s | count 30 |
| 6 | ; RUN: grep orbi %t1.s | count 15 |
Kalle Raiskila | f5769c1 | 2011-09-02 10:05:01 +0000 | [diff] [blame] | 7 | ; RUN: FileCheck %s < %t1.s |
| 8 | |
Dan Gohman | 198b7ff | 2011-11-03 21:49:52 +0000 | [diff] [blame] | 9 | ; CellSPU legalization is over-sensitive to Legalize's traversal order. |
| 10 | ; XFAIL: * |
| 11 | |
Scott Michel | 8d5841a | 2008-01-11 02:53:15 +0000 | [diff] [blame] | 12 | 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" |
| 13 | target triple = "spu" |
Scott Michel | 098c113 | 2007-12-19 20:15:47 +0000 | [diff] [blame] | 14 | |
| 15 | ; OR instruction generation: |
| 16 | define <4 x i32> @or_v4i32_1(<4 x i32> %arg1, <4 x i32> %arg2) { |
| 17 | %A = or <4 x i32> %arg1, %arg2 |
| 18 | ret <4 x i32> %A |
| 19 | } |
| 20 | |
| 21 | define <4 x i32> @or_v4i32_2(<4 x i32> %arg1, <4 x i32> %arg2) { |
| 22 | %A = or <4 x i32> %arg2, %arg1 |
| 23 | ret <4 x i32> %A |
| 24 | } |
| 25 | |
| 26 | define <8 x i16> @or_v8i16_1(<8 x i16> %arg1, <8 x i16> %arg2) { |
| 27 | %A = or <8 x i16> %arg1, %arg2 |
| 28 | ret <8 x i16> %A |
| 29 | } |
| 30 | |
| 31 | define <8 x i16> @or_v8i16_2(<8 x i16> %arg1, <8 x i16> %arg2) { |
| 32 | %A = or <8 x i16> %arg2, %arg1 |
| 33 | ret <8 x i16> %A |
| 34 | } |
| 35 | |
| 36 | define <16 x i8> @or_v16i8_1(<16 x i8> %arg1, <16 x i8> %arg2) { |
| 37 | %A = or <16 x i8> %arg2, %arg1 |
| 38 | ret <16 x i8> %A |
| 39 | } |
| 40 | |
| 41 | define <16 x i8> @or_v16i8_2(<16 x i8> %arg1, <16 x i8> %arg2) { |
| 42 | %A = or <16 x i8> %arg1, %arg2 |
| 43 | ret <16 x i8> %A |
| 44 | } |
| 45 | |
| 46 | define i32 @or_i32_1(i32 %arg1, i32 %arg2) { |
Scott Michel | 48072bf | 2008-03-05 23:00:19 +0000 | [diff] [blame] | 47 | %A = or i32 %arg2, %arg1 |
| 48 | ret i32 %A |
Scott Michel | 098c113 | 2007-12-19 20:15:47 +0000 | [diff] [blame] | 49 | } |
| 50 | |
| 51 | define i32 @or_i32_2(i32 %arg1, i32 %arg2) { |
Scott Michel | 48072bf | 2008-03-05 23:00:19 +0000 | [diff] [blame] | 52 | %A = or i32 %arg1, %arg2 |
| 53 | ret i32 %A |
Scott Michel | 098c113 | 2007-12-19 20:15:47 +0000 | [diff] [blame] | 54 | } |
| 55 | |
| 56 | define i16 @or_i16_1(i16 %arg1, i16 %arg2) { |
Scott Michel | 48072bf | 2008-03-05 23:00:19 +0000 | [diff] [blame] | 57 | %A = or i16 %arg2, %arg1 |
| 58 | ret i16 %A |
Scott Michel | 098c113 | 2007-12-19 20:15:47 +0000 | [diff] [blame] | 59 | } |
| 60 | |
| 61 | define i16 @or_i16_2(i16 %arg1, i16 %arg2) { |
Scott Michel | 48072bf | 2008-03-05 23:00:19 +0000 | [diff] [blame] | 62 | %A = or i16 %arg1, %arg2 |
| 63 | ret i16 %A |
Scott Michel | 098c113 | 2007-12-19 20:15:47 +0000 | [diff] [blame] | 64 | } |
| 65 | |
| 66 | define i8 @or_i8_1(i8 %arg1, i8 %arg2) { |
Scott Michel | 48072bf | 2008-03-05 23:00:19 +0000 | [diff] [blame] | 67 | %A = or i8 %arg2, %arg1 |
| 68 | ret i8 %A |
Scott Michel | 098c113 | 2007-12-19 20:15:47 +0000 | [diff] [blame] | 69 | } |
| 70 | |
| 71 | define i8 @or_i8_2(i8 %arg1, i8 %arg2) { |
Scott Michel | 48072bf | 2008-03-05 23:00:19 +0000 | [diff] [blame] | 72 | %A = or i8 %arg1, %arg2 |
| 73 | ret i8 %A |
Scott Michel | 098c113 | 2007-12-19 20:15:47 +0000 | [diff] [blame] | 74 | } |
| 75 | |
| 76 | ; ORC instruction generation: |
| 77 | define <4 x i32> @orc_v4i32_1(<4 x i32> %arg1, <4 x i32> %arg2) { |
| 78 | %A = xor <4 x i32> %arg2, < i32 -1, i32 -1, i32 -1, i32 -1 > |
| 79 | %B = or <4 x i32> %arg1, %A |
| 80 | ret <4 x i32> %B |
| 81 | } |
| 82 | |
| 83 | define <4 x i32> @orc_v4i32_2(<4 x i32> %arg1, <4 x i32> %arg2) { |
| 84 | %A = xor <4 x i32> %arg1, < i32 -1, i32 -1, i32 -1, i32 -1 > |
| 85 | %B = or <4 x i32> %arg2, %A |
| 86 | ret <4 x i32> %B |
| 87 | } |
| 88 | |
| 89 | define <4 x i32> @orc_v4i32_3(<4 x i32> %arg1, <4 x i32> %arg2) { |
| 90 | %A = xor <4 x i32> %arg1, < i32 -1, i32 -1, i32 -1, i32 -1 > |
| 91 | %B = or <4 x i32> %A, %arg2 |
| 92 | ret <4 x i32> %B |
| 93 | } |
| 94 | |
| 95 | define <8 x i16> @orc_v8i16_1(<8 x i16> %arg1, <8 x i16> %arg2) { |
| 96 | %A = xor <8 x i16> %arg2, < i16 -1, i16 -1, i16 -1, i16 -1, |
| 97 | i16 -1, i16 -1, i16 -1, i16 -1 > |
| 98 | %B = or <8 x i16> %arg1, %A |
| 99 | ret <8 x i16> %B |
| 100 | } |
| 101 | |
| 102 | define <8 x i16> @orc_v8i16_2(<8 x i16> %arg1, <8 x i16> %arg2) { |
| 103 | %A = xor <8 x i16> %arg1, < i16 -1, i16 -1, i16 -1, i16 -1, |
| 104 | i16 -1, i16 -1, i16 -1, i16 -1 > |
| 105 | %B = or <8 x i16> %arg2, %A |
| 106 | ret <8 x i16> %B |
| 107 | } |
| 108 | |
| 109 | define <16 x i8> @orc_v16i8_1(<16 x i8> %arg1, <16 x i8> %arg2) { |
| 110 | %A = xor <16 x i8> %arg1, < i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, |
| 111 | i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, |
| 112 | i8 -1, i8 -1, i8 -1, i8 -1 > |
| 113 | %B = or <16 x i8> %arg2, %A |
| 114 | ret <16 x i8> %B |
| 115 | } |
| 116 | |
| 117 | define <16 x i8> @orc_v16i8_2(<16 x i8> %arg1, <16 x i8> %arg2) { |
| 118 | %A = xor <16 x i8> %arg2, < i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, |
| 119 | i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, |
| 120 | i8 -1, i8 -1, i8 -1, i8 -1 > |
| 121 | %B = or <16 x i8> %arg1, %A |
| 122 | ret <16 x i8> %B |
| 123 | } |
| 124 | |
| 125 | define <16 x i8> @orc_v16i8_3(<16 x i8> %arg1, <16 x i8> %arg2) { |
| 126 | %A = xor <16 x i8> %arg2, < i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, |
| 127 | i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, |
| 128 | i8 -1, i8 -1, i8 -1, i8 -1 > |
| 129 | %B = or <16 x i8> %A, %arg1 |
| 130 | ret <16 x i8> %B |
| 131 | } |
| 132 | |
| 133 | define i32 @orc_i32_1(i32 %arg1, i32 %arg2) { |
Scott Michel | 48072bf | 2008-03-05 23:00:19 +0000 | [diff] [blame] | 134 | %A = xor i32 %arg2, -1 |
| 135 | %B = or i32 %A, %arg1 |
| 136 | ret i32 %B |
Scott Michel | 098c113 | 2007-12-19 20:15:47 +0000 | [diff] [blame] | 137 | } |
| 138 | |
| 139 | define i32 @orc_i32_2(i32 %arg1, i32 %arg2) { |
Scott Michel | 48072bf | 2008-03-05 23:00:19 +0000 | [diff] [blame] | 140 | %A = xor i32 %arg1, -1 |
| 141 | %B = or i32 %A, %arg2 |
| 142 | ret i32 %B |
Scott Michel | 098c113 | 2007-12-19 20:15:47 +0000 | [diff] [blame] | 143 | } |
| 144 | |
| 145 | define i32 @orc_i32_3(i32 %arg1, i32 %arg2) { |
Scott Michel | 48072bf | 2008-03-05 23:00:19 +0000 | [diff] [blame] | 146 | %A = xor i32 %arg2, -1 |
| 147 | %B = or i32 %arg1, %A |
| 148 | ret i32 %B |
Scott Michel | 098c113 | 2007-12-19 20:15:47 +0000 | [diff] [blame] | 149 | } |
| 150 | |
| 151 | define i16 @orc_i16_1(i16 %arg1, i16 %arg2) { |
Scott Michel | 48072bf | 2008-03-05 23:00:19 +0000 | [diff] [blame] | 152 | %A = xor i16 %arg2, -1 |
| 153 | %B = or i16 %A, %arg1 |
| 154 | ret i16 %B |
Scott Michel | 098c113 | 2007-12-19 20:15:47 +0000 | [diff] [blame] | 155 | } |
| 156 | |
| 157 | define i16 @orc_i16_2(i16 %arg1, i16 %arg2) { |
Scott Michel | 48072bf | 2008-03-05 23:00:19 +0000 | [diff] [blame] | 158 | %A = xor i16 %arg1, -1 |
| 159 | %B = or i16 %A, %arg2 |
| 160 | ret i16 %B |
Scott Michel | 098c113 | 2007-12-19 20:15:47 +0000 | [diff] [blame] | 161 | } |
| 162 | |
| 163 | define i16 @orc_i16_3(i16 %arg1, i16 %arg2) { |
Scott Michel | 48072bf | 2008-03-05 23:00:19 +0000 | [diff] [blame] | 164 | %A = xor i16 %arg2, -1 |
| 165 | %B = or i16 %arg1, %A |
| 166 | ret i16 %B |
Scott Michel | 098c113 | 2007-12-19 20:15:47 +0000 | [diff] [blame] | 167 | } |
| 168 | |
| 169 | define i8 @orc_i8_1(i8 %arg1, i8 %arg2) { |
Scott Michel | 48072bf | 2008-03-05 23:00:19 +0000 | [diff] [blame] | 170 | %A = xor i8 %arg2, -1 |
| 171 | %B = or i8 %A, %arg1 |
| 172 | ret i8 %B |
Scott Michel | 098c113 | 2007-12-19 20:15:47 +0000 | [diff] [blame] | 173 | } |
| 174 | |
| 175 | define i8 @orc_i8_2(i8 %arg1, i8 %arg2) { |
Scott Michel | 48072bf | 2008-03-05 23:00:19 +0000 | [diff] [blame] | 176 | %A = xor i8 %arg1, -1 |
| 177 | %B = or i8 %A, %arg2 |
| 178 | ret i8 %B |
Scott Michel | 098c113 | 2007-12-19 20:15:47 +0000 | [diff] [blame] | 179 | } |
| 180 | |
| 181 | define i8 @orc_i8_3(i8 %arg1, i8 %arg2) { |
Scott Michel | 48072bf | 2008-03-05 23:00:19 +0000 | [diff] [blame] | 182 | %A = xor i8 %arg2, -1 |
| 183 | %B = or i8 %arg1, %A |
| 184 | ret i8 %B |
Scott Michel | 098c113 | 2007-12-19 20:15:47 +0000 | [diff] [blame] | 185 | } |
| 186 | |
| 187 | ; ORI instruction generation (i32 data type): |
| 188 | define <4 x i32> @ori_v4i32_1(<4 x i32> %in) { |
| 189 | %tmp2 = or <4 x i32> %in, < i32 511, i32 511, i32 511, i32 511 > |
| 190 | ret <4 x i32> %tmp2 |
| 191 | } |
| 192 | |
| 193 | define <4 x i32> @ori_v4i32_2(<4 x i32> %in) { |
| 194 | %tmp2 = or <4 x i32> %in, < i32 510, i32 510, i32 510, i32 510 > |
| 195 | ret <4 x i32> %tmp2 |
| 196 | } |
| 197 | |
| 198 | define <4 x i32> @ori_v4i32_3(<4 x i32> %in) { |
| 199 | %tmp2 = or <4 x i32> %in, < i32 -1, i32 -1, i32 -1, i32 -1 > |
| 200 | ret <4 x i32> %tmp2 |
| 201 | } |
| 202 | |
| 203 | define <4 x i32> @ori_v4i32_4(<4 x i32> %in) { |
| 204 | %tmp2 = or <4 x i32> %in, < i32 -512, i32 -512, i32 -512, i32 -512 > |
| 205 | ret <4 x i32> %tmp2 |
| 206 | } |
| 207 | |
Chris Lattner | b90ed22 | 2011-06-17 03:14:27 +0000 | [diff] [blame] | 208 | define zeroext i32 @ori_u32(i32 zeroext %in) { |
Scott Michel | 098c113 | 2007-12-19 20:15:47 +0000 | [diff] [blame] | 209 | %tmp37 = or i32 %in, 37 ; <i32> [#uses=1] |
| 210 | ret i32 %tmp37 |
| 211 | } |
| 212 | |
Chris Lattner | b90ed22 | 2011-06-17 03:14:27 +0000 | [diff] [blame] | 213 | define signext i32 @ori_i32(i32 signext %in) { |
Scott Michel | 098c113 | 2007-12-19 20:15:47 +0000 | [diff] [blame] | 214 | %tmp38 = or i32 %in, 37 ; <i32> [#uses=1] |
| 215 | ret i32 %tmp38 |
| 216 | } |
| 217 | |
Kalle Raiskila | f5769c1 | 2011-09-02 10:05:01 +0000 | [diff] [blame] | 218 | define i32 @ori_i32_600(i32 %in) { |
| 219 | ;600 does not fit into 'ori' immediate field |
| 220 | ;CHECK: ori_i32_600 |
| 221 | ;CHECK: il |
| 222 | ;CHECK: ori |
| 223 | %tmp = or i32 %in, 600 |
| 224 | ret i32 %tmp |
| 225 | } |
| 226 | |
Scott Michel | 098c113 | 2007-12-19 20:15:47 +0000 | [diff] [blame] | 227 | ; ORHI instruction generation (i16 data type): |
| 228 | define <8 x i16> @orhi_v8i16_1(<8 x i16> %in) { |
| 229 | %tmp2 = or <8 x i16> %in, < i16 511, i16 511, i16 511, i16 511, |
| 230 | i16 511, i16 511, i16 511, i16 511 > |
| 231 | ret <8 x i16> %tmp2 |
| 232 | } |
| 233 | |
| 234 | define <8 x i16> @orhi_v8i16_2(<8 x i16> %in) { |
| 235 | %tmp2 = or <8 x i16> %in, < i16 510, i16 510, i16 510, i16 510, |
| 236 | i16 510, i16 510, i16 510, i16 510 > |
| 237 | ret <8 x i16> %tmp2 |
| 238 | } |
| 239 | |
| 240 | define <8 x i16> @orhi_v8i16_3(<8 x i16> %in) { |
| 241 | %tmp2 = or <8 x i16> %in, < i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, |
| 242 | i16 -1, i16 -1, i16 -1 > |
| 243 | ret <8 x i16> %tmp2 |
| 244 | } |
| 245 | |
| 246 | define <8 x i16> @orhi_v8i16_4(<8 x i16> %in) { |
| 247 | %tmp2 = or <8 x i16> %in, < i16 -512, i16 -512, i16 -512, i16 -512, |
| 248 | i16 -512, i16 -512, i16 -512, i16 -512 > |
| 249 | ret <8 x i16> %tmp2 |
| 250 | } |
| 251 | |
Chris Lattner | b90ed22 | 2011-06-17 03:14:27 +0000 | [diff] [blame] | 252 | define zeroext i16 @orhi_u16(i16 zeroext %in) { |
Scott Michel | 098c113 | 2007-12-19 20:15:47 +0000 | [diff] [blame] | 253 | %tmp37 = or i16 %in, 37 ; <i16> [#uses=1] |
| 254 | ret i16 %tmp37 |
| 255 | } |
| 256 | |
Chris Lattner | b90ed22 | 2011-06-17 03:14:27 +0000 | [diff] [blame] | 257 | define signext i16 @orhi_i16(i16 signext %in) { |
Scott Michel | 098c113 | 2007-12-19 20:15:47 +0000 | [diff] [blame] | 258 | %tmp38 = or i16 %in, 37 ; <i16> [#uses=1] |
| 259 | ret i16 %tmp38 |
| 260 | } |
| 261 | |
| 262 | ; ORBI instruction generation (i8 data type): |
| 263 | define <16 x i8> @orbi_v16i8(<16 x i8> %in) { |
| 264 | %tmp2 = or <16 x i8> %in, < i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, |
| 265 | i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, |
| 266 | i8 42, i8 42, i8 42, i8 42 > |
| 267 | ret <16 x i8> %tmp2 |
| 268 | } |
| 269 | |
Chris Lattner | b90ed22 | 2011-06-17 03:14:27 +0000 | [diff] [blame] | 270 | define zeroext i8 @orbi_u8(i8 zeroext %in) { |
Scott Michel | 098c113 | 2007-12-19 20:15:47 +0000 | [diff] [blame] | 271 | %tmp37 = or i8 %in, 37 ; <i8> [#uses=1] |
| 272 | ret i8 %tmp37 |
| 273 | } |
| 274 | |
Chris Lattner | b90ed22 | 2011-06-17 03:14:27 +0000 | [diff] [blame] | 275 | define signext i8 @orbi_i8(i8 signext %in) { |
Scott Michel | 098c113 | 2007-12-19 20:15:47 +0000 | [diff] [blame] | 276 | %tmp38 = or i8 %in, 37 ; <i8> [#uses=1] |
| 277 | ret i8 %tmp38 |
| 278 | } |