Skip to content

Commit a888505

Browse files
committed
resolve comment
1 parent b3c16c0 commit a888505

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

llvm/lib/Target/X86/Disassembler/X86Disassembler.cpp

+7-5
Original file line numberDiff line numberDiff line change
@@ -1135,11 +1135,11 @@ static int getInstructionIDWithAttrMask(uint16_t *instructionID,
11351135
}
11361136

11371137
static bool isNF(InternalInstruction *insn) {
1138-
// NF bit is the MSB of aaa.
1139-
if (nfFromEVEX4of4(insn->vectorExtensionPrefix[3]) &&
1140-
insn->opcodeType == MAP4)
1138+
if (!nfFromEVEX4of4(insn->vectorExtensionPrefix[3]))
1139+
return false;
1140+
if (insn->opcodeType == MAP4)
11411141
return true;
1142-
// Promoted BMI instrs below has nf version but not in map4.
1142+
// Below NF instructions are not in map4.
11431143
if (insn->opcodeType == THREEBYTE_38 &&
11441144
ppFromEVEX3of4(insn->vectorExtensionPrefix[2]) == VEX_PREFIX_NONE) {
11451145
switch (insn->opcode) {
@@ -1148,6 +1148,8 @@ static bool isNF(InternalInstruction *insn) {
11481148
case 0xf5: // BZHI
11491149
case 0xf7: // BEXTR
11501150
return true;
1151+
default:
1152+
break;
11511153
}
11521154
}
11531155
return false;
@@ -1188,7 +1190,7 @@ static int getInstructionID(struct InternalInstruction *insn,
11881190
attrMask |= ATTR_EVEXKZ;
11891191
if (bFromEVEX4of4(insn->vectorExtensionPrefix[3]))
11901192
attrMask |= ATTR_EVEXB;
1191-
if (isNF(insn))
1193+
if (isNF(insn)) // NF bit is the MSB of aaa.
11921194
attrMask |= ATTR_EVEXNF;
11931195
else if (aaaFromEVEX4of4(insn->vectorExtensionPrefix[3]))
11941196
attrMask |= ATTR_EVEXK;

llvm/lib/Target/X86/X86InstrArithmetic.td

+3-3
Original file line numberDiff line numberDiff line change
@@ -1030,7 +1030,7 @@ def : Pat<(X86testpat (loadi64 addr:$src1), i64relocImmSExt32_su:$src2),
10301030
//===----------------------------------------------------------------------===//
10311031
// ANDN Instruction
10321032
//
1033-
multiclass AndN<X86TypeInfo t, string suffix> {
1033+
multiclass AndN<X86TypeInfo t, string suffix = ""> {
10341034
defvar andn_rr_p =
10351035
[(set t.RegClass:$dst, EFLAGS, (X86and_flag (not t.RegClass:$src1),
10361036
t.RegClass:$src2))];
@@ -1050,8 +1050,8 @@ multiclass AndN<X86TypeInfo t, string suffix> {
10501050

10511051
// Complexity is reduced to give and with immediate a chance to match first.
10521052
let AddedComplexity = -6 in {
1053-
defm ANDN32 : AndN<Xi32, "">, VEX, Requires<[HasBMI, NoEGPR]>;
1054-
defm ANDN64 : AndN<Xi64, "">, VEX, REX_W, Requires<[HasBMI, NoEGPR]>;
1053+
defm ANDN32 : AndN<Xi32>, VEX, Requires<[HasBMI, NoEGPR]>;
1054+
defm ANDN64 : AndN<Xi64>, VEX, REX_W, Requires<[HasBMI, NoEGPR]>;
10551055
defm ANDN32 : AndN<Xi32, "_EVEX">, EVEX, Requires<[HasBMI, HasEGPR, In64BitMode]>;
10561056
defm ANDN64 : AndN<Xi64, "_EVEX">, EVEX, REX_W, Requires<[HasBMI, HasEGPR, In64BitMode]>;
10571057
let Pattern = [(null_frag)] in {

0 commit comments

Comments
 (0)