[llvm] a3c5952 - [X86][MC] Add labels for BSF in the switch-cases of X86MCInstLower::Lower, NFCI
Shengchen Kan via llvm-commits
llvm-commits at lists.llvm.org
Thu May 18 05:02:58 PDT 2023
Author: Shengchen Kan
Date: 2023-05-18T20:02:41+08:00
New Revision: a3c595282738addbf53615ba70fed4a11e5406b5
URL: https://github.com/llvm/llvm-project/commit/a3c595282738addbf53615ba70fed4a11e5406b5
DIFF: https://github.com/llvm/llvm-project/commit/a3c595282738addbf53615ba70fed4a11e5406b5.diff
LOG: [X86][MC] Add labels for BSF in the switch-cases of X86MCInstLower::Lower, NFCI
BSF is not special here and leaving it in default label looked weird.
Added:
Modified:
llvm/lib/Target/X86/X86MCInstLower.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/X86/X86MCInstLower.cpp b/llvm/lib/Target/X86/X86MCInstLower.cpp
index defc199930cb..9194f4485eb9 100644
--- a/llvm/lib/Target/X86/X86MCInstLower.cpp
+++ b/llvm/lib/Target/X86/X86MCInstLower.cpp
@@ -420,7 +420,6 @@ void X86MCInstLower::Lower(const MachineInstr *MI, MCInst &OutMI) const {
assert(OutMI.getOperand(1 + X86::AddrSegmentReg).getReg() == 0 &&
"LEA has segment specified!");
break;
-
case X86::MULX32Hrr:
case X86::MULX32Hrm:
case X86::MULX64Hrr:
@@ -440,7 +439,6 @@ void X86MCInstLower::Lower(const MachineInstr *MI, MCInst &OutMI) const {
OutMI.insert(OutMI.begin(), MCOperand::createReg(DestReg));
break;
}
-
// CALL64r, CALL64pcrel32 - These instructions used to have
// register inputs modeled as normal uses instead of implicit uses. As such,
// they we used to truncate off all but the first operand (the callee). This
@@ -449,21 +447,18 @@ void X86MCInstLower::Lower(const MachineInstr *MI, MCInst &OutMI) const {
case X86::CALL64pcrel32:
assert(OutMI.getNumOperands() == 1 && "Unexpected number of operands!");
break;
-
case X86::EH_RETURN:
case X86::EH_RETURN64: {
OutMI = MCInst();
OutMI.setOpcode(getRetOpcode(AsmPrinter.getSubtarget()));
break;
}
-
case X86::CLEANUPRET: {
// Replace CLEANUPRET with the appropriate RET.
OutMI = MCInst();
OutMI.setOpcode(getRetOpcode(AsmPrinter.getSubtarget()));
break;
}
-
case X86::CATCHRET: {
// Replace CATCHRET with the appropriate RET.
const X86Subtarget &Subtarget = AsmPrinter.getSubtarget();
@@ -473,7 +468,6 @@ void X86MCInstLower::Lower(const MachineInstr *MI, MCInst &OutMI) const {
OutMI.addOperand(MCOperand::createReg(ReturnReg));
break;
}
-
// TAILJMPd, TAILJMPd64, TailJMPd_cc - Lower to the correct jump
// instruction.
case X86::TAILJMPr:
@@ -484,13 +478,11 @@ void X86MCInstLower::Lower(const MachineInstr *MI, MCInst &OutMI) const {
assert(OutMI.getNumOperands() == 1 && "Unexpected number of operands!");
OutMI.setOpcode(convertTailJumpOpcode(OutMI.getOpcode()));
break;
-
case X86::TAILJMPd_CC:
case X86::TAILJMPd64_CC:
assert(OutMI.getNumOperands() == 2 && "Unexpected number of operands!");
OutMI.setOpcode(convertTailJumpOpcode(OutMI.getOpcode()));
break;
-
case X86::TAILJMPm:
case X86::TAILJMPm64:
case X86::TAILJMPm64_REX:
@@ -498,25 +490,28 @@ void X86MCInstLower::Lower(const MachineInstr *MI, MCInst &OutMI) const {
"Unexpected number of operands!");
OutMI.setOpcode(convertTailJumpOpcode(OutMI.getOpcode()));
break;
-
case X86::MASKMOVDQU:
case X86::VMASKMOVDQU:
if (In64BitMode)
OutMI.setFlags(X86::IP_HAS_AD_SIZE);
break;
-
- default: {
+ case X86::BSF16rm:
+ case X86::BSF16rr:
+ case X86::BSF32rm:
+ case X86::BSF32rr:
+ case X86::BSF64rm:
+ case X86::BSF64rr: {
// Add an REP prefix to BSF instructions so that new processors can
// recognize as TZCNT, which has better performance than BSF.
- if (X86::isBSF(OutMI.getOpcode()) && !MF.getFunction().hasOptSize()) {
- // BSF and TZCNT have
diff erent interpretations on ZF bit. So make sure
- // it won't be used later.
- const MachineOperand *FlagDef = MI->findRegisterDefOperand(X86::EFLAGS);
- if (FlagDef && FlagDef->isDead())
- OutMI.setFlags(X86::IP_HAS_REPEAT);
- }
+ // BSF and TZCNT have
diff erent interpretations on ZF bit. So make sure
+ // it won't be used later.
+ const MachineOperand *FlagDef = MI->findRegisterDefOperand(X86::EFLAGS);
+ if (!MF.getFunction().hasOptSize() && FlagDef && FlagDef->isDead())
+ OutMI.setFlags(X86::IP_HAS_REPEAT);
break;
}
+ default:
+ break;
}
}
More information about the llvm-commits
mailing list