]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/lib/Target/X86/X86InstrFMA.td
MFV r315950:
[FreeBSD/FreeBSD.git] / contrib / llvm / lib / Target / X86 / X86InstrFMA.td
1 //===-- X86InstrFMA.td - FMA Instruction Set ---------------*- tablegen -*-===//
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 FMA (Fused Multiply-Add) instructions.
11 //
12 //===----------------------------------------------------------------------===//
13
14 //===----------------------------------------------------------------------===//
15 // FMA3 - Intel 3 operand Fused Multiply-Add instructions
16 //===----------------------------------------------------------------------===//
17
18 // For all FMA opcodes declared in fma3p_rm and fma3s_rm milticlasses defined
19 // below, both the register and memory variants are commutable.
20 // For the register form the commutable operands are 1, 2 and 3.
21 // For the memory variant the folded operand must be in 3. Thus,
22 // in that case, only the operands 1 and 2 can be swapped.
23 // Commuting some of operands may require the opcode change.
24 // FMA*213*:
25 //   operands 1 and 2 (memory & register forms): *213* --> *213*(no changes);
26 //   operands 1 and 3 (register forms only):     *213* --> *231*;
27 //   operands 2 and 3 (register forms only):     *213* --> *132*.
28 // FMA*132*:
29 //   operands 1 and 2 (memory & register forms): *132* --> *231*;
30 //   operands 1 and 3 (register forms only):     *132* --> *132*(no changes);
31 //   operands 2 and 3 (register forms only):     *132* --> *213*.
32 // FMA*231*:
33 //   operands 1 and 2 (memory & register forms): *231* --> *132*;
34 //   operands 1 and 3 (register forms only):     *231* --> *213*;
35 //   operands 2 and 3 (register forms only):     *231* --> *231*(no changes).
36
37 let Constraints = "$src1 = $dst", hasSideEffects = 0, isCommutable = 1 in
38 multiclass fma3p_rm<bits<8> opc, string OpcodeStr,
39                     PatFrag MemFrag128, PatFrag MemFrag256,
40                     ValueType OpVT128, ValueType OpVT256,
41                     SDPatternOperator Op = null_frag> {
42   def r     : FMA3<opc, MRMSrcReg, (outs VR128:$dst),
43                    (ins VR128:$src1, VR128:$src2, VR128:$src3),
44                    !strconcat(OpcodeStr,
45                               "\t{$src3, $src2, $dst|$dst, $src2, $src3}"),
46                    [(set VR128:$dst, (OpVT128 (Op VR128:$src2,
47                                                VR128:$src1, VR128:$src3)))]>;
48
49   let mayLoad = 1 in
50   def m     : FMA3<opc, MRMSrcMem, (outs VR128:$dst),
51                    (ins VR128:$src1, VR128:$src2, f128mem:$src3),
52                    !strconcat(OpcodeStr,
53                               "\t{$src3, $src2, $dst|$dst, $src2, $src3}"),
54                    [(set VR128:$dst, (OpVT128 (Op VR128:$src2, VR128:$src1,
55                                                (MemFrag128 addr:$src3))))]>;
56
57   def Yr    : FMA3<opc, MRMSrcReg, (outs VR256:$dst),
58                    (ins VR256:$src1, VR256:$src2, VR256:$src3),
59                    !strconcat(OpcodeStr,
60                               "\t{$src3, $src2, $dst|$dst, $src2, $src3}"),
61                    [(set VR256:$dst, (OpVT256 (Op VR256:$src2, VR256:$src1,
62                                                VR256:$src3)))]>, VEX_L;
63
64   let mayLoad = 1 in
65   def Ym    : FMA3<opc, MRMSrcMem, (outs VR256:$dst),
66                    (ins VR256:$src1, VR256:$src2, f256mem:$src3),
67                    !strconcat(OpcodeStr,
68                               "\t{$src3, $src2, $dst|$dst, $src2, $src3}"),
69                    [(set VR256:$dst,
70                      (OpVT256 (Op VR256:$src2, VR256:$src1,
71                                (MemFrag256 addr:$src3))))]>, VEX_L;
72 }
73
74 multiclass fma3p_forms<bits<8> opc132, bits<8> opc213, bits<8> opc231,
75                        string OpcodeStr, string PackTy, string Suff,
76                        PatFrag MemFrag128, PatFrag MemFrag256,
77                        SDNode Op, ValueType OpTy128, ValueType OpTy256> {
78   defm NAME#213#Suff : fma3p_rm<opc213,
79                                 !strconcat(OpcodeStr, "213", PackTy),
80                                 MemFrag128, MemFrag256, OpTy128, OpTy256, Op>;
81   defm NAME#132#Suff : fma3p_rm<opc132,
82                                 !strconcat(OpcodeStr, "132", PackTy),
83                                 MemFrag128, MemFrag256, OpTy128, OpTy256>;
84   defm NAME#231#Suff : fma3p_rm<opc231,
85                                 !strconcat(OpcodeStr, "231", PackTy),
86                                 MemFrag128, MemFrag256, OpTy128, OpTy256>;
87 }
88
89 // Fused Multiply-Add
90 let ExeDomain = SSEPackedSingle in {
91   defm VFMADD    : fma3p_forms<0x98, 0xA8, 0xB8, "vfmadd", "ps", "PS",
92                                loadv4f32, loadv8f32, X86Fmadd, v4f32, v8f32>;
93   defm VFMSUB    : fma3p_forms<0x9A, 0xAA, 0xBA, "vfmsub", "ps", "PS",
94                                loadv4f32, loadv8f32, X86Fmsub, v4f32, v8f32>;
95   defm VFMADDSUB : fma3p_forms<0x96, 0xA6, 0xB6, "vfmaddsub", "ps", "PS",
96                                loadv4f32, loadv8f32, X86Fmaddsub,
97                                v4f32, v8f32>;
98   defm VFMSUBADD : fma3p_forms<0x97, 0xA7, 0xB7, "vfmsubadd", "ps", "PS",
99                                loadv4f32, loadv8f32, X86Fmsubadd,
100                                v4f32, v8f32>;
101 }
102
103 let ExeDomain = SSEPackedDouble in {
104   defm VFMADD    : fma3p_forms<0x98, 0xA8, 0xB8, "vfmadd", "pd", "PD",
105                                loadv2f64, loadv4f64, X86Fmadd, v2f64,
106                                v4f64>, VEX_W;
107   defm VFMSUB    : fma3p_forms<0x9A, 0xAA, 0xBA, "vfmsub", "pd", "PD",
108                                loadv2f64, loadv4f64, X86Fmsub, v2f64,
109                                v4f64>, VEX_W;
110   defm VFMADDSUB : fma3p_forms<0x96, 0xA6, 0xB6, "vfmaddsub", "pd", "PD",
111                                loadv2f64, loadv4f64, X86Fmaddsub,
112                                v2f64, v4f64>, VEX_W;
113   defm VFMSUBADD : fma3p_forms<0x97, 0xA7, 0xB7, "vfmsubadd", "pd", "PD",
114                                loadv2f64, loadv4f64, X86Fmsubadd,
115                                v2f64, v4f64>, VEX_W;
116 }
117
118 // Fused Negative Multiply-Add
119 let ExeDomain = SSEPackedSingle in {
120   defm VFNMADD : fma3p_forms<0x9C, 0xAC, 0xBC, "vfnmadd", "ps", "PS", loadv4f32,
121                              loadv8f32, X86Fnmadd, v4f32, v8f32>;
122   defm VFNMSUB : fma3p_forms<0x9E, 0xAE, 0xBE, "vfnmsub", "ps", "PS", loadv4f32,
123                              loadv8f32, X86Fnmsub, v4f32, v8f32>;
124 }
125 let ExeDomain = SSEPackedDouble in {
126   defm VFNMADD : fma3p_forms<0x9C, 0xAC, 0xBC, "vfnmadd", "pd", "PD", loadv2f64,
127                              loadv4f64, X86Fnmadd, v2f64, v4f64>, VEX_W;
128   defm VFNMSUB : fma3p_forms<0x9E, 0xAE, 0xBE, "vfnmsub", "pd", "PD", loadv2f64,
129                              loadv4f64, X86Fnmsub, v2f64, v4f64>, VEX_W;
130 }
131
132 // All source register operands of FMA opcodes defined in fma3s_rm multiclass
133 // can be commuted. In many cases such commute transformation requres an opcode
134 // adjustment, for example, commuting the operands 1 and 2 in FMA*132 form
135 // would require an opcode change to FMA*231:
136 //     FMA*132* reg1, reg2, reg3; // reg1 * reg3 + reg2;
137 //     -->
138 //     FMA*231* reg2, reg1, reg3; // reg1 * reg3 + reg2;
139 // Please see more detailed comment at the very beginning of the section
140 // defining FMA3 opcodes above.
141 let Constraints = "$src1 = $dst", isCommutable = 1, hasSideEffects = 0 in
142 multiclass fma3s_rm<bits<8> opc, string OpcodeStr,
143                     X86MemOperand x86memop, RegisterClass RC,
144                     SDPatternOperator OpNode = null_frag> {
145   def r     : FMA3<opc, MRMSrcReg, (outs RC:$dst),
146                    (ins RC:$src1, RC:$src2, RC:$src3),
147                    !strconcat(OpcodeStr,
148                               "\t{$src3, $src2, $dst|$dst, $src2, $src3}"),
149                    [(set RC:$dst, (OpNode RC:$src2, RC:$src1, RC:$src3))]>;
150
151   let mayLoad = 1 in
152   def m     : FMA3<opc, MRMSrcMem, (outs RC:$dst),
153                    (ins RC:$src1, RC:$src2, x86memop:$src3),
154                    !strconcat(OpcodeStr,
155                               "\t{$src3, $src2, $dst|$dst, $src2, $src3}"),
156                    [(set RC:$dst,
157                      (OpNode RC:$src2, RC:$src1, (load addr:$src3)))]>;
158 }
159
160 // These FMA*_Int instructions are defined specially for being used when
161 // the scalar FMA intrinsics are lowered to machine instructions, and in that
162 // sense, they are similar to existing ADD*_Int, SUB*_Int, MUL*_Int, etc.
163 // instructions.
164 //
165 // All of the FMA*_Int opcodes are defined as commutable here.
166 // Commuting the 2nd and 3rd source register operands of FMAs is quite trivial
167 // and the corresponding optimizations have been developed.
168 // Commuting the 1st operand of FMA*_Int requires some additional analysis,
169 // the commute optimization is legal only if all users of FMA*_Int use only
170 // the lowest element of the FMA*_Int instruction. Even though such analysis
171 // may be not implemented yet we allow the routines doing the actual commute
172 // transformation to decide if one or another instruction is commutable or not.
173 let Constraints = "$src1 = $dst", isCommutable = 1, isCodeGenOnly = 1,
174     hasSideEffects = 0 in
175 multiclass fma3s_rm_int<bits<8> opc, string OpcodeStr,
176                         Operand memopr, RegisterClass RC> {
177   def r_Int : FMA3<opc, MRMSrcReg, (outs RC:$dst),
178                    (ins RC:$src1, RC:$src2, RC:$src3),
179                    !strconcat(OpcodeStr,
180                               "\t{$src3, $src2, $dst|$dst, $src2, $src3}"),
181                    []>;
182
183   let mayLoad = 1 in
184   def m_Int : FMA3<opc, MRMSrcMem, (outs RC:$dst),
185                    (ins RC:$src1, RC:$src2, memopr:$src3),
186                    !strconcat(OpcodeStr,
187                               "\t{$src3, $src2, $dst|$dst, $src2, $src3}"),
188                    []>;
189 }
190
191 multiclass fma3s_forms<bits<8> opc132, bits<8> opc213, bits<8> opc231,
192                        string OpStr, string PackTy, string Suff,
193                        SDNode OpNode, RegisterClass RC,
194                        X86MemOperand x86memop> {
195   defm NAME#132#Suff : fma3s_rm<opc132, !strconcat(OpStr, "132", PackTy),
196                                 x86memop, RC>;
197   defm NAME#213#Suff : fma3s_rm<opc213, !strconcat(OpStr, "213", PackTy),
198                                 x86memop, RC, OpNode>;
199   defm NAME#231#Suff : fma3s_rm<opc231, !strconcat(OpStr, "231", PackTy),
200                                 x86memop, RC>;
201 }
202
203 // The FMA 213 form is created for lowering of scalar FMA intrinscis
204 // to machine instructions.
205 // The FMA 132 form can trivially be get by commuting the 2nd and 3rd operands
206 // of FMA 213 form.
207 // The FMA 231 form can be get only by commuting the 1st operand of 213 or 132
208 // forms and is possible only after special analysis of all uses of the initial
209 // instruction. Such analysis do not exist yet and thus introducing the 231
210 // form of FMA*_Int instructions is done using an optimistic assumption that
211 // such analysis will be implemented eventually.
212 multiclass fma3s_int_forms<bits<8> opc132, bits<8> opc213, bits<8> opc231,
213                            string OpStr, string PackTy, string Suff,
214                            RegisterClass RC, Operand memop> {
215   defm NAME#132#Suff : fma3s_rm_int<opc132, !strconcat(OpStr, "132", PackTy),
216                                     memop, RC>;
217   defm NAME#213#Suff : fma3s_rm_int<opc213, !strconcat(OpStr, "213", PackTy),
218                                     memop, RC>;
219   defm NAME#231#Suff : fma3s_rm_int<opc231, !strconcat(OpStr, "231", PackTy),
220                                     memop, RC>;
221 }
222
223 multiclass fma3s<bits<8> opc132, bits<8> opc213, bits<8> opc231,
224                  string OpStr, Intrinsic IntF32, Intrinsic IntF64,
225                  SDNode OpNode> {
226   let ExeDomain = SSEPackedSingle in
227   defm NAME : fma3s_forms<opc132, opc213, opc231, OpStr, "ss", "SS", OpNode,
228                           FR32, f32mem>,
229               fma3s_int_forms<opc132, opc213, opc231, OpStr, "ss", "SS",
230                               VR128, ssmem>;
231
232   let ExeDomain = SSEPackedDouble in
233   defm NAME : fma3s_forms<opc132, opc213, opc231, OpStr, "sd", "SD", OpNode,
234                         FR64, f64mem>,
235               fma3s_int_forms<opc132, opc213, opc231, OpStr, "sd", "SD",
236                               VR128, sdmem>, VEX_W;
237
238   // These patterns use the 123 ordering, instead of 213, even though
239   // they match the intrinsic to the 213 version of the instruction.
240   // This is because src1 is tied to dest, and the scalar intrinsics
241   // require the pass-through values to come from the first source
242   // operand, not the second.
243   let Predicates = [HasFMA] in {
244     def : Pat<(IntF32 VR128:$src1, VR128:$src2, VR128:$src3),
245               (COPY_TO_REGCLASS(!cast<Instruction>(NAME#"213SSr_Int")
246                $src1, $src2, $src3), VR128)>;
247
248     def : Pat<(IntF64 VR128:$src1, VR128:$src2, VR128:$src3),
249               (COPY_TO_REGCLASS(!cast<Instruction>(NAME#"213SDr_Int")
250                $src1, $src2, $src3), VR128)>;
251   }
252 }
253
254 defm VFMADD : fma3s<0x99, 0xA9, 0xB9, "vfmadd", int_x86_fma_vfmadd_ss,
255                     int_x86_fma_vfmadd_sd, X86Fmadd>, VEX_LIG;
256 defm VFMSUB : fma3s<0x9B, 0xAB, 0xBB, "vfmsub", int_x86_fma_vfmsub_ss,
257                     int_x86_fma_vfmsub_sd, X86Fmsub>, VEX_LIG;
258
259 defm VFNMADD : fma3s<0x9D, 0xAD, 0xBD, "vfnmadd", int_x86_fma_vfnmadd_ss,
260                      int_x86_fma_vfnmadd_sd, X86Fnmadd>, VEX_LIG;
261 defm VFNMSUB : fma3s<0x9F, 0xAF, 0xBF, "vfnmsub", int_x86_fma_vfnmsub_ss,
262                      int_x86_fma_vfnmsub_sd, X86Fnmsub>, VEX_LIG;
263
264
265 //===----------------------------------------------------------------------===//
266 // FMA4 - AMD 4 operand Fused Multiply-Add instructions
267 //===----------------------------------------------------------------------===//
268
269
270 multiclass fma4s<bits<8> opc, string OpcodeStr, RegisterClass RC,
271                  X86MemOperand x86memop, ValueType OpVT, SDNode OpNode,
272                  PatFrag mem_frag> {
273   let isCommutable = 1 in
274   def rr : FMA4<opc, MRMSrcRegOp4, (outs RC:$dst),
275            (ins RC:$src1, RC:$src2, RC:$src3),
276            !strconcat(OpcodeStr,
277            "\t{$src3, $src2, $src1, $dst|$dst, $src1, $src2, $src3}"),
278            [(set RC:$dst,
279              (OpVT (OpNode RC:$src1, RC:$src2, RC:$src3)))]>, VEX_W, VEX_LIG;
280   def rm : FMA4<opc, MRMSrcMemOp4, (outs RC:$dst),
281            (ins RC:$src1, RC:$src2, x86memop:$src3),
282            !strconcat(OpcodeStr,
283            "\t{$src3, $src2, $src1, $dst|$dst, $src1, $src2, $src3}"),
284            [(set RC:$dst, (OpNode RC:$src1, RC:$src2,
285                            (mem_frag addr:$src3)))]>, VEX_W, VEX_LIG;
286   def mr : FMA4<opc, MRMSrcMem, (outs RC:$dst),
287            (ins RC:$src1, x86memop:$src2, RC:$src3),
288            !strconcat(OpcodeStr,
289            "\t{$src3, $src2, $src1, $dst|$dst, $src1, $src2, $src3}"),
290            [(set RC:$dst,
291              (OpNode RC:$src1, (mem_frag addr:$src2), RC:$src3))]>, VEX_LIG;
292 // For disassembler
293 let isCodeGenOnly = 1, ForceDisassemble = 1, hasSideEffects = 0 in
294   def rr_REV : FMA4<opc, MRMSrcReg, (outs RC:$dst),
295                (ins RC:$src1, RC:$src2, RC:$src3),
296                !strconcat(OpcodeStr,
297                "\t{$src3, $src2, $src1, $dst|$dst, $src1, $src2, $src3}"), []>,
298                VEX_LIG;
299 }
300
301 multiclass fma4s_int<bits<8> opc, string OpcodeStr, Operand memop,
302                      ComplexPattern mem_cpat, Intrinsic Int> {
303 let isCodeGenOnly = 1 in {
304   def rr_Int : FMA4<opc, MRMSrcRegOp4, (outs VR128:$dst),
305                (ins VR128:$src1, VR128:$src2, VR128:$src3),
306                !strconcat(OpcodeStr,
307                "\t{$src3, $src2, $src1, $dst|$dst, $src1, $src2, $src3}"),
308                [(set VR128:$dst,
309                  (Int VR128:$src1, VR128:$src2, VR128:$src3))]>, VEX_W, VEX_LIG;
310   def rm_Int : FMA4<opc, MRMSrcMemOp4, (outs VR128:$dst),
311                (ins VR128:$src1, VR128:$src2, memop:$src3),
312                !strconcat(OpcodeStr,
313                "\t{$src3, $src2, $src1, $dst|$dst, $src1, $src2, $src3}"),
314                [(set VR128:$dst, (Int VR128:$src1, VR128:$src2,
315                                   mem_cpat:$src3))]>, VEX_W, VEX_LIG;
316   def mr_Int : FMA4<opc, MRMSrcMem, (outs VR128:$dst),
317                (ins VR128:$src1, memop:$src2, VR128:$src3),
318                !strconcat(OpcodeStr,
319                "\t{$src3, $src2, $src1, $dst|$dst, $src1, $src2, $src3}"),
320                [(set VR128:$dst,
321                  (Int VR128:$src1, mem_cpat:$src2, VR128:$src3))]>, VEX_LIG;
322 } // isCodeGenOnly = 1
323 }
324
325 multiclass fma4p<bits<8> opc, string OpcodeStr, SDNode OpNode,
326                  ValueType OpVT128, ValueType OpVT256,
327                  PatFrag ld_frag128, PatFrag ld_frag256> {
328   let isCommutable = 1 in
329   def rr : FMA4<opc, MRMSrcRegOp4, (outs VR128:$dst),
330            (ins VR128:$src1, VR128:$src2, VR128:$src3),
331            !strconcat(OpcodeStr,
332            "\t{$src3, $src2, $src1, $dst|$dst, $src1, $src2, $src3}"),
333            [(set VR128:$dst,
334              (OpVT128 (OpNode VR128:$src1, VR128:$src2, VR128:$src3)))]>,
335            VEX_W;
336   def rm : FMA4<opc, MRMSrcMemOp4, (outs VR128:$dst),
337            (ins VR128:$src1, VR128:$src2, f128mem:$src3),
338            !strconcat(OpcodeStr,
339            "\t{$src3, $src2, $src1, $dst|$dst, $src1, $src2, $src3}"),
340            [(set VR128:$dst, (OpNode VR128:$src1, VR128:$src2,
341                               (ld_frag128 addr:$src3)))]>, VEX_W;
342   def mr : FMA4<opc, MRMSrcMem, (outs VR128:$dst),
343            (ins VR128:$src1, f128mem:$src2, VR128:$src3),
344            !strconcat(OpcodeStr,
345            "\t{$src3, $src2, $src1, $dst|$dst, $src1, $src2, $src3}"),
346            [(set VR128:$dst,
347              (OpNode VR128:$src1, (ld_frag128 addr:$src2), VR128:$src3))]>;
348   let isCommutable = 1 in
349   def Yrr : FMA4<opc, MRMSrcRegOp4, (outs VR256:$dst),
350            (ins VR256:$src1, VR256:$src2, VR256:$src3),
351            !strconcat(OpcodeStr,
352            "\t{$src3, $src2, $src1, $dst|$dst, $src1, $src2, $src3}"),
353            [(set VR256:$dst,
354              (OpVT256 (OpNode VR256:$src1, VR256:$src2, VR256:$src3)))]>,
355            VEX_W, VEX_L;
356   def Yrm : FMA4<opc, MRMSrcMemOp4, (outs VR256:$dst),
357            (ins VR256:$src1, VR256:$src2, f256mem:$src3),
358            !strconcat(OpcodeStr,
359            "\t{$src3, $src2, $src1, $dst|$dst, $src1, $src2, $src3}"),
360            [(set VR256:$dst, (OpNode VR256:$src1, VR256:$src2,
361                               (ld_frag256 addr:$src3)))]>, VEX_W, VEX_L;
362   def Ymr : FMA4<opc, MRMSrcMem, (outs VR256:$dst),
363            (ins VR256:$src1, f256mem:$src2, VR256:$src3),
364            !strconcat(OpcodeStr,
365            "\t{$src3, $src2, $src1, $dst|$dst, $src1, $src2, $src3}"),
366            [(set VR256:$dst, (OpNode VR256:$src1,
367                               (ld_frag256 addr:$src2), VR256:$src3))]>, VEX_L;
368 // For disassembler
369 let isCodeGenOnly = 1, ForceDisassemble = 1, hasSideEffects = 0 in {
370   def rr_REV : FMA4<opc, MRMSrcReg, (outs VR128:$dst),
371                (ins VR128:$src1, VR128:$src2, VR128:$src3),
372                !strconcat(OpcodeStr,
373                "\t{$src3, $src2, $src1, $dst|$dst, $src1, $src2, $src3}"), []>;
374   def Yrr_REV : FMA4<opc, MRMSrcReg, (outs VR256:$dst),
375                 (ins VR256:$src1, VR256:$src2, VR256:$src3),
376                 !strconcat(OpcodeStr,
377                 "\t{$src3, $src2, $src1, $dst|$dst, $src1, $src2, $src3}"), []>,
378                 VEX_L;
379 } // isCodeGenOnly = 1
380 }
381
382 let ExeDomain = SSEPackedSingle in {
383   // Scalar Instructions
384   defm VFMADDSS4  : fma4s<0x6A, "vfmaddss", FR32, f32mem, f32, X86Fmadd, loadf32>,
385                     fma4s_int<0x6A, "vfmaddss", ssmem, sse_load_f32,
386                               int_x86_fma_vfmadd_ss>;
387   defm VFMSUBSS4  : fma4s<0x6E, "vfmsubss", FR32, f32mem, f32, X86Fmsub, loadf32>,
388                     fma4s_int<0x6E, "vfmsubss", ssmem, sse_load_f32,
389                               int_x86_fma_vfmsub_ss>;
390   defm VFNMADDSS4 : fma4s<0x7A, "vfnmaddss", FR32, f32mem, f32,
391                           X86Fnmadd, loadf32>,
392                     fma4s_int<0x7A, "vfnmaddss", ssmem, sse_load_f32,
393                               int_x86_fma_vfnmadd_ss>;
394   defm VFNMSUBSS4 : fma4s<0x7E, "vfnmsubss", FR32, f32mem, f32,
395                           X86Fnmsub, loadf32>,
396                     fma4s_int<0x7E, "vfnmsubss", ssmem, sse_load_f32,
397                               int_x86_fma_vfnmsub_ss>;
398   // Packed Instructions
399   defm VFMADDPS4    : fma4p<0x68, "vfmaddps", X86Fmadd, v4f32, v8f32,
400                             loadv4f32, loadv8f32>;
401   defm VFMSUBPS4    : fma4p<0x6C, "vfmsubps", X86Fmsub, v4f32, v8f32,
402                             loadv4f32, loadv8f32>;
403   defm VFNMADDPS4   : fma4p<0x78, "vfnmaddps", X86Fnmadd, v4f32, v8f32,
404                             loadv4f32, loadv8f32>;
405   defm VFNMSUBPS4   : fma4p<0x7C, "vfnmsubps", X86Fnmsub, v4f32, v8f32,
406                             loadv4f32, loadv8f32>;
407   defm VFMADDSUBPS4 : fma4p<0x5C, "vfmaddsubps", X86Fmaddsub, v4f32, v8f32,
408                             loadv4f32, loadv8f32>;
409   defm VFMSUBADDPS4 : fma4p<0x5E, "vfmsubaddps", X86Fmsubadd, v4f32, v8f32,
410                             loadv4f32, loadv8f32>;
411 }
412
413 let ExeDomain = SSEPackedDouble in {
414   // Scalar Instructions
415   defm VFMADDSD4  : fma4s<0x6B, "vfmaddsd", FR64, f64mem, f64, X86Fmadd, loadf64>,
416                     fma4s_int<0x6B, "vfmaddsd", sdmem, sse_load_f64,
417                               int_x86_fma_vfmadd_sd>;
418   defm VFMSUBSD4  : fma4s<0x6F, "vfmsubsd", FR64, f64mem, f64, X86Fmsub, loadf64>,
419                     fma4s_int<0x6F, "vfmsubsd", sdmem, sse_load_f64,
420                               int_x86_fma_vfmsub_sd>;
421   defm VFNMADDSD4 : fma4s<0x7B, "vfnmaddsd", FR64, f64mem, f64,
422                           X86Fnmadd, loadf64>,
423                     fma4s_int<0x7B, "vfnmaddsd", sdmem, sse_load_f64,
424                               int_x86_fma_vfnmadd_sd>;
425   defm VFNMSUBSD4 : fma4s<0x7F, "vfnmsubsd", FR64, f64mem, f64,
426                           X86Fnmsub, loadf64>,
427                     fma4s_int<0x7F, "vfnmsubsd", sdmem, sse_load_f64,
428                               int_x86_fma_vfnmsub_sd>;
429   // Packed Instructions
430   defm VFMADDPD4    : fma4p<0x69, "vfmaddpd", X86Fmadd, v2f64, v4f64,
431                             loadv2f64, loadv4f64>;
432   defm VFMSUBPD4    : fma4p<0x6D, "vfmsubpd", X86Fmsub, v2f64, v4f64,
433                             loadv2f64, loadv4f64>;
434   defm VFNMADDPD4   : fma4p<0x79, "vfnmaddpd", X86Fnmadd, v2f64, v4f64,
435                             loadv2f64, loadv4f64>;
436   defm VFNMSUBPD4   : fma4p<0x7D, "vfnmsubpd", X86Fnmsub, v2f64, v4f64,
437                             loadv2f64, loadv4f64>;
438   defm VFMADDSUBPD4 : fma4p<0x5D, "vfmaddsubpd", X86Fmaddsub, v2f64, v4f64,
439                             loadv2f64, loadv4f64>;
440   defm VFMSUBADDPD4 : fma4p<0x5F, "vfmsubaddpd", X86Fmsubadd, v2f64, v4f64,
441                             loadv2f64, loadv4f64>;
442 }
443