Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 1 | //===- SPUOperands.td - Cell SPU Instruction Operands ------*- tablegen -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Chris Lattner | 4ee451d | 2007-12-29 20:36:04 +0000 | [diff] [blame] | 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // Cell SPU Instruction Operands: |
| 10 | //===----------------------------------------------------------------------===// |
| 11 | |
| 12 | def LO16 : SDNodeXForm<imm, [{ |
Dan Gohman | f5aeb1a | 2008-09-12 16:56:44 +0000 | [diff] [blame] | 13 | unsigned val = N->getZExtValue(); |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 14 | // Transformation function: get the low 16 bits. |
| 15 | return getI32Imm(val & 0xffff); |
| 16 | }]>; |
| 17 | |
| 18 | def LO16_vec : SDNodeXForm<scalar_to_vector, [{ |
Dan Gohman | 475871a | 2008-07-27 21:46:04 +0000 | [diff] [blame] | 19 | SDValue OpVal(0, 0); |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 20 | |
| 21 | // Transformation function: get the low 16 bit immediate from a build_vector |
| 22 | // node. |
| 23 | assert(N->getOpcode() == ISD::BUILD_VECTOR |
| 24 | && "LO16_vec got something other than a BUILD_VECTOR"); |
| 25 | |
| 26 | // Get first constant operand... |
Gabor Greif | 93c53e5 | 2008-08-31 15:37:04 +0000 | [diff] [blame] | 27 | for (unsigned i = 0, e = N->getNumOperands(); |
| 28 | OpVal.getNode() == 0 && i != e; ++i) { |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 29 | if (N->getOperand(i).getOpcode() == ISD::UNDEF) continue; |
Gabor Greif | ba36cb5 | 2008-08-28 21:40:38 +0000 | [diff] [blame] | 30 | if (OpVal.getNode() == 0) |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 31 | OpVal = N->getOperand(i); |
| 32 | } |
| 33 | |
Gabor Greif | ba36cb5 | 2008-08-28 21:40:38 +0000 | [diff] [blame] | 34 | assert(OpVal.getNode() != 0 && "LO16_vec did not locate a <defined> node"); |
Dan Gohman | d8ed2a7 | 2008-08-20 14:50:24 +0000 | [diff] [blame] | 35 | ConstantSDNode *CN = cast<ConstantSDNode>(OpVal); |
Dan Gohman | f5aeb1a | 2008-09-12 16:56:44 +0000 | [diff] [blame] | 36 | return getI32Imm((unsigned)CN->getZExtValue() & 0xffff); |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 37 | }]>; |
| 38 | |
| 39 | // Transform an immediate, returning the high 16 bits shifted down: |
| 40 | def HI16 : SDNodeXForm<imm, [{ |
Dan Gohman | f5aeb1a | 2008-09-12 16:56:44 +0000 | [diff] [blame] | 41 | return getI32Imm((unsigned)N->getZExtValue() >> 16); |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 42 | }]>; |
| 43 | |
| 44 | // Transformation function: shift the high 16 bit immediate from a build_vector |
| 45 | // node into the low 16 bits, and return a 16-bit constant. |
| 46 | def HI16_vec : SDNodeXForm<scalar_to_vector, [{ |
Dan Gohman | 475871a | 2008-07-27 21:46:04 +0000 | [diff] [blame] | 47 | SDValue OpVal(0, 0); |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 48 | |
| 49 | assert(N->getOpcode() == ISD::BUILD_VECTOR |
| 50 | && "HI16_vec got something other than a BUILD_VECTOR"); |
| 51 | |
| 52 | // Get first constant operand... |
Gabor Greif | 93c53e5 | 2008-08-31 15:37:04 +0000 | [diff] [blame] | 53 | for (unsigned i = 0, e = N->getNumOperands(); |
| 54 | OpVal.getNode() == 0 && i != e; ++i) { |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 55 | if (N->getOperand(i).getOpcode() == ISD::UNDEF) continue; |
Gabor Greif | ba36cb5 | 2008-08-28 21:40:38 +0000 | [diff] [blame] | 56 | if (OpVal.getNode() == 0) |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 57 | OpVal = N->getOperand(i); |
| 58 | } |
| 59 | |
Gabor Greif | ba36cb5 | 2008-08-28 21:40:38 +0000 | [diff] [blame] | 60 | assert(OpVal.getNode() != 0 && "HI16_vec did not locate a <defined> node"); |
Dan Gohman | d8ed2a7 | 2008-08-20 14:50:24 +0000 | [diff] [blame] | 61 | ConstantSDNode *CN = cast<ConstantSDNode>(OpVal); |
Dan Gohman | f5aeb1a | 2008-09-12 16:56:44 +0000 | [diff] [blame] | 62 | return getI32Imm((unsigned)CN->getZExtValue() >> 16); |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 63 | }]>; |
| 64 | |
| 65 | // simm7 predicate - True if the immediate fits in an 7-bit signed |
| 66 | // field. |
| 67 | def simm7: PatLeaf<(imm), [{ |
Dan Gohman | 7810bfe | 2008-09-26 21:54:37 +0000 | [diff] [blame] | 68 | int sextVal = int(N->getSExtValue()); |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 69 | return (sextVal >= -64 && sextVal <= 63); |
| 70 | }]>; |
| 71 | |
| 72 | // uimm7 predicate - True if the immediate fits in an 7-bit unsigned |
| 73 | // field. |
| 74 | def uimm7: PatLeaf<(imm), [{ |
Dan Gohman | f5aeb1a | 2008-09-12 16:56:44 +0000 | [diff] [blame] | 75 | return (N->getZExtValue() <= 0x7f); |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 76 | }]>; |
| 77 | |
| 78 | // immSExt8 predicate - True if the immediate fits in an 8-bit sign extended |
| 79 | // field. |
| 80 | def immSExt8 : PatLeaf<(imm), [{ |
Dan Gohman | 7810bfe | 2008-09-26 21:54:37 +0000 | [diff] [blame] | 81 | int Value = int(N->getSExtValue()); |
Scott Michel | 79698f6 | 2008-03-20 00:51:36 +0000 | [diff] [blame] | 82 | return (Value >= -(1 << 8) && Value <= (1 << 8) - 1); |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 83 | }]>; |
| 84 | |
| 85 | // immU8: immediate, unsigned 8-bit quantity |
| 86 | def immU8 : PatLeaf<(imm), [{ |
Dan Gohman | f5aeb1a | 2008-09-12 16:56:44 +0000 | [diff] [blame] | 87 | return (N->getZExtValue() <= 0xff); |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 88 | }]>; |
| 89 | |
| 90 | // i64ImmSExt10 predicate - True if the i64 immediate fits in a 10-bit sign |
| 91 | // extended field. Used by RI10Form instructions like 'ldq'. |
| 92 | def i64ImmSExt10 : PatLeaf<(imm), [{ |
| 93 | return isI64IntS10Immediate(N); |
| 94 | }]>; |
| 95 | |
| 96 | // i32ImmSExt10 predicate - True if the i32 immediate fits in a 10-bit sign |
| 97 | // extended field. Used by RI10Form instructions like 'ldq'. |
| 98 | def i32ImmSExt10 : PatLeaf<(imm), [{ |
| 99 | return isI32IntS10Immediate(N); |
| 100 | }]>; |
| 101 | |
Scott Michel | 504c369 | 2007-12-17 22:32:34 +0000 | [diff] [blame] | 102 | // i32ImmUns10 predicate - True if the i32 immediate fits in a 10-bit unsigned |
| 103 | // field. Used by RI10Form instructions like 'ldq'. |
| 104 | def i32ImmUns10 : PatLeaf<(imm), [{ |
| 105 | return isI32IntU10Immediate(N); |
| 106 | }]>; |
| 107 | |
Scott Michel | ec2a08f | 2007-12-15 00:38:50 +0000 | [diff] [blame] | 108 | // i16ImmSExt10 predicate - True if the i16 immediate fits in a 10-bit sign |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 109 | // extended field. Used by RI10Form instructions like 'ldq'. |
| 110 | def i16ImmSExt10 : PatLeaf<(imm), [{ |
| 111 | return isI16IntS10Immediate(N); |
| 112 | }]>; |
| 113 | |
Scott Michel | 504c369 | 2007-12-17 22:32:34 +0000 | [diff] [blame] | 114 | // i16ImmUns10 predicate - True if the i16 immediate fits into a 10-bit unsigned |
Scott Michel | ec2a08f | 2007-12-15 00:38:50 +0000 | [diff] [blame] | 115 | // value. Used by RI10Form instructions. |
Scott Michel | 504c369 | 2007-12-17 22:32:34 +0000 | [diff] [blame] | 116 | def i16ImmUns10 : PatLeaf<(imm), [{ |
Scott Michel | ec2a08f | 2007-12-15 00:38:50 +0000 | [diff] [blame] | 117 | return isI16IntU10Immediate(N); |
| 118 | }]>; |
| 119 | |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 120 | def immSExt16 : PatLeaf<(imm), [{ |
| 121 | // immSExt16 predicate - True if the immediate fits in a 16-bit sign extended |
| 122 | // field. |
| 123 | short Ignored; |
| 124 | return isIntS16Immediate(N, Ignored); |
| 125 | }]>; |
| 126 | |
| 127 | def immZExt16 : PatLeaf<(imm), [{ |
| 128 | // immZExt16 predicate - True if the immediate fits in a 16-bit zero extended |
| 129 | // field. |
Dan Gohman | f5aeb1a | 2008-09-12 16:56:44 +0000 | [diff] [blame] | 130 | return (uint64_t)N->getZExtValue() == (unsigned short)N->getZExtValue(); |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 131 | }], LO16>; |
| 132 | |
| 133 | def immU16 : PatLeaf<(imm), [{ |
| 134 | // immU16 predicate- True if the immediate fits into a 16-bit unsigned field. |
Dan Gohman | f5aeb1a | 2008-09-12 16:56:44 +0000 | [diff] [blame] | 135 | return (uint64_t)N->getZExtValue() == (N->getZExtValue() & 0xffff); |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 136 | }]>; |
| 137 | |
| 138 | def imm18 : PatLeaf<(imm), [{ |
| 139 | // imm18 predicate: True if the immediate fits into an 18-bit unsigned field. |
Dan Gohman | f5aeb1a | 2008-09-12 16:56:44 +0000 | [diff] [blame] | 140 | int Value = (int) N->getZExtValue(); |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 141 | return ((Value & ((1 << 19) - 1)) == Value); |
| 142 | }]>; |
| 143 | |
Scott Michel | 9de5d0d | 2008-01-11 02:53:15 +0000 | [diff] [blame] | 144 | def lo16 : PatLeaf<(imm), [{ |
Scott Michel | ad2715e | 2008-03-05 23:02:02 +0000 | [diff] [blame] | 145 | // lo16 predicate - returns true if the immediate has all zeros in the |
Scott Michel | 9de5d0d | 2008-01-11 02:53:15 +0000 | [diff] [blame] | 146 | // low order bits and is a 32-bit constant: |
Owen Anderson | 825b72b | 2009-08-11 20:47:22 +0000 | [diff] [blame^] | 147 | if (N->getValueType(0) == MVT::i32) { |
Dan Gohman | f5aeb1a | 2008-09-12 16:56:44 +0000 | [diff] [blame] | 148 | uint32_t val = N->getZExtValue(); |
Scott Michel | 9de5d0d | 2008-01-11 02:53:15 +0000 | [diff] [blame] | 149 | return ((val & 0x0000ffff) == val); |
| 150 | } |
| 151 | |
| 152 | return false; |
| 153 | }], LO16>; |
| 154 | |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 155 | def hi16 : PatLeaf<(imm), [{ |
| 156 | // hi16 predicate - returns true if the immediate has all zeros in the |
| 157 | // low order bits and is a 32-bit constant: |
Owen Anderson | 825b72b | 2009-08-11 20:47:22 +0000 | [diff] [blame^] | 158 | if (N->getValueType(0) == MVT::i32) { |
Dan Gohman | f5aeb1a | 2008-09-12 16:56:44 +0000 | [diff] [blame] | 159 | uint32_t val = uint32_t(N->getZExtValue()); |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 160 | return ((val & 0xffff0000) == val); |
Owen Anderson | 825b72b | 2009-08-11 20:47:22 +0000 | [diff] [blame^] | 161 | } else if (N->getValueType(0) == MVT::i64) { |
Dan Gohman | f5aeb1a | 2008-09-12 16:56:44 +0000 | [diff] [blame] | 162 | uint64_t val = N->getZExtValue(); |
Scott Michel | ad2715e | 2008-03-05 23:02:02 +0000 | [diff] [blame] | 163 | return ((val & 0xffff0000ULL) == val); |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 164 | } |
| 165 | |
| 166 | return false; |
| 167 | }], HI16>; |
| 168 | |
Scott Michel | a59d469 | 2008-02-23 18:41:37 +0000 | [diff] [blame] | 169 | def bitshift : PatLeaf<(imm), [{ |
| 170 | // bitshift predicate - returns true if 0 < imm <= 7 for SHLQBII |
| 171 | // (shift left quadword by bits immediate) |
Dan Gohman | f5aeb1a | 2008-09-12 16:56:44 +0000 | [diff] [blame] | 172 | int64_t Val = N->getZExtValue(); |
Scott Michel | a59d469 | 2008-02-23 18:41:37 +0000 | [diff] [blame] | 173 | return (Val > 0 && Val <= 7); |
| 174 | }]>; |
| 175 | |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 176 | //===----------------------------------------------------------------------===// |
| 177 | // Floating point operands: |
| 178 | //===----------------------------------------------------------------------===// |
| 179 | |
| 180 | // Transform a float, returning the high 16 bits shifted down, as if |
| 181 | // the float was really an unsigned integer: |
| 182 | def HI16_f32 : SDNodeXForm<fpimm, [{ |
Chris Lattner | 10d724a | 2007-12-16 20:41:33 +0000 | [diff] [blame] | 183 | float fval = N->getValueAPF().convertToFloat(); |
| 184 | return getI32Imm(FloatToBits(fval) >> 16); |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 185 | }]>; |
| 186 | |
| 187 | // Transformation function on floats: get the low 16 bits as if the float was |
| 188 | // an unsigned integer. |
| 189 | def LO16_f32 : SDNodeXForm<fpimm, [{ |
Chris Lattner | 10d724a | 2007-12-16 20:41:33 +0000 | [diff] [blame] | 190 | float fval = N->getValueAPF().convertToFloat(); |
| 191 | return getI32Imm(FloatToBits(fval) & 0xffff); |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 192 | }]>; |
| 193 | |
| 194 | def FPimm_sext16 : SDNodeXForm<fpimm, [{ |
Chris Lattner | 10d724a | 2007-12-16 20:41:33 +0000 | [diff] [blame] | 195 | float fval = N->getValueAPF().convertToFloat(); |
| 196 | return getI32Imm((int) ((FloatToBits(fval) << 16) >> 16)); |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 197 | }]>; |
| 198 | |
| 199 | def FPimm_u18 : SDNodeXForm<fpimm, [{ |
Chris Lattner | 10d724a | 2007-12-16 20:41:33 +0000 | [diff] [blame] | 200 | float fval = N->getValueAPF().convertToFloat(); |
| 201 | return getI32Imm(FloatToBits(fval) & ((1 << 19) - 1)); |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 202 | }]>; |
| 203 | |
| 204 | def fpimmSExt16 : PatLeaf<(fpimm), [{ |
| 205 | short Ignored; |
| 206 | return isFPS16Immediate(N, Ignored); |
| 207 | }], FPimm_sext16>; |
| 208 | |
| 209 | // Does the SFP constant only have upp 16 bits set? |
| 210 | def hi16_f32 : PatLeaf<(fpimm), [{ |
Owen Anderson | 825b72b | 2009-08-11 20:47:22 +0000 | [diff] [blame^] | 211 | if (N->getValueType(0) == MVT::f32) { |
Chris Lattner | 10d724a | 2007-12-16 20:41:33 +0000 | [diff] [blame] | 212 | uint32_t val = FloatToBits(N->getValueAPF().convertToFloat()); |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 213 | return ((val & 0xffff0000) == val); |
| 214 | } |
| 215 | |
| 216 | return false; |
| 217 | }], HI16_f32>; |
| 218 | |
| 219 | // Does the SFP constant fit into 18 bits? |
| 220 | def fpimm18 : PatLeaf<(fpimm), [{ |
Owen Anderson | 825b72b | 2009-08-11 20:47:22 +0000 | [diff] [blame^] | 221 | if (N->getValueType(0) == MVT::f32) { |
Chris Lattner | 10d724a | 2007-12-16 20:41:33 +0000 | [diff] [blame] | 222 | uint32_t Value = FloatToBits(N->getValueAPF().convertToFloat()); |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 223 | return ((Value & ((1 << 19) - 1)) == Value); |
| 224 | } |
| 225 | |
| 226 | return false; |
| 227 | }], FPimm_u18>; |
| 228 | |
| 229 | //===----------------------------------------------------------------------===// |
Scott Michel | ec2a08f | 2007-12-15 00:38:50 +0000 | [diff] [blame] | 230 | // 64-bit operands (TODO): |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 231 | //===----------------------------------------------------------------------===// |
| 232 | |
| 233 | //===----------------------------------------------------------------------===// |
| 234 | // build_vector operands: |
| 235 | //===----------------------------------------------------------------------===// |
| 236 | |
| 237 | // v16i8SExt8Imm_xform function: convert build_vector to 8-bit sign extended |
| 238 | // immediate constant load for v16i8 vectors. N.B.: The incoming constant has |
| 239 | // to be a 16-bit quantity with the upper and lower bytes equal (e.g., 0x2a2a). |
| 240 | def v16i8SExt8Imm_xform: SDNodeXForm<build_vector, [{ |
Owen Anderson | 825b72b | 2009-08-11 20:47:22 +0000 | [diff] [blame^] | 241 | return SPU::get_vec_i8imm(N, *CurDAG, MVT::i8); |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 242 | }]>; |
| 243 | |
| 244 | // v16i8SExt8Imm: Predicate test for 8-bit sign extended immediate constant |
| 245 | // load, works in conjunction with its transform function. N.B.: This relies the |
| 246 | // incoming constant being a 16-bit quantity, where the upper and lower bytes |
| 247 | // are EXACTLY the same (e.g., 0x2a2a) |
| 248 | def v16i8SExt8Imm: PatLeaf<(build_vector), [{ |
Owen Anderson | 825b72b | 2009-08-11 20:47:22 +0000 | [diff] [blame^] | 249 | return SPU::get_vec_i8imm(N, *CurDAG, MVT::i8).getNode() != 0; |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 250 | }], v16i8SExt8Imm_xform>; |
| 251 | |
| 252 | // v16i8U8Imm_xform function: convert build_vector to unsigned 8-bit |
| 253 | // immediate constant load for v16i8 vectors. N.B.: The incoming constant has |
| 254 | // to be a 16-bit quantity with the upper and lower bytes equal (e.g., 0x2a2a). |
| 255 | def v16i8U8Imm_xform: SDNodeXForm<build_vector, [{ |
Owen Anderson | 825b72b | 2009-08-11 20:47:22 +0000 | [diff] [blame^] | 256 | return SPU::get_vec_i8imm(N, *CurDAG, MVT::i8); |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 257 | }]>; |
| 258 | |
| 259 | // v16i8U8Imm: Predicate test for unsigned 8-bit immediate constant |
| 260 | // load, works in conjunction with its transform function. N.B.: This relies the |
| 261 | // incoming constant being a 16-bit quantity, where the upper and lower bytes |
| 262 | // are EXACTLY the same (e.g., 0x2a2a) |
| 263 | def v16i8U8Imm: PatLeaf<(build_vector), [{ |
Owen Anderson | 825b72b | 2009-08-11 20:47:22 +0000 | [diff] [blame^] | 264 | return SPU::get_vec_i8imm(N, *CurDAG, MVT::i8).getNode() != 0; |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 265 | }], v16i8U8Imm_xform>; |
| 266 | |
| 267 | // v8i16SExt8Imm_xform function: convert build_vector to 8-bit sign extended |
| 268 | // immediate constant load for v8i16 vectors. |
| 269 | def v8i16SExt8Imm_xform: SDNodeXForm<build_vector, [{ |
Owen Anderson | 825b72b | 2009-08-11 20:47:22 +0000 | [diff] [blame^] | 270 | return SPU::get_vec_i8imm(N, *CurDAG, MVT::i16); |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 271 | }]>; |
| 272 | |
| 273 | // v8i16SExt8Imm: Predicate test for 8-bit sign extended immediate constant |
| 274 | // load, works in conjunction with its transform function. |
| 275 | def v8i16SExt8Imm: PatLeaf<(build_vector), [{ |
Owen Anderson | 825b72b | 2009-08-11 20:47:22 +0000 | [diff] [blame^] | 276 | return SPU::get_vec_i8imm(N, *CurDAG, MVT::i16).getNode() != 0; |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 277 | }], v8i16SExt8Imm_xform>; |
| 278 | |
| 279 | // v8i16SExt10Imm_xform function: convert build_vector to 16-bit sign extended |
| 280 | // immediate constant load for v8i16 vectors. |
| 281 | def v8i16SExt10Imm_xform: SDNodeXForm<build_vector, [{ |
Owen Anderson | 825b72b | 2009-08-11 20:47:22 +0000 | [diff] [blame^] | 282 | return SPU::get_vec_i10imm(N, *CurDAG, MVT::i16); |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 283 | }]>; |
| 284 | |
| 285 | // v8i16SExt10Imm: Predicate test for 16-bit sign extended immediate constant |
| 286 | // load, works in conjunction with its transform function. |
| 287 | def v8i16SExt10Imm: PatLeaf<(build_vector), [{ |
Owen Anderson | 825b72b | 2009-08-11 20:47:22 +0000 | [diff] [blame^] | 288 | return SPU::get_vec_i10imm(N, *CurDAG, MVT::i16).getNode() != 0; |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 289 | }], v8i16SExt10Imm_xform>; |
| 290 | |
Scott Michel | 504c369 | 2007-12-17 22:32:34 +0000 | [diff] [blame] | 291 | // v8i16Uns10Imm_xform function: convert build_vector to 16-bit unsigned |
| 292 | // immediate constant load for v8i16 vectors. |
| 293 | def v8i16Uns10Imm_xform: SDNodeXForm<build_vector, [{ |
Owen Anderson | 825b72b | 2009-08-11 20:47:22 +0000 | [diff] [blame^] | 294 | return SPU::get_vec_i10imm(N, *CurDAG, MVT::i16); |
Scott Michel | 504c369 | 2007-12-17 22:32:34 +0000 | [diff] [blame] | 295 | }]>; |
| 296 | |
| 297 | // v8i16Uns10Imm: Predicate test for 16-bit unsigned immediate constant |
| 298 | // load, works in conjunction with its transform function. |
| 299 | def v8i16Uns10Imm: PatLeaf<(build_vector), [{ |
Owen Anderson | 825b72b | 2009-08-11 20:47:22 +0000 | [diff] [blame^] | 300 | return SPU::get_vec_i10imm(N, *CurDAG, MVT::i16).getNode() != 0; |
Scott Michel | 504c369 | 2007-12-17 22:32:34 +0000 | [diff] [blame] | 301 | }], v8i16Uns10Imm_xform>; |
| 302 | |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 303 | // v8i16SExt16Imm_xform function: convert build_vector to 16-bit sign extended |
| 304 | // immediate constant load for v8i16 vectors. |
Scott Michel | 504c369 | 2007-12-17 22:32:34 +0000 | [diff] [blame] | 305 | def v8i16Uns16Imm_xform: SDNodeXForm<build_vector, [{ |
Owen Anderson | 825b72b | 2009-08-11 20:47:22 +0000 | [diff] [blame^] | 306 | return SPU::get_vec_i16imm(N, *CurDAG, MVT::i16); |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 307 | }]>; |
| 308 | |
| 309 | // v8i16SExt16Imm: Predicate test for 16-bit sign extended immediate constant |
| 310 | // load, works in conjunction with its transform function. |
| 311 | def v8i16SExt16Imm: PatLeaf<(build_vector), [{ |
Owen Anderson | 825b72b | 2009-08-11 20:47:22 +0000 | [diff] [blame^] | 312 | return SPU::get_vec_i16imm(N, *CurDAG, MVT::i16).getNode() != 0; |
Scott Michel | 504c369 | 2007-12-17 22:32:34 +0000 | [diff] [blame] | 313 | }], v8i16Uns16Imm_xform>; |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 314 | |
| 315 | // v4i32SExt10Imm_xform function: convert build_vector to 10-bit sign extended |
| 316 | // immediate constant load for v4i32 vectors. |
| 317 | def v4i32SExt10Imm_xform: SDNodeXForm<build_vector, [{ |
Owen Anderson | 825b72b | 2009-08-11 20:47:22 +0000 | [diff] [blame^] | 318 | return SPU::get_vec_i10imm(N, *CurDAG, MVT::i32); |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 319 | }]>; |
| 320 | |
| 321 | // v4i32SExt10Imm: Predicate test for 10-bit sign extended immediate constant |
| 322 | // load, works in conjunction with its transform function. |
| 323 | def v4i32SExt10Imm: PatLeaf<(build_vector), [{ |
Owen Anderson | 825b72b | 2009-08-11 20:47:22 +0000 | [diff] [blame^] | 324 | return SPU::get_vec_i10imm(N, *CurDAG, MVT::i32).getNode() != 0; |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 325 | }], v4i32SExt10Imm_xform>; |
| 326 | |
Scott Michel | 504c369 | 2007-12-17 22:32:34 +0000 | [diff] [blame] | 327 | // v4i32Uns10Imm_xform function: convert build_vector to 10-bit unsigned |
| 328 | // immediate constant load for v4i32 vectors. |
| 329 | def v4i32Uns10Imm_xform: SDNodeXForm<build_vector, [{ |
Owen Anderson | 825b72b | 2009-08-11 20:47:22 +0000 | [diff] [blame^] | 330 | return SPU::get_vec_i10imm(N, *CurDAG, MVT::i32); |
Scott Michel | 504c369 | 2007-12-17 22:32:34 +0000 | [diff] [blame] | 331 | }]>; |
| 332 | |
| 333 | // v4i32Uns10Imm: Predicate test for 10-bit unsigned immediate constant |
| 334 | // load, works in conjunction with its transform function. |
| 335 | def v4i32Uns10Imm: PatLeaf<(build_vector), [{ |
Owen Anderson | 825b72b | 2009-08-11 20:47:22 +0000 | [diff] [blame^] | 336 | return SPU::get_vec_i10imm(N, *CurDAG, MVT::i32).getNode() != 0; |
Scott Michel | 504c369 | 2007-12-17 22:32:34 +0000 | [diff] [blame] | 337 | }], v4i32Uns10Imm_xform>; |
| 338 | |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 339 | // v4i32SExt16Imm_xform function: convert build_vector to 16-bit sign extended |
| 340 | // immediate constant load for v4i32 vectors. |
| 341 | def v4i32SExt16Imm_xform: SDNodeXForm<build_vector, [{ |
Owen Anderson | 825b72b | 2009-08-11 20:47:22 +0000 | [diff] [blame^] | 342 | return SPU::get_vec_i16imm(N, *CurDAG, MVT::i32); |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 343 | }]>; |
| 344 | |
| 345 | // v4i32SExt16Imm: Predicate test for 16-bit sign extended immediate constant |
| 346 | // load, works in conjunction with its transform function. |
| 347 | def v4i32SExt16Imm: PatLeaf<(build_vector), [{ |
Owen Anderson | 825b72b | 2009-08-11 20:47:22 +0000 | [diff] [blame^] | 348 | return SPU::get_vec_i16imm(N, *CurDAG, MVT::i32).getNode() != 0; |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 349 | }], v4i32SExt16Imm_xform>; |
| 350 | |
| 351 | // v4i32Uns18Imm_xform function: convert build_vector to 18-bit unsigned |
| 352 | // immediate constant load for v4i32 vectors. |
| 353 | def v4i32Uns18Imm_xform: SDNodeXForm<build_vector, [{ |
Owen Anderson | 825b72b | 2009-08-11 20:47:22 +0000 | [diff] [blame^] | 354 | return SPU::get_vec_u18imm(N, *CurDAG, MVT::i32); |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 355 | }]>; |
| 356 | |
| 357 | // v4i32Uns18Imm: Predicate test for 18-bit unsigned immediate constant load, |
| 358 | // works in conjunction with its transform function. |
| 359 | def v4i32Uns18Imm: PatLeaf<(build_vector), [{ |
Owen Anderson | 825b72b | 2009-08-11 20:47:22 +0000 | [diff] [blame^] | 360 | return SPU::get_vec_u18imm(N, *CurDAG, MVT::i32).getNode() != 0; |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 361 | }], v4i32Uns18Imm_xform>; |
| 362 | |
| 363 | // ILHUvec_get_imm xform function: convert build_vector to ILHUvec imm constant |
| 364 | // load. |
| 365 | def ILHUvec_get_imm: SDNodeXForm<build_vector, [{ |
Owen Anderson | 825b72b | 2009-08-11 20:47:22 +0000 | [diff] [blame^] | 366 | return SPU::get_ILHUvec_imm(N, *CurDAG, MVT::i32); |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 367 | }]>; |
| 368 | |
| 369 | /// immILHUvec: Predicate test for a ILHU constant vector. |
| 370 | def immILHUvec: PatLeaf<(build_vector), [{ |
Owen Anderson | 825b72b | 2009-08-11 20:47:22 +0000 | [diff] [blame^] | 371 | return SPU::get_ILHUvec_imm(N, *CurDAG, MVT::i32).getNode() != 0; |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 372 | }], ILHUvec_get_imm>; |
| 373 | |
| 374 | // Catch-all for any other i32 vector constants |
| 375 | def v4i32_get_imm: SDNodeXForm<build_vector, [{ |
| 376 | return SPU::get_v4i32_imm(N, *CurDAG); |
| 377 | }]>; |
| 378 | |
| 379 | def v4i32Imm: PatLeaf<(build_vector), [{ |
Gabor Greif | ba36cb5 | 2008-08-28 21:40:38 +0000 | [diff] [blame] | 380 | return SPU::get_v4i32_imm(N, *CurDAG).getNode() != 0; |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 381 | }], v4i32_get_imm>; |
| 382 | |
| 383 | // v2i64SExt10Imm_xform function: convert build_vector to 10-bit sign extended |
| 384 | // immediate constant load for v2i64 vectors. |
| 385 | def v2i64SExt10Imm_xform: SDNodeXForm<build_vector, [{ |
Owen Anderson | 825b72b | 2009-08-11 20:47:22 +0000 | [diff] [blame^] | 386 | return SPU::get_vec_i10imm(N, *CurDAG, MVT::i64); |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 387 | }]>; |
| 388 | |
| 389 | // v2i64SExt10Imm: Predicate test for 10-bit sign extended immediate constant |
| 390 | // load, works in conjunction with its transform function. |
| 391 | def v2i64SExt10Imm: PatLeaf<(build_vector), [{ |
Owen Anderson | 825b72b | 2009-08-11 20:47:22 +0000 | [diff] [blame^] | 392 | return SPU::get_vec_i10imm(N, *CurDAG, MVT::i64).getNode() != 0; |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 393 | }], v2i64SExt10Imm_xform>; |
| 394 | |
| 395 | // v2i64SExt16Imm_xform function: convert build_vector to 16-bit sign extended |
| 396 | // immediate constant load for v2i64 vectors. |
| 397 | def v2i64SExt16Imm_xform: SDNodeXForm<build_vector, [{ |
Owen Anderson | 825b72b | 2009-08-11 20:47:22 +0000 | [diff] [blame^] | 398 | return SPU::get_vec_i16imm(N, *CurDAG, MVT::i64); |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 399 | }]>; |
| 400 | |
| 401 | // v2i64SExt16Imm: Predicate test for 16-bit sign extended immediate constant |
| 402 | // load, works in conjunction with its transform function. |
| 403 | def v2i64SExt16Imm: PatLeaf<(build_vector), [{ |
Owen Anderson | 825b72b | 2009-08-11 20:47:22 +0000 | [diff] [blame^] | 404 | return SPU::get_vec_i16imm(N, *CurDAG, MVT::i64).getNode() != 0; |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 405 | }], v2i64SExt16Imm_xform>; |
| 406 | |
| 407 | // v2i64Uns18Imm_xform function: convert build_vector to 18-bit unsigned |
| 408 | // immediate constant load for v2i64 vectors. |
| 409 | def v2i64Uns18Imm_xform: SDNodeXForm<build_vector, [{ |
Owen Anderson | 825b72b | 2009-08-11 20:47:22 +0000 | [diff] [blame^] | 410 | return SPU::get_vec_u18imm(N, *CurDAG, MVT::i64); |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 411 | }]>; |
| 412 | |
| 413 | // v2i64Uns18Imm: Predicate test for 18-bit unsigned immediate constant load, |
| 414 | // works in conjunction with its transform function. |
| 415 | def v2i64Uns18Imm: PatLeaf<(build_vector), [{ |
Owen Anderson | 825b72b | 2009-08-11 20:47:22 +0000 | [diff] [blame^] | 416 | return SPU::get_vec_u18imm(N, *CurDAG, MVT::i64).getNode() != 0; |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 417 | }], v2i64Uns18Imm_xform>; |
| 418 | |
| 419 | /// immILHUvec: Predicate test for a ILHU constant vector. |
| 420 | def immILHUvec_i64: PatLeaf<(build_vector), [{ |
Owen Anderson | 825b72b | 2009-08-11 20:47:22 +0000 | [diff] [blame^] | 421 | return SPU::get_ILHUvec_imm(N, *CurDAG, MVT::i64).getNode() != 0; |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 422 | }], ILHUvec_get_imm>; |
| 423 | |
| 424 | // Catch-all for any other i32 vector constants |
| 425 | def v2i64_get_imm: SDNodeXForm<build_vector, [{ |
| 426 | return SPU::get_v2i64_imm(N, *CurDAG); |
| 427 | }]>; |
| 428 | |
| 429 | def v2i64Imm: PatLeaf<(build_vector), [{ |
Gabor Greif | ba36cb5 | 2008-08-28 21:40:38 +0000 | [diff] [blame] | 430 | return SPU::get_v2i64_imm(N, *CurDAG).getNode() != 0; |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 431 | }], v2i64_get_imm>; |
| 432 | |
| 433 | //===----------------------------------------------------------------------===// |
| 434 | // Operand Definitions. |
| 435 | |
Scott Michel | 9de5d0d | 2008-01-11 02:53:15 +0000 | [diff] [blame] | 436 | def s7imm: Operand<i8> { |
| 437 | let PrintMethod = "printS7ImmOperand"; |
| 438 | } |
| 439 | |
| 440 | def s7imm_i8: Operand<i8> { |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 441 | let PrintMethod = "printS7ImmOperand"; |
| 442 | } |
| 443 | |
| 444 | def u7imm: Operand<i16> { |
| 445 | let PrintMethod = "printU7ImmOperand"; |
| 446 | } |
| 447 | |
Scott Michel | 504c369 | 2007-12-17 22:32:34 +0000 | [diff] [blame] | 448 | def u7imm_i8: Operand<i8> { |
| 449 | let PrintMethod = "printU7ImmOperand"; |
| 450 | } |
| 451 | |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 452 | def u7imm_i32: Operand<i32> { |
| 453 | let PrintMethod = "printU7ImmOperand"; |
| 454 | } |
| 455 | |
| 456 | // Halfword, signed 10-bit constant |
| 457 | def s10imm : Operand<i16> { |
| 458 | let PrintMethod = "printS10ImmOperand"; |
| 459 | } |
| 460 | |
Scott Michel | a59d469 | 2008-02-23 18:41:37 +0000 | [diff] [blame] | 461 | def s10imm_i8: Operand<i8> { |
| 462 | let PrintMethod = "printS10ImmOperand"; |
| 463 | } |
| 464 | |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 465 | def s10imm_i32: Operand<i32> { |
| 466 | let PrintMethod = "printS10ImmOperand"; |
| 467 | } |
| 468 | |
| 469 | def s10imm_i64: Operand<i64> { |
| 470 | let PrintMethod = "printS10ImmOperand"; |
| 471 | } |
| 472 | |
| 473 | // Unsigned 10-bit integers: |
| 474 | def u10imm: Operand<i16> { |
| 475 | let PrintMethod = "printU10ImmOperand"; |
| 476 | } |
| 477 | |
Scott Michel | 504c369 | 2007-12-17 22:32:34 +0000 | [diff] [blame] | 478 | def u10imm_i8: Operand<i8> { |
| 479 | let PrintMethod = "printU10ImmOperand"; |
| 480 | } |
| 481 | |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 482 | def u10imm_i32: Operand<i32> { |
| 483 | let PrintMethod = "printU10ImmOperand"; |
| 484 | } |
| 485 | |
| 486 | def s16imm : Operand<i16> { |
| 487 | let PrintMethod = "printS16ImmOperand"; |
| 488 | } |
| 489 | |
Scott Michel | 504c369 | 2007-12-17 22:32:34 +0000 | [diff] [blame] | 490 | def s16imm_i8: Operand<i8> { |
| 491 | let PrintMethod = "printS16ImmOperand"; |
| 492 | } |
| 493 | |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 494 | def s16imm_i32: Operand<i32> { |
| 495 | let PrintMethod = "printS16ImmOperand"; |
| 496 | } |
| 497 | |
| 498 | def s16imm_i64: Operand<i64> { |
| 499 | let PrintMethod = "printS16ImmOperand"; |
| 500 | } |
| 501 | |
| 502 | def s16imm_f32: Operand<f32> { |
| 503 | let PrintMethod = "printS16ImmOperand"; |
| 504 | } |
| 505 | |
| 506 | def s16imm_f64: Operand<f64> { |
| 507 | let PrintMethod = "printS16ImmOperand"; |
| 508 | } |
| 509 | |
Scott Michel | ad2715e | 2008-03-05 23:02:02 +0000 | [diff] [blame] | 510 | def u16imm_i64 : Operand<i64> { |
| 511 | let PrintMethod = "printU16ImmOperand"; |
| 512 | } |
| 513 | |
Scott Michel | 203b2d6 | 2008-04-30 00:30:08 +0000 | [diff] [blame] | 514 | def u16imm_i32 : Operand<i32> { |
| 515 | let PrintMethod = "printU16ImmOperand"; |
| 516 | } |
| 517 | |
| 518 | def u16imm : Operand<i16> { |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 519 | let PrintMethod = "printU16ImmOperand"; |
| 520 | } |
| 521 | |
| 522 | def f16imm : Operand<f32> { |
| 523 | let PrintMethod = "printU16ImmOperand"; |
| 524 | } |
| 525 | |
| 526 | def s18imm : Operand<i32> { |
| 527 | let PrintMethod = "printS18ImmOperand"; |
| 528 | } |
| 529 | |
| 530 | def u18imm : Operand<i32> { |
| 531 | let PrintMethod = "printU18ImmOperand"; |
| 532 | } |
| 533 | |
| 534 | def u18imm_i64 : Operand<i64> { |
| 535 | let PrintMethod = "printU18ImmOperand"; |
| 536 | } |
| 537 | |
| 538 | def f18imm : Operand<f32> { |
| 539 | let PrintMethod = "printU18ImmOperand"; |
| 540 | } |
| 541 | |
| 542 | def f18imm_f64 : Operand<f64> { |
| 543 | let PrintMethod = "printU18ImmOperand"; |
| 544 | } |
| 545 | |
| 546 | // Negated 7-bit halfword rotate immediate operands |
| 547 | def rothNeg7imm : Operand<i32> { |
| 548 | let PrintMethod = "printROTHNeg7Imm"; |
| 549 | } |
| 550 | |
| 551 | def rothNeg7imm_i16 : Operand<i16> { |
| 552 | let PrintMethod = "printROTHNeg7Imm"; |
| 553 | } |
| 554 | |
| 555 | // Negated 7-bit word rotate immediate operands |
| 556 | def rotNeg7imm : Operand<i32> { |
| 557 | let PrintMethod = "printROTNeg7Imm"; |
| 558 | } |
| 559 | |
| 560 | def rotNeg7imm_i16 : Operand<i16> { |
| 561 | let PrintMethod = "printROTNeg7Imm"; |
| 562 | } |
| 563 | |
Scott Michel | 8bf61e8 | 2008-06-02 22:18:03 +0000 | [diff] [blame] | 564 | def rotNeg7imm_i8 : Operand<i8> { |
| 565 | let PrintMethod = "printROTNeg7Imm"; |
| 566 | } |
| 567 | |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 568 | def target : Operand<OtherVT> { |
| 569 | let PrintMethod = "printBranchOperand"; |
| 570 | } |
| 571 | |
| 572 | // Absolute address call target |
| 573 | def calltarget : Operand<iPTR> { |
| 574 | let PrintMethod = "printCallOperand"; |
| 575 | let MIOperandInfo = (ops u18imm:$calldest); |
| 576 | } |
| 577 | |
Scott Michel | aedc637 | 2008-12-10 00:15:19 +0000 | [diff] [blame] | 578 | // PC relative call target |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 579 | def relcalltarget : Operand<iPTR> { |
| 580 | let PrintMethod = "printPCRelativeOperand"; |
| 581 | let MIOperandInfo = (ops s16imm:$calldest); |
| 582 | } |
| 583 | |
| 584 | // Branch targets: |
| 585 | def brtarget : Operand<OtherVT> { |
| 586 | let PrintMethod = "printPCRelativeOperand"; |
| 587 | } |
| 588 | |
Scott Michel | aedc637 | 2008-12-10 00:15:19 +0000 | [diff] [blame] | 589 | // Hint for branch target |
| 590 | def hbrtarget : Operand<OtherVT> { |
| 591 | let PrintMethod = "printHBROperand"; |
| 592 | } |
| 593 | |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 594 | // Indirect call target |
| 595 | def indcalltarget : Operand<iPTR> { |
| 596 | let PrintMethod = "printCallOperand"; |
| 597 | let MIOperandInfo = (ops ptr_rc:$calldest); |
| 598 | } |
| 599 | |
| 600 | def symbolHi: Operand<i32> { |
| 601 | let PrintMethod = "printSymbolHi"; |
| 602 | } |
| 603 | |
| 604 | def symbolLo: Operand<i32> { |
| 605 | let PrintMethod = "printSymbolLo"; |
| 606 | } |
| 607 | |
| 608 | def symbolLSA: Operand<i32> { |
| 609 | let PrintMethod = "printSymbolLSA"; |
| 610 | } |
| 611 | |
Scott Michel | f0569be | 2008-12-27 04:51:36 +0000 | [diff] [blame] | 612 | // Shuffle address memory operaand [s7imm(reg) d-format] |
| 613 | def shufaddr : Operand<iPTR> { |
| 614 | let PrintMethod = "printShufAddr"; |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 615 | let MIOperandInfo = (ops s7imm:$imm, ptr_rc:$reg); |
| 616 | } |
| 617 | |
| 618 | // memory s10imm(reg) operand |
Scott Michel | f0569be | 2008-12-27 04:51:36 +0000 | [diff] [blame] | 619 | def dformaddr : Operand<iPTR> { |
| 620 | let PrintMethod = "printDFormAddr"; |
Scott Michel | 564427e | 2007-12-05 01:24:05 +0000 | [diff] [blame] | 621 | let MIOperandInfo = (ops s10imm:$imm, ptr_rc:$reg); |
| 622 | } |
| 623 | |
| 624 | // 256K local store address |
| 625 | // N.B.: The tblgen code generator expects to have two operands, an offset |
| 626 | // and a pointer. Of these, only the immediate is actually used. |
| 627 | def addr256k : Operand<iPTR> { |
| 628 | let PrintMethod = "printAddr256K"; |
| 629 | let MIOperandInfo = (ops s16imm:$imm, ptr_rc:$reg); |
| 630 | } |
| 631 | |
| 632 | // memory s18imm(reg) operand |
| 633 | def memri18 : Operand<iPTR> { |
| 634 | let PrintMethod = "printMemRegImmS18"; |
| 635 | let MIOperandInfo = (ops s18imm:$imm, ptr_rc:$reg); |
| 636 | } |
| 637 | |
| 638 | // memory register + register operand |
| 639 | def memrr : Operand<iPTR> { |
| 640 | let PrintMethod = "printMemRegReg"; |
| 641 | let MIOperandInfo = (ops ptr_rc:$reg_a, ptr_rc:$reg_b); |
| 642 | } |
| 643 | |
| 644 | // Define SPU-specific addressing modes: These come in three basic |
| 645 | // flavors: |
| 646 | // |
| 647 | // D-form : [r+I10] (10-bit signed offset + reg) |
| 648 | // X-form : [r+r] (reg+reg) |
| 649 | // A-form : abs (256K LSA offset) |
| 650 | // D-form(2): [r+I7] (7-bit signed offset + reg) |
| 651 | |
| 652 | def dform_addr : ComplexPattern<iPTR, 2, "SelectDFormAddr", [], []>; |
| 653 | def xform_addr : ComplexPattern<iPTR, 2, "SelectXFormAddr", [], []>; |
| 654 | def aform_addr : ComplexPattern<iPTR, 2, "SelectAFormAddr", [], []>; |
| 655 | def dform2_addr : ComplexPattern<iPTR, 2, "SelectDForm2Addr", [], []>; |