@@ -232,7 +232,7 @@ class BinOpMIF_MF<bits<8> o, string m, X86TypeInfo t, SDNode node, Format f>
232
232
233
233
// BinOpMI8 - Instructions that read "[mem], imm8".
234
234
class BinOpMI8<string m, X86TypeInfo t, Format f>
235
- : ITy<0x82 , f, t, (outs), (ins t.MemOperand:$dst, t.Imm8Operand:$src), m,
235
+ : ITy<0x83 , f, t, (outs), (ins t.MemOperand:$dst, t.Imm8Operand:$src), m,
236
236
"{$src, $dst|$dst, $src}", []> {
237
237
let ImmT = Imm8;
238
238
let mayLoad = 1;
@@ -292,15 +292,15 @@ class UnaryOpM<bits<8> o, Format f, string m, X86TypeInfo t, list<dag> p>
292
292
293
293
// INCDECR - Instructions like "inc reg".
294
294
class INCDECR<Format f, string m, X86TypeInfo t, SDPatternOperator node>
295
- : UnaryOpR<0xFE , f, m, t,
295
+ : UnaryOpR<0xFF , f, m, t,
296
296
[(set t.RegClass:$dst, EFLAGS, (node t.RegClass:$src1, 1))]>,
297
297
DefEFLAGS {
298
298
let isConvertibleToThreeAddress = 1; // Can xform into LEA.
299
299
}
300
300
301
301
// INCDECM - Instructions like "inc [mem]".
302
302
class INCDECM<Format f, string m, X86TypeInfo t, int num>
303
- : UnaryOpM<0xFE , f, m, t,
303
+ : UnaryOpM<0xFF , f, m, t,
304
304
[(store (add (t.LoadNode addr:$dst), num), addr:$dst),
305
305
(implicit EFLAGS)]>, DefEFLAGS;
306
306
@@ -309,7 +309,6 @@ class INCDECR_ALT<bits<8> o, string m, X86TypeInfo t>
309
309
: UnaryOpR<o, AddRegFrm, m, t, []>, DefEFLAGS {
310
310
// Short forms only valid in 32-bit mode. Selected during MCInst lowering.
311
311
let Predicates = [Not64BitMode];
312
- let Opcode = o;
313
312
}
314
313
315
314
// MulOpR - Instructions like "mul reg".
@@ -664,13 +663,13 @@ multiclass ArithBinOp_RF<bits<8> BaseOpc, bits<8> BaseOpc2, bits<8> BaseOpc4,
664
663
def NAME#8ri : BinOpRI_RF<0x80, mnemonic, Xi8 , opnodeflag, RegMRM>;
665
664
// NOTE: These are order specific, we want the ri8 forms to be listed
666
665
// first so that they are slightly preferred to the ri forms.
667
- def NAME#16ri8 : BinOpRI8_RF<0x82 , mnemonic, Xi16, RegMRM>;
668
- def NAME#32ri8 : BinOpRI8_RF<0x82 , mnemonic, Xi32, RegMRM>;
669
- def NAME#64ri8 : BinOpRI8_RF<0x82 , mnemonic, Xi64, RegMRM>;
666
+ def NAME#16ri8 : BinOpRI8_RF<0x83 , mnemonic, Xi16, RegMRM>;
667
+ def NAME#32ri8 : BinOpRI8_RF<0x83 , mnemonic, Xi32, RegMRM>;
668
+ def NAME#64ri8 : BinOpRI8_RF<0x83 , mnemonic, Xi64, RegMRM>;
670
669
671
- def NAME#16ri : BinOpRI_RF<0x80 , mnemonic, Xi16, opnodeflag, RegMRM>;
672
- def NAME#32ri : BinOpRI_RF<0x80 , mnemonic, Xi32, opnodeflag, RegMRM>;
673
- def NAME#64ri32: BinOpRI_RF<0x80 , mnemonic, Xi64, opnodeflag, RegMRM>;
670
+ def NAME#16ri : BinOpRI_RF<0x81 , mnemonic, Xi16, opnodeflag, RegMRM>;
671
+ def NAME#32ri : BinOpRI_RF<0x81 , mnemonic, Xi32, opnodeflag, RegMRM>;
672
+ def NAME#64ri32: BinOpRI_RF<0x81 , mnemonic, Xi64, opnodeflag, RegMRM>;
674
673
}
675
674
} // Constraints = "$src1 = $dst"
676
675
@@ -687,10 +686,10 @@ multiclass ArithBinOp_RF<bits<8> BaseOpc, bits<8> BaseOpc2, bits<8> BaseOpc4,
687
686
def NAME#64mi8 : BinOpMI8_MF<mnemonic, Xi64, MemMRM>;
688
687
689
688
def NAME#8mi : BinOpMI_MF<0x80, mnemonic, Xi8 , opnode, MemMRM>;
690
- def NAME#16mi : BinOpMI_MF<0x80 , mnemonic, Xi16, opnode, MemMRM>;
691
- def NAME#32mi : BinOpMI_MF<0x80 , mnemonic, Xi32, opnode, MemMRM>;
689
+ def NAME#16mi : BinOpMI_MF<0x81 , mnemonic, Xi16, opnode, MemMRM>;
690
+ def NAME#32mi : BinOpMI_MF<0x81 , mnemonic, Xi32, opnode, MemMRM>;
692
691
let Predicates = [In64BitMode] in
693
- def NAME#64mi32 : BinOpMI_MF<0x80 , mnemonic, Xi64, opnode, MemMRM>;
692
+ def NAME#64mi32 : BinOpMI_MF<0x81 , mnemonic, Xi64, opnode, MemMRM>;
694
693
695
694
// These are for the disassembler since 0x82 opcode behaves like 0x80, but
696
695
// not in 64-bit mode.
@@ -744,13 +743,13 @@ multiclass ArithBinOp_RFF<bits<8> BaseOpc, bits<8> BaseOpc2, bits<8> BaseOpc4,
744
743
let isConvertibleToThreeAddress = ConvertibleToThreeAddress in {
745
744
// NOTE: These are order specific, we want the ri8 forms to be listed
746
745
// first so that they are slightly preferred to the ri forms.
747
- def NAME#16ri8 : BinOpRI8F_RF<0x82 , mnemonic, Xi16, RegMRM>;
748
- def NAME#32ri8 : BinOpRI8F_RF<0x82 , mnemonic, Xi32, RegMRM>;
749
- def NAME#64ri8 : BinOpRI8F_RF<0x82 , mnemonic, Xi64, RegMRM>;
746
+ def NAME#16ri8 : BinOpRI8F_RF<0x83 , mnemonic, Xi16, RegMRM>;
747
+ def NAME#32ri8 : BinOpRI8F_RF<0x83 , mnemonic, Xi32, RegMRM>;
748
+ def NAME#64ri8 : BinOpRI8F_RF<0x83 , mnemonic, Xi64, RegMRM>;
750
749
751
- def NAME#16ri : BinOpRIF_RF<0x80 , mnemonic, Xi16, opnode, RegMRM>;
752
- def NAME#32ri : BinOpRIF_RF<0x80 , mnemonic, Xi32, opnode, RegMRM>;
753
- def NAME#64ri32: BinOpRIF_RF<0x80 , mnemonic, Xi64, opnode, RegMRM>;
750
+ def NAME#16ri : BinOpRIF_RF<0x81 , mnemonic, Xi16, opnode, RegMRM>;
751
+ def NAME#32ri : BinOpRIF_RF<0x81 , mnemonic, Xi32, opnode, RegMRM>;
752
+ def NAME#64ri32: BinOpRIF_RF<0x81 , mnemonic, Xi64, opnode, RegMRM>;
754
753
}
755
754
} // Constraints = "$src1 = $dst"
756
755
@@ -767,10 +766,10 @@ multiclass ArithBinOp_RFF<bits<8> BaseOpc, bits<8> BaseOpc2, bits<8> BaseOpc4,
767
766
def NAME#64mi8 : BinOpMI8F_MF<mnemonic, Xi64, MemMRM>;
768
767
769
768
def NAME#8mi : BinOpMIF_MF<0x80, mnemonic, Xi8 , opnode, MemMRM>;
770
- def NAME#16mi : BinOpMIF_MF<0x80 , mnemonic, Xi16, opnode, MemMRM>;
771
- def NAME#32mi : BinOpMIF_MF<0x80 , mnemonic, Xi32, opnode, MemMRM>;
769
+ def NAME#16mi : BinOpMIF_MF<0x81 , mnemonic, Xi16, opnode, MemMRM>;
770
+ def NAME#32mi : BinOpMIF_MF<0x81 , mnemonic, Xi32, opnode, MemMRM>;
772
771
let Predicates = [In64BitMode] in
773
- def NAME#64mi32 : BinOpMIF_MF<0x80 , mnemonic, Xi64, opnode, MemMRM>;
772
+ def NAME#64mi32 : BinOpMIF_MF<0x81 , mnemonic, Xi64, opnode, MemMRM>;
774
773
775
774
// These are for the disassembler since 0x82 opcode behaves like 0x80, but
776
775
// not in 64-bit mode.
@@ -822,13 +821,13 @@ multiclass ArithBinOp_F<bits<8> BaseOpc, bits<8> BaseOpc2, bits<8> BaseOpc4,
822
821
let isConvertibleToThreeAddress = ConvertibleToThreeAddress in {
823
822
// NOTE: These are order specific, we want the ri8 forms to be listed
824
823
// first so that they are slightly preferred to the ri forms.
825
- def NAME#16ri8 : BinOpRI8_F<0x82 , mnemonic, Xi16, RegMRM>;
826
- def NAME#32ri8 : BinOpRI8_F<0x82 , mnemonic, Xi32, RegMRM>;
827
- def NAME#64ri8 : BinOpRI8_F<0x82 , mnemonic, Xi64, RegMRM>;
824
+ def NAME#16ri8 : BinOpRI8_F<0x83 , mnemonic, Xi16, RegMRM>;
825
+ def NAME#32ri8 : BinOpRI8_F<0x83 , mnemonic, Xi32, RegMRM>;
826
+ def NAME#64ri8 : BinOpRI8_F<0x83 , mnemonic, Xi64, RegMRM>;
828
827
829
- def NAME#16ri : BinOpRI_F<0x80 , mnemonic, Xi16, opnode, RegMRM>;
830
- def NAME#32ri : BinOpRI_F<0x80 , mnemonic, Xi32, opnode, RegMRM>;
831
- def NAME#64ri32: BinOpRI_F<0x80 , mnemonic, Xi64, opnode, RegMRM>;
828
+ def NAME#16ri : BinOpRI_F<0x81 , mnemonic, Xi16, opnode, RegMRM>;
829
+ def NAME#32ri : BinOpRI_F<0x81 , mnemonic, Xi32, opnode, RegMRM>;
830
+ def NAME#64ri32: BinOpRI_F<0x81 , mnemonic, Xi64, opnode, RegMRM>;
832
831
}
833
832
834
833
def NAME#8mr : BinOpMR_F<BaseOpc, mnemonic, Xi8 , opnode>;
@@ -844,10 +843,10 @@ multiclass ArithBinOp_F<bits<8> BaseOpc, bits<8> BaseOpc2, bits<8> BaseOpc4,
844
843
def NAME#64mi8 : BinOpMI8_F<mnemonic, Xi64, MemMRM>;
845
844
846
845
def NAME#8mi : BinOpMI_F<0x80, mnemonic, Xi8 , opnode, MemMRM>;
847
- def NAME#16mi : BinOpMI_F<0x80 , mnemonic, Xi16, opnode, MemMRM>;
848
- def NAME#32mi : BinOpMI_F<0x80 , mnemonic, Xi32, opnode, MemMRM>;
846
+ def NAME#16mi : BinOpMI_F<0x81 , mnemonic, Xi16, opnode, MemMRM>;
847
+ def NAME#32mi : BinOpMI_F<0x81 , mnemonic, Xi32, opnode, MemMRM>;
849
848
let Predicates = [In64BitMode] in
850
- def NAME#64mi32 : BinOpMI_F<0x80 , mnemonic, Xi64, opnode, MemMRM>;
849
+ def NAME#64mi32 : BinOpMI_F<0x81 , mnemonic, Xi64, opnode, MemMRM>;
851
850
852
851
// These are for the disassembler since 0x82 opcode behaves like 0x80, but
853
852
// not in 64-bit mode.
@@ -868,16 +867,16 @@ multiclass ArithBinOp_F<bits<8> BaseOpc, bits<8> BaseOpc2, bits<8> BaseOpc4,
868
867
}
869
868
870
869
871
- defm AND : ArithBinOp_RF<0x20, 0x22, 0x24 , "and", MRM4r, MRM4m,
870
+ defm AND : ArithBinOp_RF<0x21, 0x23, 0x25 , "and", MRM4r, MRM4m,
872
871
X86and_flag, and, 1, 0, 0>;
873
- defm OR : ArithBinOp_RF<0x08, 0x0A, 0x0C , "or", MRM1r, MRM1m,
872
+ defm OR : ArithBinOp_RF<0x09, 0x0B, 0x0D , "or", MRM1r, MRM1m,
874
873
X86or_flag, or, 1, 0, 0>;
875
- defm XOR : ArithBinOp_RF<0x30, 0x32, 0x34 , "xor", MRM6r, MRM6m,
874
+ defm XOR : ArithBinOp_RF<0x31, 0x33, 0x35 , "xor", MRM6r, MRM6m,
876
875
X86xor_flag, xor, 1, 0, 0>;
877
- defm ADD : ArithBinOp_RF<0x00, 0x02, 0x04 , "add", MRM0r, MRM0m,
876
+ defm ADD : ArithBinOp_RF<0x01, 0x03, 0x05 , "add", MRM0r, MRM0m,
878
877
X86add_flag, add, 1, 1, 1>;
879
878
let isCompare = 1 in {
880
- defm SUB : ArithBinOp_RF<0x28, 0x2A, 0x2C , "sub", MRM5r, MRM5m,
879
+ defm SUB : ArithBinOp_RF<0x29, 0x2B, 0x2D , "sub", MRM5r, MRM5m,
881
880
X86sub_flag, sub, 0, 1, 0>;
882
881
}
883
882
@@ -891,13 +890,13 @@ def XOR8rr_NOREX : I<0x30, MRMDestReg, (outs GR8_NOREX:$dst),
891
890
Sched<[WriteALU]>;
892
891
893
892
// Arithmetic.
894
- defm ADC : ArithBinOp_RFF<0x10, 0x12, 0x14 , "adc", MRM2r, MRM2m, X86adc_flag,
893
+ defm ADC : ArithBinOp_RFF<0x11, 0x13, 0x15 , "adc", MRM2r, MRM2m, X86adc_flag,
895
894
1, 0>;
896
- defm SBB : ArithBinOp_RFF<0x18, 0x1A, 0x1C , "sbb", MRM3r, MRM3m, X86sbb_flag,
895
+ defm SBB : ArithBinOp_RFF<0x19, 0x1B, 0x1D , "sbb", MRM3r, MRM3m, X86sbb_flag,
897
896
0, 0>;
898
897
899
898
let isCompare = 1 in {
900
- defm CMP : ArithBinOp_F<0x38, 0x3A, 0x3C , "cmp", MRM7r, MRM7m, X86cmp, 0, 0>;
899
+ defm CMP : ArithBinOp_F<0x39, 0x3B, 0x3D , "cmp", MRM7r, MRM7m, X86cmp, 0, 0>;
901
900
}
902
901
903
902
// Patterns to recognize loads on the LHS of an ADC. We can't make X86adc_flag
@@ -1040,32 +1039,32 @@ let isCompare = 1 in {
1040
1039
// combine them. This gives bunch of other patterns that start with
1041
1040
// and a chance to match.
1042
1041
def TEST8rr : BinOpRR_F<0x84, "test", Xi8 , null_frag>;
1043
- def TEST16rr : BinOpRR_F<0x84 , "test", Xi16, null_frag>;
1044
- def TEST32rr : BinOpRR_F<0x84 , "test", Xi32, null_frag>;
1045
- def TEST64rr : BinOpRR_F<0x84 , "test", Xi64, null_frag>;
1042
+ def TEST16rr : BinOpRR_F<0x85 , "test", Xi16, null_frag>;
1043
+ def TEST32rr : BinOpRR_F<0x85 , "test", Xi32, null_frag>;
1044
+ def TEST64rr : BinOpRR_F<0x85 , "test", Xi64, null_frag>;
1046
1045
} // isCommutable
1047
1046
1048
1047
def TEST8mr : BinOpMR_F<0x84, "test", Xi8 , null_frag>;
1049
- def TEST16mr : BinOpMR_F<0x84 , "test", Xi16, null_frag>;
1050
- def TEST32mr : BinOpMR_F<0x84 , "test", Xi32, null_frag>;
1051
- def TEST64mr : BinOpMR_F<0x84 , "test", Xi64, null_frag>;
1048
+ def TEST16mr : BinOpMR_F<0x85 , "test", Xi16, null_frag>;
1049
+ def TEST32mr : BinOpMR_F<0x85 , "test", Xi32, null_frag>;
1050
+ def TEST64mr : BinOpMR_F<0x85 , "test", Xi64, null_frag>;
1052
1051
1053
1052
def TEST8ri : BinOpRI_F<0xF6, "test", Xi8 , X86testpat, MRM0r>;
1054
- def TEST16ri : BinOpRI_F<0xF6 , "test", Xi16, X86testpat, MRM0r>;
1055
- def TEST32ri : BinOpRI_F<0xF6 , "test", Xi32, X86testpat, MRM0r>;
1056
- def TEST64ri32 : BinOpRI_F<0xF6 , "test", Xi64, X86testpat, MRM0r>;
1053
+ def TEST16ri : BinOpRI_F<0xF7 , "test", Xi16, X86testpat, MRM0r>;
1054
+ def TEST32ri : BinOpRI_F<0xF7 , "test", Xi32, X86testpat, MRM0r>;
1055
+ def TEST64ri32 : BinOpRI_F<0xF7 , "test", Xi64, X86testpat, MRM0r>;
1057
1056
1058
1057
def TEST8mi : BinOpMI_F<0xF6, "test", Xi8 , X86testpat, MRM0m>;
1059
- def TEST16mi : BinOpMI_F<0xF6 , "test", Xi16, X86testpat, MRM0m>;
1060
- def TEST32mi : BinOpMI_F<0xF6 , "test", Xi32, X86testpat, MRM0m>;
1058
+ def TEST16mi : BinOpMI_F<0xF7 , "test", Xi16, X86testpat, MRM0m>;
1059
+ def TEST32mi : BinOpMI_F<0xF7 , "test", Xi32, X86testpat, MRM0m>;
1061
1060
1062
1061
let Predicates = [In64BitMode] in
1063
- def TEST64mi32 : BinOpMI_F<0xF6 , "test", Xi64, X86testpat, MRM0m>;
1062
+ def TEST64mi32 : BinOpMI_F<0xF7 , "test", Xi64, X86testpat, MRM0m>;
1064
1063
1065
1064
def TEST8i8 : BinOpAI_F<0xA8, "test", Xi8 , AL, "{$src, %al|al, $src}">;
1066
- def TEST16i16 : BinOpAI_F<0xA8 , "test", Xi16, AX, "{$src, %ax|ax, $src}">;
1067
- def TEST32i32 : BinOpAI_F<0xA8 , "test", Xi32, EAX, "{$src, %eax|eax, $src}">;
1068
- def TEST64i32 : BinOpAI_F<0xA8 , "test", Xi64, RAX, "{$src, %rax|rax, $src}">;
1065
+ def TEST16i16 : BinOpAI_F<0xA9 , "test", Xi16, AX, "{$src, %ax|ax, $src}">;
1066
+ def TEST32i32 : BinOpAI_F<0xA9 , "test", Xi32, EAX, "{$src, %eax|eax, $src}">;
1067
+ def TEST64i32 : BinOpAI_F<0xA9 , "test", Xi64, RAX, "{$src, %rax|rax, $src}">;
1069
1068
} // isCompare
1070
1069
1071
1070
// Patterns to match a relocImm into the immediate field.
@@ -1189,38 +1188,35 @@ let Uses = [RDX] in
1189
1188
//
1190
1189
// We don't have patterns for these as there is no advantage over ADC for
1191
1190
// most code.
1192
- class ADCOXOpRR <bits<8> opcode, string mnemonic, X86TypeInfo info>
1193
- : BinOpRR_RF<opcode, mnemonic, info, null_frag> {
1194
- let Opcode = opcode;
1191
+ class ADCOXOpRR <string m, X86TypeInfo t>
1192
+ : BinOpRR_RF<0xF6, m, t, null_frag> {
1195
1193
let OpSize = OpSizeFixed;
1196
1194
let Form = MRMSrcReg;
1195
+ let isCommutable = 1;
1197
1196
}
1198
1197
1199
- class ADCOXOpRM <bits<8> opcode, string mnemonic, X86TypeInfo info>
1200
- : BinOpRM_RF<opcode, mnemonic, info, null_frag> {
1201
- let Opcode = opcode;
1198
+ class ADCOXOpRM <string m, X86TypeInfo t>
1199
+ : BinOpRM_RF<0xF6, m, t, null_frag> {
1202
1200
let OpSize = OpSizeFixed;
1203
1201
let Form = MRMSrcMem;
1204
1202
}
1205
1203
1206
1204
let Predicates = [HasADX], Constraints = "$src1 = $dst" in {
1207
- let SchedRW = [WriteADC], isCommutable = 1 in {
1208
- def ADCX32rr : ADCOXOpRR<0xF6, "adcx", Xi32>, T8PD;
1209
- def ADCX64rr : ADCOXOpRR<0xF6, "adcx", Xi64>, T8PD;
1210
-
1211
- def ADOX32rr : ADCOXOpRR<0xF6, "adox", Xi32>, T8XS;
1212
- def ADOX64rr : ADCOXOpRR<0xF6, "adox", Xi64>, T8XS;
1205
+ let SchedRW = [WriteADC] in {
1206
+ def ADCX32rr : ADCOXOpRR<"adcx", Xi32>, T8PD;
1207
+ def ADCX64rr : ADCOXOpRR<"adcx", Xi64>, T8PD;
1208
+ def ADOX32rr : ADCOXOpRR<"adox", Xi32>, T8XS;
1209
+ def ADOX64rr : ADCOXOpRR<"adox", Xi64>, T8XS;
1213
1210
}
1214
1211
1215
1212
let SchedRW = [WriteADC.Folded, WriteADC.ReadAfterFold,
1216
1213
// Memory operand.
1217
1214
ReadDefault, ReadDefault, ReadDefault, ReadDefault, ReadDefault,
1218
1215
// Implicit read of EFLAGS
1219
1216
WriteADC.ReadAfterFold] in {
1220
- def ADCX32rm : ADCOXOpRM<0xF6, "adcx", Xi32>, T8PD;
1221
- def ADCX64rm : ADCOXOpRM<0xF6, "adcx", Xi64>, T8PD;
1222
-
1223
- def ADOX32rm : ADCOXOpRM<0xF6, "adox", Xi32>, T8XS;
1224
- def ADOX64rm : ADCOXOpRM<0xF6, "adox", Xi64>, T8XS;
1217
+ def ADCX32rm : ADCOXOpRM<"adcx", Xi32>, T8PD;
1218
+ def ADCX64rm : ADCOXOpRM<"adcx", Xi64>, T8PD;
1219
+ def ADOX32rm : ADCOXOpRM<"adox", Xi32>, T8XS;
1220
+ def ADOX64rm : ADCOXOpRM<"adox", Xi64>, T8XS;
1225
1221
}
1226
1222
}
0 commit comments