[PATCH] D133852: [AMDGPU] Check for num elts in SelectVOP3PMods

Piotr Sobczak via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 14 11:05:11 PDT 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGabd927e5a849: [AMDGPU] Check for num elts in SelectVOP3PMods (authored by piotr).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133852

Files:
  llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp
  llvm/test/CodeGen/AMDGPU/wmma_modifiers.ll


Index: llvm/test/CodeGen/AMDGPU/wmma_modifiers.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/AMDGPU/wmma_modifiers.ll
@@ -0,0 +1,22 @@
+; RUN: llc -march=amdgcn -mcpu=gfx1100 -mattr=-wavefrontsize32,+wavefrontsize64 -verify-machineinstrs < %s | FileCheck %s
+
+declare <4 x float> @llvm.amdgcn.wmma.f32.16x16x16.f16(<16 x half>, <16 x half>, <4 x float>)
+
+; Make sure we don't crash when trying to select modifiers in SelectVOP3PMods.
+
+define amdgpu_cs void @xyz () {
+; CHECK-LABEL: xyz:
+; CHECK: v_wmma_f32_16x16x16_f16 v[0:3], v[4:11], v[4:11], v[0:3]
+
+.entry:
+  br label %loop
+loop:
+  %ld = load <8 x float>, <8 x float> addrspace(5)* null, align 32
+  %in_shuffle = shufflevector <8 x float> %ld, <8 x float> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
+  %wmma = call <4 x float> @llvm.amdgcn.wmma.f32.16x16x16.f16(<16 x half> undef, <16 x half> undef, <4 x float> %in_shuffle)
+  %out_shuffle = shufflevector <4 x float> %wmma, <4 x float> undef, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef>
+  store <8 x float> %out_shuffle, <8 x float> addrspace(5)* null, align 32
+  br i1 false, label %.exit, label %loop
+.exit:
+  ret void
+}
Index: llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp
+++ llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp
@@ -2704,7 +2704,7 @@
     Src = Src.getOperand(0);
   }
 
-  if (Src.getOpcode() == ISD::BUILD_VECTOR &&
+  if (Src.getOpcode() == ISD::BUILD_VECTOR && Src.getNumOperands() == 2 &&
       (!IsDOT || !Subtarget->hasDOTOpSelHazard())) {
     unsigned VecMods = Mods;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133852.460158.patch
Type: text/x-patch
Size: 1740 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220914/18c6d3f7/attachment.bin>


More information about the llvm-commits mailing list