[llvm] [X86][NFC] Share isDispOrCDisp8 between the encoder and CompressEVEX (PR #222591)
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 10 06:09:44 PDT 2026
================
@@ -145,14 +137,7 @@ static bool hasShorterEVEXViaCDisp8(const MachineInstr &MI) {
return false;
int64_t Val = Disp.getImm();
- // VEX can already use a disp8 in this range, so EVEX offers no saving.
- if (isInt<8>(Val))
- return false;
- // EVEX can use disp8*N only when the value is a multiple of N and the scaled
- // value fits in a signed byte.
- if (Val % static_cast<int64_t>(CD8_Scale) != 0)
- return false;
- return isInt<8>(Val / static_cast<int64_t>(CD8_Scale));
+ return X86II::isDispOrCDisp8(MI.getDesc().TSFlags, Val) && !isInt<8>(Val);
----------------
RKSimon wrote:
Cheaper test first.
```suggestion
return !isInt<8>(Val) && X86II::isDispOrCDisp8(MI.getDesc().TSFlags, Val);
```
https://github.com/llvm/llvm-project/pull/222591
More information about the llvm-commits
mailing list