[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
Mon Jun 8 08:00:17 PDT 2026
================
@@ -444,6 +444,27 @@ defm imm64hh16c : Immediate<i64, [{
SystemZ::isImmHH(uint64_t(~Imm.getZExtValue()));
}], HH16, "U16Imm">;
+// Immediates for the 8-bit LSB chunk of an i32, with the other bits being one.
+defm imm32ll8c : Immediate<i32, [{
+ if (!Imm.isIntN(32)) return false;
+ uint64_t Val = Imm.getZExtValue();
+ return (Val & 0xffffff00ULL) == 0xffffff00ULL;
+}], UIMM8, "U8Imm">;
+
+// Immediates for the second 8-bit LSB chunk of an i32, with the other bits
+// being one.
+defm imm16ll8c : Immediate<i32, [{
+ if (!Imm.isIntN(32)) return false;
+ uint64_t Val = Imm.getZExtValue();
+ return (Val & 0xff00ULL) == 0xff00ULL;
+}], UIMM8, "U8Imm">;
+
+// Immediates for the 8-bit LSB chunk of an i64, with the other bits being one.
+defm imm64ll8c : Immediate<i64, [{
+ return Imm.isIntN(64) &&
+ (uint64_t(~Imm.getZExtValue()) & 0xffffffffffffff00ULL) == 0;
----------------
uweigand wrote:
I think the three versions could use a more similar implementation. What about
- `(uint16_t(~Imm.getZExtValue()) & ~0xffULL) == 0`
- `(uint32_t(~Imm.getZExtValue()) & ~0xffULL) == 0`
- `(uint64_t(~Imm.getZExtValue()) & ~0xffULL) == 0`
instead of the tests you have now?
https://github.com/llvm/llvm-project/pull/192802
More information about the llvm-commits
mailing list