Bruno Cardoso Lopes | 6b7e916 | 2010-07-23 00:54:35 +0000 | [diff] [blame^] | 1 | //====- X86InstrFMA.td - Describe the X86 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 | multiclass fma_rm<bits<8> opc, string OpcodeStr> { |
| 19 | def r : FMA3<opc, MRMSrcReg, (outs VR128:$dst), |
| 20 | (ins VR128:$src1, VR128:$src2), |
| 21 | !strconcat(OpcodeStr, "\t{$src2, $src1, $dst|$dst, $src1, $src2}"), |
| 22 | []>; |
| 23 | def m : FMA3<opc, MRMSrcMem, (outs VR128:$dst), |
| 24 | (ins VR128:$src1, f128mem:$src2), |
| 25 | !strconcat(OpcodeStr, "\t{$src2, $src1, $dst|$dst, $src1, $src2}"), |
| 26 | []>; |
| 27 | def rY : FMA3<opc, MRMSrcReg, (outs VR256:$dst), |
| 28 | (ins VR256:$src1, VR256:$src2), |
| 29 | !strconcat(OpcodeStr, "\t{$src2, $src1, $dst|$dst, $src1, $src2}"), |
| 30 | []>; |
| 31 | def mY : FMA3<opc, MRMSrcMem, (outs VR256:$dst), |
| 32 | (ins VR256:$src1, f256mem:$src2), |
| 33 | !strconcat(OpcodeStr, "\t{$src2, $src1, $dst|$dst, $src1, $src2}"), |
| 34 | []>; |
| 35 | } |
| 36 | |
| 37 | multiclass fma_forms<bits<8> opc132, bits<8> opc213, bits<8> opc231, |
| 38 | string OpcodeStr, string PackTy> { |
| 39 | defm r132 : fma_rm<opc132, !strconcat(OpcodeStr, !strconcat("132", PackTy))>; |
| 40 | defm r213 : fma_rm<opc213, !strconcat(OpcodeStr, !strconcat("213", PackTy))>; |
| 41 | defm r231 : fma_rm<opc231, !strconcat(OpcodeStr, !strconcat("231", PackTy))>; |
| 42 | } |
| 43 | |
| 44 | let isAsmParserOnly = 1 in { |
| 45 | // Fused Multiply-Add |
| 46 | defm VFMADDPS : fma_forms<0x98, 0xA8, 0xB8, "vfmadd", "ps">; |
| 47 | defm VFMADDPD : fma_forms<0x98, 0xA8, 0xB8, "vfmadd", "pd">, VEX_W; |
| 48 | defm VFMADDSUBPS : fma_forms<0x96, 0xA6, 0xB6, "vfmaddsub", "ps">; |
| 49 | defm VFMADDSUBPD : fma_forms<0x96, 0xA6, 0xB6, "vfmaddsub", "pd">, VEX_W; |
| 50 | defm VFMSUBADDPS : fma_forms<0x97, 0xA7, 0xB7, "vfmsubadd", "ps">; |
| 51 | defm VFMSUBADDPD : fma_forms<0x97, 0xA7, 0xB7, "vfmsubadd", "pd">, VEX_W; |
| 52 | defm VFMSUBPS : fma_forms<0x9A, 0xAA, 0xBA, "vfmsub", "ps">; |
| 53 | defm VFMSUBPD : fma_forms<0x9A, 0xAA, 0xBA, "vfmsub", "pd">, VEX_W; |
| 54 | |
| 55 | // Fused Negative Multiply-Add |
| 56 | defm VFNMADDPS : fma_forms<0x9C, 0xAC, 0xBC, "vfnmadd", "ps">; |
| 57 | defm VFNMADDPD : fma_forms<0x9C, 0xAC, 0xBC, "vfnmadd", "pd">, VEX_W; |
| 58 | defm VFNMSUBPS : fma_forms<0x9E, 0xAE, 0xBE, "vfnmsub", "ps">; |
| 59 | defm VFNMSUBPD : fma_forms<0x9E, 0xAE, 0xBE, "vfnmsub", "pd">, VEX_W; |
| 60 | } |