@@ -100,17 +100,20 @@ defvar unaryop_ndd_args = "{$src1, $dst|$dst, $src1}";
100
100
defvar binop_args = "{$src2, $src1|$src1, $src2}";
101
101
defvar binop_ndd_args = "{$src2, $src1, $dst|$dst, $src1, $src2}";
102
102
defvar binop_cl_args = "{%cl, $src1|$src1, cl}";
103
+ defvar binop_cl_ndd_args = "{%cl, $src1, $dst|$dst, $src1, cl}";
103
104
defvar triop_args = "{$src3, $src2, $src1|$src1, $src2, $src3}";
105
+ defvar triop_ndd_args = "{$src3, $src2, $src1, $dst|$dst, $src1, $src2, $src3}";
104
106
defvar triop_cl_args = "{%cl, $src2, $src1|$src1, $src2, cl}";
107
+ defvar triop_cl_ndd_args = "{%cl, $src2, $src1, $dst|$dst, $src1, $src2, cl}";
105
108
defvar tie_dst_src1 = "$src1 = $dst";
106
109
107
110
// NDD - Helper for new data destination instructions
108
- class NDD<bit ndd, Map map = OB > {
111
+ class NDD<bit ndd> {
109
112
string Constraints = !if(!eq(ndd, 0), tie_dst_src1, "");
110
113
Encoding OpEnc = !if(!eq(ndd, 0), EncNormal, EncEVEX);
111
114
bit hasEVEX_B = ndd;
112
115
bit hasVEX_4V = ndd;
113
- Map OpMap = !if(!eq(ndd, 0), map , T_MAP4);
116
+ Map OpMap = !if(!eq(ndd, 0), OB , T_MAP4);
114
117
}
115
118
// NF - Helper for NF (no flags update) instructions
116
119
class NF: T_MAP4, EVEX, EVEX_NF;
@@ -1067,9 +1070,10 @@ class BinOpRI_R<bits<8> o, string m, X86TypeInfo t, Format f, bit ndd = 0>
1067
1070
: BinOpRI<o, m, !if(!eq(ndd, 0), binop_args, binop_ndd_args), t, f, (outs t.RegClass:$dst),
1068
1071
[]>, NDD<ndd>;
1069
1072
// BinOpRI8U_R - Instructions that read "reg, u8imm" and write "reg".
1070
- class BinOpRI8U_R<string m, Format f, X86TypeInfo t, SDPatternOperator node>
1073
+ class BinOpRI8U_R<string m, Format f, X86TypeInfo t, SDPatternOperator node, bit ndd = 0 >
1071
1074
: ITy<0xC1, f, t, (outs t.RegClass:$dst), (ins t.RegClass:$src1, u8imm:$src2), m,
1072
- binop_args, [(set t.RegClass:$dst, (node t.RegClass:$src1, (i8 imm:$src2)))]>, NDD<0> {
1075
+ !if(!eq(ndd, 0), binop_args, binop_ndd_args),
1076
+ [(set t.RegClass:$dst, (node t.RegClass:$src1, (i8 imm:$src2)))]>, NDD<ndd> {
1073
1077
let ImmT = Imm8;
1074
1078
}
1075
1079
// BinOpRI_RF - Instructions that read "reg, imm" and write "reg", EFLAGS.
@@ -1232,20 +1236,22 @@ class BinOpMI8<string m, string args, X86TypeInfo t, Format f, dag out>
1232
1236
let ImmT = Imm8;
1233
1237
let mayLoad = 1;
1234
1238
}
1239
+ // BinOpMI8U - Instructions that read "[mem], u8imm".
1240
+ class BinOpMI8U<string m, string args, X86TypeInfo t, Format f, dag out, list<dag> p>
1241
+ : ITy<0xC1, f, t, out, (ins t.MemOperand:$src1, u8imm:$src2), m, args, p> {
1242
+ let ImmT = Imm8;
1243
+ let mayLoad = 1;
1244
+ }
1235
1245
// BinOpMI8_F - Instructions that read "[mem], imm8" and write EFLAGS only.
1236
1246
class BinOpMI8_F<string m, X86TypeInfo t, Format f>
1237
1247
: BinOpMI8<m, binop_args, t, f, (outs)>, Sched<[WriteALU.Folded]>, DefEFLAGS;
1238
1248
// BinOpMI8_R - Instructions that read "[mem], imm8" and write "reg".
1239
1249
class BinOpMI8_R<string m, X86TypeInfo t, Format f>
1240
1250
: BinOpMI8<m, binop_ndd_args, t, f, (outs t.RegClass:$dst)>, Sched<[WriteALU.Folded, WriteALU.ReadAfterFold]>, NDD<1>;
1241
- // BinOpMI8U_M - Instructions that read "[mem], u8imm" and write "[mem]".
1242
- class BinOpMI8U_M<string m, Format f, X86TypeInfo t, SDPatternOperator node>
1243
- : ITy<0xC1, f, t, (outs), (ins t.MemOperand:$src1, u8imm:$src2), m,
1244
- binop_args, [(store (node (t.LoadNode addr:$src1), (i8 imm:$src2)), addr:$src1)]> {
1245
- let ImmT = Imm8;
1246
- let mayLoad = 1;
1247
- let mayStore = 1;
1248
- }
1251
+ // BinOpMI8U_R - Instructions that read "[mem], u8imm" and write "reg".
1252
+ class BinOpMI8U_R<string m, Format f, X86TypeInfo t, SDPatternOperator node>
1253
+ : BinOpMI8U<m, binop_ndd_args, t, f, (outs t.RegClass:$dst),
1254
+ [(set t.RegClass:$dst, (node (t.LoadNode addr:$src1), (i8 imm:$src2)))]>, NDD<1>;
1249
1255
// BinOpMI8_RF - Instructions that read "[mem], imm8" and write "reg"/EFLAGS.
1250
1256
class BinOpMI8_RF<string m, X86TypeInfo t, Format f>
1251
1257
: BinOpMI8<m, binop_ndd_args, t, f, (outs t.RegClass:$dst)>, Sched<[WriteALU.Folded, WriteALU.ReadAfterFold]>, DefEFLAGS, NDD<1>;
@@ -1254,6 +1260,12 @@ class BinOpMI8_M<string m, X86TypeInfo t, Format f>
1254
1260
: BinOpMI8<m, binop_args, t, f, (outs)>, Sched<[WriteALURMW]> {
1255
1261
let mayStore = 1;
1256
1262
}
1263
+ // BinOpMI8U_M - Instructions that read "[mem], u8imm" and write "[mem]".
1264
+ class BinOpMI8U_M<string m, Format f, X86TypeInfo t, SDPatternOperator node>
1265
+ : BinOpMI8U<m, binop_args, t, f, (outs),
1266
+ [(store (node (t.LoadNode addr:$src1), (i8 imm:$src2)), addr:$src1)]> {
1267
+ let mayStore = 1;
1268
+ }
1257
1269
// BinOpMI8_MF - Instructions that read "[mem], imm8" and write "[mem]", EFLAGS.
1258
1270
class BinOpMI8_MF<string m, X86TypeInfo t, Format f>
1259
1271
: BinOpMI8<m, binop_args, t, f, (outs)>, Sched<[WriteALURMW]>, DefEFLAGS {
@@ -1296,9 +1308,10 @@ class BinOpAIF_AF<bits<8> o, string m, X86TypeInfo t, Register areg,
1296
1308
let SchedRW = [WriteADC];
1297
1309
}
1298
1310
// BinOpRC_R - Instructions that read "reg, cl" and write reg.
1299
- class BinOpRC_R<string m, Format f, X86TypeInfo t, SDPatternOperator node>
1300
- : ITy<0xD3, f, t, (outs t.RegClass:$dst), (ins t.RegClass:$src1), m, binop_cl_args,
1301
- [(set t.RegClass:$dst, (node t.RegClass:$src1, CL))]>, NDD<0> {
1311
+ class BinOpRC_R<string m, Format f, X86TypeInfo t, SDPatternOperator node, bit ndd = 0>
1312
+ : ITy<0xD3, f, t, (outs t.RegClass:$dst), (ins t.RegClass:$src1), m,
1313
+ !if(!eq(ndd, 0), binop_cl_args, binop_cl_ndd_args),
1314
+ [(set t.RegClass:$dst, (node t.RegClass:$src1, CL))]>, NDD<ndd> {
1302
1315
let Uses = [CL];
1303
1316
}
1304
1317
// BinOpMC_M - Instructions that read "[mem], cl" and write [mem].
@@ -1309,6 +1322,13 @@ class BinOpMC_M<string m, Format f, X86TypeInfo t, SDPatternOperator node>
1309
1322
let mayLoad = 1;
1310
1323
let mayStore = 1;
1311
1324
}
1325
+ // BinOpMC_R - Instructions that read "[mem], cl" and write reg.
1326
+ class BinOpMC_R<string m, Format f, X86TypeInfo t, SDPatternOperator node>
1327
+ : ITy<0xD3, f, t, (outs t.RegClass:$dst), (ins t.MemOperand:$src1), m, binop_cl_ndd_args,
1328
+ [(set t.RegClass:$dst, (node (t.LoadNode addr:$src1), CL))]>, NDD<1> {
1329
+ let Uses = [CL];
1330
+ let mayLoad = 1;
1331
+ }
1312
1332
1313
1333
// UnaryOpR - Instructions that read "reg".
1314
1334
class UnaryOpR<bits<8> o, Format f, string m, string args, X86TypeInfo t,
0 commit comments