[PATCH] D118043: [AMDGPU] Only match correct type for a16

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 24 08:45:48 PST 2022


foad accepted this revision.
foad added a comment.
This revision is now accepted and ready to land.

LGTM, thanks! Just a couple of nits inline.



================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp:81
+    if (ConstantInt *ConstInt = dyn_cast<ConstantInt>(&V)) {
+      // We need to check that if we cast the index down to a half, we do not
+      // lose precision.
----------------
s/half/i16/ ?


================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp:89
   Value *CastSrc;
-  if (match(&V, m_FPExt(PatternMatch::m_Value(CastSrc))) ||
-      match(&V, m_SExt(PatternMatch::m_Value(CastSrc))) ||
-      match(&V, m_ZExt(PatternMatch::m_Value(CastSrc)))) {
+  if ((IsFloat && match(&V, m_FPExt(PatternMatch::m_Value(CastSrc)))) ||
+      (!IsFloat && match(&V, m_ZExt(PatternMatch::m_Value(CastSrc))))) {
----------------
I have a slight preference for `IsFloat ? match(...) : match(...)`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D118043/new/

https://reviews.llvm.org/D118043



More information about the llvm-commits mailing list