[llvm] AMDGPU: Fold mov imm to copy to av_32 class (PR #155428)

Stanislav Mekhanoshin via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 26 16:13:57 PDT 2025


================
@@ -1315,6 +1298,14 @@ void SIFoldOperandsImpl::foldOperand(
       UseMI->setDesc(MovDesc);
 
       if (MovOp == AMDGPU::V_MOV_B16_t16_e64) {
+        // Allow immediates COPYd into sgpr_lo16 to be further folded while
+        // still being legal if not further folded
+        if (DestRC == &AMDGPU::SGPR_LO16RegClass) {
+          assert(ST->useRealTrue16Insts());
+          MRI->setRegClass(DestReg, &AMDGPU::SGPR_32RegClass);
+          DestRC = &AMDGPU::SGPR_32RegClass;
+        }
+
----------------
rampitec wrote:

I do not think it is a regression really. It is just VOPD does not have t16 support. That's a question what is better after all.

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


More information about the llvm-commits mailing list