[llvm] [SystemZ] Fold i16/i32/i64 logical RMW operations into memory operands in TableGen (PR #192802)
Ulrich Weigand via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 3 04:54:18 PDT 2026
================
@@ -554,10 +554,33 @@ static bool isFoldableRMW(const Instruction *I, Type *Ty) {
switch (Opcode) {
case Instruction::And:
case Instruction::Or:
- case Instruction::Xor:
- if (BitWidth != 8)
+ case Instruction::Xor: {
+ if (BitWidth == 8)
+ break;
+ if (BitWidth != 16 && BitWidth != 32 && BitWidth != 64)
+ return false;
+
+ auto *CI = dyn_cast<ConstantInt>(I->getOperand(1));
+ if (!CI)
return false;
+
+ uint64_t Val = CI->getZExtValue();
+ if (Opcode == Instruction::And) {
+ if (BitWidth == 16 && (Val & 0xff00ULL) != 0xff00ULL)
+ return false;
+ if (BitWidth == 32 && (Val & 0xffffff00ULL) != 0xffffff00ULL &&
+ (Val & 0xffffff00ULL) != 0x0000ff00ULL)
----------------
uweigand wrote:
Same problem as above.
https://github.com/llvm/llvm-project/pull/192802
More information about the llvm-commits
mailing list