[llvm] [AMDGPU][MC] Support src modifiers for v_mov_b32 and v_movrel* instructions (PR #76498)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 18 05:25:03 PST 2024


================
@@ -3309,6 +3310,14 @@ bool SIInstrInfo::isFoldableCopy(const MachineInstr &MI) {
   case AMDGPU::V_ACCVGPR_READ_B32_e64:
   case AMDGPU::V_ACCVGPR_MOV_B32:
     return true;
+  case AMDGPU::V_MOV_B32_e64:
+    if (MI
+            .getOperand(AMDGPU::getNamedOperandIdx(
+                AMDGPU::V_MOV_B32_e64, AMDGPU::OpName::src0_modifiers))
+            .getImm() == 0)
----------------
ankurepa wrote:

I need to check if the instruction has neg or abs modifiers since it will fold if it doesn't. Would it be better to make a function that checks that?

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


More information about the llvm-commits mailing list