8bf4b4fe58a7147ee8e660dde8403f53958cace1
[oota-llvm.git] / lib / Target / SystemZ / SystemZInstrInfo.td
1 //===- SystemZInstrInfo.td - SystemZ Instruction defs ---------*- tblgen-*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source 
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file describes the SystemZ instructions in TableGen format.
11 //
12 //===----------------------------------------------------------------------===//
13
14 include "SystemZInstrFormats.td"
15
16 //===----------------------------------------------------------------------===//
17 // SystemZ Specific Node Definitions.
18 //===----------------------------------------------------------------------===//
19 def SystemZretflag : SDNode<"SystemZISD::RET_FLAG", SDTNone,
20                      [SDNPHasChain, SDNPOptInFlag]>;
21
22 let neverHasSideEffects = 1 in
23 def NOP : Pseudo<(outs), (ins), "# no-op", []>;
24
25 //===----------------------------------------------------------------------===//
26 // Instruction Pattern Stuff.
27 //===----------------------------------------------------------------------===//
28 def LL16 : SDNodeXForm<imm, [{
29   // Transformation function: return low 16 bits.
30   return getI16Imm(N->getZExtValue() & 0x000000000000FFFFULL);
31 }]>;
32
33 def LH16 : SDNodeXForm<imm, [{
34   // Transformation function: return bits 16-31.
35   return getI16Imm((N->getZExtValue() & 0x00000000FFFF0000ULL) >> 16);
36 }]>;
37
38 def HL16 : SDNodeXForm<imm, [{
39   // Transformation function: return bits 32-47.
40   return getI16Imm((N->getZExtValue() & 0x0000FFFF00000000ULL) >> 32);
41 }]>;
42
43 def HH16 : SDNodeXForm<imm, [{
44   // Transformation function: return bits 48-63.
45   return getI16Imm((N->getZExtValue() & 0xFFFF000000000000ULL) >> 48);
46 }]>;
47
48 def LO32 : SDNodeXForm<imm, [{
49   // Transformation function: return low 32 bits.
50   return getI32Imm(N->getZExtValue() & 0x00000000FFFFFFFFULL);
51 }]>;
52
53 def HI32 : SDNodeXForm<imm, [{
54   // Transformation function: return bits 32-63.
55   return getI32Imm(N->getZExtValue() >> 32);
56 }]>;
57
58 def i64ll16 : PatLeaf<(imm), [{  
59   // i64ll16 predicate - true if the 64-bit immediate has only rightmost 16
60   // bits set.
61   return ((N->getZExtValue() & 0x000000000000FFFFULL) == N->getZExtValue());
62 }], LL16>;
63
64 def i64lh16 : PatLeaf<(imm), [{  
65   // i64lh16 predicate - true if the 64-bit immediate has only bits 16-31 set.
66   return ((N->getZExtValue() & 0x00000000FFFF0000ULL) == N->getZExtValue());
67 }], LH16>;
68
69 def i64hl16 : PatLeaf<(i64 imm), [{  
70   // i64hl16 predicate - true if the 64-bit immediate has only bits 32-47 set.
71   return ((N->getZExtValue() & 0x0000FFFF00000000ULL) == N->getZExtValue());
72 }], HL16>;
73
74 def i64hh16 : PatLeaf<(i64 imm), [{  
75   // i64hh16 predicate - true if the 64-bit immediate has only bits 48-63 set.
76   return ((N->getZExtValue() & 0xFFFF000000000000ULL) == N->getZExtValue());
77 }], HH16>;
78
79 def immSExt16 : PatLeaf<(imm), [{
80   // immSExt16 predicate - true if the immediate fits in a 16-bit sign extended
81   // field.
82   if (N->getValueType(0) == MVT::i64) {
83     uint64_t val = N->getZExtValue();
84     return ((int64_t)val == (int16_t)val);
85   } else if (N->getValueType(0) == MVT::i32) {
86     uint32_t val = N->getZExtValue();
87     return ((int32_t)val == (int16_t)val);
88   }
89
90   return false;
91 }]>;
92
93 def immSExt32 : PatLeaf<(i64 imm), [{
94   // immSExt32 predicate - true if the immediate fits in a 32-bit sign extended
95   // field.
96   uint64_t val = N->getZExtValue();
97   return ((int64_t)val == (int32_t)val);
98 }]>;
99
100 def i64lo32 : PatLeaf<(i64 imm), [{
101   // i64lo32 predicate - true if the 64-bit immediate has only rightmost 32
102   // bits set.
103   return ((N->getZExtValue() & 0x00000000FFFFFFFFULL) == N->getZExtValue());
104 }], LO32>;
105
106 def i64hi32 : PatLeaf<(i64 imm), [{
107   // i64hi32 predicate - true if the 64-bit immediate has only bits 32-63 set.
108   return ((N->getZExtValue() & 0xFFFFFFFF00000000ULL) == N->getZExtValue());
109 }], HI32>;
110
111 // extloads
112 def extloadi64i8   : PatFrag<(ops node:$ptr), (i64 (extloadi8  node:$ptr))>;
113 def extloadi64i16  : PatFrag<(ops node:$ptr), (i64 (extloadi16 node:$ptr))>;
114 def extloadi64i32  : PatFrag<(ops node:$ptr), (i64 (extloadi32 node:$ptr))>;
115
116 def sextloadi64i8   : PatFrag<(ops node:$ptr), (i64 (sextloadi8  node:$ptr))>;
117 def sextloadi64i16  : PatFrag<(ops node:$ptr), (i64 (sextloadi16 node:$ptr))>;
118 def sextloadi64i32  : PatFrag<(ops node:$ptr), (i64 (sextloadi32 node:$ptr))>;
119
120 def zextloadi64i8   : PatFrag<(ops node:$ptr), (i64 (zextloadi8  node:$ptr))>;
121 def zextloadi64i16  : PatFrag<(ops node:$ptr), (i64 (zextloadi16 node:$ptr))>;
122 def zextloadi64i32  : PatFrag<(ops node:$ptr), (i64 (zextloadi32 node:$ptr))>;
123
124
125 //===----------------------------------------------------------------------===//
126 // SystemZ Operand Definitions.
127 //===----------------------------------------------------------------------===//
128
129 // Address operands
130
131 // riaddr := reg + imm
132 def riaddr32 : Operand<i32>,
133                ComplexPattern<i32, 2, "SelectAddrRI", []> {
134   let PrintMethod = "printRIAddrOperand";
135   let MIOperandInfo = (ops ADDR32:$base, i32imm:$disp);
136 }
137
138 def riaddr : Operand<i64>,
139              ComplexPattern<i64, 2, "SelectAddrRI", []> {
140   let PrintMethod = "printRIAddrOperand";
141   let MIOperandInfo = (ops ADDR64:$base, i32imm:$disp);
142 }
143
144 //===----------------------------------------------------------------------===//
145
146 // rriaddr := reg + reg + imm
147 def rriaddr : Operand<i64>,
148               ComplexPattern<i64, 3, "SelectAddrRRI", []> {
149   let PrintMethod = "printRRIAddrOperand";
150   let MIOperandInfo = (ops ADDR64:$base, ADDR64:$index, i32imm:$disp);
151 }
152
153 //===----------------------------------------------------------------------===//
154 //  Control Flow Instructions...
155 //
156
157 // FIXME: Provide proper encoding!
158 let isReturn = 1, isTerminator = 1 in {
159   def RET : Pseudo<(outs), (ins), "br\t%r14", [(SystemZretflag)]>;
160 }
161
162 //===----------------------------------------------------------------------===//
163 // Move Instructions
164
165 // FIXME: Provide proper encoding!
166 let neverHasSideEffects = 1 in {
167 def MOV32rr : Pseudo<(outs GR32:$dst), (ins GR32:$src),
168                      "lr\t{$dst, $src}",
169                      []>;
170 def MOV64rr : Pseudo<(outs GR64:$dst), (ins GR64:$src),
171                      "lgr\t{$dst, $src}",
172                      []>;
173 }
174
175 def MOVSX64rr32 : Pseudo<(outs GR64:$dst), (ins GR32:$src),
176                          "lgfr\t{$dst, $src}",
177                          [(set GR64:$dst, (sext GR32:$src))]>;
178 def MOVZX64rr32 : Pseudo<(outs GR64:$dst), (ins GR32:$src),
179                          "llgfr\t{$dst, $src}",
180                          [(set GR64:$dst, (zext GR32:$src))]>;
181
182 // FIXME: Provide proper encoding!
183 let isReMaterializable = 1, isAsCheapAsAMove = 1 in {
184 def MOV32ri16 : Pseudo<(outs GR32:$dst), (ins i32imm:$src),
185                        "lhi\t{$dst, $src}",
186                        [(set GR32:$dst, immSExt16:$src)]>;
187 def MOV64ri16 : Pseudo<(outs GR64:$dst), (ins i64imm:$src),
188                        "lghi\t{$dst, $src}",
189                        [(set GR64:$dst, immSExt16:$src)]>;
190
191 def MOV64rill16 : Pseudo<(outs GR64:$dst), (ins i64imm:$src),
192                          "llill\t{$dst, $src}",
193                          [(set GR64:$dst, i64ll16:$src)]>;
194 def MOV64rilh16 : Pseudo<(outs GR64:$dst), (ins i64imm:$src),
195                          "llilh\t{$dst, $src}",
196                          [(set GR64:$dst, i64lh16:$src)]>;
197 def MOV64rihl16 : Pseudo<(outs GR64:$dst), (ins i64imm:$src),
198                          "llihl\t{$dst, $src}",
199                          [(set GR64:$dst, i64hl16:$src)]>;
200 def MOV64rihh16 : Pseudo<(outs GR64:$dst), (ins i64imm:$src),
201                          "llihh\t{$dst, $src}",
202                          [(set GR64:$dst, i64hh16:$src)]>;
203 // FIXME: these 3 instructions seem to require extimm facility
204 def MOV64ri32 : Pseudo<(outs GR64:$dst), (ins i64imm:$src),
205                        "lgfi\t{$dst, $src}",
206                        [(set GR64:$dst, immSExt32:$src)]>;
207 def MOV64rilo32 : Pseudo<(outs GR64:$dst), (ins i64imm:$src),
208                          "llilf\t{$dst, $src}",
209                          [(set GR64:$dst, i64lo32:$src)]>;
210 def MOV64rihi32 : Pseudo<(outs GR64:$dst), (ins i64imm:$src),
211                          "llihf\t{$dst, $src}",
212                          [(set GR64:$dst, i64hi32:$src)]>;
213 }
214
215 let canFoldAsLoad = 1, isReMaterializable = 1, mayHaveSideEffects = 1 in {
216 def MOV64rm : Pseudo<(outs GR64:$dst), (ins rriaddr:$src),
217                      "lg\t{$dst, $src}",
218                      [(set GR64:$dst, (load rriaddr:$src))]>;
219
220 }
221
222 def MOVSX64rm8  : Pseudo<(outs GR64:$dst), (ins rriaddr:$src),
223                          "lgb\t{$dst, $src}",
224                          [(set GR64:$dst, (sextloadi64i8 rriaddr:$src))]>;
225 def MOVSX64rm16 : Pseudo<(outs GR64:$dst), (ins rriaddr:$src),
226                          "lgh\t{$dst, $src}",
227                          [(set GR64:$dst, (sextloadi64i16 rriaddr:$src))]>;
228 def MOVSX64rm32 : Pseudo<(outs GR64:$dst), (ins rriaddr:$src),
229                          "lgf\t{$dst, $src}",
230                          [(set GR64:$dst, (sextloadi64i32 rriaddr:$src))]>;
231
232 def MOVZX64rm8  : Pseudo<(outs GR64:$dst), (ins rriaddr:$src),
233                          "llgc\t{$dst, $src}",
234                          [(set GR64:$dst, (zextloadi64i8 rriaddr:$src))]>;
235 def MOVZX64rm16 : Pseudo<(outs GR64:$dst), (ins rriaddr:$src),
236                          "llgh\t{$dst, $src}",
237                          [(set GR64:$dst, (zextloadi64i16 rriaddr:$src))]>;
238 def MOVZX64rm32 : Pseudo<(outs GR64:$dst), (ins rriaddr:$src),
239                          "llgf\t{$dst, $src}",
240                          [(set GR64:$dst, (zextloadi64i32 rriaddr:$src))]>;
241
242
243 //===----------------------------------------------------------------------===//
244 // Arithmetic Instructions
245
246 let isTwoAddress = 1 in {
247
248 let Defs = [PSW] in {
249
250 let isCommutable = 1 in { // X = ADD Y, Z  == X = ADD Z, Y
251 // FIXME: Provide proper encoding!
252 def ADD32rr : Pseudo<(outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
253                      "ar\t{$dst, $src2}",
254                      [(set GR32:$dst, (add GR32:$src1, GR32:$src2)),
255                       (implicit PSW)]>;
256 def ADD64rr : Pseudo<(outs GR64:$dst), (ins GR64:$src1, GR64:$src2),
257                      "agr\t{$dst, $src2}",
258                      [(set GR64:$dst, (add GR64:$src1, GR64:$src2)),
259                       (implicit PSW)]>;
260 }
261
262 // FIXME: Provide proper encoding!
263 def ADD32ri16 : Pseudo<(outs GR32:$dst), (ins GR32:$src1, i32imm:$src2),
264                        "ahi\t{$dst, $src2}",
265                        [(set GR32:$dst, (add GR32:$src1, immSExt16:$src2)),
266                         (implicit PSW)]>;
267 def ADD32ri   : Pseudo<(outs GR32:$dst), (ins GR32:$src1, i32imm:$src2),
268                        "afi\t{$dst, $src2}",
269                        [(set GR32:$dst, (add GR32:$src1, imm:$src2)),
270                         (implicit PSW)]>;
271 def ADD64ri16 : Pseudo<(outs GR64:$dst), (ins GR64:$src1, i64imm:$src2),
272                        "aghi\t{$dst, $src2}",
273                        [(set GR64:$dst, (add GR64:$src1, immSExt16:$src2)),
274                         (implicit PSW)]>;
275 def ADD64ri32 : Pseudo<(outs GR64:$dst), (ins GR64:$src1, i64imm:$src2),
276                        "agfi\t{$dst, $src2}",
277                        [(set GR64:$dst, (add GR64:$src1, immSExt32:$src2)),
278                         (implicit PSW)]>;
279
280 let isCommutable = 1 in { // X = AND Y, Z  == X = AND Z, Y
281 // FIXME: Provide proper encoding!
282 def AND32rr : Pseudo<(outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
283                      "nr\t{$dst, $src2}",
284                      [(set GR32:$dst, (and GR32:$src1, GR32:$src2))]>;
285 def AND64rr : Pseudo<(outs GR64:$dst), (ins GR64:$src1, GR64:$src2),
286                      "ngr\t{$dst, $src2}",
287                      [(set GR64:$dst, (and GR64:$src1, GR64:$src2))]>;
288 }
289
290 // FIXME: Provide proper encoding!
291 def AND64rill16 : Pseudo<(outs GR64:$dst), (ins GR64:$src1, i64imm:$src2),
292                          "nill\t{$dst, $src2}",
293                          [(set GR64:$dst, (and GR64:$src1, i64ll16:$src2))]>;
294 def AND64rilh16 : Pseudo<(outs GR64:$dst), (ins GR64:$src1, i64imm:$src2),
295                          "nilh\t{$dst, $src2}",
296                          [(set GR64:$dst, (and GR64:$src1, i64lh16:$src2))]>;
297 def AND64rihl16 : Pseudo<(outs GR64:$dst), (ins GR64:$src1, i64imm:$src2),
298                          "nihl\t{$dst, $src2}",
299                          [(set GR64:$dst, (and GR64:$src1, i64hl16:$src2))]>;
300 def AND64rihh16 : Pseudo<(outs GR64:$dst), (ins GR64:$src1, i64imm:$src2),
301                          "nihh\t{$dst, $src2}",
302                          [(set GR64:$dst, (and GR64:$src1, i64hh16:$src2))]>;
303 // FIXME: these 2 instructions seem to require extimm facility
304 def AND64rilo32 : Pseudo<(outs GR64:$dst), (ins GR64:$src1, i64imm:$src2),
305                          "nilf\t{$dst, $src2}",
306                          [(set GR64:$dst, (and GR64:$src1, i64lo32:$src2))]>;
307 def AND64rihi32 : Pseudo<(outs GR64:$dst), (ins GR64:$src1, i64imm:$src2),
308                          "nihf\t{$dst, $src2}",
309                          [(set GR64:$dst, (and GR64:$src1, i64hi32:$src2))]>;
310
311 let isCommutable = 1 in { // X = OR Y, Z  == X = OR Z, Y
312 // FIXME: Provide proper encoding!
313 def OR32rr : Pseudo<(outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
314                     "or\t{$dst, $src2}",
315                     [(set GR32:$dst, (or GR32:$src1, GR32:$src2))]>;
316 def OR64rr : Pseudo<(outs GR64:$dst), (ins GR64:$src1, GR64:$src2),
317                     "ogr\t{$dst, $src2}",
318                     [(set GR64:$dst, (or GR64:$src1, GR64:$src2))]>;
319 }
320
321 def OR32ri16  : Pseudo<(outs GR32:$dst), (ins GR32:$src1, i16imm:$src2),
322                       "oill\t{$dst, $src2}",
323                       [(set GR32:$dst, (or GR32:$src1, i64ll16:$src2))]>;
324 def OR32ri16h : Pseudo<(outs GR32:$dst), (ins GR32:$src1, i16imm:$src2),
325                       "oilh\t{$dst, $src2}",
326                       [(set GR32:$dst, (or GR32:$src1, i64lh16:$src2))]>;
327 def OR32ri : Pseudo<(outs GR32:$dst), (ins GR32:$src1, i32imm:$src2),
328                     "oilf\t{$dst, $src2}",
329                     [(set GR32:$dst, (or GR32:$src1, imm:$src2))]>;
330
331 def OR64rill16 : Pseudo<(outs GR64:$dst), (ins GR64:$src1, i64imm:$src2),
332                         "oill\t{$dst, $src2}",
333                         [(set GR64:$dst, (or GR64:$src1, i64ll16:$src2))]>;
334 def OR64rilh16 : Pseudo<(outs GR64:$dst), (ins GR64:$src1, i64imm:$src2),
335                         "oilh\t{$dst, $src2}",
336                         [(set GR64:$dst, (or GR64:$src1, i64lh16:$src2))]>;
337 def OR64rihl16 : Pseudo<(outs GR64:$dst), (ins GR64:$src1, i64imm:$src2),
338                         "oihl\t{$dst, $src2}",
339                         [(set GR64:$dst, (or GR64:$src1, i64hl16:$src2))]>;
340 def OR64rihh16 : Pseudo<(outs GR64:$dst), (ins GR64:$src1, i64imm:$src2),
341                         "oihh\t{$dst, $src2}",
342                         [(set GR64:$dst, (or GR64:$src1, i64hh16:$src2))]>;
343 // FIXME: these 2 instructions seem to require extimm facility
344 def OR64rilo32 : Pseudo<(outs GR64:$dst), (ins GR64:$src1, i64imm:$src2),
345                         "oilf\t{$dst, $src2}",
346                         [(set GR64:$dst, (or GR64:$src1, i64lo32:$src2))]>;
347 def OR64rihi32 : Pseudo<(outs GR64:$dst), (ins GR64:$src1, i64imm:$src2),
348                         "oihf\t{$dst, $src2}",
349                         [(set GR64:$dst, (or GR64:$src1, i64hi32:$src2))]>;
350
351 // FIXME: Provide proper encoding!
352 def SUB32rr : Pseudo<(outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
353                      "sr\t{$dst, $src2}",
354                      [(set GR32:$dst, (sub GR32:$src1, GR32:$src2))]>;
355 def SUB64rr : Pseudo<(outs GR64:$dst), (ins GR64:$src1, GR64:$src2),
356                      "sgr\t{$dst, $src2}",
357                      [(set GR64:$dst, (sub GR64:$src1, GR64:$src2))]>;
358
359
360 let isCommutable = 1 in { // X = XOR Y, Z  == X = XOR Z, Y
361 // FIXME: Provide proper encoding!
362 def XOR32rr : Pseudo<(outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
363                      "xr\t{$dst, $src2}",
364                      [(set GR32:$dst, (xor GR32:$src1, GR32:$src2))]>;
365 def XOR64rr : Pseudo<(outs GR64:$dst), (ins GR64:$src1, GR64:$src2),
366                      "xgr\t{$dst, $src2}",
367                      [(set GR64:$dst, (xor GR64:$src1, GR64:$src2))]>;
368 }
369
370 def XOR32ri : Pseudo<(outs GR32:$dst), (ins GR32:$src1, i32imm:$src2),
371                      "xilf\t{$dst, $src2}",
372                      [(set GR32:$dst, (xor GR32:$src1, imm:$src2))]>;
373
374 // FIXME: these 2 instructions seem to require extimm facility
375 def XOR64rilo32 : Pseudo<(outs GR64:$dst), (ins GR64:$src1, i64imm:$src2),
376                          "xilf\t{$dst, $src2}",
377                          [(set GR64:$dst, (xor GR64:$src1, i64lo32:$src2))]>;
378 def XOR64rihi32 : Pseudo<(outs GR64:$dst), (ins GR64:$src1, i64imm:$src2),
379                          "xihf\t{$dst, $src2}",
380                          [(set GR64:$dst, (xor GR64:$src1, i64hi32:$src2))]>;
381
382 } // Defs = [PSW]
383 } // isTwoAddress = 1
384
385 //===----------------------------------------------------------------------===//
386 // Shifts
387
388 let isTwoAddress = 1 in
389 def SRL32rri : Pseudo<(outs GR32:$dst), (ins GR32:$src, riaddr32:$amt),
390                       "srl\t{$src, $amt}",
391                       [(set GR32:$dst, (srl GR32:$src, riaddr32:$amt))]>;
392 def SRL64rri : Pseudo<(outs GR64:$dst), (ins GR64:$src, riaddr:$amt),
393                       "srlg\t{$dst, $src, $amt}",
394                       [(set GR64:$dst, (srl GR64:$src, (i32 (trunc riaddr:$amt))))]>;
395 def SRLA64ri  : Pseudo<(outs GR64:$dst), (ins GR64:$src, i32imm:$amt),
396                       "srlg\t{$dst, $src, $amt}",
397                       [(set GR64:$dst, (srl GR64:$src, (i32 imm:$amt)))]>;
398
399 let isTwoAddress = 1 in
400 def SHL32rri : Pseudo<(outs GR32:$dst), (ins GR32:$src, riaddr32:$amt),
401                       "sll\t{$src, $amt}",
402                       [(set GR32:$dst, (shl GR32:$src, riaddr32:$amt))]>;
403 def SHL64rri : Pseudo<(outs GR64:$dst), (ins GR64:$src, riaddr:$amt),
404                       "sllg\t{$dst, $src, $amt}",
405                       [(set GR64:$dst, (shl GR64:$src, (i32 (trunc riaddr:$amt))))]>;
406 def SHL64ri  : Pseudo<(outs GR64:$dst), (ins GR64:$src, i32imm:$amt),
407                       "sllg\t{$dst, $src, $amt}",
408                       [(set GR64:$dst, (shl GR64:$src, (i32 imm:$amt)))]>;
409
410
411 let Defs = [PSW] in {
412 let isTwoAddress = 1 in
413 def SRA32rri : Pseudo<(outs GR32:$dst), (ins GR32:$src, riaddr32:$amt),
414                       "sra\t{$src, $amt}",
415                       [(set GR32:$dst, (sra GR32:$src, riaddr32:$amt)),
416                        (implicit PSW)]>;
417 def SRA64rri : Pseudo<(outs GR64:$dst), (ins GR64:$src, riaddr:$amt),
418                       "srag\t{$dst, $src, $amt}",
419                       [(set GR64:$dst, (sra GR64:$src, (i32 (trunc riaddr:$amt)))),
420                        (implicit PSW)]>;
421 def SRA64ri  : Pseudo<(outs GR64:$dst), (ins GR64:$src, i32imm:$amt),
422                       "srag\t{$dst, $src, $amt}",
423                       [(set GR64:$dst, (sra GR64:$src, (i32 imm:$amt))),
424                        (implicit PSW)]>;
425 } // Defs = [PSW]
426
427 //===----------------------------------------------------------------------===//
428 // Non-Instruction Patterns.
429 //===----------------------------------------------------------------------===//
430
431 // anyext
432 def : Pat<(i64 (anyext GR32:$src)),
433           (INSERT_SUBREG (i64 (IMPLICIT_DEF)), GR32:$src, subreg_32bit)>;
434
435 //===----------------------------------------------------------------------===//
436 // Peepholes.
437 //===----------------------------------------------------------------------===//
438
439 // FIXME: use add/sub tricks with 32678/-32768
440
441 // trunc patterns
442 def : Pat<(i32 (trunc GR64:$src)),
443           (EXTRACT_SUBREG GR64:$src, subreg_32bit)>;
444
445 // sext_inreg patterns
446 def : Pat<(sext_inreg GR64:$src, i32),
447           (MOVSX64rr32 (EXTRACT_SUBREG GR64:$src, subreg_32bit))>;
448
449 // extload patterns
450 def : Pat<(extloadi64i8  rriaddr:$src), (MOVZX64rm8  rriaddr:$src)>;
451 def : Pat<(extloadi64i16 rriaddr:$src), (MOVZX64rm16 rriaddr:$src)>;
452 def : Pat<(extloadi64i32 rriaddr:$src), (MOVZX64rm32 rriaddr:$src)>;