[llvm] [AMDGPU] Optimize image sample followed by llvm.amdgcn.cvt.pkrtz into d16 variant (PR #145203)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 23 01:45:44 PDT 2025


================
@@ -247,6 +247,42 @@ simplifyAMDGCNImageIntrinsic(const GCNSubtarget *ST,
                                        ArgTys[0] = User->getType();
                                      });
         }
+
+        // Fold image.sample + cvt.pkrtz -> extractelement idx0 into a single
+        // d16 image sample.
----------------
jayfoad wrote:

I agree that this optimization is not OK _unless_ we have some extra information saying that it's OK to use a different rounding mode. (But then if it's OK to use the normal round-to-nearest-even mode then why would you generate pkrtz instructions in the first place?)

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


More information about the llvm-commits mailing list