[llvm] [AArch64] AArch64TargetLowering::computeKnownBitsForTargetNode - add support for AArch64ISD::MOV/MVN constants (PR #154039)

Yatao Wang via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 18 21:10:48 PDT 2025


================
@@ -30624,6 +30650,10 @@ bool AArch64TargetLowering::isTargetCanonicalConstantNode(SDValue Op) const {
   return Op.getOpcode() == AArch64ISD::DUP ||
          Op.getOpcode() == AArch64ISD::MOVI ||
          Op.getOpcode() == AArch64ISD::MOVIshift ||
----------------
ningxinr wrote:

Hi David and Simon,

Following the other thread about adding fneg(zero) as a canonical constant pattern, I am still a bit confused about what I should do and expect here. 

1) Shall I add something along the lines of the following:
```suggestion
         Op.getOpcode() == AArch64ISD::MOVIshift ||
         (Op.getOpcode() == ISD::FNEG &&
         Op.getOperand(0).getOpcode() == AArch64ISD::MOVI &&
         Op.getOperand(0).getConstantOperandVal(0) == 0) ||
```

Please see my other question my other comment in file `llvm/test/CodeGen/AArch64/urem-vector-lkk.ll`.

https://github.com/llvm/llvm-project/pull/154039


More information about the llvm-commits mailing list