[llvm] [AMDGPU] Optimize rotate instruction selection patterns (PR #143551)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 19 04:26:02 PDT 2025


================
@@ -3610,6 +3610,26 @@ bool AMDGPUDAGToDAGISel::SelectSWMMACIndex16(SDValue In, SDValue &Src,
   return true;
 }
 
+bool AMDGPUDAGToDAGISel::SelectImmSub(SDValue In, SDValue &Src,
----------------
jayfoad wrote:

You really should not have to reimplement constant folding of subtracts during instruction selection. This is a strong hint that you should convert uniform rotates back to shifts and ORs _before_ instruction selection, e.g. during legalization or some combining pass. Then the subtract will get folded and/or selected like any other subtract.

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


More information about the llvm-commits mailing list