1 //====- X86Instr3DNow.td - The 3DNow! Instruction Set ------*- tablegen -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file describes the 3DNow! instruction set, which extends MMX to support
11 // floating point and also adds a few more random instructions for good measure.
13 //===----------------------------------------------------------------------===//
15 // FIXME: We don't support any intrinsics for these instructions yet.
17 class I3DNow<bits<8> o, Format F, dag outs, dag ins, string asm,
19 : I<o, F, outs, ins, asm, pattern>, TB, Requires<[Has3DNow]> {
22 class I3DNow_binop<bits<8> o, Format F, dag ins, string Mnemonic>
23 : I<o, F, (outs VR64:$dst), ins,
24 !strconcat(Mnemonic, "\t{$src2, $dst|$dst, $src2}"), []>,
25 TB, Requires<[Has3DNow]>, Has3DNow0F0FOpcode {
26 // FIXME: The disassembler doesn't support Has3DNow0F0FOpcode yet.
27 let isAsmParserOnly = 1;
31 let Constraints = "$src1 = $dst" in {
32 // MMXI_binop_rm_int - Simple MMX binary operator based on intrinsic.
33 // When this is cleaned up, remove the FIXME from X86RecognizableInstr.cpp.
34 multiclass I3DNow_binop_rm<bits<8> opc, string Mn> {
35 def rr : I3DNow_binop<opc, MRMSrcReg, (ins VR64:$src1, VR64:$src2), Mn>;
36 def rm : I3DNow_binop<opc, MRMSrcMem, (ins VR64:$src1, i64mem:$src2), Mn>;
40 defm PAVGUSB : I3DNow_binop_rm<0xBF, "pavgusb">;
41 defm PF2ID : I3DNow_binop_rm<0x1D, "pf2id">;
42 defm PFACC : I3DNow_binop_rm<0xAE, "pfacc">;
43 defm PFADD : I3DNow_binop_rm<0x9E, "pfadd">;
44 defm PFCMPEQ : I3DNow_binop_rm<0xB0, "pfcmpeq">;
45 defm PFCMPGE : I3DNow_binop_rm<0x90, "pfcmpge">;
46 defm PFCMPGT : I3DNow_binop_rm<0xA0, "pfcmpgt">;
47 defm PFMAX : I3DNow_binop_rm<0xA4, "pfmax">;
48 defm PFMIN : I3DNow_binop_rm<0x94, "pfmin">;
49 defm PFMUL : I3DNow_binop_rm<0xB4, "pfmul">;
50 defm PFRCP : I3DNow_binop_rm<0x96, "pfrcp">;
51 defm PFRCPIT1 : I3DNow_binop_rm<0xA6, "pfrcpit1">;
52 defm PFRCPIT2 : I3DNow_binop_rm<0xB6, "pfrcpit2">;
53 defm PFRSQIT1 : I3DNow_binop_rm<0xA7, "pfrsqit1">;
54 defm PFRSQRT : I3DNow_binop_rm<0x97, "pfrsqrt">;
55 defm PFSUB : I3DNow_binop_rm<0x9A, "pfsub">;
56 defm PFSUBR : I3DNow_binop_rm<0xAA, "pfsubr">;
57 defm PI2FD : I3DNow_binop_rm<0x0D, "pi2fd">;
58 defm PMULHRW : I3DNow_binop_rm<0xB7, "pmulhrw">;
61 def FEMMS : I3DNow<0x0E, RawFrm, (outs), (ins), "femms", [(int_x86_mmx_femms)]>;
63 def PREFETCH : I3DNow<0x0D, MRM0m, (outs), (ins i32mem:$addr),
64 "prefetch $addr", []>;
66 // FIXME: Diassembler gets a bogus decode conflict.
67 let isAsmParserOnly = 1 in {
68 def PREFETCHW : I3DNow<0x0D, MRM1m, (outs), (ins i16mem:$addr),
69 "prefetchw $addr", []>;
72 // "3DNowA" instructions
73 defm PF2IW : I3DNow_binop_rm<0x1C, "pf2iw">;
74 defm PI2FW : I3DNow_binop_rm<0x0C, "pi2fw">;
75 defm PFNACC : I3DNow_binop_rm<0x8A, "pfnacc">;
76 defm PFPNACC : I3DNow_binop_rm<0x8E, "pfpnacc">;
77 defm PSWAPD : I3DNow_binop_rm<0xBB, "pswapd">;