[llvm] SystemZ: Fold copy of vector immediate to gr128 (PR #90706)

Ulrich Weigand via llvm-commits llvm-commits at lists.llvm.org
Thu May 2 04:49:14 PDT 2024


================
@@ -640,6 +640,48 @@ bool SystemZInstrInfo::foldImmediate(MachineInstr &UseMI, MachineInstr &DefMI,
                                      Register Reg,
                                      MachineRegisterInfo *MRI) const {
   unsigned DefOpc = DefMI.getOpcode();
+
+  if (DefOpc == SystemZ::VGBM) {
+    // Fold gr128 = COPY (vr128 VGBM imm)
+    //
+    // %tmp:gr64 = LGHI 0
+    // to  gr128 = REG_SEQUENCE %tmp, %tmp
----------------
uweigand wrote:

This is only correct for VGBM 0.   Other immediate arguments to VGBM result in different immediates: the VGBM immediate argument is a bitmask of 16 bits, and the result is a sequence of 16 bytes, each of which is 0xFF or 0 depending on whether the corresponding bit is set or not.

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


More information about the llvm-commits mailing list