79440990fb9d40ab8316fdc2f6fb7b1a822c51e5
[oota-llvm.git] / lib / Target / X86 / X86InstrMMX.td
1 //====- X86InstrMMX.td - Describe the X86 Instruction Set -------*- C++ -*-===//
2 // 
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file was developed by the Evan Cheng and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
7 // 
8 //===----------------------------------------------------------------------===//
9 //
10 // This file describes the X86 MMX instruction set, defining the instructions,
11 // and properties of the instructions which are needed for code generation,
12 // machine code emission, and analysis.
13 //
14 //===----------------------------------------------------------------------===//
15
16 // Instruction templates
17 // MMXi8 - MMX instructions with ImmT == Imm8 and TB prefix.
18 class MMXIi8<bits<8> o, Format F, dag ops, string asm, list<dag> pattern>
19       : X86Inst<o, F, Imm8, ops, asm>, TB, Requires<[HasMMX]> {
20   let Pattern = pattern;
21 }
22
23 // Some 'special' instructions
24 def IMPLICIT_DEF_VR64 : I<0, Pseudo, (ops VR64:$dst),
25                           "#IMPLICIT_DEF $dst",
26                           [(set VR64:$dst, (v8i8 (undef)))]>,
27                         Requires<[HasMMX]>;
28
29 def : Pat<(v4i16 (undef)), (IMPLICIT_DEF_VR64)>,  Requires<[HasMMX]>;
30 def : Pat<(v2i32 (undef)), (IMPLICIT_DEF_VR64)>,  Requires<[HasMMX]>;
31
32 // Move Instructions
33 def MOVD64rr : I<0x6E, MRMSrcReg, (ops VR64:$dst, R32:$src),
34                  "movd {$src, $dst|$dst, $src}", []>, TB,
35                Requires<[HasMMX]>;
36 def MOVD64rm : I<0x6E, MRMSrcMem, (ops VR64:$dst, i32mem:$src),
37                  "movd {$src, $dst|$dst, $src}", []>, TB,
38                Requires<[HasMMX]>;
39 def MOVD64mr : I<0x7E, MRMDestMem, (ops i32mem:$dst, VR64:$src),
40                  "movd {$src, $dst|$dst, $src}", []>, TB,
41                Requires<[HasMMX]>;
42
43 def MOVQ64rr : I<0x6F, MRMSrcReg, (ops VR64:$dst, VR64:$src),
44                  "movq {$src, $dst|$dst, $src}", []>, TB,
45                Requires<[HasMMX]>;
46 def MOVQ64rm : I<0x6F, MRMSrcMem, (ops VR64:$dst, i64mem:$src),
47                  "movq {$src, $dst|$dst, $src}", []>, TB,
48                Requires<[HasMMX]>;
49 def MOVQ64mr : I<0x7F, MRMDestMem, (ops i64mem:$dst, VR64:$src),
50                  "movq {$src, $dst|$dst, $src}", []>, TB,
51                Requires<[HasMMX]>;
52
53 // Conversion instructions
54 def CVTTPS2PIrr: I<0x2C, MRMSrcReg, (ops VR64:$dst, VR128:$src),
55                    "cvttps2pi {$src, $dst|$dst, $src}", []>, TB,
56                  Requires<[HasSSE2]>;
57 def CVTTPS2PIrm: I<0x2C, MRMSrcMem, (ops VR64:$dst, f64mem:$src),
58                    "cvttps2pi {$src, $dst|$dst, $src}", []>, TB,
59                  Requires<[HasMMX]>;
60
61 // Shuffle and unpack instructions
62 def PSHUFWri : MMXIi8<0x70, MRMSrcReg,
63                       (ops VR64:$dst, VR64:$src1, i8imm:$src2),
64                       "pshufw {$src2, $src1, $dst|$dst, $src1, $src2}", []>;
65 def PSHUFWmi : MMXIi8<0x70, MRMSrcMem,
66                       (ops VR64:$dst, i64mem:$src1, i8imm:$src2),
67                       "pshufw {$src2, $src1, $dst|$dst, $src1, $src2}", []>;
68
69 // Misc.
70 def MOVNTQ   : I<0xE7, MRMDestMem, (ops i64mem:$dst, VR64:$src),
71                  "movntq {$src, $dst|$dst, $src}", []>, TB,
72                Requires<[HasMMX]>;
73
74 def MASKMOVQ : I<0xF7, MRMDestMem, (ops VR64:$src, VR64:$mask),
75                  "maskmovq {$mask, $src|$src, $mask}", []>, TB,
76                Requires<[HasMMX]>;
77