[llvm-branch-commits] [llvm] [AMDGPU][True16] Keep hi16 in 32-to-16-bit VGPR-to-SGPR copies (PR #239247)

Krzysztof Drewniak via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Nov 5 13:59:37 PST 2026


================
@@ -8942,7 +8942,11 @@ void SIInstrInfo::moveToVALUImpl(
         return;
       } else if (RI.getMatchingSuperRegClass(SrcRegRC, NewDstRC,
                                              AMDGPU::lo16)) {
-        Inst.getOperand(1).setSubReg(AMDGPU::lo16);
+        // Read the low half, unless the copy already reads a 16-bit
+        // subregister such as hi16.
+        MachineOperand &SrcOp = Inst.getOperand(1);
+        if (!SrcOp.getSubReg() || RI.getSubRegIdxSize(SrcOp.getSubReg()) != 16)
----------------
krzysz00 wrote:

Inviting post-commit review on if this condition is spelled correctly, but it looks correct and like it's fixing a real bug.

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


More information about the llvm-branch-commits mailing list