[PATCH] D118000: [AArch64][NFC] Abstracts shared behavior in MIPeepholeOpt for ADD, SUB, and AND.
Micah Weston via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 25 13:27:39 PST 2022
red1bluelost added inline comments.
================
Comment at: llvm/lib/Target/AArch64/AArch64MIPeepholeOpt.cpp:354-355
+ T Imm = static_cast<T>(MovMI->getOperand(1).getImm()), Imm0, Imm1;
+ if (SubregToRegMI)
+ Imm &= 0xFFFFFFFF;
+ unsigned Opcode;
----------------
dmgreen wrote:
> Do we have test case for this case with an ADD?
Turns out this was a very subtle but that I didn't catch in D117429. See example here: https://llvm.godbolt.org/z/Gnq1x8rh1
I added a test for this. We definitely want to have the `Imm &= 0xFFFF'FFFF` since assigning to `T Imm` will sign extend the value, not zero extend.
I guess in this case the revision is no longer NFC.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D118000/new/
https://reviews.llvm.org/D118000
More information about the llvm-commits
mailing list