[llvm] 43bb1c2 - AMDGPU: Fix incorrect selection of buffer atomic fadd
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 5 11:34:34 PDT 2020
Author: Matt Arsenault
Date: 2020-06-05T14:34:15-04:00
New Revision: 43bb1c239c27de0ef9fdb8a43da1ef0bc16fc42a
URL: https://github.com/llvm/llvm-project/commit/43bb1c239c27de0ef9fdb8a43da1ef0bc16fc42a
DIFF: https://github.com/llvm/llvm-project/commit/43bb1c239c27de0ef9fdb8a43da1ef0bc16fc42a.diff
LOG: AMDGPU: Fix incorrect selection of buffer atomic fadd
There were additional standalone patterns for these nodes which were
missing the subtarget predicate.
Added:
llvm/test/CodeGen/AMDGPU/fail-select-buffer-atomic-fadd.ll
Modified:
llvm/lib/Target/AMDGPU/BUFInstructions.td
Removed:
################################################################################
diff --git a/llvm/lib/Target/AMDGPU/BUFInstructions.td b/llvm/lib/Target/AMDGPU/BUFInstructions.td
index 7d6a6b92484e..2e5188b4cf74 100644
--- a/llvm/lib/Target/AMDGPU/BUFInstructions.td
+++ b/llvm/lib/Target/AMDGPU/BUFInstructions.td
@@ -1422,8 +1422,10 @@ multiclass BufferAtomicPatterns_NO_RTN<SDPatternOperator name, ValueType vt,
>;
}
+let SubtargetPredicate = HasAtomicFaddInsts in {
defm : BufferAtomicPatterns_NO_RTN<SIbuffer_atomic_fadd, f32, "BUFFER_ATOMIC_ADD_F32">;
defm : BufferAtomicPatterns_NO_RTN<SIbuffer_atomic_pk_fadd, v2f16, "BUFFER_ATOMIC_PK_ADD_F16">;
+}
def : GCNPat<
(SIbuffer_atomic_cmpswap
diff --git a/llvm/test/CodeGen/AMDGPU/fail-select-buffer-atomic-fadd.ll b/llvm/test/CodeGen/AMDGPU/fail-select-buffer-atomic-fadd.ll
new file mode 100644
index 000000000000..e52fcc747a71
--- /dev/null
+++ b/llvm/test/CodeGen/AMDGPU/fail-select-buffer-atomic-fadd.ll
@@ -0,0 +1,19 @@
+; RUN: not --crash llc -march=amdgcn -mcpu=tahiti -o /dev/null %s 2>&1 | FileCheck -check-prefix=FAIL %s
+; RUN: not --crash llc -march=amdgcn -mcpu=hawaii -o /dev/null %s 2>&1 | FileCheck -check-prefix=FAIL %s
+; RUN: not --crash llc -march=amdgcn -mcpu=fiji -o /dev/null %s 2>&1 | FileCheck -check-prefix=FAIL %s
+; RUN: not --crash llc -march=amdgcn -mcpu=gfx900 -o /dev/null %s 2>&1 | FileCheck -check-prefix=FAIL %s
+; RUN: not --crash llc -march=amdgcn -mcpu=gfx1010 -o /dev/null %s 2>&1 | FileCheck -check-prefix=FAIL %s
+
+; Make sure selection of these intrinsics fails on targets that do not
+; have the instruction available.
+; FIXME: Should also really make sure the v2f16 version fails.
+
+; FAIL: LLVM ERROR: Cannot select: {{.+}}: ch = BUFFER_ATOMIC_FADD
+define amdgpu_cs void @atomic_fadd(<4 x i32> inreg %arg0) {
+ call void @llvm.amdgcn.buffer.atomic.fadd.f32(float 1.0, <4 x i32> %arg0, i32 0, i32 112, i1 false)
+ ret void
+}
+
+declare void @llvm.amdgcn.buffer.atomic.fadd.f32(float, <4 x i32>, i32, i32, i1 immarg) #0
+
+attributes #0 = { nounwind }
More information about the llvm-commits
mailing list