Emit symbol type information for ELF/COFF targets
[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 // MMXI   - MMX instructions with TB prefix.
18 // MMX2I  - MMX / SSE2 instructions with TB and OpSize prefixes.
19 // MMXIi8 - MMX instructions with ImmT == Imm8 and TB prefix.
20 class MMXI<bits<8> o, Format F, dag ops, string asm, list<dag> pattern>
21       : I<o, F, ops, asm, pattern>, TB, Requires<[HasMMX]>;
22 class MMX2I<bits<8> o, Format F, dag ops, string asm, list<dag> pattern>
23       : I<o, F, ops, asm, pattern>, TB, OpSize, Requires<[HasSSE2]>;
24 class MMXIi8<bits<8> o, Format F, dag ops, string asm, list<dag> pattern>
25       : Ii8<o, F, ops, asm, pattern>, TB, Requires<[HasMMX]>;
26
27 // Some 'special' instructions
28 def IMPLICIT_DEF_VR64 : I<0, Pseudo, (ops VR64:$dst),
29                           "#IMPLICIT_DEF $dst",
30                           [(set VR64:$dst, (v8i8 (undef)))]>,
31                         Requires<[HasMMX]>;
32
33 def : Pat<(v4i16 (undef)), (IMPLICIT_DEF_VR64)>,  Requires<[HasMMX]>;
34 def : Pat<(v2i32 (undef)), (IMPLICIT_DEF_VR64)>,  Requires<[HasMMX]>;
35
36 // Move Instructions
37 def MOVD64rr : I<0x6E, MRMSrcReg, (ops VR64:$dst, GR32:$src),
38                  "movd {$src, $dst|$dst, $src}", []>, TB,
39                Requires<[HasMMX]>;
40 def MOVD64rm : I<0x6E, MRMSrcMem, (ops VR64:$dst, i32mem:$src),
41                  "movd {$src, $dst|$dst, $src}", []>, TB,
42                Requires<[HasMMX]>;
43 def MOVD64mr : I<0x7E, MRMDestMem, (ops i32mem:$dst, VR64:$src),
44                  "movd {$src, $dst|$dst, $src}", []>, TB,
45                Requires<[HasMMX]>;
46
47 def MOVQ64rr : I<0x6F, MRMSrcReg, (ops VR64:$dst, VR64:$src),
48                  "movq {$src, $dst|$dst, $src}", []>, TB,
49                Requires<[HasMMX]>;
50 def MOVQ64rm : I<0x6F, MRMSrcMem, (ops VR64:$dst, i64mem:$src),
51                  "movq {$src, $dst|$dst, $src}", []>, TB,
52                Requires<[HasMMX]>;
53 def MOVQ64mr : I<0x7F, MRMDestMem, (ops i64mem:$dst, VR64:$src),
54                  "movq {$src, $dst|$dst, $src}", []>, TB,
55                Requires<[HasMMX]>;
56
57 // Conversion instructions
58 def CVTPI2PSrr : MMXI<0x2A, MRMSrcReg, (ops VR128:$dst, VR64:$src),
59                       "cvtpi2ps {$src, $dst|$dst, $src}", []>;
60 def CVTPI2PSrm : MMXI<0x2A, MRMSrcMem, (ops VR128:$dst, i64mem:$src),
61                       "cvtpi2ps {$src, $dst|$dst, $src}", []>;
62 def CVTPI2PDrr : MMX2I<0x2A, MRMSrcReg, (ops VR128:$dst, VR64:$src),
63                        "cvtpi2pd {$src, $dst|$dst, $src}", []>;
64 def CVTPI2PDrm : MMX2I<0x2A, MRMSrcMem, (ops VR128:$dst, i64mem:$src),
65                        "cvtpi2pd {$src, $dst|$dst, $src}", []>;
66 def CVTTPS2PIrr: I<0x2C, MRMSrcReg, (ops VR64:$dst, VR128:$src),
67                    "cvttps2pi {$src, $dst|$dst, $src}", []>, TB,
68                  Requires<[HasSSE2]>;
69 def CVTTPS2PIrm: I<0x2C, MRMSrcMem, (ops VR64:$dst, f64mem:$src),
70                    "cvttps2pi {$src, $dst|$dst, $src}", []>, TB,
71                  Requires<[HasMMX]>;
72 def CVTPS2PIrr : MMXI<0x2D, MRMSrcReg, (ops VR64:$dst, VR128:$src),
73                       "cvtps2pi {$src, $dst|$dst, $src}", []>;
74 def CVTPS2PIrm : MMXI<0x2D, MRMSrcMem, (ops VR64:$dst, f64mem:$src),
75                       "cvtps2pi {$src, $dst|$dst, $src}", []>;
76 def CVTPD2PIrr : MMX2I<0x2D, MRMSrcReg, (ops VR64:$dst, VR128:$src),
77                        "cvtpd2pi {$src, $dst|$dst, $src}", []>;
78 def CVTPD2PIrm : MMX2I<0x2D, MRMSrcMem, (ops VR64:$dst, f128mem:$src),
79                        "cvtpd2pi {$src, $dst|$dst, $src}", []>;
80
81 // Shuffle and unpack instructions
82 def PSHUFWri : MMXIi8<0x70, MRMSrcReg,
83                       (ops VR64:$dst, VR64:$src1, i8imm:$src2),
84                       "pshufw {$src2, $src1, $dst|$dst, $src1, $src2}", []>;
85 def PSHUFWmi : MMXIi8<0x70, MRMSrcMem,
86                       (ops VR64:$dst, i64mem:$src1, i8imm:$src2),
87                       "pshufw {$src2, $src1, $dst|$dst, $src1, $src2}", []>;
88
89 // Misc.
90 def MOVNTQ   : I<0xE7, MRMDestMem, (ops i64mem:$dst, VR64:$src),
91                  "movntq {$src, $dst|$dst, $src}", []>, TB,
92                Requires<[HasMMX]>;
93
94 def MASKMOVQ : I<0xF7, MRMDestMem, (ops VR64:$src, VR64:$mask),
95                  "maskmovq {$mask, $src|$src, $mask}", []>, TB,
96                Requires<[HasMMX]>;
97