1*9880d681SAndroid Build Coastguard Worker//===-- X86InstrArithmetic.td - Integer Arithmetic Instrs --*- tablegen -*-===// 2*9880d681SAndroid Build Coastguard Worker// 3*9880d681SAndroid Build Coastguard Worker// The LLVM Compiler Infrastructure 4*9880d681SAndroid Build Coastguard Worker// 5*9880d681SAndroid Build Coastguard Worker// This file is distributed under the University of Illinois Open Source 6*9880d681SAndroid Build Coastguard Worker// License. See LICENSE.TXT for details. 7*9880d681SAndroid Build Coastguard Worker// 8*9880d681SAndroid Build Coastguard Worker//===----------------------------------------------------------------------===// 9*9880d681SAndroid Build Coastguard Worker// 10*9880d681SAndroid Build Coastguard Worker// This file describes the integer arithmetic instructions in the X86 11*9880d681SAndroid Build Coastguard Worker// architecture. 12*9880d681SAndroid Build Coastguard Worker// 13*9880d681SAndroid Build Coastguard Worker//===----------------------------------------------------------------------===// 14*9880d681SAndroid Build Coastguard Worker 15*9880d681SAndroid Build Coastguard Worker//===----------------------------------------------------------------------===// 16*9880d681SAndroid Build Coastguard Worker// LEA - Load Effective Address 17*9880d681SAndroid Build Coastguard Workerlet SchedRW = [WriteLEA] in { 18*9880d681SAndroid Build Coastguard Workerlet hasSideEffects = 0 in 19*9880d681SAndroid Build Coastguard Workerdef LEA16r : I<0x8D, MRMSrcMem, 20*9880d681SAndroid Build Coastguard Worker (outs GR16:$dst), (ins anymem:$src), 21*9880d681SAndroid Build Coastguard Worker "lea{w}\t{$src|$dst}, {$dst|$src}", [], IIC_LEA_16>, OpSize16; 22*9880d681SAndroid Build Coastguard Workerlet isReMaterializable = 1 in 23*9880d681SAndroid Build Coastguard Workerdef LEA32r : I<0x8D, MRMSrcMem, 24*9880d681SAndroid Build Coastguard Worker (outs GR32:$dst), (ins anymem:$src), 25*9880d681SAndroid Build Coastguard Worker "lea{l}\t{$src|$dst}, {$dst|$src}", 26*9880d681SAndroid Build Coastguard Worker [(set GR32:$dst, lea32addr:$src)], IIC_LEA>, 27*9880d681SAndroid Build Coastguard Worker OpSize32, Requires<[Not64BitMode]>; 28*9880d681SAndroid Build Coastguard Worker 29*9880d681SAndroid Build Coastguard Workerdef LEA64_32r : I<0x8D, MRMSrcMem, 30*9880d681SAndroid Build Coastguard Worker (outs GR32:$dst), (ins lea64_32mem:$src), 31*9880d681SAndroid Build Coastguard Worker "lea{l}\t{$src|$dst}, {$dst|$src}", 32*9880d681SAndroid Build Coastguard Worker [(set GR32:$dst, lea64_32addr:$src)], IIC_LEA>, 33*9880d681SAndroid Build Coastguard Worker OpSize32, Requires<[In64BitMode]>; 34*9880d681SAndroid Build Coastguard Worker 35*9880d681SAndroid Build Coastguard Workerlet isReMaterializable = 1 in 36*9880d681SAndroid Build Coastguard Workerdef LEA64r : RI<0x8D, MRMSrcMem, (outs GR64:$dst), (ins lea64mem:$src), 37*9880d681SAndroid Build Coastguard Worker "lea{q}\t{$src|$dst}, {$dst|$src}", 38*9880d681SAndroid Build Coastguard Worker [(set GR64:$dst, lea64addr:$src)], IIC_LEA>; 39*9880d681SAndroid Build Coastguard Worker} // SchedRW 40*9880d681SAndroid Build Coastguard Worker 41*9880d681SAndroid Build Coastguard Worker//===----------------------------------------------------------------------===// 42*9880d681SAndroid Build Coastguard Worker// Fixed-Register Multiplication and Division Instructions. 43*9880d681SAndroid Build Coastguard Worker// 44*9880d681SAndroid Build Coastguard Worker 45*9880d681SAndroid Build Coastguard Worker// SchedModel info for instruction that loads one value and gets the second 46*9880d681SAndroid Build Coastguard Worker// (and possibly third) value from a register. 47*9880d681SAndroid Build Coastguard Worker// This is used for instructions that put the memory operands before other 48*9880d681SAndroid Build Coastguard Worker// uses. 49*9880d681SAndroid Build Coastguard Workerclass SchedLoadReg<SchedWrite SW> : Sched<[SW, 50*9880d681SAndroid Build Coastguard Worker // Memory operand. 51*9880d681SAndroid Build Coastguard Worker ReadDefault, ReadDefault, ReadDefault, ReadDefault, ReadDefault, 52*9880d681SAndroid Build Coastguard Worker // Register reads (implicit or explicit). 53*9880d681SAndroid Build Coastguard Worker ReadAfterLd, ReadAfterLd]>; 54*9880d681SAndroid Build Coastguard Worker 55*9880d681SAndroid Build Coastguard Worker// Extra precision multiplication 56*9880d681SAndroid Build Coastguard Worker 57*9880d681SAndroid Build Coastguard Worker// AL is really implied by AX, but the registers in Defs must match the 58*9880d681SAndroid Build Coastguard Worker// SDNode results (i8, i32). 59*9880d681SAndroid Build Coastguard Worker// AL,AH = AL*GR8 60*9880d681SAndroid Build Coastguard Workerlet Defs = [AL,EFLAGS,AX], Uses = [AL] in 61*9880d681SAndroid Build Coastguard Workerdef MUL8r : I<0xF6, MRM4r, (outs), (ins GR8:$src), "mul{b}\t$src", 62*9880d681SAndroid Build Coastguard Worker // FIXME: Used for 8-bit mul, ignore result upper 8 bits. 63*9880d681SAndroid Build Coastguard Worker // This probably ought to be moved to a def : Pat<> if the 64*9880d681SAndroid Build Coastguard Worker // syntax can be accepted. 65*9880d681SAndroid Build Coastguard Worker [(set AL, (mul AL, GR8:$src)), 66*9880d681SAndroid Build Coastguard Worker (implicit EFLAGS)], IIC_MUL8>, Sched<[WriteIMul]>; 67*9880d681SAndroid Build Coastguard Worker// AX,DX = AX*GR16 68*9880d681SAndroid Build Coastguard Workerlet Defs = [AX,DX,EFLAGS], Uses = [AX], hasSideEffects = 0 in 69*9880d681SAndroid Build Coastguard Workerdef MUL16r : I<0xF7, MRM4r, (outs), (ins GR16:$src), 70*9880d681SAndroid Build Coastguard Worker "mul{w}\t$src", 71*9880d681SAndroid Build Coastguard Worker [], IIC_MUL16_REG>, OpSize16, Sched<[WriteIMul]>; 72*9880d681SAndroid Build Coastguard Worker// EAX,EDX = EAX*GR32 73*9880d681SAndroid Build Coastguard Workerlet Defs = [EAX,EDX,EFLAGS], Uses = [EAX], hasSideEffects = 0 in 74*9880d681SAndroid Build Coastguard Workerdef MUL32r : I<0xF7, MRM4r, (outs), (ins GR32:$src), 75*9880d681SAndroid Build Coastguard Worker "mul{l}\t$src", 76*9880d681SAndroid Build Coastguard Worker [/*(set EAX, EDX, EFLAGS, (X86umul_flag EAX, GR32:$src))*/], 77*9880d681SAndroid Build Coastguard Worker IIC_MUL32_REG>, OpSize32, Sched<[WriteIMul]>; 78*9880d681SAndroid Build Coastguard Worker// RAX,RDX = RAX*GR64 79*9880d681SAndroid Build Coastguard Workerlet Defs = [RAX,RDX,EFLAGS], Uses = [RAX], hasSideEffects = 0 in 80*9880d681SAndroid Build Coastguard Workerdef MUL64r : RI<0xF7, MRM4r, (outs), (ins GR64:$src), 81*9880d681SAndroid Build Coastguard Worker "mul{q}\t$src", 82*9880d681SAndroid Build Coastguard Worker [/*(set RAX, RDX, EFLAGS, (X86umul_flag RAX, GR64:$src))*/], 83*9880d681SAndroid Build Coastguard Worker IIC_MUL64>, Sched<[WriteIMul]>; 84*9880d681SAndroid Build Coastguard Worker// AL,AH = AL*[mem8] 85*9880d681SAndroid Build Coastguard Workerlet Defs = [AL,EFLAGS,AX], Uses = [AL] in 86*9880d681SAndroid Build Coastguard Workerdef MUL8m : I<0xF6, MRM4m, (outs), (ins i8mem :$src), 87*9880d681SAndroid Build Coastguard Worker "mul{b}\t$src", 88*9880d681SAndroid Build Coastguard Worker // FIXME: Used for 8-bit mul, ignore result upper 8 bits. 89*9880d681SAndroid Build Coastguard Worker // This probably ought to be moved to a def : Pat<> if the 90*9880d681SAndroid Build Coastguard Worker // syntax can be accepted. 91*9880d681SAndroid Build Coastguard Worker [(set AL, (mul AL, (loadi8 addr:$src))), 92*9880d681SAndroid Build Coastguard Worker (implicit EFLAGS)], IIC_MUL8>, SchedLoadReg<WriteIMulLd>; 93*9880d681SAndroid Build Coastguard Worker// AX,DX = AX*[mem16] 94*9880d681SAndroid Build Coastguard Workerlet mayLoad = 1, hasSideEffects = 0 in { 95*9880d681SAndroid Build Coastguard Workerlet Defs = [AX,DX,EFLAGS], Uses = [AX] in 96*9880d681SAndroid Build Coastguard Workerdef MUL16m : I<0xF7, MRM4m, (outs), (ins i16mem:$src), 97*9880d681SAndroid Build Coastguard Worker "mul{w}\t$src", 98*9880d681SAndroid Build Coastguard Worker [], IIC_MUL16_MEM>, OpSize16, SchedLoadReg<WriteIMulLd>; 99*9880d681SAndroid Build Coastguard Worker// EAX,EDX = EAX*[mem32] 100*9880d681SAndroid Build Coastguard Workerlet Defs = [EAX,EDX,EFLAGS], Uses = [EAX] in 101*9880d681SAndroid Build Coastguard Workerdef MUL32m : I<0xF7, MRM4m, (outs), (ins i32mem:$src), 102*9880d681SAndroid Build Coastguard Worker "mul{l}\t$src", 103*9880d681SAndroid Build Coastguard Worker [], IIC_MUL32_MEM>, OpSize32, SchedLoadReg<WriteIMulLd>; 104*9880d681SAndroid Build Coastguard Worker// RAX,RDX = RAX*[mem64] 105*9880d681SAndroid Build Coastguard Workerlet Defs = [RAX,RDX,EFLAGS], Uses = [RAX] in 106*9880d681SAndroid Build Coastguard Workerdef MUL64m : RI<0xF7, MRM4m, (outs), (ins i64mem:$src), 107*9880d681SAndroid Build Coastguard Worker "mul{q}\t$src", [], IIC_MUL64>, SchedLoadReg<WriteIMulLd>; 108*9880d681SAndroid Build Coastguard Worker} 109*9880d681SAndroid Build Coastguard Worker 110*9880d681SAndroid Build Coastguard Workerlet hasSideEffects = 0 in { 111*9880d681SAndroid Build Coastguard Worker// AL,AH = AL*GR8 112*9880d681SAndroid Build Coastguard Workerlet Defs = [AL,EFLAGS,AX], Uses = [AL] in 113*9880d681SAndroid Build Coastguard Workerdef IMUL8r : I<0xF6, MRM5r, (outs), (ins GR8:$src), "imul{b}\t$src", [], 114*9880d681SAndroid Build Coastguard Worker IIC_IMUL8>, Sched<[WriteIMul]>; 115*9880d681SAndroid Build Coastguard Worker// AX,DX = AX*GR16 116*9880d681SAndroid Build Coastguard Workerlet Defs = [AX,DX,EFLAGS], Uses = [AX] in 117*9880d681SAndroid Build Coastguard Workerdef IMUL16r : I<0xF7, MRM5r, (outs), (ins GR16:$src), "imul{w}\t$src", [], 118*9880d681SAndroid Build Coastguard Worker IIC_IMUL16_RR>, OpSize16, Sched<[WriteIMul]>; 119*9880d681SAndroid Build Coastguard Worker// EAX,EDX = EAX*GR32 120*9880d681SAndroid Build Coastguard Workerlet Defs = [EAX,EDX,EFLAGS], Uses = [EAX] in 121*9880d681SAndroid Build Coastguard Workerdef IMUL32r : I<0xF7, MRM5r, (outs), (ins GR32:$src), "imul{l}\t$src", [], 122*9880d681SAndroid Build Coastguard Worker IIC_IMUL32_RR>, OpSize32, Sched<[WriteIMul]>; 123*9880d681SAndroid Build Coastguard Worker// RAX,RDX = RAX*GR64 124*9880d681SAndroid Build Coastguard Workerlet Defs = [RAX,RDX,EFLAGS], Uses = [RAX] in 125*9880d681SAndroid Build Coastguard Workerdef IMUL64r : RI<0xF7, MRM5r, (outs), (ins GR64:$src), "imul{q}\t$src", [], 126*9880d681SAndroid Build Coastguard Worker IIC_IMUL64_RR>, Sched<[WriteIMul]>; 127*9880d681SAndroid Build Coastguard Worker 128*9880d681SAndroid Build Coastguard Workerlet mayLoad = 1 in { 129*9880d681SAndroid Build Coastguard Worker// AL,AH = AL*[mem8] 130*9880d681SAndroid Build Coastguard Workerlet Defs = [AL,EFLAGS,AX], Uses = [AL] in 131*9880d681SAndroid Build Coastguard Workerdef IMUL8m : I<0xF6, MRM5m, (outs), (ins i8mem :$src), 132*9880d681SAndroid Build Coastguard Worker "imul{b}\t$src", [], IIC_IMUL8>, SchedLoadReg<WriteIMulLd>; 133*9880d681SAndroid Build Coastguard Worker// AX,DX = AX*[mem16] 134*9880d681SAndroid Build Coastguard Workerlet Defs = [AX,DX,EFLAGS], Uses = [AX] in 135*9880d681SAndroid Build Coastguard Workerdef IMUL16m : I<0xF7, MRM5m, (outs), (ins i16mem:$src), 136*9880d681SAndroid Build Coastguard Worker "imul{w}\t$src", [], IIC_IMUL16_MEM>, OpSize16, 137*9880d681SAndroid Build Coastguard Worker SchedLoadReg<WriteIMulLd>; 138*9880d681SAndroid Build Coastguard Worker// EAX,EDX = EAX*[mem32] 139*9880d681SAndroid Build Coastguard Workerlet Defs = [EAX,EDX,EFLAGS], Uses = [EAX] in 140*9880d681SAndroid Build Coastguard Workerdef IMUL32m : I<0xF7, MRM5m, (outs), (ins i32mem:$src), 141*9880d681SAndroid Build Coastguard Worker "imul{l}\t$src", [], IIC_IMUL32_MEM>, OpSize32, 142*9880d681SAndroid Build Coastguard Worker SchedLoadReg<WriteIMulLd>; 143*9880d681SAndroid Build Coastguard Worker// RAX,RDX = RAX*[mem64] 144*9880d681SAndroid Build Coastguard Workerlet Defs = [RAX,RDX,EFLAGS], Uses = [RAX] in 145*9880d681SAndroid Build Coastguard Workerdef IMUL64m : RI<0xF7, MRM5m, (outs), (ins i64mem:$src), 146*9880d681SAndroid Build Coastguard Worker "imul{q}\t$src", [], IIC_IMUL64>, SchedLoadReg<WriteIMulLd>; 147*9880d681SAndroid Build Coastguard Worker} 148*9880d681SAndroid Build Coastguard Worker} // hasSideEffects 149*9880d681SAndroid Build Coastguard Worker 150*9880d681SAndroid Build Coastguard Worker 151*9880d681SAndroid Build Coastguard Workerlet Defs = [EFLAGS] in { 152*9880d681SAndroid Build Coastguard Workerlet Constraints = "$src1 = $dst" in { 153*9880d681SAndroid Build Coastguard Worker 154*9880d681SAndroid Build Coastguard Workerlet isCommutable = 1, SchedRW = [WriteIMul] in { 155*9880d681SAndroid Build Coastguard Worker// X = IMUL Y, Z --> X = IMUL Z, Y 156*9880d681SAndroid Build Coastguard Worker// Register-Register Signed Integer Multiply 157*9880d681SAndroid Build Coastguard Workerdef IMUL16rr : I<0xAF, MRMSrcReg, (outs GR16:$dst), (ins GR16:$src1,GR16:$src2), 158*9880d681SAndroid Build Coastguard Worker "imul{w}\t{$src2, $dst|$dst, $src2}", 159*9880d681SAndroid Build Coastguard Worker [(set GR16:$dst, EFLAGS, 160*9880d681SAndroid Build Coastguard Worker (X86smul_flag GR16:$src1, GR16:$src2))], IIC_IMUL16_RR>, 161*9880d681SAndroid Build Coastguard Worker TB, OpSize16; 162*9880d681SAndroid Build Coastguard Workerdef IMUL32rr : I<0xAF, MRMSrcReg, (outs GR32:$dst), (ins GR32:$src1,GR32:$src2), 163*9880d681SAndroid Build Coastguard Worker "imul{l}\t{$src2, $dst|$dst, $src2}", 164*9880d681SAndroid Build Coastguard Worker [(set GR32:$dst, EFLAGS, 165*9880d681SAndroid Build Coastguard Worker (X86smul_flag GR32:$src1, GR32:$src2))], IIC_IMUL32_RR>, 166*9880d681SAndroid Build Coastguard Worker TB, OpSize32; 167*9880d681SAndroid Build Coastguard Workerdef IMUL64rr : RI<0xAF, MRMSrcReg, (outs GR64:$dst), 168*9880d681SAndroid Build Coastguard Worker (ins GR64:$src1, GR64:$src2), 169*9880d681SAndroid Build Coastguard Worker "imul{q}\t{$src2, $dst|$dst, $src2}", 170*9880d681SAndroid Build Coastguard Worker [(set GR64:$dst, EFLAGS, 171*9880d681SAndroid Build Coastguard Worker (X86smul_flag GR64:$src1, GR64:$src2))], IIC_IMUL64_RR>, 172*9880d681SAndroid Build Coastguard Worker TB; 173*9880d681SAndroid Build Coastguard Worker} // isCommutable, SchedRW 174*9880d681SAndroid Build Coastguard Worker 175*9880d681SAndroid Build Coastguard Worker// Register-Memory Signed Integer Multiply 176*9880d681SAndroid Build Coastguard Workerlet SchedRW = [WriteIMulLd, ReadAfterLd] in { 177*9880d681SAndroid Build Coastguard Workerdef IMUL16rm : I<0xAF, MRMSrcMem, (outs GR16:$dst), 178*9880d681SAndroid Build Coastguard Worker (ins GR16:$src1, i16mem:$src2), 179*9880d681SAndroid Build Coastguard Worker "imul{w}\t{$src2, $dst|$dst, $src2}", 180*9880d681SAndroid Build Coastguard Worker [(set GR16:$dst, EFLAGS, 181*9880d681SAndroid Build Coastguard Worker (X86smul_flag GR16:$src1, (load addr:$src2)))], 182*9880d681SAndroid Build Coastguard Worker IIC_IMUL16_RM>, 183*9880d681SAndroid Build Coastguard Worker TB, OpSize16; 184*9880d681SAndroid Build Coastguard Workerdef IMUL32rm : I<0xAF, MRMSrcMem, (outs GR32:$dst), 185*9880d681SAndroid Build Coastguard Worker (ins GR32:$src1, i32mem:$src2), 186*9880d681SAndroid Build Coastguard Worker "imul{l}\t{$src2, $dst|$dst, $src2}", 187*9880d681SAndroid Build Coastguard Worker [(set GR32:$dst, EFLAGS, 188*9880d681SAndroid Build Coastguard Worker (X86smul_flag GR32:$src1, (load addr:$src2)))], 189*9880d681SAndroid Build Coastguard Worker IIC_IMUL32_RM>, 190*9880d681SAndroid Build Coastguard Worker TB, OpSize32; 191*9880d681SAndroid Build Coastguard Workerdef IMUL64rm : RI<0xAF, MRMSrcMem, (outs GR64:$dst), 192*9880d681SAndroid Build Coastguard Worker (ins GR64:$src1, i64mem:$src2), 193*9880d681SAndroid Build Coastguard Worker "imul{q}\t{$src2, $dst|$dst, $src2}", 194*9880d681SAndroid Build Coastguard Worker [(set GR64:$dst, EFLAGS, 195*9880d681SAndroid Build Coastguard Worker (X86smul_flag GR64:$src1, (load addr:$src2)))], 196*9880d681SAndroid Build Coastguard Worker IIC_IMUL64_RM>, 197*9880d681SAndroid Build Coastguard Worker TB; 198*9880d681SAndroid Build Coastguard Worker} // SchedRW 199*9880d681SAndroid Build Coastguard Worker} // Constraints = "$src1 = $dst" 200*9880d681SAndroid Build Coastguard Worker 201*9880d681SAndroid Build Coastguard Worker} // Defs = [EFLAGS] 202*9880d681SAndroid Build Coastguard Worker 203*9880d681SAndroid Build Coastguard Worker// Surprisingly enough, these are not two address instructions! 204*9880d681SAndroid Build Coastguard Workerlet Defs = [EFLAGS] in { 205*9880d681SAndroid Build Coastguard Workerlet SchedRW = [WriteIMul] in { 206*9880d681SAndroid Build Coastguard Worker// Register-Integer Signed Integer Multiply 207*9880d681SAndroid Build Coastguard Workerdef IMUL16rri : Ii16<0x69, MRMSrcReg, // GR16 = GR16*I16 208*9880d681SAndroid Build Coastguard Worker (outs GR16:$dst), (ins GR16:$src1, i16imm:$src2), 209*9880d681SAndroid Build Coastguard Worker "imul{w}\t{$src2, $src1, $dst|$dst, $src1, $src2}", 210*9880d681SAndroid Build Coastguard Worker [(set GR16:$dst, EFLAGS, 211*9880d681SAndroid Build Coastguard Worker (X86smul_flag GR16:$src1, imm:$src2))], 212*9880d681SAndroid Build Coastguard Worker IIC_IMUL16_RRI>, OpSize16; 213*9880d681SAndroid Build Coastguard Workerdef IMUL16rri8 : Ii8<0x6B, MRMSrcReg, // GR16 = GR16*I8 214*9880d681SAndroid Build Coastguard Worker (outs GR16:$dst), (ins GR16:$src1, i16i8imm:$src2), 215*9880d681SAndroid Build Coastguard Worker "imul{w}\t{$src2, $src1, $dst|$dst, $src1, $src2}", 216*9880d681SAndroid Build Coastguard Worker [(set GR16:$dst, EFLAGS, 217*9880d681SAndroid Build Coastguard Worker (X86smul_flag GR16:$src1, i16immSExt8:$src2))], 218*9880d681SAndroid Build Coastguard Worker IIC_IMUL16_RRI>, OpSize16; 219*9880d681SAndroid Build Coastguard Workerdef IMUL32rri : Ii32<0x69, MRMSrcReg, // GR32 = GR32*I32 220*9880d681SAndroid Build Coastguard Worker (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2), 221*9880d681SAndroid Build Coastguard Worker "imul{l}\t{$src2, $src1, $dst|$dst, $src1, $src2}", 222*9880d681SAndroid Build Coastguard Worker [(set GR32:$dst, EFLAGS, 223*9880d681SAndroid Build Coastguard Worker (X86smul_flag GR32:$src1, imm:$src2))], 224*9880d681SAndroid Build Coastguard Worker IIC_IMUL32_RRI>, OpSize32; 225*9880d681SAndroid Build Coastguard Workerdef IMUL32rri8 : Ii8<0x6B, MRMSrcReg, // GR32 = GR32*I8 226*9880d681SAndroid Build Coastguard Worker (outs GR32:$dst), (ins GR32:$src1, i32i8imm:$src2), 227*9880d681SAndroid Build Coastguard Worker "imul{l}\t{$src2, $src1, $dst|$dst, $src1, $src2}", 228*9880d681SAndroid Build Coastguard Worker [(set GR32:$dst, EFLAGS, 229*9880d681SAndroid Build Coastguard Worker (X86smul_flag GR32:$src1, i32immSExt8:$src2))], 230*9880d681SAndroid Build Coastguard Worker IIC_IMUL32_RRI>, OpSize32; 231*9880d681SAndroid Build Coastguard Workerdef IMUL64rri32 : RIi32S<0x69, MRMSrcReg, // GR64 = GR64*I32 232*9880d681SAndroid Build Coastguard Worker (outs GR64:$dst), (ins GR64:$src1, i64i32imm:$src2), 233*9880d681SAndroid Build Coastguard Worker "imul{q}\t{$src2, $src1, $dst|$dst, $src1, $src2}", 234*9880d681SAndroid Build Coastguard Worker [(set GR64:$dst, EFLAGS, 235*9880d681SAndroid Build Coastguard Worker (X86smul_flag GR64:$src1, i64immSExt32:$src2))], 236*9880d681SAndroid Build Coastguard Worker IIC_IMUL64_RRI>; 237*9880d681SAndroid Build Coastguard Workerdef IMUL64rri8 : RIi8<0x6B, MRMSrcReg, // GR64 = GR64*I8 238*9880d681SAndroid Build Coastguard Worker (outs GR64:$dst), (ins GR64:$src1, i64i8imm:$src2), 239*9880d681SAndroid Build Coastguard Worker "imul{q}\t{$src2, $src1, $dst|$dst, $src1, $src2}", 240*9880d681SAndroid Build Coastguard Worker [(set GR64:$dst, EFLAGS, 241*9880d681SAndroid Build Coastguard Worker (X86smul_flag GR64:$src1, i64immSExt8:$src2))], 242*9880d681SAndroid Build Coastguard Worker IIC_IMUL64_RRI>; 243*9880d681SAndroid Build Coastguard Worker} // SchedRW 244*9880d681SAndroid Build Coastguard Worker 245*9880d681SAndroid Build Coastguard Worker// Memory-Integer Signed Integer Multiply 246*9880d681SAndroid Build Coastguard Workerlet SchedRW = [WriteIMulLd] in { 247*9880d681SAndroid Build Coastguard Workerdef IMUL16rmi : Ii16<0x69, MRMSrcMem, // GR16 = [mem16]*I16 248*9880d681SAndroid Build Coastguard Worker (outs GR16:$dst), (ins i16mem:$src1, i16imm:$src2), 249*9880d681SAndroid Build Coastguard Worker "imul{w}\t{$src2, $src1, $dst|$dst, $src1, $src2}", 250*9880d681SAndroid Build Coastguard Worker [(set GR16:$dst, EFLAGS, 251*9880d681SAndroid Build Coastguard Worker (X86smul_flag (load addr:$src1), imm:$src2))], 252*9880d681SAndroid Build Coastguard Worker IIC_IMUL16_RMI>, 253*9880d681SAndroid Build Coastguard Worker OpSize16; 254*9880d681SAndroid Build Coastguard Workerdef IMUL16rmi8 : Ii8<0x6B, MRMSrcMem, // GR16 = [mem16]*I8 255*9880d681SAndroid Build Coastguard Worker (outs GR16:$dst), (ins i16mem:$src1, i16i8imm :$src2), 256*9880d681SAndroid Build Coastguard Worker "imul{w}\t{$src2, $src1, $dst|$dst, $src1, $src2}", 257*9880d681SAndroid Build Coastguard Worker [(set GR16:$dst, EFLAGS, 258*9880d681SAndroid Build Coastguard Worker (X86smul_flag (load addr:$src1), 259*9880d681SAndroid Build Coastguard Worker i16immSExt8:$src2))], IIC_IMUL16_RMI>, 260*9880d681SAndroid Build Coastguard Worker OpSize16; 261*9880d681SAndroid Build Coastguard Workerdef IMUL32rmi : Ii32<0x69, MRMSrcMem, // GR32 = [mem32]*I32 262*9880d681SAndroid Build Coastguard Worker (outs GR32:$dst), (ins i32mem:$src1, i32imm:$src2), 263*9880d681SAndroid Build Coastguard Worker "imul{l}\t{$src2, $src1, $dst|$dst, $src1, $src2}", 264*9880d681SAndroid Build Coastguard Worker [(set GR32:$dst, EFLAGS, 265*9880d681SAndroid Build Coastguard Worker (X86smul_flag (load addr:$src1), imm:$src2))], 266*9880d681SAndroid Build Coastguard Worker IIC_IMUL32_RMI>, OpSize32; 267*9880d681SAndroid Build Coastguard Workerdef IMUL32rmi8 : Ii8<0x6B, MRMSrcMem, // GR32 = [mem32]*I8 268*9880d681SAndroid Build Coastguard Worker (outs GR32:$dst), (ins i32mem:$src1, i32i8imm: $src2), 269*9880d681SAndroid Build Coastguard Worker "imul{l}\t{$src2, $src1, $dst|$dst, $src1, $src2}", 270*9880d681SAndroid Build Coastguard Worker [(set GR32:$dst, EFLAGS, 271*9880d681SAndroid Build Coastguard Worker (X86smul_flag (load addr:$src1), 272*9880d681SAndroid Build Coastguard Worker i32immSExt8:$src2))], 273*9880d681SAndroid Build Coastguard Worker IIC_IMUL32_RMI>, OpSize32; 274*9880d681SAndroid Build Coastguard Workerdef IMUL64rmi32 : RIi32S<0x69, MRMSrcMem, // GR64 = [mem64]*I32 275*9880d681SAndroid Build Coastguard Worker (outs GR64:$dst), (ins i64mem:$src1, i64i32imm:$src2), 276*9880d681SAndroid Build Coastguard Worker "imul{q}\t{$src2, $src1, $dst|$dst, $src1, $src2}", 277*9880d681SAndroid Build Coastguard Worker [(set GR64:$dst, EFLAGS, 278*9880d681SAndroid Build Coastguard Worker (X86smul_flag (load addr:$src1), 279*9880d681SAndroid Build Coastguard Worker i64immSExt32:$src2))], 280*9880d681SAndroid Build Coastguard Worker IIC_IMUL64_RMI>; 281*9880d681SAndroid Build Coastguard Workerdef IMUL64rmi8 : RIi8<0x6B, MRMSrcMem, // GR64 = [mem64]*I8 282*9880d681SAndroid Build Coastguard Worker (outs GR64:$dst), (ins i64mem:$src1, i64i8imm: $src2), 283*9880d681SAndroid Build Coastguard Worker "imul{q}\t{$src2, $src1, $dst|$dst, $src1, $src2}", 284*9880d681SAndroid Build Coastguard Worker [(set GR64:$dst, EFLAGS, 285*9880d681SAndroid Build Coastguard Worker (X86smul_flag (load addr:$src1), 286*9880d681SAndroid Build Coastguard Worker i64immSExt8:$src2))], 287*9880d681SAndroid Build Coastguard Worker IIC_IMUL64_RMI>; 288*9880d681SAndroid Build Coastguard Worker} // SchedRW 289*9880d681SAndroid Build Coastguard Worker} // Defs = [EFLAGS] 290*9880d681SAndroid Build Coastguard Worker 291*9880d681SAndroid Build Coastguard Worker 292*9880d681SAndroid Build Coastguard Worker 293*9880d681SAndroid Build Coastguard Worker 294*9880d681SAndroid Build Coastguard Worker// unsigned division/remainder 295*9880d681SAndroid Build Coastguard Workerlet hasSideEffects = 1 in { // so that we don't speculatively execute 296*9880d681SAndroid Build Coastguard Workerlet SchedRW = [WriteIDiv] in { 297*9880d681SAndroid Build Coastguard Workerlet Defs = [AL,AH,EFLAGS], Uses = [AX] in 298*9880d681SAndroid Build Coastguard Workerdef DIV8r : I<0xF6, MRM6r, (outs), (ins GR8:$src), // AX/r8 = AL,AH 299*9880d681SAndroid Build Coastguard Worker "div{b}\t$src", [], IIC_DIV8_REG>; 300*9880d681SAndroid Build Coastguard Workerlet Defs = [AX,DX,EFLAGS], Uses = [AX,DX] in 301*9880d681SAndroid Build Coastguard Workerdef DIV16r : I<0xF7, MRM6r, (outs), (ins GR16:$src), // DX:AX/r16 = AX,DX 302*9880d681SAndroid Build Coastguard Worker "div{w}\t$src", [], IIC_DIV16>, OpSize16; 303*9880d681SAndroid Build Coastguard Workerlet Defs = [EAX,EDX,EFLAGS], Uses = [EAX,EDX] in 304*9880d681SAndroid Build Coastguard Workerdef DIV32r : I<0xF7, MRM6r, (outs), (ins GR32:$src), // EDX:EAX/r32 = EAX,EDX 305*9880d681SAndroid Build Coastguard Worker "div{l}\t$src", [], IIC_DIV32>, OpSize32; 306*9880d681SAndroid Build Coastguard Worker// RDX:RAX/r64 = RAX,RDX 307*9880d681SAndroid Build Coastguard Workerlet Defs = [RAX,RDX,EFLAGS], Uses = [RAX,RDX] in 308*9880d681SAndroid Build Coastguard Workerdef DIV64r : RI<0xF7, MRM6r, (outs), (ins GR64:$src), 309*9880d681SAndroid Build Coastguard Worker "div{q}\t$src", [], IIC_DIV64>; 310*9880d681SAndroid Build Coastguard Worker} // SchedRW 311*9880d681SAndroid Build Coastguard Worker 312*9880d681SAndroid Build Coastguard Workerlet mayLoad = 1 in { 313*9880d681SAndroid Build Coastguard Workerlet Defs = [AL,AH,EFLAGS], Uses = [AX] in 314*9880d681SAndroid Build Coastguard Workerdef DIV8m : I<0xF6, MRM6m, (outs), (ins i8mem:$src), // AX/[mem8] = AL,AH 315*9880d681SAndroid Build Coastguard Worker "div{b}\t$src", [], IIC_DIV8_MEM>, 316*9880d681SAndroid Build Coastguard Worker SchedLoadReg<WriteIDivLd>; 317*9880d681SAndroid Build Coastguard Workerlet Defs = [AX,DX,EFLAGS], Uses = [AX,DX] in 318*9880d681SAndroid Build Coastguard Workerdef DIV16m : I<0xF7, MRM6m, (outs), (ins i16mem:$src), // DX:AX/[mem16] = AX,DX 319*9880d681SAndroid Build Coastguard Worker "div{w}\t$src", [], IIC_DIV16>, OpSize16, 320*9880d681SAndroid Build Coastguard Worker SchedLoadReg<WriteIDivLd>; 321*9880d681SAndroid Build Coastguard Workerlet Defs = [EAX,EDX,EFLAGS], Uses = [EAX,EDX] in // EDX:EAX/[mem32] = EAX,EDX 322*9880d681SAndroid Build Coastguard Workerdef DIV32m : I<0xF7, MRM6m, (outs), (ins i32mem:$src), 323*9880d681SAndroid Build Coastguard Worker "div{l}\t$src", [], IIC_DIV32>, 324*9880d681SAndroid Build Coastguard Worker SchedLoadReg<WriteIDivLd>, OpSize32; 325*9880d681SAndroid Build Coastguard Worker// RDX:RAX/[mem64] = RAX,RDX 326*9880d681SAndroid Build Coastguard Workerlet Defs = [RAX,RDX,EFLAGS], Uses = [RAX,RDX] in 327*9880d681SAndroid Build Coastguard Workerdef DIV64m : RI<0xF7, MRM6m, (outs), (ins i64mem:$src), 328*9880d681SAndroid Build Coastguard Worker "div{q}\t$src", [], IIC_DIV64>, 329*9880d681SAndroid Build Coastguard Worker SchedLoadReg<WriteIDivLd>; 330*9880d681SAndroid Build Coastguard Worker} 331*9880d681SAndroid Build Coastguard Worker 332*9880d681SAndroid Build Coastguard Worker// Signed division/remainder. 333*9880d681SAndroid Build Coastguard Workerlet SchedRW = [WriteIDiv] in { 334*9880d681SAndroid Build Coastguard Workerlet Defs = [AL,AH,EFLAGS], Uses = [AX] in 335*9880d681SAndroid Build Coastguard Workerdef IDIV8r : I<0xF6, MRM7r, (outs), (ins GR8:$src), // AX/r8 = AL,AH 336*9880d681SAndroid Build Coastguard Worker "idiv{b}\t$src", [], IIC_IDIV8>; 337*9880d681SAndroid Build Coastguard Workerlet Defs = [AX,DX,EFLAGS], Uses = [AX,DX] in 338*9880d681SAndroid Build Coastguard Workerdef IDIV16r: I<0xF7, MRM7r, (outs), (ins GR16:$src), // DX:AX/r16 = AX,DX 339*9880d681SAndroid Build Coastguard Worker "idiv{w}\t$src", [], IIC_IDIV16>, OpSize16; 340*9880d681SAndroid Build Coastguard Workerlet Defs = [EAX,EDX,EFLAGS], Uses = [EAX,EDX] in 341*9880d681SAndroid Build Coastguard Workerdef IDIV32r: I<0xF7, MRM7r, (outs), (ins GR32:$src), // EDX:EAX/r32 = EAX,EDX 342*9880d681SAndroid Build Coastguard Worker "idiv{l}\t$src", [], IIC_IDIV32>, OpSize32; 343*9880d681SAndroid Build Coastguard Worker// RDX:RAX/r64 = RAX,RDX 344*9880d681SAndroid Build Coastguard Workerlet Defs = [RAX,RDX,EFLAGS], Uses = [RAX,RDX] in 345*9880d681SAndroid Build Coastguard Workerdef IDIV64r: RI<0xF7, MRM7r, (outs), (ins GR64:$src), 346*9880d681SAndroid Build Coastguard Worker "idiv{q}\t$src", [], IIC_IDIV64>; 347*9880d681SAndroid Build Coastguard Worker} // SchedRW 348*9880d681SAndroid Build Coastguard Worker 349*9880d681SAndroid Build Coastguard Workerlet mayLoad = 1 in { 350*9880d681SAndroid Build Coastguard Workerlet Defs = [AL,AH,EFLAGS], Uses = [AX] in 351*9880d681SAndroid Build Coastguard Workerdef IDIV8m : I<0xF6, MRM7m, (outs), (ins i8mem:$src), // AX/[mem8] = AL,AH 352*9880d681SAndroid Build Coastguard Worker "idiv{b}\t$src", [], IIC_IDIV8>, 353*9880d681SAndroid Build Coastguard Worker SchedLoadReg<WriteIDivLd>; 354*9880d681SAndroid Build Coastguard Workerlet Defs = [AX,DX,EFLAGS], Uses = [AX,DX] in 355*9880d681SAndroid Build Coastguard Workerdef IDIV16m: I<0xF7, MRM7m, (outs), (ins i16mem:$src), // DX:AX/[mem16] = AX,DX 356*9880d681SAndroid Build Coastguard Worker "idiv{w}\t$src", [], IIC_IDIV16>, OpSize16, 357*9880d681SAndroid Build Coastguard Worker SchedLoadReg<WriteIDivLd>; 358*9880d681SAndroid Build Coastguard Workerlet Defs = [EAX,EDX,EFLAGS], Uses = [EAX,EDX] in // EDX:EAX/[mem32] = EAX,EDX 359*9880d681SAndroid Build Coastguard Workerdef IDIV32m: I<0xF7, MRM7m, (outs), (ins i32mem:$src), 360*9880d681SAndroid Build Coastguard Worker "idiv{l}\t$src", [], IIC_IDIV32>, OpSize32, 361*9880d681SAndroid Build Coastguard Worker SchedLoadReg<WriteIDivLd>; 362*9880d681SAndroid Build Coastguard Workerlet Defs = [RAX,RDX,EFLAGS], Uses = [RAX,RDX] in // RDX:RAX/[mem64] = RAX,RDX 363*9880d681SAndroid Build Coastguard Workerdef IDIV64m: RI<0xF7, MRM7m, (outs), (ins i64mem:$src), 364*9880d681SAndroid Build Coastguard Worker "idiv{q}\t$src", [], IIC_IDIV64>, 365*9880d681SAndroid Build Coastguard Worker SchedLoadReg<WriteIDivLd>; 366*9880d681SAndroid Build Coastguard Worker} 367*9880d681SAndroid Build Coastguard Worker} // hasSideEffects = 0 368*9880d681SAndroid Build Coastguard Worker 369*9880d681SAndroid Build Coastguard Worker//===----------------------------------------------------------------------===// 370*9880d681SAndroid Build Coastguard Worker// Two address Instructions. 371*9880d681SAndroid Build Coastguard Worker// 372*9880d681SAndroid Build Coastguard Worker 373*9880d681SAndroid Build Coastguard Worker// unary instructions 374*9880d681SAndroid Build Coastguard Workerlet CodeSize = 2 in { 375*9880d681SAndroid Build Coastguard Workerlet Defs = [EFLAGS] in { 376*9880d681SAndroid Build Coastguard Workerlet Constraints = "$src1 = $dst", SchedRW = [WriteALU] in { 377*9880d681SAndroid Build Coastguard Workerdef NEG8r : I<0xF6, MRM3r, (outs GR8 :$dst), (ins GR8 :$src1), 378*9880d681SAndroid Build Coastguard Worker "neg{b}\t$dst", 379*9880d681SAndroid Build Coastguard Worker [(set GR8:$dst, (ineg GR8:$src1)), 380*9880d681SAndroid Build Coastguard Worker (implicit EFLAGS)], IIC_UNARY_REG>; 381*9880d681SAndroid Build Coastguard Workerdef NEG16r : I<0xF7, MRM3r, (outs GR16:$dst), (ins GR16:$src1), 382*9880d681SAndroid Build Coastguard Worker "neg{w}\t$dst", 383*9880d681SAndroid Build Coastguard Worker [(set GR16:$dst, (ineg GR16:$src1)), 384*9880d681SAndroid Build Coastguard Worker (implicit EFLAGS)], IIC_UNARY_REG>, OpSize16; 385*9880d681SAndroid Build Coastguard Workerdef NEG32r : I<0xF7, MRM3r, (outs GR32:$dst), (ins GR32:$src1), 386*9880d681SAndroid Build Coastguard Worker "neg{l}\t$dst", 387*9880d681SAndroid Build Coastguard Worker [(set GR32:$dst, (ineg GR32:$src1)), 388*9880d681SAndroid Build Coastguard Worker (implicit EFLAGS)], IIC_UNARY_REG>, OpSize32; 389*9880d681SAndroid Build Coastguard Workerdef NEG64r : RI<0xF7, MRM3r, (outs GR64:$dst), (ins GR64:$src1), "neg{q}\t$dst", 390*9880d681SAndroid Build Coastguard Worker [(set GR64:$dst, (ineg GR64:$src1)), 391*9880d681SAndroid Build Coastguard Worker (implicit EFLAGS)], IIC_UNARY_REG>; 392*9880d681SAndroid Build Coastguard Worker} // Constraints = "$src1 = $dst", SchedRW 393*9880d681SAndroid Build Coastguard Worker 394*9880d681SAndroid Build Coastguard Worker// Read-modify-write negate. 395*9880d681SAndroid Build Coastguard Workerlet SchedRW = [WriteALULd, WriteRMW] in { 396*9880d681SAndroid Build Coastguard Workerdef NEG8m : I<0xF6, MRM3m, (outs), (ins i8mem :$dst), 397*9880d681SAndroid Build Coastguard Worker "neg{b}\t$dst", 398*9880d681SAndroid Build Coastguard Worker [(store (ineg (loadi8 addr:$dst)), addr:$dst), 399*9880d681SAndroid Build Coastguard Worker (implicit EFLAGS)], IIC_UNARY_MEM>; 400*9880d681SAndroid Build Coastguard Workerdef NEG16m : I<0xF7, MRM3m, (outs), (ins i16mem:$dst), 401*9880d681SAndroid Build Coastguard Worker "neg{w}\t$dst", 402*9880d681SAndroid Build Coastguard Worker [(store (ineg (loadi16 addr:$dst)), addr:$dst), 403*9880d681SAndroid Build Coastguard Worker (implicit EFLAGS)], IIC_UNARY_MEM>, OpSize16; 404*9880d681SAndroid Build Coastguard Workerdef NEG32m : I<0xF7, MRM3m, (outs), (ins i32mem:$dst), 405*9880d681SAndroid Build Coastguard Worker "neg{l}\t$dst", 406*9880d681SAndroid Build Coastguard Worker [(store (ineg (loadi32 addr:$dst)), addr:$dst), 407*9880d681SAndroid Build Coastguard Worker (implicit EFLAGS)], IIC_UNARY_MEM>, OpSize32; 408*9880d681SAndroid Build Coastguard Workerdef NEG64m : RI<0xF7, MRM3m, (outs), (ins i64mem:$dst), "neg{q}\t$dst", 409*9880d681SAndroid Build Coastguard Worker [(store (ineg (loadi64 addr:$dst)), addr:$dst), 410*9880d681SAndroid Build Coastguard Worker (implicit EFLAGS)], IIC_UNARY_MEM>; 411*9880d681SAndroid Build Coastguard Worker} // SchedRW 412*9880d681SAndroid Build Coastguard Worker} // Defs = [EFLAGS] 413*9880d681SAndroid Build Coastguard Worker 414*9880d681SAndroid Build Coastguard Worker 415*9880d681SAndroid Build Coastguard Worker// Note: NOT does not set EFLAGS! 416*9880d681SAndroid Build Coastguard Worker 417*9880d681SAndroid Build Coastguard Workerlet Constraints = "$src1 = $dst", SchedRW = [WriteALU] in { 418*9880d681SAndroid Build Coastguard Worker// Match xor -1 to not. Favors these over a move imm + xor to save code size. 419*9880d681SAndroid Build Coastguard Workerlet AddedComplexity = 15 in { 420*9880d681SAndroid Build Coastguard Workerdef NOT8r : I<0xF6, MRM2r, (outs GR8 :$dst), (ins GR8 :$src1), 421*9880d681SAndroid Build Coastguard Worker "not{b}\t$dst", 422*9880d681SAndroid Build Coastguard Worker [(set GR8:$dst, (not GR8:$src1))], IIC_UNARY_REG>; 423*9880d681SAndroid Build Coastguard Workerdef NOT16r : I<0xF7, MRM2r, (outs GR16:$dst), (ins GR16:$src1), 424*9880d681SAndroid Build Coastguard Worker "not{w}\t$dst", 425*9880d681SAndroid Build Coastguard Worker [(set GR16:$dst, (not GR16:$src1))], IIC_UNARY_REG>, OpSize16; 426*9880d681SAndroid Build Coastguard Workerdef NOT32r : I<0xF7, MRM2r, (outs GR32:$dst), (ins GR32:$src1), 427*9880d681SAndroid Build Coastguard Worker "not{l}\t$dst", 428*9880d681SAndroid Build Coastguard Worker [(set GR32:$dst, (not GR32:$src1))], IIC_UNARY_REG>, OpSize32; 429*9880d681SAndroid Build Coastguard Workerdef NOT64r : RI<0xF7, MRM2r, (outs GR64:$dst), (ins GR64:$src1), "not{q}\t$dst", 430*9880d681SAndroid Build Coastguard Worker [(set GR64:$dst, (not GR64:$src1))], IIC_UNARY_REG>; 431*9880d681SAndroid Build Coastguard Worker} 432*9880d681SAndroid Build Coastguard Worker} // Constraints = "$src1 = $dst", SchedRW 433*9880d681SAndroid Build Coastguard Worker 434*9880d681SAndroid Build Coastguard Workerlet SchedRW = [WriteALULd, WriteRMW] in { 435*9880d681SAndroid Build Coastguard Workerdef NOT8m : I<0xF6, MRM2m, (outs), (ins i8mem :$dst), 436*9880d681SAndroid Build Coastguard Worker "not{b}\t$dst", 437*9880d681SAndroid Build Coastguard Worker [(store (not (loadi8 addr:$dst)), addr:$dst)], IIC_UNARY_MEM>; 438*9880d681SAndroid Build Coastguard Workerdef NOT16m : I<0xF7, MRM2m, (outs), (ins i16mem:$dst), 439*9880d681SAndroid Build Coastguard Worker "not{w}\t$dst", 440*9880d681SAndroid Build Coastguard Worker [(store (not (loadi16 addr:$dst)), addr:$dst)], IIC_UNARY_MEM>, 441*9880d681SAndroid Build Coastguard Worker OpSize16; 442*9880d681SAndroid Build Coastguard Workerdef NOT32m : I<0xF7, MRM2m, (outs), (ins i32mem:$dst), 443*9880d681SAndroid Build Coastguard Worker "not{l}\t$dst", 444*9880d681SAndroid Build Coastguard Worker [(store (not (loadi32 addr:$dst)), addr:$dst)], IIC_UNARY_MEM>, 445*9880d681SAndroid Build Coastguard Worker OpSize32; 446*9880d681SAndroid Build Coastguard Workerdef NOT64m : RI<0xF7, MRM2m, (outs), (ins i64mem:$dst), "not{q}\t$dst", 447*9880d681SAndroid Build Coastguard Worker [(store (not (loadi64 addr:$dst)), addr:$dst)], IIC_UNARY_MEM>; 448*9880d681SAndroid Build Coastguard Worker} // SchedRW 449*9880d681SAndroid Build Coastguard Worker} // CodeSize 450*9880d681SAndroid Build Coastguard Worker 451*9880d681SAndroid Build Coastguard Worker// TODO: inc/dec is slow for P4, but fast for Pentium-M. 452*9880d681SAndroid Build Coastguard Workerlet Defs = [EFLAGS] in { 453*9880d681SAndroid Build Coastguard Workerlet Constraints = "$src1 = $dst", SchedRW = [WriteALU] in { 454*9880d681SAndroid Build Coastguard Workerlet CodeSize = 2 in 455*9880d681SAndroid Build Coastguard Workerdef INC8r : I<0xFE, MRM0r, (outs GR8 :$dst), (ins GR8 :$src1), 456*9880d681SAndroid Build Coastguard Worker "inc{b}\t$dst", 457*9880d681SAndroid Build Coastguard Worker [(set GR8:$dst, EFLAGS, (X86inc_flag GR8:$src1))], 458*9880d681SAndroid Build Coastguard Worker IIC_UNARY_REG>; 459*9880d681SAndroid Build Coastguard Workerlet isConvertibleToThreeAddress = 1, CodeSize = 2 in { // Can xform into LEA. 460*9880d681SAndroid Build Coastguard Workerdef INC16r : I<0xFF, MRM0r, (outs GR16:$dst), (ins GR16:$src1), 461*9880d681SAndroid Build Coastguard Worker "inc{w}\t$dst", 462*9880d681SAndroid Build Coastguard Worker [(set GR16:$dst, EFLAGS, (X86inc_flag GR16:$src1))], 463*9880d681SAndroid Build Coastguard Worker IIC_UNARY_REG>, OpSize16; 464*9880d681SAndroid Build Coastguard Workerdef INC32r : I<0xFF, MRM0r, (outs GR32:$dst), (ins GR32:$src1), 465*9880d681SAndroid Build Coastguard Worker "inc{l}\t$dst", 466*9880d681SAndroid Build Coastguard Worker [(set GR32:$dst, EFLAGS, (X86inc_flag GR32:$src1))], 467*9880d681SAndroid Build Coastguard Worker IIC_UNARY_REG>, OpSize32; 468*9880d681SAndroid Build Coastguard Workerdef INC64r : RI<0xFF, MRM0r, (outs GR64:$dst), (ins GR64:$src1), "inc{q}\t$dst", 469*9880d681SAndroid Build Coastguard Worker [(set GR64:$dst, EFLAGS, (X86inc_flag GR64:$src1))], 470*9880d681SAndroid Build Coastguard Worker IIC_UNARY_REG>; 471*9880d681SAndroid Build Coastguard Worker} // isConvertibleToThreeAddress = 1, CodeSize = 2 472*9880d681SAndroid Build Coastguard Worker 473*9880d681SAndroid Build Coastguard Worker// Short forms only valid in 32-bit mode. Selected during MCInst lowering. 474*9880d681SAndroid Build Coastguard Workerlet CodeSize = 1, hasSideEffects = 0 in { 475*9880d681SAndroid Build Coastguard Workerdef INC16r_alt : I<0x40, AddRegFrm, (outs GR16:$dst), (ins GR16:$src1), 476*9880d681SAndroid Build Coastguard Worker "inc{w}\t$dst", [], IIC_UNARY_REG>, 477*9880d681SAndroid Build Coastguard Worker OpSize16, Requires<[Not64BitMode]>; 478*9880d681SAndroid Build Coastguard Workerdef INC32r_alt : I<0x40, AddRegFrm, (outs GR32:$dst), (ins GR32:$src1), 479*9880d681SAndroid Build Coastguard Worker "inc{l}\t$dst", [], IIC_UNARY_REG>, 480*9880d681SAndroid Build Coastguard Worker OpSize32, Requires<[Not64BitMode]>; 481*9880d681SAndroid Build Coastguard Worker} // CodeSize = 1, hasSideEffects = 0 482*9880d681SAndroid Build Coastguard Worker} // Constraints = "$src1 = $dst", SchedRW 483*9880d681SAndroid Build Coastguard Worker 484*9880d681SAndroid Build Coastguard Workerlet CodeSize = 2, SchedRW = [WriteALULd, WriteRMW] in { 485*9880d681SAndroid Build Coastguard Worker def INC8m : I<0xFE, MRM0m, (outs), (ins i8mem :$dst), "inc{b}\t$dst", 486*9880d681SAndroid Build Coastguard Worker [(store (add (loadi8 addr:$dst), 1), addr:$dst), 487*9880d681SAndroid Build Coastguard Worker (implicit EFLAGS)], IIC_UNARY_MEM>; 488*9880d681SAndroid Build Coastguard Worker def INC16m : I<0xFF, MRM0m, (outs), (ins i16mem:$dst), "inc{w}\t$dst", 489*9880d681SAndroid Build Coastguard Worker [(store (add (loadi16 addr:$dst), 1), addr:$dst), 490*9880d681SAndroid Build Coastguard Worker (implicit EFLAGS)], IIC_UNARY_MEM>, OpSize16; 491*9880d681SAndroid Build Coastguard Worker def INC32m : I<0xFF, MRM0m, (outs), (ins i32mem:$dst), "inc{l}\t$dst", 492*9880d681SAndroid Build Coastguard Worker [(store (add (loadi32 addr:$dst), 1), addr:$dst), 493*9880d681SAndroid Build Coastguard Worker (implicit EFLAGS)], IIC_UNARY_MEM>, OpSize32; 494*9880d681SAndroid Build Coastguard Worker def INC64m : RI<0xFF, MRM0m, (outs), (ins i64mem:$dst), "inc{q}\t$dst", 495*9880d681SAndroid Build Coastguard Worker [(store (add (loadi64 addr:$dst), 1), addr:$dst), 496*9880d681SAndroid Build Coastguard Worker (implicit EFLAGS)], IIC_UNARY_MEM>; 497*9880d681SAndroid Build Coastguard Worker} // CodeSize = 2, SchedRW 498*9880d681SAndroid Build Coastguard Worker 499*9880d681SAndroid Build Coastguard Workerlet Constraints = "$src1 = $dst", SchedRW = [WriteALU] in { 500*9880d681SAndroid Build Coastguard Workerlet CodeSize = 2 in 501*9880d681SAndroid Build Coastguard Workerdef DEC8r : I<0xFE, MRM1r, (outs GR8 :$dst), (ins GR8 :$src1), 502*9880d681SAndroid Build Coastguard Worker "dec{b}\t$dst", 503*9880d681SAndroid Build Coastguard Worker [(set GR8:$dst, EFLAGS, (X86dec_flag GR8:$src1))], 504*9880d681SAndroid Build Coastguard Worker IIC_UNARY_REG>; 505*9880d681SAndroid Build Coastguard Workerlet isConvertibleToThreeAddress = 1, CodeSize = 2 in { // Can xform into LEA. 506*9880d681SAndroid Build Coastguard Workerdef DEC16r : I<0xFF, MRM1r, (outs GR16:$dst), (ins GR16:$src1), 507*9880d681SAndroid Build Coastguard Worker "dec{w}\t$dst", 508*9880d681SAndroid Build Coastguard Worker [(set GR16:$dst, EFLAGS, (X86dec_flag GR16:$src1))], 509*9880d681SAndroid Build Coastguard Worker IIC_UNARY_REG>, OpSize16; 510*9880d681SAndroid Build Coastguard Workerdef DEC32r : I<0xFF, MRM1r, (outs GR32:$dst), (ins GR32:$src1), 511*9880d681SAndroid Build Coastguard Worker "dec{l}\t$dst", 512*9880d681SAndroid Build Coastguard Worker [(set GR32:$dst, EFLAGS, (X86dec_flag GR32:$src1))], 513*9880d681SAndroid Build Coastguard Worker IIC_UNARY_REG>, OpSize32; 514*9880d681SAndroid Build Coastguard Workerdef DEC64r : RI<0xFF, MRM1r, (outs GR64:$dst), (ins GR64:$src1), "dec{q}\t$dst", 515*9880d681SAndroid Build Coastguard Worker [(set GR64:$dst, EFLAGS, (X86dec_flag GR64:$src1))], 516*9880d681SAndroid Build Coastguard Worker IIC_UNARY_REG>; 517*9880d681SAndroid Build Coastguard Worker} // isConvertibleToThreeAddress = 1, CodeSize = 2 518*9880d681SAndroid Build Coastguard Worker 519*9880d681SAndroid Build Coastguard Worker// Short forms only valid in 32-bit mode. Selected during MCInst lowering. 520*9880d681SAndroid Build Coastguard Workerlet CodeSize = 1, hasSideEffects = 0 in { 521*9880d681SAndroid Build Coastguard Workerdef DEC16r_alt : I<0x48, AddRegFrm, (outs GR16:$dst), (ins GR16:$src1), 522*9880d681SAndroid Build Coastguard Worker "dec{w}\t$dst", [], IIC_UNARY_REG>, 523*9880d681SAndroid Build Coastguard Worker OpSize16, Requires<[Not64BitMode]>; 524*9880d681SAndroid Build Coastguard Workerdef DEC32r_alt : I<0x48, AddRegFrm, (outs GR32:$dst), (ins GR32:$src1), 525*9880d681SAndroid Build Coastguard Worker "dec{l}\t$dst", [], IIC_UNARY_REG>, 526*9880d681SAndroid Build Coastguard Worker OpSize32, Requires<[Not64BitMode]>; 527*9880d681SAndroid Build Coastguard Worker} // CodeSize = 1, hasSideEffects = 0 528*9880d681SAndroid Build Coastguard Worker} // Constraints = "$src1 = $dst", SchedRW 529*9880d681SAndroid Build Coastguard Worker 530*9880d681SAndroid Build Coastguard Worker 531*9880d681SAndroid Build Coastguard Workerlet CodeSize = 2, SchedRW = [WriteALULd, WriteRMW] in { 532*9880d681SAndroid Build Coastguard Worker def DEC8m : I<0xFE, MRM1m, (outs), (ins i8mem :$dst), "dec{b}\t$dst", 533*9880d681SAndroid Build Coastguard Worker [(store (add (loadi8 addr:$dst), -1), addr:$dst), 534*9880d681SAndroid Build Coastguard Worker (implicit EFLAGS)], IIC_UNARY_MEM>; 535*9880d681SAndroid Build Coastguard Worker def DEC16m : I<0xFF, MRM1m, (outs), (ins i16mem:$dst), "dec{w}\t$dst", 536*9880d681SAndroid Build Coastguard Worker [(store (add (loadi16 addr:$dst), -1), addr:$dst), 537*9880d681SAndroid Build Coastguard Worker (implicit EFLAGS)], IIC_UNARY_MEM>, OpSize16; 538*9880d681SAndroid Build Coastguard Worker def DEC32m : I<0xFF, MRM1m, (outs), (ins i32mem:$dst), "dec{l}\t$dst", 539*9880d681SAndroid Build Coastguard Worker [(store (add (loadi32 addr:$dst), -1), addr:$dst), 540*9880d681SAndroid Build Coastguard Worker (implicit EFLAGS)], IIC_UNARY_MEM>, OpSize32; 541*9880d681SAndroid Build Coastguard Worker def DEC64m : RI<0xFF, MRM1m, (outs), (ins i64mem:$dst), "dec{q}\t$dst", 542*9880d681SAndroid Build Coastguard Worker [(store (add (loadi64 addr:$dst), -1), addr:$dst), 543*9880d681SAndroid Build Coastguard Worker (implicit EFLAGS)], IIC_UNARY_MEM>; 544*9880d681SAndroid Build Coastguard Worker} // CodeSize = 2, SchedRW 545*9880d681SAndroid Build Coastguard Worker} // Defs = [EFLAGS] 546*9880d681SAndroid Build Coastguard Worker 547*9880d681SAndroid Build Coastguard Worker/// X86TypeInfo - This is a bunch of information that describes relevant X86 548*9880d681SAndroid Build Coastguard Worker/// information about value types. For example, it can tell you what the 549*9880d681SAndroid Build Coastguard Worker/// register class and preferred load to use. 550*9880d681SAndroid Build Coastguard Workerclass X86TypeInfo<ValueType vt, string instrsuffix, RegisterClass regclass, 551*9880d681SAndroid Build Coastguard Worker PatFrag loadnode, X86MemOperand memoperand, ImmType immkind, 552*9880d681SAndroid Build Coastguard Worker Operand immoperand, SDPatternOperator immoperator, 553*9880d681SAndroid Build Coastguard Worker Operand imm8operand, SDPatternOperator imm8operator, 554*9880d681SAndroid Build Coastguard Worker bit hasOddOpcode, OperandSize opSize, 555*9880d681SAndroid Build Coastguard Worker bit hasREX_WPrefix> { 556*9880d681SAndroid Build Coastguard Worker /// VT - This is the value type itself. 557*9880d681SAndroid Build Coastguard Worker ValueType VT = vt; 558*9880d681SAndroid Build Coastguard Worker 559*9880d681SAndroid Build Coastguard Worker /// InstrSuffix - This is the suffix used on instructions with this type. For 560*9880d681SAndroid Build Coastguard Worker /// example, i8 -> "b", i16 -> "w", i32 -> "l", i64 -> "q". 561*9880d681SAndroid Build Coastguard Worker string InstrSuffix = instrsuffix; 562*9880d681SAndroid Build Coastguard Worker 563*9880d681SAndroid Build Coastguard Worker /// RegClass - This is the register class associated with this type. For 564*9880d681SAndroid Build Coastguard Worker /// example, i8 -> GR8, i16 -> GR16, i32 -> GR32, i64 -> GR64. 565*9880d681SAndroid Build Coastguard Worker RegisterClass RegClass = regclass; 566*9880d681SAndroid Build Coastguard Worker 567*9880d681SAndroid Build Coastguard Worker /// LoadNode - This is the load node associated with this type. For 568*9880d681SAndroid Build Coastguard Worker /// example, i8 -> loadi8, i16 -> loadi16, i32 -> loadi32, i64 -> loadi64. 569*9880d681SAndroid Build Coastguard Worker PatFrag LoadNode = loadnode; 570*9880d681SAndroid Build Coastguard Worker 571*9880d681SAndroid Build Coastguard Worker /// MemOperand - This is the memory operand associated with this type. For 572*9880d681SAndroid Build Coastguard Worker /// example, i8 -> i8mem, i16 -> i16mem, i32 -> i32mem, i64 -> i64mem. 573*9880d681SAndroid Build Coastguard Worker X86MemOperand MemOperand = memoperand; 574*9880d681SAndroid Build Coastguard Worker 575*9880d681SAndroid Build Coastguard Worker /// ImmEncoding - This is the encoding of an immediate of this type. For 576*9880d681SAndroid Build Coastguard Worker /// example, i8 -> Imm8, i16 -> Imm16, i32 -> Imm32. Note that i64 -> Imm32 577*9880d681SAndroid Build Coastguard Worker /// since the immediate fields of i64 instructions is a 32-bit sign extended 578*9880d681SAndroid Build Coastguard Worker /// value. 579*9880d681SAndroid Build Coastguard Worker ImmType ImmEncoding = immkind; 580*9880d681SAndroid Build Coastguard Worker 581*9880d681SAndroid Build Coastguard Worker /// ImmOperand - This is the operand kind of an immediate of this type. For 582*9880d681SAndroid Build Coastguard Worker /// example, i8 -> i8imm, i16 -> i16imm, i32 -> i32imm. Note that i64 -> 583*9880d681SAndroid Build Coastguard Worker /// i64i32imm since the immediate fields of i64 instructions is a 32-bit sign 584*9880d681SAndroid Build Coastguard Worker /// extended value. 585*9880d681SAndroid Build Coastguard Worker Operand ImmOperand = immoperand; 586*9880d681SAndroid Build Coastguard Worker 587*9880d681SAndroid Build Coastguard Worker /// ImmOperator - This is the operator that should be used to match an 588*9880d681SAndroid Build Coastguard Worker /// immediate of this kind in a pattern (e.g. imm, or i64immSExt32). 589*9880d681SAndroid Build Coastguard Worker SDPatternOperator ImmOperator = immoperator; 590*9880d681SAndroid Build Coastguard Worker 591*9880d681SAndroid Build Coastguard Worker /// Imm8Operand - This is the operand kind to use for an imm8 of this type. 592*9880d681SAndroid Build Coastguard Worker /// For example, i8 -> <invalid>, i16 -> i16i8imm, i32 -> i32i8imm. This is 593*9880d681SAndroid Build Coastguard Worker /// only used for instructions that have a sign-extended imm8 field form. 594*9880d681SAndroid Build Coastguard Worker Operand Imm8Operand = imm8operand; 595*9880d681SAndroid Build Coastguard Worker 596*9880d681SAndroid Build Coastguard Worker /// Imm8Operator - This is the operator that should be used to match an 8-bit 597*9880d681SAndroid Build Coastguard Worker /// sign extended immediate of this kind in a pattern (e.g. imm16immSExt8). 598*9880d681SAndroid Build Coastguard Worker SDPatternOperator Imm8Operator = imm8operator; 599*9880d681SAndroid Build Coastguard Worker 600*9880d681SAndroid Build Coastguard Worker /// HasOddOpcode - This bit is true if the instruction should have an odd (as 601*9880d681SAndroid Build Coastguard Worker /// opposed to even) opcode. Operations on i8 are usually even, operations on 602*9880d681SAndroid Build Coastguard Worker /// other datatypes are odd. 603*9880d681SAndroid Build Coastguard Worker bit HasOddOpcode = hasOddOpcode; 604*9880d681SAndroid Build Coastguard Worker 605*9880d681SAndroid Build Coastguard Worker /// OpSize - Selects whether the instruction needs a 0x66 prefix based on 606*9880d681SAndroid Build Coastguard Worker /// 16-bit vs 32-bit mode. i8/i64 set this to OpSizeFixed. i16 sets this 607*9880d681SAndroid Build Coastguard Worker /// to Opsize16. i32 sets this to OpSize32. 608*9880d681SAndroid Build Coastguard Worker OperandSize OpSize = opSize; 609*9880d681SAndroid Build Coastguard Worker 610*9880d681SAndroid Build Coastguard Worker /// HasREX_WPrefix - This bit is set to true if the instruction should have 611*9880d681SAndroid Build Coastguard Worker /// the 0x40 REX prefix. This is set for i64 types. 612*9880d681SAndroid Build Coastguard Worker bit HasREX_WPrefix = hasREX_WPrefix; 613*9880d681SAndroid Build Coastguard Worker} 614*9880d681SAndroid Build Coastguard Worker 615*9880d681SAndroid Build Coastguard Workerdef invalid_node : SDNode<"<<invalid_node>>", SDTIntLeaf,[],"<<invalid_node>>">; 616*9880d681SAndroid Build Coastguard Worker 617*9880d681SAndroid Build Coastguard Worker 618*9880d681SAndroid Build Coastguard Workerdef Xi8 : X86TypeInfo<i8, "b", GR8, loadi8, i8mem, 619*9880d681SAndroid Build Coastguard Worker Imm8, i8imm, imm8_su, i8imm, invalid_node, 620*9880d681SAndroid Build Coastguard Worker 0, OpSizeFixed, 0>; 621*9880d681SAndroid Build Coastguard Workerdef Xi16 : X86TypeInfo<i16, "w", GR16, loadi16, i16mem, 622*9880d681SAndroid Build Coastguard Worker Imm16, i16imm, imm16_su, i16i8imm, i16immSExt8_su, 623*9880d681SAndroid Build Coastguard Worker 1, OpSize16, 0>; 624*9880d681SAndroid Build Coastguard Workerdef Xi32 : X86TypeInfo<i32, "l", GR32, loadi32, i32mem, 625*9880d681SAndroid Build Coastguard Worker Imm32, i32imm, imm32_su, i32i8imm, i32immSExt8_su, 626*9880d681SAndroid Build Coastguard Worker 1, OpSize32, 0>; 627*9880d681SAndroid Build Coastguard Workerdef Xi64 : X86TypeInfo<i64, "q", GR64, loadi64, i64mem, 628*9880d681SAndroid Build Coastguard Worker Imm32S, i64i32imm, i64immSExt32, i64i8imm, i64immSExt8, 629*9880d681SAndroid Build Coastguard Worker 1, OpSizeFixed, 1>; 630*9880d681SAndroid Build Coastguard Worker 631*9880d681SAndroid Build Coastguard Worker/// ITy - This instruction base class takes the type info for the instruction. 632*9880d681SAndroid Build Coastguard Worker/// Using this, it: 633*9880d681SAndroid Build Coastguard Worker/// 1. Concatenates together the instruction mnemonic with the appropriate 634*9880d681SAndroid Build Coastguard Worker/// suffix letter, a tab, and the arguments. 635*9880d681SAndroid Build Coastguard Worker/// 2. Infers whether the instruction should have a 0x66 prefix byte. 636*9880d681SAndroid Build Coastguard Worker/// 3. Infers whether the instruction should have a 0x40 REX_W prefix. 637*9880d681SAndroid Build Coastguard Worker/// 4. Infers whether the low bit of the opcode should be 0 (for i8 operations) 638*9880d681SAndroid Build Coastguard Worker/// or 1 (for i16,i32,i64 operations). 639*9880d681SAndroid Build Coastguard Workerclass ITy<bits<8> opcode, Format f, X86TypeInfo typeinfo, dag outs, dag ins, 640*9880d681SAndroid Build Coastguard Worker string mnemonic, string args, list<dag> pattern, 641*9880d681SAndroid Build Coastguard Worker InstrItinClass itin = IIC_BIN_NONMEM> 642*9880d681SAndroid Build Coastguard Worker : I<{opcode{7}, opcode{6}, opcode{5}, opcode{4}, 643*9880d681SAndroid Build Coastguard Worker opcode{3}, opcode{2}, opcode{1}, typeinfo.HasOddOpcode }, 644*9880d681SAndroid Build Coastguard Worker f, outs, ins, 645*9880d681SAndroid Build Coastguard Worker !strconcat(mnemonic, "{", typeinfo.InstrSuffix, "}\t", args), pattern, 646*9880d681SAndroid Build Coastguard Worker itin> { 647*9880d681SAndroid Build Coastguard Worker 648*9880d681SAndroid Build Coastguard Worker // Infer instruction prefixes from type info. 649*9880d681SAndroid Build Coastguard Worker let OpSize = typeinfo.OpSize; 650*9880d681SAndroid Build Coastguard Worker let hasREX_WPrefix = typeinfo.HasREX_WPrefix; 651*9880d681SAndroid Build Coastguard Worker} 652*9880d681SAndroid Build Coastguard Worker 653*9880d681SAndroid Build Coastguard Worker// BinOpRR - Instructions like "add reg, reg, reg". 654*9880d681SAndroid Build Coastguard Workerclass BinOpRR<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo, 655*9880d681SAndroid Build Coastguard Worker dag outlist, list<dag> pattern, InstrItinClass itin, 656*9880d681SAndroid Build Coastguard Worker Format f = MRMDestReg> 657*9880d681SAndroid Build Coastguard Worker : ITy<opcode, f, typeinfo, outlist, 658*9880d681SAndroid Build Coastguard Worker (ins typeinfo.RegClass:$src1, typeinfo.RegClass:$src2), 659*9880d681SAndroid Build Coastguard Worker mnemonic, "{$src2, $src1|$src1, $src2}", pattern, itin>, 660*9880d681SAndroid Build Coastguard Worker Sched<[WriteALU]>; 661*9880d681SAndroid Build Coastguard Worker 662*9880d681SAndroid Build Coastguard Worker// BinOpRR_F - Instructions like "cmp reg, Reg", where the pattern has 663*9880d681SAndroid Build Coastguard Worker// just a EFLAGS as a result. 664*9880d681SAndroid Build Coastguard Workerclass BinOpRR_F<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo, 665*9880d681SAndroid Build Coastguard Worker SDPatternOperator opnode, Format f = MRMDestReg> 666*9880d681SAndroid Build Coastguard Worker : BinOpRR<opcode, mnemonic, typeinfo, (outs), 667*9880d681SAndroid Build Coastguard Worker [(set EFLAGS, 668*9880d681SAndroid Build Coastguard Worker (opnode typeinfo.RegClass:$src1, typeinfo.RegClass:$src2))], 669*9880d681SAndroid Build Coastguard Worker IIC_BIN_NONMEM, f>; 670*9880d681SAndroid Build Coastguard Worker 671*9880d681SAndroid Build Coastguard Worker// BinOpRR_RF - Instructions like "add reg, reg, reg", where the pattern has 672*9880d681SAndroid Build Coastguard Worker// both a regclass and EFLAGS as a result. 673*9880d681SAndroid Build Coastguard Workerclass BinOpRR_RF<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo, 674*9880d681SAndroid Build Coastguard Worker SDNode opnode> 675*9880d681SAndroid Build Coastguard Worker : BinOpRR<opcode, mnemonic, typeinfo, (outs typeinfo.RegClass:$dst), 676*9880d681SAndroid Build Coastguard Worker [(set typeinfo.RegClass:$dst, EFLAGS, 677*9880d681SAndroid Build Coastguard Worker (opnode typeinfo.RegClass:$src1, typeinfo.RegClass:$src2))], 678*9880d681SAndroid Build Coastguard Worker IIC_BIN_NONMEM>; 679*9880d681SAndroid Build Coastguard Worker 680*9880d681SAndroid Build Coastguard Worker// BinOpRR_RFF - Instructions like "adc reg, reg, reg", where the pattern has 681*9880d681SAndroid Build Coastguard Worker// both a regclass and EFLAGS as a result, and has EFLAGS as input. 682*9880d681SAndroid Build Coastguard Workerclass BinOpRR_RFF<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo, 683*9880d681SAndroid Build Coastguard Worker SDNode opnode> 684*9880d681SAndroid Build Coastguard Worker : BinOpRR<opcode, mnemonic, typeinfo, (outs typeinfo.RegClass:$dst), 685*9880d681SAndroid Build Coastguard Worker [(set typeinfo.RegClass:$dst, EFLAGS, 686*9880d681SAndroid Build Coastguard Worker (opnode typeinfo.RegClass:$src1, typeinfo.RegClass:$src2, 687*9880d681SAndroid Build Coastguard Worker EFLAGS))], IIC_BIN_CARRY_NONMEM>; 688*9880d681SAndroid Build Coastguard Worker 689*9880d681SAndroid Build Coastguard Worker// BinOpRR_Rev - Instructions like "add reg, reg, reg" (reversed encoding). 690*9880d681SAndroid Build Coastguard Workerclass BinOpRR_Rev<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo, 691*9880d681SAndroid Build Coastguard Worker InstrItinClass itin = IIC_BIN_NONMEM> 692*9880d681SAndroid Build Coastguard Worker : ITy<opcode, MRMSrcReg, typeinfo, 693*9880d681SAndroid Build Coastguard Worker (outs typeinfo.RegClass:$dst), 694*9880d681SAndroid Build Coastguard Worker (ins typeinfo.RegClass:$src1, typeinfo.RegClass:$src2), 695*9880d681SAndroid Build Coastguard Worker mnemonic, "{$src2, $dst|$dst, $src2}", [], itin>, 696*9880d681SAndroid Build Coastguard Worker Sched<[WriteALU]> { 697*9880d681SAndroid Build Coastguard Worker // The disassembler should know about this, but not the asmparser. 698*9880d681SAndroid Build Coastguard Worker let isCodeGenOnly = 1; 699*9880d681SAndroid Build Coastguard Worker let ForceDisassemble = 1; 700*9880d681SAndroid Build Coastguard Worker let hasSideEffects = 0; 701*9880d681SAndroid Build Coastguard Worker} 702*9880d681SAndroid Build Coastguard Worker 703*9880d681SAndroid Build Coastguard Worker// BinOpRR_RDD_Rev - Instructions like "adc reg, reg, reg" (reversed encoding). 704*9880d681SAndroid Build Coastguard Workerclass BinOpRR_RFF_Rev<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo> 705*9880d681SAndroid Build Coastguard Worker : BinOpRR_Rev<opcode, mnemonic, typeinfo, IIC_BIN_CARRY_NONMEM>; 706*9880d681SAndroid Build Coastguard Worker 707*9880d681SAndroid Build Coastguard Worker// BinOpRR_F_Rev - Instructions like "cmp reg, reg" (reversed encoding). 708*9880d681SAndroid Build Coastguard Workerclass BinOpRR_F_Rev<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo> 709*9880d681SAndroid Build Coastguard Worker : ITy<opcode, MRMSrcReg, typeinfo, (outs), 710*9880d681SAndroid Build Coastguard Worker (ins typeinfo.RegClass:$src1, typeinfo.RegClass:$src2), 711*9880d681SAndroid Build Coastguard Worker mnemonic, "{$src2, $src1|$src1, $src2}", [], IIC_BIN_NONMEM>, 712*9880d681SAndroid Build Coastguard Worker Sched<[WriteALU]> { 713*9880d681SAndroid Build Coastguard Worker // The disassembler should know about this, but not the asmparser. 714*9880d681SAndroid Build Coastguard Worker let isCodeGenOnly = 1; 715*9880d681SAndroid Build Coastguard Worker let ForceDisassemble = 1; 716*9880d681SAndroid Build Coastguard Worker let hasSideEffects = 0; 717*9880d681SAndroid Build Coastguard Worker} 718*9880d681SAndroid Build Coastguard Worker 719*9880d681SAndroid Build Coastguard Worker// BinOpRM - Instructions like "add reg, reg, [mem]". 720*9880d681SAndroid Build Coastguard Workerclass BinOpRM<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo, 721*9880d681SAndroid Build Coastguard Worker dag outlist, list<dag> pattern, 722*9880d681SAndroid Build Coastguard Worker InstrItinClass itin = IIC_BIN_MEM> 723*9880d681SAndroid Build Coastguard Worker : ITy<opcode, MRMSrcMem, typeinfo, outlist, 724*9880d681SAndroid Build Coastguard Worker (ins typeinfo.RegClass:$src1, typeinfo.MemOperand:$src2), 725*9880d681SAndroid Build Coastguard Worker mnemonic, "{$src2, $src1|$src1, $src2}", pattern, itin>, 726*9880d681SAndroid Build Coastguard Worker Sched<[WriteALULd, ReadAfterLd]>; 727*9880d681SAndroid Build Coastguard Worker 728*9880d681SAndroid Build Coastguard Worker// BinOpRM_R - Instructions like "add reg, reg, [mem]". 729*9880d681SAndroid Build Coastguard Workerclass BinOpRM_R<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo, 730*9880d681SAndroid Build Coastguard Worker SDNode opnode> 731*9880d681SAndroid Build Coastguard Worker : BinOpRM<opcode, mnemonic, typeinfo, (outs typeinfo.RegClass:$dst), 732*9880d681SAndroid Build Coastguard Worker [(set typeinfo.RegClass:$dst, 733*9880d681SAndroid Build Coastguard Worker (opnode typeinfo.RegClass:$src1, (typeinfo.LoadNode addr:$src2)))]>; 734*9880d681SAndroid Build Coastguard Worker 735*9880d681SAndroid Build Coastguard Worker// BinOpRM_F - Instructions like "cmp reg, [mem]". 736*9880d681SAndroid Build Coastguard Workerclass BinOpRM_F<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo, 737*9880d681SAndroid Build Coastguard Worker SDPatternOperator opnode> 738*9880d681SAndroid Build Coastguard Worker : BinOpRM<opcode, mnemonic, typeinfo, (outs), 739*9880d681SAndroid Build Coastguard Worker [(set EFLAGS, 740*9880d681SAndroid Build Coastguard Worker (opnode typeinfo.RegClass:$src1, (typeinfo.LoadNode addr:$src2)))]>; 741*9880d681SAndroid Build Coastguard Worker 742*9880d681SAndroid Build Coastguard Worker// BinOpRM_RF - Instructions like "add reg, reg, [mem]". 743*9880d681SAndroid Build Coastguard Workerclass BinOpRM_RF<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo, 744*9880d681SAndroid Build Coastguard Worker SDNode opnode> 745*9880d681SAndroid Build Coastguard Worker : BinOpRM<opcode, mnemonic, typeinfo, (outs typeinfo.RegClass:$dst), 746*9880d681SAndroid Build Coastguard Worker [(set typeinfo.RegClass:$dst, EFLAGS, 747*9880d681SAndroid Build Coastguard Worker (opnode typeinfo.RegClass:$src1, (typeinfo.LoadNode addr:$src2)))]>; 748*9880d681SAndroid Build Coastguard Worker 749*9880d681SAndroid Build Coastguard Worker// BinOpRM_RFF - Instructions like "adc reg, reg, [mem]". 750*9880d681SAndroid Build Coastguard Workerclass BinOpRM_RFF<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo, 751*9880d681SAndroid Build Coastguard Worker SDNode opnode> 752*9880d681SAndroid Build Coastguard Worker : BinOpRM<opcode, mnemonic, typeinfo, (outs typeinfo.RegClass:$dst), 753*9880d681SAndroid Build Coastguard Worker [(set typeinfo.RegClass:$dst, EFLAGS, 754*9880d681SAndroid Build Coastguard Worker (opnode typeinfo.RegClass:$src1, (typeinfo.LoadNode addr:$src2), 755*9880d681SAndroid Build Coastguard Worker EFLAGS))], IIC_BIN_CARRY_MEM>; 756*9880d681SAndroid Build Coastguard Worker 757*9880d681SAndroid Build Coastguard Worker// BinOpRI - Instructions like "add reg, reg, imm". 758*9880d681SAndroid Build Coastguard Workerclass BinOpRI<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo, 759*9880d681SAndroid Build Coastguard Worker Format f, dag outlist, list<dag> pattern, 760*9880d681SAndroid Build Coastguard Worker InstrItinClass itin = IIC_BIN_NONMEM> 761*9880d681SAndroid Build Coastguard Worker : ITy<opcode, f, typeinfo, outlist, 762*9880d681SAndroid Build Coastguard Worker (ins typeinfo.RegClass:$src1, typeinfo.ImmOperand:$src2), 763*9880d681SAndroid Build Coastguard Worker mnemonic, "{$src2, $src1|$src1, $src2}", pattern, itin>, 764*9880d681SAndroid Build Coastguard Worker Sched<[WriteALU]> { 765*9880d681SAndroid Build Coastguard Worker let ImmT = typeinfo.ImmEncoding; 766*9880d681SAndroid Build Coastguard Worker} 767*9880d681SAndroid Build Coastguard Worker 768*9880d681SAndroid Build Coastguard Worker// BinOpRI_F - Instructions like "cmp reg, imm". 769*9880d681SAndroid Build Coastguard Workerclass BinOpRI_F<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo, 770*9880d681SAndroid Build Coastguard Worker SDPatternOperator opnode, Format f> 771*9880d681SAndroid Build Coastguard Worker : BinOpRI<opcode, mnemonic, typeinfo, f, (outs), 772*9880d681SAndroid Build Coastguard Worker [(set EFLAGS, 773*9880d681SAndroid Build Coastguard Worker (opnode typeinfo.RegClass:$src1, typeinfo.ImmOperator:$src2))]>; 774*9880d681SAndroid Build Coastguard Worker 775*9880d681SAndroid Build Coastguard Worker// BinOpRI_RF - Instructions like "add reg, reg, imm". 776*9880d681SAndroid Build Coastguard Workerclass BinOpRI_RF<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo, 777*9880d681SAndroid Build Coastguard Worker SDNode opnode, Format f> 778*9880d681SAndroid Build Coastguard Worker : BinOpRI<opcode, mnemonic, typeinfo, f, (outs typeinfo.RegClass:$dst), 779*9880d681SAndroid Build Coastguard Worker [(set typeinfo.RegClass:$dst, EFLAGS, 780*9880d681SAndroid Build Coastguard Worker (opnode typeinfo.RegClass:$src1, typeinfo.ImmOperator:$src2))]>; 781*9880d681SAndroid Build Coastguard Worker// BinOpRI_RFF - Instructions like "adc reg, reg, imm". 782*9880d681SAndroid Build Coastguard Workerclass BinOpRI_RFF<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo, 783*9880d681SAndroid Build Coastguard Worker SDNode opnode, Format f> 784*9880d681SAndroid Build Coastguard Worker : BinOpRI<opcode, mnemonic, typeinfo, f, (outs typeinfo.RegClass:$dst), 785*9880d681SAndroid Build Coastguard Worker [(set typeinfo.RegClass:$dst, EFLAGS, 786*9880d681SAndroid Build Coastguard Worker (opnode typeinfo.RegClass:$src1, typeinfo.ImmOperator:$src2, 787*9880d681SAndroid Build Coastguard Worker EFLAGS))], IIC_BIN_CARRY_NONMEM>; 788*9880d681SAndroid Build Coastguard Worker 789*9880d681SAndroid Build Coastguard Worker// BinOpRI8 - Instructions like "add reg, reg, imm8". 790*9880d681SAndroid Build Coastguard Workerclass BinOpRI8<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo, 791*9880d681SAndroid Build Coastguard Worker Format f, dag outlist, list<dag> pattern, 792*9880d681SAndroid Build Coastguard Worker InstrItinClass itin = IIC_BIN_NONMEM> 793*9880d681SAndroid Build Coastguard Worker : ITy<opcode, f, typeinfo, outlist, 794*9880d681SAndroid Build Coastguard Worker (ins typeinfo.RegClass:$src1, typeinfo.Imm8Operand:$src2), 795*9880d681SAndroid Build Coastguard Worker mnemonic, "{$src2, $src1|$src1, $src2}", pattern, itin>, 796*9880d681SAndroid Build Coastguard Worker Sched<[WriteALU]> { 797*9880d681SAndroid Build Coastguard Worker let ImmT = Imm8; // Always 8-bit immediate. 798*9880d681SAndroid Build Coastguard Worker} 799*9880d681SAndroid Build Coastguard Worker 800*9880d681SAndroid Build Coastguard Worker// BinOpRI8_F - Instructions like "cmp reg, imm8". 801*9880d681SAndroid Build Coastguard Workerclass BinOpRI8_F<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo, 802*9880d681SAndroid Build Coastguard Worker SDPatternOperator opnode, Format f> 803*9880d681SAndroid Build Coastguard Worker : BinOpRI8<opcode, mnemonic, typeinfo, f, (outs), 804*9880d681SAndroid Build Coastguard Worker [(set EFLAGS, 805*9880d681SAndroid Build Coastguard Worker (opnode typeinfo.RegClass:$src1, typeinfo.Imm8Operator:$src2))]>; 806*9880d681SAndroid Build Coastguard Worker 807*9880d681SAndroid Build Coastguard Worker// BinOpRI8_RF - Instructions like "add reg, reg, imm8". 808*9880d681SAndroid Build Coastguard Workerclass BinOpRI8_RF<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo, 809*9880d681SAndroid Build Coastguard Worker SDPatternOperator opnode, Format f> 810*9880d681SAndroid Build Coastguard Worker : BinOpRI8<opcode, mnemonic, typeinfo, f, (outs typeinfo.RegClass:$dst), 811*9880d681SAndroid Build Coastguard Worker [(set typeinfo.RegClass:$dst, EFLAGS, 812*9880d681SAndroid Build Coastguard Worker (opnode typeinfo.RegClass:$src1, typeinfo.Imm8Operator:$src2))]>; 813*9880d681SAndroid Build Coastguard Worker 814*9880d681SAndroid Build Coastguard Worker// BinOpRI8_RFF - Instructions like "adc reg, reg, imm8". 815*9880d681SAndroid Build Coastguard Workerclass BinOpRI8_RFF<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo, 816*9880d681SAndroid Build Coastguard Worker SDPatternOperator opnode, Format f> 817*9880d681SAndroid Build Coastguard Worker : BinOpRI8<opcode, mnemonic, typeinfo, f, (outs typeinfo.RegClass:$dst), 818*9880d681SAndroid Build Coastguard Worker [(set typeinfo.RegClass:$dst, EFLAGS, 819*9880d681SAndroid Build Coastguard Worker (opnode typeinfo.RegClass:$src1, typeinfo.Imm8Operator:$src2, 820*9880d681SAndroid Build Coastguard Worker EFLAGS))], IIC_BIN_CARRY_NONMEM>; 821*9880d681SAndroid Build Coastguard Worker 822*9880d681SAndroid Build Coastguard Worker// BinOpMR - Instructions like "add [mem], reg". 823*9880d681SAndroid Build Coastguard Workerclass BinOpMR<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo, 824*9880d681SAndroid Build Coastguard Worker list<dag> pattern, InstrItinClass itin = IIC_BIN_MEM> 825*9880d681SAndroid Build Coastguard Worker : ITy<opcode, MRMDestMem, typeinfo, 826*9880d681SAndroid Build Coastguard Worker (outs), (ins typeinfo.MemOperand:$dst, typeinfo.RegClass:$src), 827*9880d681SAndroid Build Coastguard Worker mnemonic, "{$src, $dst|$dst, $src}", pattern, itin>, 828*9880d681SAndroid Build Coastguard Worker Sched<[WriteALULd, WriteRMW]>; 829*9880d681SAndroid Build Coastguard Worker 830*9880d681SAndroid Build Coastguard Worker// BinOpMR_RMW - Instructions like "add [mem], reg". 831*9880d681SAndroid Build Coastguard Workerclass BinOpMR_RMW<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo, 832*9880d681SAndroid Build Coastguard Worker SDNode opnode> 833*9880d681SAndroid Build Coastguard Worker : BinOpMR<opcode, mnemonic, typeinfo, 834*9880d681SAndroid Build Coastguard Worker [(store (opnode (load addr:$dst), typeinfo.RegClass:$src), addr:$dst), 835*9880d681SAndroid Build Coastguard Worker (implicit EFLAGS)]>; 836*9880d681SAndroid Build Coastguard Worker 837*9880d681SAndroid Build Coastguard Worker// BinOpMR_RMW_FF - Instructions like "adc [mem], reg". 838*9880d681SAndroid Build Coastguard Workerclass BinOpMR_RMW_FF<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo, 839*9880d681SAndroid Build Coastguard Worker SDNode opnode> 840*9880d681SAndroid Build Coastguard Worker : BinOpMR<opcode, mnemonic, typeinfo, 841*9880d681SAndroid Build Coastguard Worker [(store (opnode (load addr:$dst), typeinfo.RegClass:$src, EFLAGS), 842*9880d681SAndroid Build Coastguard Worker addr:$dst), 843*9880d681SAndroid Build Coastguard Worker (implicit EFLAGS)], IIC_BIN_CARRY_MEM>; 844*9880d681SAndroid Build Coastguard Worker 845*9880d681SAndroid Build Coastguard Worker// BinOpMR_F - Instructions like "cmp [mem], reg". 846*9880d681SAndroid Build Coastguard Workerclass BinOpMR_F<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo, 847*9880d681SAndroid Build Coastguard Worker SDNode opnode> 848*9880d681SAndroid Build Coastguard Worker : BinOpMR<opcode, mnemonic, typeinfo, 849*9880d681SAndroid Build Coastguard Worker [(set EFLAGS, (opnode (load addr:$dst), typeinfo.RegClass:$src))]>; 850*9880d681SAndroid Build Coastguard Worker 851*9880d681SAndroid Build Coastguard Worker// BinOpMI - Instructions like "add [mem], imm". 852*9880d681SAndroid Build Coastguard Workerclass BinOpMI<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo, 853*9880d681SAndroid Build Coastguard Worker Format f, list<dag> pattern, 854*9880d681SAndroid Build Coastguard Worker InstrItinClass itin = IIC_BIN_MEM> 855*9880d681SAndroid Build Coastguard Worker : ITy<opcode, f, typeinfo, 856*9880d681SAndroid Build Coastguard Worker (outs), (ins typeinfo.MemOperand:$dst, typeinfo.ImmOperand:$src), 857*9880d681SAndroid Build Coastguard Worker mnemonic, "{$src, $dst|$dst, $src}", pattern, itin>, 858*9880d681SAndroid Build Coastguard Worker Sched<[WriteALULd, WriteRMW]> { 859*9880d681SAndroid Build Coastguard Worker let ImmT = typeinfo.ImmEncoding; 860*9880d681SAndroid Build Coastguard Worker} 861*9880d681SAndroid Build Coastguard Worker 862*9880d681SAndroid Build Coastguard Worker// BinOpMI_RMW - Instructions like "add [mem], imm". 863*9880d681SAndroid Build Coastguard Workerclass BinOpMI_RMW<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo, 864*9880d681SAndroid Build Coastguard Worker SDNode opnode, Format f> 865*9880d681SAndroid Build Coastguard Worker : BinOpMI<opcode, mnemonic, typeinfo, f, 866*9880d681SAndroid Build Coastguard Worker [(store (opnode (typeinfo.VT (load addr:$dst)), 867*9880d681SAndroid Build Coastguard Worker typeinfo.ImmOperator:$src), addr:$dst), 868*9880d681SAndroid Build Coastguard Worker (implicit EFLAGS)]>; 869*9880d681SAndroid Build Coastguard Worker// BinOpMI_RMW_FF - Instructions like "adc [mem], imm". 870*9880d681SAndroid Build Coastguard Workerclass BinOpMI_RMW_FF<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo, 871*9880d681SAndroid Build Coastguard Worker SDNode opnode, Format f> 872*9880d681SAndroid Build Coastguard Worker : BinOpMI<opcode, mnemonic, typeinfo, f, 873*9880d681SAndroid Build Coastguard Worker [(store (opnode (typeinfo.VT (load addr:$dst)), 874*9880d681SAndroid Build Coastguard Worker typeinfo.ImmOperator:$src, EFLAGS), addr:$dst), 875*9880d681SAndroid Build Coastguard Worker (implicit EFLAGS)], IIC_BIN_CARRY_MEM>; 876*9880d681SAndroid Build Coastguard Worker 877*9880d681SAndroid Build Coastguard Worker// BinOpMI_F - Instructions like "cmp [mem], imm". 878*9880d681SAndroid Build Coastguard Workerclass BinOpMI_F<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo, 879*9880d681SAndroid Build Coastguard Worker SDPatternOperator opnode, Format f> 880*9880d681SAndroid Build Coastguard Worker : BinOpMI<opcode, mnemonic, typeinfo, f, 881*9880d681SAndroid Build Coastguard Worker [(set EFLAGS, (opnode (typeinfo.VT (load addr:$dst)), 882*9880d681SAndroid Build Coastguard Worker typeinfo.ImmOperator:$src))]>; 883*9880d681SAndroid Build Coastguard Worker 884*9880d681SAndroid Build Coastguard Worker// BinOpMI8 - Instructions like "add [mem], imm8". 885*9880d681SAndroid Build Coastguard Workerclass BinOpMI8<string mnemonic, X86TypeInfo typeinfo, 886*9880d681SAndroid Build Coastguard Worker Format f, list<dag> pattern, 887*9880d681SAndroid Build Coastguard Worker InstrItinClass itin = IIC_BIN_MEM> 888*9880d681SAndroid Build Coastguard Worker : ITy<0x82, f, typeinfo, 889*9880d681SAndroid Build Coastguard Worker (outs), (ins typeinfo.MemOperand:$dst, typeinfo.Imm8Operand:$src), 890*9880d681SAndroid Build Coastguard Worker mnemonic, "{$src, $dst|$dst, $src}", pattern, itin>, 891*9880d681SAndroid Build Coastguard Worker Sched<[WriteALULd, WriteRMW]> { 892*9880d681SAndroid Build Coastguard Worker let ImmT = Imm8; // Always 8-bit immediate. 893*9880d681SAndroid Build Coastguard Worker} 894*9880d681SAndroid Build Coastguard Worker 895*9880d681SAndroid Build Coastguard Worker// BinOpMI8_RMW - Instructions like "add [mem], imm8". 896*9880d681SAndroid Build Coastguard Workerclass BinOpMI8_RMW<string mnemonic, X86TypeInfo typeinfo, 897*9880d681SAndroid Build Coastguard Worker SDPatternOperator opnode, Format f> 898*9880d681SAndroid Build Coastguard Worker : BinOpMI8<mnemonic, typeinfo, f, 899*9880d681SAndroid Build Coastguard Worker [(store (opnode (load addr:$dst), 900*9880d681SAndroid Build Coastguard Worker typeinfo.Imm8Operator:$src), addr:$dst), 901*9880d681SAndroid Build Coastguard Worker (implicit EFLAGS)]>; 902*9880d681SAndroid Build Coastguard Worker 903*9880d681SAndroid Build Coastguard Worker// BinOpMI8_RMW_FF - Instructions like "adc [mem], imm8". 904*9880d681SAndroid Build Coastguard Workerclass BinOpMI8_RMW_FF<string mnemonic, X86TypeInfo typeinfo, 905*9880d681SAndroid Build Coastguard Worker SDPatternOperator opnode, Format f> 906*9880d681SAndroid Build Coastguard Worker : BinOpMI8<mnemonic, typeinfo, f, 907*9880d681SAndroid Build Coastguard Worker [(store (opnode (load addr:$dst), 908*9880d681SAndroid Build Coastguard Worker typeinfo.Imm8Operator:$src, EFLAGS), addr:$dst), 909*9880d681SAndroid Build Coastguard Worker (implicit EFLAGS)], IIC_BIN_CARRY_MEM>; 910*9880d681SAndroid Build Coastguard Worker 911*9880d681SAndroid Build Coastguard Worker// BinOpMI8_F - Instructions like "cmp [mem], imm8". 912*9880d681SAndroid Build Coastguard Workerclass BinOpMI8_F<string mnemonic, X86TypeInfo typeinfo, 913*9880d681SAndroid Build Coastguard Worker SDPatternOperator opnode, Format f> 914*9880d681SAndroid Build Coastguard Worker : BinOpMI8<mnemonic, typeinfo, f, 915*9880d681SAndroid Build Coastguard Worker [(set EFLAGS, (opnode (load addr:$dst), 916*9880d681SAndroid Build Coastguard Worker typeinfo.Imm8Operator:$src))]>; 917*9880d681SAndroid Build Coastguard Worker 918*9880d681SAndroid Build Coastguard Worker// BinOpAI - Instructions like "add %eax, %eax, imm", that imp-def EFLAGS. 919*9880d681SAndroid Build Coastguard Workerclass BinOpAI<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo, 920*9880d681SAndroid Build Coastguard Worker Register areg, string operands, 921*9880d681SAndroid Build Coastguard Worker InstrItinClass itin = IIC_BIN_NONMEM> 922*9880d681SAndroid Build Coastguard Worker : ITy<opcode, RawFrm, typeinfo, 923*9880d681SAndroid Build Coastguard Worker (outs), (ins typeinfo.ImmOperand:$src), 924*9880d681SAndroid Build Coastguard Worker mnemonic, operands, [], itin>, Sched<[WriteALU]> { 925*9880d681SAndroid Build Coastguard Worker let ImmT = typeinfo.ImmEncoding; 926*9880d681SAndroid Build Coastguard Worker let Uses = [areg]; 927*9880d681SAndroid Build Coastguard Worker let Defs = [areg, EFLAGS]; 928*9880d681SAndroid Build Coastguard Worker let hasSideEffects = 0; 929*9880d681SAndroid Build Coastguard Worker} 930*9880d681SAndroid Build Coastguard Worker 931*9880d681SAndroid Build Coastguard Worker// BinOpAI_RFF - Instructions like "adc %eax, %eax, imm", that implicitly define 932*9880d681SAndroid Build Coastguard Worker// and use EFLAGS. 933*9880d681SAndroid Build Coastguard Workerclass BinOpAI_RFF<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo, 934*9880d681SAndroid Build Coastguard Worker Register areg, string operands> 935*9880d681SAndroid Build Coastguard Worker : BinOpAI<opcode, mnemonic, typeinfo, areg, operands, 936*9880d681SAndroid Build Coastguard Worker IIC_BIN_CARRY_NONMEM> { 937*9880d681SAndroid Build Coastguard Worker let Uses = [areg, EFLAGS]; 938*9880d681SAndroid Build Coastguard Worker} 939*9880d681SAndroid Build Coastguard Worker 940*9880d681SAndroid Build Coastguard Worker// BinOpAI_F - Instructions like "cmp %eax, %eax, imm", that imp-def EFLAGS. 941*9880d681SAndroid Build Coastguard Workerclass BinOpAI_F<bits<8> opcode, string mnemonic, X86TypeInfo typeinfo, 942*9880d681SAndroid Build Coastguard Worker Register areg, string operands> 943*9880d681SAndroid Build Coastguard Worker : BinOpAI<opcode, mnemonic, typeinfo, areg, operands> { 944*9880d681SAndroid Build Coastguard Worker let Defs = [EFLAGS]; 945*9880d681SAndroid Build Coastguard Worker} 946*9880d681SAndroid Build Coastguard Worker 947*9880d681SAndroid Build Coastguard Worker/// ArithBinOp_RF - This is an arithmetic binary operator where the pattern is 948*9880d681SAndroid Build Coastguard Worker/// defined with "(set GPR:$dst, EFLAGS, (...". 949*9880d681SAndroid Build Coastguard Worker/// 950*9880d681SAndroid Build Coastguard Worker/// It would be nice to get rid of the second and third argument here, but 951*9880d681SAndroid Build Coastguard Worker/// tblgen can't handle dependent type references aggressively enough: PR8330 952*9880d681SAndroid Build Coastguard Workermulticlass ArithBinOp_RF<bits<8> BaseOpc, bits<8> BaseOpc2, bits<8> BaseOpc4, 953*9880d681SAndroid Build Coastguard Worker string mnemonic, Format RegMRM, Format MemMRM, 954*9880d681SAndroid Build Coastguard Worker SDNode opnodeflag, SDNode opnode, 955*9880d681SAndroid Build Coastguard Worker bit CommutableRR, bit ConvertibleToThreeAddress> { 956*9880d681SAndroid Build Coastguard Worker let Defs = [EFLAGS] in { 957*9880d681SAndroid Build Coastguard Worker let Constraints = "$src1 = $dst" in { 958*9880d681SAndroid Build Coastguard Worker let isCommutable = CommutableRR in { 959*9880d681SAndroid Build Coastguard Worker def NAME#8rr : BinOpRR_RF<BaseOpc, mnemonic, Xi8 , opnodeflag>; 960*9880d681SAndroid Build Coastguard Worker let isConvertibleToThreeAddress = ConvertibleToThreeAddress in { 961*9880d681SAndroid Build Coastguard Worker def NAME#16rr : BinOpRR_RF<BaseOpc, mnemonic, Xi16, opnodeflag>; 962*9880d681SAndroid Build Coastguard Worker def NAME#32rr : BinOpRR_RF<BaseOpc, mnemonic, Xi32, opnodeflag>; 963*9880d681SAndroid Build Coastguard Worker def NAME#64rr : BinOpRR_RF<BaseOpc, mnemonic, Xi64, opnodeflag>; 964*9880d681SAndroid Build Coastguard Worker } // isConvertibleToThreeAddress 965*9880d681SAndroid Build Coastguard Worker } // isCommutable 966*9880d681SAndroid Build Coastguard Worker 967*9880d681SAndroid Build Coastguard Worker def NAME#8rr_REV : BinOpRR_Rev<BaseOpc2, mnemonic, Xi8>; 968*9880d681SAndroid Build Coastguard Worker def NAME#16rr_REV : BinOpRR_Rev<BaseOpc2, mnemonic, Xi16>; 969*9880d681SAndroid Build Coastguard Worker def NAME#32rr_REV : BinOpRR_Rev<BaseOpc2, mnemonic, Xi32>; 970*9880d681SAndroid Build Coastguard Worker def NAME#64rr_REV : BinOpRR_Rev<BaseOpc2, mnemonic, Xi64>; 971*9880d681SAndroid Build Coastguard Worker 972*9880d681SAndroid Build Coastguard Worker def NAME#8rm : BinOpRM_RF<BaseOpc2, mnemonic, Xi8 , opnodeflag>; 973*9880d681SAndroid Build Coastguard Worker def NAME#16rm : BinOpRM_RF<BaseOpc2, mnemonic, Xi16, opnodeflag>; 974*9880d681SAndroid Build Coastguard Worker def NAME#32rm : BinOpRM_RF<BaseOpc2, mnemonic, Xi32, opnodeflag>; 975*9880d681SAndroid Build Coastguard Worker def NAME#64rm : BinOpRM_RF<BaseOpc2, mnemonic, Xi64, opnodeflag>; 976*9880d681SAndroid Build Coastguard Worker 977*9880d681SAndroid Build Coastguard Worker def NAME#8ri : BinOpRI_RF<0x80, mnemonic, Xi8 , opnodeflag, RegMRM>; 978*9880d681SAndroid Build Coastguard Worker 979*9880d681SAndroid Build Coastguard Worker let isConvertibleToThreeAddress = ConvertibleToThreeAddress in { 980*9880d681SAndroid Build Coastguard Worker // NOTE: These are order specific, we want the ri8 forms to be listed 981*9880d681SAndroid Build Coastguard Worker // first so that they are slightly preferred to the ri forms. 982*9880d681SAndroid Build Coastguard Worker def NAME#16ri8 : BinOpRI8_RF<0x82, mnemonic, Xi16, opnodeflag, RegMRM>; 983*9880d681SAndroid Build Coastguard Worker def NAME#32ri8 : BinOpRI8_RF<0x82, mnemonic, Xi32, opnodeflag, RegMRM>; 984*9880d681SAndroid Build Coastguard Worker def NAME#64ri8 : BinOpRI8_RF<0x82, mnemonic, Xi64, opnodeflag, RegMRM>; 985*9880d681SAndroid Build Coastguard Worker 986*9880d681SAndroid Build Coastguard Worker def NAME#16ri : BinOpRI_RF<0x80, mnemonic, Xi16, opnodeflag, RegMRM>; 987*9880d681SAndroid Build Coastguard Worker def NAME#32ri : BinOpRI_RF<0x80, mnemonic, Xi32, opnodeflag, RegMRM>; 988*9880d681SAndroid Build Coastguard Worker def NAME#64ri32: BinOpRI_RF<0x80, mnemonic, Xi64, opnodeflag, RegMRM>; 989*9880d681SAndroid Build Coastguard Worker } 990*9880d681SAndroid Build Coastguard Worker } // Constraints = "$src1 = $dst" 991*9880d681SAndroid Build Coastguard Worker 992*9880d681SAndroid Build Coastguard Worker def NAME#8mr : BinOpMR_RMW<BaseOpc, mnemonic, Xi8 , opnode>; 993*9880d681SAndroid Build Coastguard Worker def NAME#16mr : BinOpMR_RMW<BaseOpc, mnemonic, Xi16, opnode>; 994*9880d681SAndroid Build Coastguard Worker def NAME#32mr : BinOpMR_RMW<BaseOpc, mnemonic, Xi32, opnode>; 995*9880d681SAndroid Build Coastguard Worker def NAME#64mr : BinOpMR_RMW<BaseOpc, mnemonic, Xi64, opnode>; 996*9880d681SAndroid Build Coastguard Worker 997*9880d681SAndroid Build Coastguard Worker // NOTE: These are order specific, we want the mi8 forms to be listed 998*9880d681SAndroid Build Coastguard Worker // first so that they are slightly preferred to the mi forms. 999*9880d681SAndroid Build Coastguard Worker def NAME#16mi8 : BinOpMI8_RMW<mnemonic, Xi16, opnode, MemMRM>; 1000*9880d681SAndroid Build Coastguard Worker def NAME#32mi8 : BinOpMI8_RMW<mnemonic, Xi32, opnode, MemMRM>; 1001*9880d681SAndroid Build Coastguard Worker def NAME#64mi8 : BinOpMI8_RMW<mnemonic, Xi64, opnode, MemMRM>; 1002*9880d681SAndroid Build Coastguard Worker 1003*9880d681SAndroid Build Coastguard Worker def NAME#8mi : BinOpMI_RMW<0x80, mnemonic, Xi8 , opnode, MemMRM>; 1004*9880d681SAndroid Build Coastguard Worker def NAME#16mi : BinOpMI_RMW<0x80, mnemonic, Xi16, opnode, MemMRM>; 1005*9880d681SAndroid Build Coastguard Worker def NAME#32mi : BinOpMI_RMW<0x80, mnemonic, Xi32, opnode, MemMRM>; 1006*9880d681SAndroid Build Coastguard Worker def NAME#64mi32 : BinOpMI_RMW<0x80, mnemonic, Xi64, opnode, MemMRM>; 1007*9880d681SAndroid Build Coastguard Worker 1008*9880d681SAndroid Build Coastguard Worker // These are for the disassembler since 0x82 opcode behaves like 0x80, but 1009*9880d681SAndroid Build Coastguard Worker // not in 64-bit mode. 1010*9880d681SAndroid Build Coastguard Worker let Predicates = [Not64BitMode], isCodeGenOnly = 1, ForceDisassemble = 1, 1011*9880d681SAndroid Build Coastguard Worker hasSideEffects = 0 in { 1012*9880d681SAndroid Build Coastguard Worker let Constraints = "$src1 = $dst" in 1013*9880d681SAndroid Build Coastguard Worker def NAME#8ri8 : BinOpRI8_RF<0x82, mnemonic, Xi8, null_frag, RegMRM>; 1014*9880d681SAndroid Build Coastguard Worker let mayLoad = 1, mayStore = 1 in 1015*9880d681SAndroid Build Coastguard Worker def NAME#8mi8 : BinOpMI8_RMW<mnemonic, Xi8, null_frag, MemMRM>; 1016*9880d681SAndroid Build Coastguard Worker } 1017*9880d681SAndroid Build Coastguard Worker } // Defs = [EFLAGS] 1018*9880d681SAndroid Build Coastguard Worker 1019*9880d681SAndroid Build Coastguard Worker def NAME#8i8 : BinOpAI<BaseOpc4, mnemonic, Xi8 , AL, 1020*9880d681SAndroid Build Coastguard Worker "{$src, %al|al, $src}">; 1021*9880d681SAndroid Build Coastguard Worker def NAME#16i16 : BinOpAI<BaseOpc4, mnemonic, Xi16, AX, 1022*9880d681SAndroid Build Coastguard Worker "{$src, %ax|ax, $src}">; 1023*9880d681SAndroid Build Coastguard Worker def NAME#32i32 : BinOpAI<BaseOpc4, mnemonic, Xi32, EAX, 1024*9880d681SAndroid Build Coastguard Worker "{$src, %eax|eax, $src}">; 1025*9880d681SAndroid Build Coastguard Worker def NAME#64i32 : BinOpAI<BaseOpc4, mnemonic, Xi64, RAX, 1026*9880d681SAndroid Build Coastguard Worker "{$src, %rax|rax, $src}">; 1027*9880d681SAndroid Build Coastguard Worker} 1028*9880d681SAndroid Build Coastguard Worker 1029*9880d681SAndroid Build Coastguard Worker/// ArithBinOp_RFF - This is an arithmetic binary operator where the pattern is 1030*9880d681SAndroid Build Coastguard Worker/// defined with "(set GPR:$dst, EFLAGS, (node LHS, RHS, EFLAGS))" like ADC and 1031*9880d681SAndroid Build Coastguard Worker/// SBB. 1032*9880d681SAndroid Build Coastguard Worker/// 1033*9880d681SAndroid Build Coastguard Worker/// It would be nice to get rid of the second and third argument here, but 1034*9880d681SAndroid Build Coastguard Worker/// tblgen can't handle dependent type references aggressively enough: PR8330 1035*9880d681SAndroid Build Coastguard Workermulticlass ArithBinOp_RFF<bits<8> BaseOpc, bits<8> BaseOpc2, bits<8> BaseOpc4, 1036*9880d681SAndroid Build Coastguard Worker string mnemonic, Format RegMRM, Format MemMRM, 1037*9880d681SAndroid Build Coastguard Worker SDNode opnode, bit CommutableRR, 1038*9880d681SAndroid Build Coastguard Worker bit ConvertibleToThreeAddress> { 1039*9880d681SAndroid Build Coastguard Worker let Uses = [EFLAGS], Defs = [EFLAGS] in { 1040*9880d681SAndroid Build Coastguard Worker let Constraints = "$src1 = $dst" in { 1041*9880d681SAndroid Build Coastguard Worker let isCommutable = CommutableRR in { 1042*9880d681SAndroid Build Coastguard Worker def NAME#8rr : BinOpRR_RFF<BaseOpc, mnemonic, Xi8 , opnode>; 1043*9880d681SAndroid Build Coastguard Worker let isConvertibleToThreeAddress = ConvertibleToThreeAddress in { 1044*9880d681SAndroid Build Coastguard Worker def NAME#16rr : BinOpRR_RFF<BaseOpc, mnemonic, Xi16, opnode>; 1045*9880d681SAndroid Build Coastguard Worker def NAME#32rr : BinOpRR_RFF<BaseOpc, mnemonic, Xi32, opnode>; 1046*9880d681SAndroid Build Coastguard Worker def NAME#64rr : BinOpRR_RFF<BaseOpc, mnemonic, Xi64, opnode>; 1047*9880d681SAndroid Build Coastguard Worker } // isConvertibleToThreeAddress 1048*9880d681SAndroid Build Coastguard Worker } // isCommutable 1049*9880d681SAndroid Build Coastguard Worker 1050*9880d681SAndroid Build Coastguard Worker def NAME#8rr_REV : BinOpRR_RFF_Rev<BaseOpc2, mnemonic, Xi8>; 1051*9880d681SAndroid Build Coastguard Worker def NAME#16rr_REV : BinOpRR_RFF_Rev<BaseOpc2, mnemonic, Xi16>; 1052*9880d681SAndroid Build Coastguard Worker def NAME#32rr_REV : BinOpRR_RFF_Rev<BaseOpc2, mnemonic, Xi32>; 1053*9880d681SAndroid Build Coastguard Worker def NAME#64rr_REV : BinOpRR_RFF_Rev<BaseOpc2, mnemonic, Xi64>; 1054*9880d681SAndroid Build Coastguard Worker 1055*9880d681SAndroid Build Coastguard Worker def NAME#8rm : BinOpRM_RFF<BaseOpc2, mnemonic, Xi8 , opnode>; 1056*9880d681SAndroid Build Coastguard Worker def NAME#16rm : BinOpRM_RFF<BaseOpc2, mnemonic, Xi16, opnode>; 1057*9880d681SAndroid Build Coastguard Worker def NAME#32rm : BinOpRM_RFF<BaseOpc2, mnemonic, Xi32, opnode>; 1058*9880d681SAndroid Build Coastguard Worker def NAME#64rm : BinOpRM_RFF<BaseOpc2, mnemonic, Xi64, opnode>; 1059*9880d681SAndroid Build Coastguard Worker 1060*9880d681SAndroid Build Coastguard Worker def NAME#8ri : BinOpRI_RFF<0x80, mnemonic, Xi8 , opnode, RegMRM>; 1061*9880d681SAndroid Build Coastguard Worker 1062*9880d681SAndroid Build Coastguard Worker let isConvertibleToThreeAddress = ConvertibleToThreeAddress in { 1063*9880d681SAndroid Build Coastguard Worker // NOTE: These are order specific, we want the ri8 forms to be listed 1064*9880d681SAndroid Build Coastguard Worker // first so that they are slightly preferred to the ri forms. 1065*9880d681SAndroid Build Coastguard Worker def NAME#16ri8 : BinOpRI8_RFF<0x82, mnemonic, Xi16, opnode, RegMRM>; 1066*9880d681SAndroid Build Coastguard Worker def NAME#32ri8 : BinOpRI8_RFF<0x82, mnemonic, Xi32, opnode, RegMRM>; 1067*9880d681SAndroid Build Coastguard Worker def NAME#64ri8 : BinOpRI8_RFF<0x82, mnemonic, Xi64, opnode, RegMRM>; 1068*9880d681SAndroid Build Coastguard Worker 1069*9880d681SAndroid Build Coastguard Worker def NAME#16ri : BinOpRI_RFF<0x80, mnemonic, Xi16, opnode, RegMRM>; 1070*9880d681SAndroid Build Coastguard Worker def NAME#32ri : BinOpRI_RFF<0x80, mnemonic, Xi32, opnode, RegMRM>; 1071*9880d681SAndroid Build Coastguard Worker def NAME#64ri32: BinOpRI_RFF<0x80, mnemonic, Xi64, opnode, RegMRM>; 1072*9880d681SAndroid Build Coastguard Worker } 1073*9880d681SAndroid Build Coastguard Worker } // Constraints = "$src1 = $dst" 1074*9880d681SAndroid Build Coastguard Worker 1075*9880d681SAndroid Build Coastguard Worker def NAME#8mr : BinOpMR_RMW_FF<BaseOpc, mnemonic, Xi8 , opnode>; 1076*9880d681SAndroid Build Coastguard Worker def NAME#16mr : BinOpMR_RMW_FF<BaseOpc, mnemonic, Xi16, opnode>; 1077*9880d681SAndroid Build Coastguard Worker def NAME#32mr : BinOpMR_RMW_FF<BaseOpc, mnemonic, Xi32, opnode>; 1078*9880d681SAndroid Build Coastguard Worker def NAME#64mr : BinOpMR_RMW_FF<BaseOpc, mnemonic, Xi64, opnode>; 1079*9880d681SAndroid Build Coastguard Worker 1080*9880d681SAndroid Build Coastguard Worker // NOTE: These are order specific, we want the mi8 forms to be listed 1081*9880d681SAndroid Build Coastguard Worker // first so that they are slightly preferred to the mi forms. 1082*9880d681SAndroid Build Coastguard Worker def NAME#16mi8 : BinOpMI8_RMW_FF<mnemonic, Xi16, opnode, MemMRM>; 1083*9880d681SAndroid Build Coastguard Worker def NAME#32mi8 : BinOpMI8_RMW_FF<mnemonic, Xi32, opnode, MemMRM>; 1084*9880d681SAndroid Build Coastguard Worker def NAME#64mi8 : BinOpMI8_RMW_FF<mnemonic, Xi64, opnode, MemMRM>; 1085*9880d681SAndroid Build Coastguard Worker 1086*9880d681SAndroid Build Coastguard Worker def NAME#8mi : BinOpMI_RMW_FF<0x80, mnemonic, Xi8 , opnode, MemMRM>; 1087*9880d681SAndroid Build Coastguard Worker def NAME#16mi : BinOpMI_RMW_FF<0x80, mnemonic, Xi16, opnode, MemMRM>; 1088*9880d681SAndroid Build Coastguard Worker def NAME#32mi : BinOpMI_RMW_FF<0x80, mnemonic, Xi32, opnode, MemMRM>; 1089*9880d681SAndroid Build Coastguard Worker def NAME#64mi32 : BinOpMI_RMW_FF<0x80, mnemonic, Xi64, opnode, MemMRM>; 1090*9880d681SAndroid Build Coastguard Worker 1091*9880d681SAndroid Build Coastguard Worker // These are for the disassembler since 0x82 opcode behaves like 0x80, but 1092*9880d681SAndroid Build Coastguard Worker // not in 64-bit mode. 1093*9880d681SAndroid Build Coastguard Worker let Predicates = [Not64BitMode], isCodeGenOnly = 1, ForceDisassemble = 1, 1094*9880d681SAndroid Build Coastguard Worker hasSideEffects = 0 in { 1095*9880d681SAndroid Build Coastguard Worker let Constraints = "$src1 = $dst" in 1096*9880d681SAndroid Build Coastguard Worker def NAME#8ri8 : BinOpRI8_RFF<0x82, mnemonic, Xi8, null_frag, RegMRM>; 1097*9880d681SAndroid Build Coastguard Worker let mayLoad = 1, mayStore = 1 in 1098*9880d681SAndroid Build Coastguard Worker def NAME#8mi8 : BinOpMI8_RMW_FF<mnemonic, Xi8, null_frag, MemMRM>; 1099*9880d681SAndroid Build Coastguard Worker } 1100*9880d681SAndroid Build Coastguard Worker } // Uses = [EFLAGS], Defs = [EFLAGS] 1101*9880d681SAndroid Build Coastguard Worker 1102*9880d681SAndroid Build Coastguard Worker def NAME#8i8 : BinOpAI_RFF<BaseOpc4, mnemonic, Xi8 , AL, 1103*9880d681SAndroid Build Coastguard Worker "{$src, %al|al, $src}">; 1104*9880d681SAndroid Build Coastguard Worker def NAME#16i16 : BinOpAI_RFF<BaseOpc4, mnemonic, Xi16, AX, 1105*9880d681SAndroid Build Coastguard Worker "{$src, %ax|ax, $src}">; 1106*9880d681SAndroid Build Coastguard Worker def NAME#32i32 : BinOpAI_RFF<BaseOpc4, mnemonic, Xi32, EAX, 1107*9880d681SAndroid Build Coastguard Worker "{$src, %eax|eax, $src}">; 1108*9880d681SAndroid Build Coastguard Worker def NAME#64i32 : BinOpAI_RFF<BaseOpc4, mnemonic, Xi64, RAX, 1109*9880d681SAndroid Build Coastguard Worker "{$src, %rax|rax, $src}">; 1110*9880d681SAndroid Build Coastguard Worker} 1111*9880d681SAndroid Build Coastguard Worker 1112*9880d681SAndroid Build Coastguard Worker/// ArithBinOp_F - This is an arithmetic binary operator where the pattern is 1113*9880d681SAndroid Build Coastguard Worker/// defined with "(set EFLAGS, (...". It would be really nice to find a way 1114*9880d681SAndroid Build Coastguard Worker/// to factor this with the other ArithBinOp_*. 1115*9880d681SAndroid Build Coastguard Worker/// 1116*9880d681SAndroid Build Coastguard Workermulticlass ArithBinOp_F<bits<8> BaseOpc, bits<8> BaseOpc2, bits<8> BaseOpc4, 1117*9880d681SAndroid Build Coastguard Worker string mnemonic, Format RegMRM, Format MemMRM, 1118*9880d681SAndroid Build Coastguard Worker SDNode opnode, 1119*9880d681SAndroid Build Coastguard Worker bit CommutableRR, bit ConvertibleToThreeAddress> { 1120*9880d681SAndroid Build Coastguard Worker let Defs = [EFLAGS] in { 1121*9880d681SAndroid Build Coastguard Worker let isCommutable = CommutableRR in { 1122*9880d681SAndroid Build Coastguard Worker def NAME#8rr : BinOpRR_F<BaseOpc, mnemonic, Xi8 , opnode>; 1123*9880d681SAndroid Build Coastguard Worker let isConvertibleToThreeAddress = ConvertibleToThreeAddress in { 1124*9880d681SAndroid Build Coastguard Worker def NAME#16rr : BinOpRR_F<BaseOpc, mnemonic, Xi16, opnode>; 1125*9880d681SAndroid Build Coastguard Worker def NAME#32rr : BinOpRR_F<BaseOpc, mnemonic, Xi32, opnode>; 1126*9880d681SAndroid Build Coastguard Worker def NAME#64rr : BinOpRR_F<BaseOpc, mnemonic, Xi64, opnode>; 1127*9880d681SAndroid Build Coastguard Worker } 1128*9880d681SAndroid Build Coastguard Worker } // isCommutable 1129*9880d681SAndroid Build Coastguard Worker 1130*9880d681SAndroid Build Coastguard Worker def NAME#8rr_REV : BinOpRR_F_Rev<BaseOpc2, mnemonic, Xi8>; 1131*9880d681SAndroid Build Coastguard Worker def NAME#16rr_REV : BinOpRR_F_Rev<BaseOpc2, mnemonic, Xi16>; 1132*9880d681SAndroid Build Coastguard Worker def NAME#32rr_REV : BinOpRR_F_Rev<BaseOpc2, mnemonic, Xi32>; 1133*9880d681SAndroid Build Coastguard Worker def NAME#64rr_REV : BinOpRR_F_Rev<BaseOpc2, mnemonic, Xi64>; 1134*9880d681SAndroid Build Coastguard Worker 1135*9880d681SAndroid Build Coastguard Worker def NAME#8rm : BinOpRM_F<BaseOpc2, mnemonic, Xi8 , opnode>; 1136*9880d681SAndroid Build Coastguard Worker def NAME#16rm : BinOpRM_F<BaseOpc2, mnemonic, Xi16, opnode>; 1137*9880d681SAndroid Build Coastguard Worker def NAME#32rm : BinOpRM_F<BaseOpc2, mnemonic, Xi32, opnode>; 1138*9880d681SAndroid Build Coastguard Worker def NAME#64rm : BinOpRM_F<BaseOpc2, mnemonic, Xi64, opnode>; 1139*9880d681SAndroid Build Coastguard Worker 1140*9880d681SAndroid Build Coastguard Worker def NAME#8ri : BinOpRI_F<0x80, mnemonic, Xi8 , opnode, RegMRM>; 1141*9880d681SAndroid Build Coastguard Worker 1142*9880d681SAndroid Build Coastguard Worker let isConvertibleToThreeAddress = ConvertibleToThreeAddress in { 1143*9880d681SAndroid Build Coastguard Worker // NOTE: These are order specific, we want the ri8 forms to be listed 1144*9880d681SAndroid Build Coastguard Worker // first so that they are slightly preferred to the ri forms. 1145*9880d681SAndroid Build Coastguard Worker def NAME#16ri8 : BinOpRI8_F<0x82, mnemonic, Xi16, opnode, RegMRM>; 1146*9880d681SAndroid Build Coastguard Worker def NAME#32ri8 : BinOpRI8_F<0x82, mnemonic, Xi32, opnode, RegMRM>; 1147*9880d681SAndroid Build Coastguard Worker def NAME#64ri8 : BinOpRI8_F<0x82, mnemonic, Xi64, opnode, RegMRM>; 1148*9880d681SAndroid Build Coastguard Worker 1149*9880d681SAndroid Build Coastguard Worker def NAME#16ri : BinOpRI_F<0x80, mnemonic, Xi16, opnode, RegMRM>; 1150*9880d681SAndroid Build Coastguard Worker def NAME#32ri : BinOpRI_F<0x80, mnemonic, Xi32, opnode, RegMRM>; 1151*9880d681SAndroid Build Coastguard Worker def NAME#64ri32: BinOpRI_F<0x80, mnemonic, Xi64, opnode, RegMRM>; 1152*9880d681SAndroid Build Coastguard Worker } 1153*9880d681SAndroid Build Coastguard Worker 1154*9880d681SAndroid Build Coastguard Worker def NAME#8mr : BinOpMR_F<BaseOpc, mnemonic, Xi8 , opnode>; 1155*9880d681SAndroid Build Coastguard Worker def NAME#16mr : BinOpMR_F<BaseOpc, mnemonic, Xi16, opnode>; 1156*9880d681SAndroid Build Coastguard Worker def NAME#32mr : BinOpMR_F<BaseOpc, mnemonic, Xi32, opnode>; 1157*9880d681SAndroid Build Coastguard Worker def NAME#64mr : BinOpMR_F<BaseOpc, mnemonic, Xi64, opnode>; 1158*9880d681SAndroid Build Coastguard Worker 1159*9880d681SAndroid Build Coastguard Worker // NOTE: These are order specific, we want the mi8 forms to be listed 1160*9880d681SAndroid Build Coastguard Worker // first so that they are slightly preferred to the mi forms. 1161*9880d681SAndroid Build Coastguard Worker def NAME#16mi8 : BinOpMI8_F<mnemonic, Xi16, opnode, MemMRM>; 1162*9880d681SAndroid Build Coastguard Worker def NAME#32mi8 : BinOpMI8_F<mnemonic, Xi32, opnode, MemMRM>; 1163*9880d681SAndroid Build Coastguard Worker def NAME#64mi8 : BinOpMI8_F<mnemonic, Xi64, opnode, MemMRM>; 1164*9880d681SAndroid Build Coastguard Worker 1165*9880d681SAndroid Build Coastguard Worker def NAME#8mi : BinOpMI_F<0x80, mnemonic, Xi8 , opnode, MemMRM>; 1166*9880d681SAndroid Build Coastguard Worker def NAME#16mi : BinOpMI_F<0x80, mnemonic, Xi16, opnode, MemMRM>; 1167*9880d681SAndroid Build Coastguard Worker def NAME#32mi : BinOpMI_F<0x80, mnemonic, Xi32, opnode, MemMRM>; 1168*9880d681SAndroid Build Coastguard Worker def NAME#64mi32 : BinOpMI_F<0x80, mnemonic, Xi64, opnode, MemMRM>; 1169*9880d681SAndroid Build Coastguard Worker 1170*9880d681SAndroid Build Coastguard Worker // These are for the disassembler since 0x82 opcode behaves like 0x80, but 1171*9880d681SAndroid Build Coastguard Worker // not in 64-bit mode. 1172*9880d681SAndroid Build Coastguard Worker let Predicates = [Not64BitMode], isCodeGenOnly = 1, ForceDisassemble = 1, 1173*9880d681SAndroid Build Coastguard Worker hasSideEffects = 0 in { 1174*9880d681SAndroid Build Coastguard Worker def NAME#8ri8 : BinOpRI8_F<0x82, mnemonic, Xi8, null_frag, RegMRM>; 1175*9880d681SAndroid Build Coastguard Worker let mayLoad = 1 in 1176*9880d681SAndroid Build Coastguard Worker def NAME#8mi8 : BinOpMI8_F<mnemonic, Xi8, null_frag, MemMRM>; 1177*9880d681SAndroid Build Coastguard Worker } 1178*9880d681SAndroid Build Coastguard Worker } // Defs = [EFLAGS] 1179*9880d681SAndroid Build Coastguard Worker 1180*9880d681SAndroid Build Coastguard Worker def NAME#8i8 : BinOpAI_F<BaseOpc4, mnemonic, Xi8 , AL, 1181*9880d681SAndroid Build Coastguard Worker "{$src, %al|al, $src}">; 1182*9880d681SAndroid Build Coastguard Worker def NAME#16i16 : BinOpAI_F<BaseOpc4, mnemonic, Xi16, AX, 1183*9880d681SAndroid Build Coastguard Worker "{$src, %ax|ax, $src}">; 1184*9880d681SAndroid Build Coastguard Worker def NAME#32i32 : BinOpAI_F<BaseOpc4, mnemonic, Xi32, EAX, 1185*9880d681SAndroid Build Coastguard Worker "{$src, %eax|eax, $src}">; 1186*9880d681SAndroid Build Coastguard Worker def NAME#64i32 : BinOpAI_F<BaseOpc4, mnemonic, Xi64, RAX, 1187*9880d681SAndroid Build Coastguard Worker "{$src, %rax|rax, $src}">; 1188*9880d681SAndroid Build Coastguard Worker} 1189*9880d681SAndroid Build Coastguard Worker 1190*9880d681SAndroid Build Coastguard Worker 1191*9880d681SAndroid Build Coastguard Workerdefm AND : ArithBinOp_RF<0x20, 0x22, 0x24, "and", MRM4r, MRM4m, 1192*9880d681SAndroid Build Coastguard Worker X86and_flag, and, 1, 0>; 1193*9880d681SAndroid Build Coastguard Workerdefm OR : ArithBinOp_RF<0x08, 0x0A, 0x0C, "or", MRM1r, MRM1m, 1194*9880d681SAndroid Build Coastguard Worker X86or_flag, or, 1, 0>; 1195*9880d681SAndroid Build Coastguard Workerdefm XOR : ArithBinOp_RF<0x30, 0x32, 0x34, "xor", MRM6r, MRM6m, 1196*9880d681SAndroid Build Coastguard Worker X86xor_flag, xor, 1, 0>; 1197*9880d681SAndroid Build Coastguard Workerdefm ADD : ArithBinOp_RF<0x00, 0x02, 0x04, "add", MRM0r, MRM0m, 1198*9880d681SAndroid Build Coastguard Worker X86add_flag, add, 1, 1>; 1199*9880d681SAndroid Build Coastguard Workerlet isCompare = 1 in { 1200*9880d681SAndroid Build Coastguard Workerdefm SUB : ArithBinOp_RF<0x28, 0x2A, 0x2C, "sub", MRM5r, MRM5m, 1201*9880d681SAndroid Build Coastguard Worker X86sub_flag, sub, 0, 0>; 1202*9880d681SAndroid Build Coastguard Worker} 1203*9880d681SAndroid Build Coastguard Worker 1204*9880d681SAndroid Build Coastguard Worker// Arithmetic. 1205*9880d681SAndroid Build Coastguard Workerdefm ADC : ArithBinOp_RFF<0x10, 0x12, 0x14, "adc", MRM2r, MRM2m, X86adc_flag, 1206*9880d681SAndroid Build Coastguard Worker 1, 0>; 1207*9880d681SAndroid Build Coastguard Workerdefm SBB : ArithBinOp_RFF<0x18, 0x1A, 0x1C, "sbb", MRM3r, MRM3m, X86sbb_flag, 1208*9880d681SAndroid Build Coastguard Worker 0, 0>; 1209*9880d681SAndroid Build Coastguard Worker 1210*9880d681SAndroid Build Coastguard Workerlet isCompare = 1 in { 1211*9880d681SAndroid Build Coastguard Workerdefm CMP : ArithBinOp_F<0x38, 0x3A, 0x3C, "cmp", MRM7r, MRM7m, X86cmp, 0, 0>; 1212*9880d681SAndroid Build Coastguard Worker} 1213*9880d681SAndroid Build Coastguard Worker 1214*9880d681SAndroid Build Coastguard Worker 1215*9880d681SAndroid Build Coastguard Worker//===----------------------------------------------------------------------===// 1216*9880d681SAndroid Build Coastguard Worker// Semantically, test instructions are similar like AND, except they don't 1217*9880d681SAndroid Build Coastguard Worker// generate a result. From an encoding perspective, they are very different: 1218*9880d681SAndroid Build Coastguard Worker// they don't have all the usual imm8 and REV forms, and are encoded into a 1219*9880d681SAndroid Build Coastguard Worker// different space. 1220*9880d681SAndroid Build Coastguard Workerdef X86testpat : PatFrag<(ops node:$lhs, node:$rhs), 1221*9880d681SAndroid Build Coastguard Worker (X86cmp (and_su node:$lhs, node:$rhs), 0)>; 1222*9880d681SAndroid Build Coastguard Worker 1223*9880d681SAndroid Build Coastguard Workerlet isCompare = 1 in { 1224*9880d681SAndroid Build Coastguard Worker let Defs = [EFLAGS] in { 1225*9880d681SAndroid Build Coastguard Worker let isCommutable = 1 in { 1226*9880d681SAndroid Build Coastguard Worker def TEST8rr : BinOpRR_F<0x84, "test", Xi8 , X86testpat>; 1227*9880d681SAndroid Build Coastguard Worker def TEST16rr : BinOpRR_F<0x84, "test", Xi16, X86testpat>; 1228*9880d681SAndroid Build Coastguard Worker def TEST32rr : BinOpRR_F<0x84, "test", Xi32, X86testpat>; 1229*9880d681SAndroid Build Coastguard Worker def TEST64rr : BinOpRR_F<0x84, "test", Xi64, X86testpat>; 1230*9880d681SAndroid Build Coastguard Worker } // isCommutable 1231*9880d681SAndroid Build Coastguard Worker 1232*9880d681SAndroid Build Coastguard Worker def TEST8rm : BinOpRM_F<0x84, "test", Xi8 , X86testpat>; 1233*9880d681SAndroid Build Coastguard Worker def TEST16rm : BinOpRM_F<0x84, "test", Xi16, X86testpat>; 1234*9880d681SAndroid Build Coastguard Worker def TEST32rm : BinOpRM_F<0x84, "test", Xi32, X86testpat>; 1235*9880d681SAndroid Build Coastguard Worker def TEST64rm : BinOpRM_F<0x84, "test", Xi64, X86testpat>; 1236*9880d681SAndroid Build Coastguard Worker 1237*9880d681SAndroid Build Coastguard Worker def TEST8ri : BinOpRI_F<0xF6, "test", Xi8 , X86testpat, MRM0r>; 1238*9880d681SAndroid Build Coastguard Worker def TEST16ri : BinOpRI_F<0xF6, "test", Xi16, X86testpat, MRM0r>; 1239*9880d681SAndroid Build Coastguard Worker def TEST32ri : BinOpRI_F<0xF6, "test", Xi32, X86testpat, MRM0r>; 1240*9880d681SAndroid Build Coastguard Worker def TEST64ri32 : BinOpRI_F<0xF6, "test", Xi64, X86testpat, MRM0r>; 1241*9880d681SAndroid Build Coastguard Worker 1242*9880d681SAndroid Build Coastguard Worker def TEST8mi : BinOpMI_F<0xF6, "test", Xi8 , X86testpat, MRM0m>; 1243*9880d681SAndroid Build Coastguard Worker def TEST16mi : BinOpMI_F<0xF6, "test", Xi16, X86testpat, MRM0m>; 1244*9880d681SAndroid Build Coastguard Worker def TEST32mi : BinOpMI_F<0xF6, "test", Xi32, X86testpat, MRM0m>; 1245*9880d681SAndroid Build Coastguard Worker def TEST64mi32 : BinOpMI_F<0xF6, "test", Xi64, X86testpat, MRM0m>; 1246*9880d681SAndroid Build Coastguard Worker 1247*9880d681SAndroid Build Coastguard Worker // When testing the result of EXTRACT_SUBREG sub_8bit_hi, make sure the 1248*9880d681SAndroid Build Coastguard Worker // register class is constrained to GR8_NOREX. This pseudo is explicitly 1249*9880d681SAndroid Build Coastguard Worker // marked side-effect free, since it doesn't have an isel pattern like 1250*9880d681SAndroid Build Coastguard Worker // other test instructions. 1251*9880d681SAndroid Build Coastguard Worker let isPseudo = 1, hasSideEffects = 0 in 1252*9880d681SAndroid Build Coastguard Worker def TEST8ri_NOREX : I<0, Pseudo, (outs), (ins GR8_NOREX:$src, i8imm:$mask), 1253*9880d681SAndroid Build Coastguard Worker "", [], IIC_BIN_NONMEM>, Sched<[WriteALU]>; 1254*9880d681SAndroid Build Coastguard Worker } // Defs = [EFLAGS] 1255*9880d681SAndroid Build Coastguard Worker 1256*9880d681SAndroid Build Coastguard Worker def TEST8i8 : BinOpAI_F<0xA8, "test", Xi8 , AL, 1257*9880d681SAndroid Build Coastguard Worker "{$src, %al|al, $src}">; 1258*9880d681SAndroid Build Coastguard Worker def TEST16i16 : BinOpAI_F<0xA8, "test", Xi16, AX, 1259*9880d681SAndroid Build Coastguard Worker "{$src, %ax|ax, $src}">; 1260*9880d681SAndroid Build Coastguard Worker def TEST32i32 : BinOpAI_F<0xA8, "test", Xi32, EAX, 1261*9880d681SAndroid Build Coastguard Worker "{$src, %eax|eax, $src}">; 1262*9880d681SAndroid Build Coastguard Worker def TEST64i32 : BinOpAI_F<0xA8, "test", Xi64, RAX, 1263*9880d681SAndroid Build Coastguard Worker "{$src, %rax|rax, $src}">; 1264*9880d681SAndroid Build Coastguard Worker} // isCompare 1265*9880d681SAndroid Build Coastguard Worker 1266*9880d681SAndroid Build Coastguard Worker//===----------------------------------------------------------------------===// 1267*9880d681SAndroid Build Coastguard Worker// ANDN Instruction 1268*9880d681SAndroid Build Coastguard Worker// 1269*9880d681SAndroid Build Coastguard Workermulticlass bmi_andn<string mnemonic, RegisterClass RC, X86MemOperand x86memop, 1270*9880d681SAndroid Build Coastguard Worker PatFrag ld_frag> { 1271*9880d681SAndroid Build Coastguard Worker def rr : I<0xF2, MRMSrcReg, (outs RC:$dst), (ins RC:$src1, RC:$src2), 1272*9880d681SAndroid Build Coastguard Worker !strconcat(mnemonic, "\t{$src2, $src1, $dst|$dst, $src1, $src2}"), 1273*9880d681SAndroid Build Coastguard Worker [(set RC:$dst, EFLAGS, (X86and_flag (not RC:$src1), RC:$src2))], 1274*9880d681SAndroid Build Coastguard Worker IIC_BIN_NONMEM>, Sched<[WriteALU]>; 1275*9880d681SAndroid Build Coastguard Worker def rm : I<0xF2, MRMSrcMem, (outs RC:$dst), (ins RC:$src1, x86memop:$src2), 1276*9880d681SAndroid Build Coastguard Worker !strconcat(mnemonic, "\t{$src2, $src1, $dst|$dst, $src1, $src2}"), 1277*9880d681SAndroid Build Coastguard Worker [(set RC:$dst, EFLAGS, 1278*9880d681SAndroid Build Coastguard Worker (X86and_flag (not RC:$src1), (ld_frag addr:$src2)))], IIC_BIN_MEM>, 1279*9880d681SAndroid Build Coastguard Worker Sched<[WriteALULd, ReadAfterLd]>; 1280*9880d681SAndroid Build Coastguard Worker} 1281*9880d681SAndroid Build Coastguard Worker 1282*9880d681SAndroid Build Coastguard Workerlet Predicates = [HasBMI], Defs = [EFLAGS] in { 1283*9880d681SAndroid Build Coastguard Worker defm ANDN32 : bmi_andn<"andn{l}", GR32, i32mem, loadi32>, T8PS, VEX_4V; 1284*9880d681SAndroid Build Coastguard Worker defm ANDN64 : bmi_andn<"andn{q}", GR64, i64mem, loadi64>, T8PS, VEX_4V, VEX_W; 1285*9880d681SAndroid Build Coastguard Worker} 1286*9880d681SAndroid Build Coastguard Worker 1287*9880d681SAndroid Build Coastguard Workerlet Predicates = [HasBMI] in { 1288*9880d681SAndroid Build Coastguard Worker def : Pat<(and (not GR32:$src1), GR32:$src2), 1289*9880d681SAndroid Build Coastguard Worker (ANDN32rr GR32:$src1, GR32:$src2)>; 1290*9880d681SAndroid Build Coastguard Worker def : Pat<(and (not GR64:$src1), GR64:$src2), 1291*9880d681SAndroid Build Coastguard Worker (ANDN64rr GR64:$src1, GR64:$src2)>; 1292*9880d681SAndroid Build Coastguard Worker def : Pat<(and (not GR32:$src1), (loadi32 addr:$src2)), 1293*9880d681SAndroid Build Coastguard Worker (ANDN32rm GR32:$src1, addr:$src2)>; 1294*9880d681SAndroid Build Coastguard Worker def : Pat<(and (not GR64:$src1), (loadi64 addr:$src2)), 1295*9880d681SAndroid Build Coastguard Worker (ANDN64rm GR64:$src1, addr:$src2)>; 1296*9880d681SAndroid Build Coastguard Worker} 1297*9880d681SAndroid Build Coastguard Worker 1298*9880d681SAndroid Build Coastguard Worker//===----------------------------------------------------------------------===// 1299*9880d681SAndroid Build Coastguard Worker// MULX Instruction 1300*9880d681SAndroid Build Coastguard Worker// 1301*9880d681SAndroid Build Coastguard Workermulticlass bmi_mulx<string mnemonic, RegisterClass RC, X86MemOperand x86memop> { 1302*9880d681SAndroid Build Coastguard Workerlet hasSideEffects = 0 in { 1303*9880d681SAndroid Build Coastguard Worker let isCommutable = 1 in 1304*9880d681SAndroid Build Coastguard Worker def rr : I<0xF6, MRMSrcReg, (outs RC:$dst1, RC:$dst2), (ins RC:$src), 1305*9880d681SAndroid Build Coastguard Worker !strconcat(mnemonic, "\t{$src, $dst2, $dst1|$dst1, $dst2, $src}"), 1306*9880d681SAndroid Build Coastguard Worker [], IIC_MUL8>, T8XD, VEX_4V, Sched<[WriteIMul, WriteIMulH]>; 1307*9880d681SAndroid Build Coastguard Worker 1308*9880d681SAndroid Build Coastguard Worker let mayLoad = 1 in 1309*9880d681SAndroid Build Coastguard Worker def rm : I<0xF6, MRMSrcMem, (outs RC:$dst1, RC:$dst2), (ins x86memop:$src), 1310*9880d681SAndroid Build Coastguard Worker !strconcat(mnemonic, "\t{$src, $dst2, $dst1|$dst1, $dst2, $src}"), 1311*9880d681SAndroid Build Coastguard Worker [], IIC_MUL8>, T8XD, VEX_4V, Sched<[WriteIMulLd, WriteIMulH]>; 1312*9880d681SAndroid Build Coastguard Worker} 1313*9880d681SAndroid Build Coastguard Worker} 1314*9880d681SAndroid Build Coastguard Worker 1315*9880d681SAndroid Build Coastguard Workerlet Predicates = [HasBMI2] in { 1316*9880d681SAndroid Build Coastguard Worker let Uses = [EDX] in 1317*9880d681SAndroid Build Coastguard Worker defm MULX32 : bmi_mulx<"mulx{l}", GR32, i32mem>; 1318*9880d681SAndroid Build Coastguard Worker let Uses = [RDX] in 1319*9880d681SAndroid Build Coastguard Worker defm MULX64 : bmi_mulx<"mulx{q}", GR64, i64mem>, VEX_W; 1320*9880d681SAndroid Build Coastguard Worker} 1321*9880d681SAndroid Build Coastguard Worker 1322*9880d681SAndroid Build Coastguard Worker//===----------------------------------------------------------------------===// 1323*9880d681SAndroid Build Coastguard Worker// ADCX Instruction 1324*9880d681SAndroid Build Coastguard Worker// 1325*9880d681SAndroid Build Coastguard Workerlet Predicates = [HasADX], Defs = [EFLAGS], Uses = [EFLAGS], 1326*9880d681SAndroid Build Coastguard Worker Constraints = "$src0 = $dst", AddedComplexity = 10 in { 1327*9880d681SAndroid Build Coastguard Worker let SchedRW = [WriteALU] in { 1328*9880d681SAndroid Build Coastguard Worker def ADCX32rr : I<0xF6, MRMSrcReg, (outs GR32:$dst), 1329*9880d681SAndroid Build Coastguard Worker (ins GR32:$src0, GR32:$src), "adcx{l}\t{$src, $dst|$dst, $src}", 1330*9880d681SAndroid Build Coastguard Worker [(set GR32:$dst, EFLAGS, 1331*9880d681SAndroid Build Coastguard Worker (X86adc_flag GR32:$src0, GR32:$src, EFLAGS))], 1332*9880d681SAndroid Build Coastguard Worker IIC_BIN_CARRY_NONMEM>, T8PD; 1333*9880d681SAndroid Build Coastguard Worker def ADCX64rr : RI<0xF6, MRMSrcReg, (outs GR64:$dst), 1334*9880d681SAndroid Build Coastguard Worker (ins GR64:$src0, GR64:$src), "adcx{q}\t{$src, $dst|$dst, $src}", 1335*9880d681SAndroid Build Coastguard Worker [(set GR64:$dst, EFLAGS, 1336*9880d681SAndroid Build Coastguard Worker (X86adc_flag GR64:$src0, GR64:$src, EFLAGS))], 1337*9880d681SAndroid Build Coastguard Worker IIC_BIN_CARRY_NONMEM>, T8PD; 1338*9880d681SAndroid Build Coastguard Worker } // SchedRW 1339*9880d681SAndroid Build Coastguard Worker 1340*9880d681SAndroid Build Coastguard Worker let mayLoad = 1, SchedRW = [WriteALULd] in { 1341*9880d681SAndroid Build Coastguard Worker def ADCX32rm : I<0xF6, MRMSrcMem, (outs GR32:$dst), 1342*9880d681SAndroid Build Coastguard Worker (ins GR32:$src0, i32mem:$src), "adcx{l}\t{$src, $dst|$dst, $src}", 1343*9880d681SAndroid Build Coastguard Worker [(set GR32:$dst, EFLAGS, 1344*9880d681SAndroid Build Coastguard Worker (X86adc_flag GR32:$src0, (loadi32 addr:$src), EFLAGS))], 1345*9880d681SAndroid Build Coastguard Worker IIC_BIN_CARRY_MEM>, T8PD; 1346*9880d681SAndroid Build Coastguard Worker 1347*9880d681SAndroid Build Coastguard Worker def ADCX64rm : RI<0xF6, MRMSrcMem, (outs GR64:$dst), 1348*9880d681SAndroid Build Coastguard Worker (ins GR64:$src0, i64mem:$src), "adcx{q}\t{$src, $dst|$dst, $src}", 1349*9880d681SAndroid Build Coastguard Worker [(set GR64:$dst, EFLAGS, 1350*9880d681SAndroid Build Coastguard Worker (X86adc_flag GR64:$src0, (loadi64 addr:$src), EFLAGS))], 1351*9880d681SAndroid Build Coastguard Worker IIC_BIN_CARRY_MEM>, T8PD; 1352*9880d681SAndroid Build Coastguard Worker } 1353*9880d681SAndroid Build Coastguard Worker} 1354*9880d681SAndroid Build Coastguard Worker 1355*9880d681SAndroid Build Coastguard Worker//===----------------------------------------------------------------------===// 1356*9880d681SAndroid Build Coastguard Worker// ADOX Instruction 1357*9880d681SAndroid Build Coastguard Worker// 1358*9880d681SAndroid Build Coastguard Workerlet Predicates = [HasADX], hasSideEffects = 0, Defs = [EFLAGS], 1359*9880d681SAndroid Build Coastguard Worker Uses = [EFLAGS] in { 1360*9880d681SAndroid Build Coastguard Worker let SchedRW = [WriteALU] in { 1361*9880d681SAndroid Build Coastguard Worker def ADOX32rr : I<0xF6, MRMSrcReg, (outs GR32:$dst), (ins GR32:$src), 1362*9880d681SAndroid Build Coastguard Worker "adox{l}\t{$src, $dst|$dst, $src}", [], IIC_BIN_NONMEM>, T8XS; 1363*9880d681SAndroid Build Coastguard Worker 1364*9880d681SAndroid Build Coastguard Worker def ADOX64rr : RI<0xF6, MRMSrcReg, (outs GR64:$dst), (ins GR64:$src), 1365*9880d681SAndroid Build Coastguard Worker "adox{q}\t{$src, $dst|$dst, $src}", [], IIC_BIN_NONMEM>, T8XS; 1366*9880d681SAndroid Build Coastguard Worker } // SchedRW 1367*9880d681SAndroid Build Coastguard Worker 1368*9880d681SAndroid Build Coastguard Worker let mayLoad = 1, SchedRW = [WriteALULd] in { 1369*9880d681SAndroid Build Coastguard Worker def ADOX32rm : I<0xF6, MRMSrcMem, (outs GR32:$dst), (ins i32mem:$src), 1370*9880d681SAndroid Build Coastguard Worker "adox{l}\t{$src, $dst|$dst, $src}", [], IIC_BIN_MEM>, T8XS; 1371*9880d681SAndroid Build Coastguard Worker 1372*9880d681SAndroid Build Coastguard Worker def ADOX64rm : RI<0xF6, MRMSrcMem, (outs GR64:$dst), (ins i64mem:$src), 1373*9880d681SAndroid Build Coastguard Worker "adox{q}\t{$src, $dst|$dst, $src}", [], IIC_BIN_MEM>, T8XS; 1374*9880d681SAndroid Build Coastguard Worker } 1375*9880d681SAndroid Build Coastguard Worker} 1376