aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2023-12-08 14:21:11 +0100
committerBenjamin Kramer <benny.kra@googlemail.com>2023-12-08 14:22:07 +0100
commit06ebe3b2372fce68b6f47434d02b93239d27a0c4 (patch)
tree02058c383a8806997aa157f2120c2b767b967443
parente38c29c2b7769c255e4976742b6ed51f7f6f576a (diff)
downloadllvm-06ebe3b2372fce68b6f47434d02b93239d27a0c4.zip
llvm-06ebe3b2372fce68b6f47434d02b93239d27a0c4.tar.gz
llvm-06ebe3b2372fce68b6f47434d02b93239d27a0c4.tar.bz2
[NVPTX] Fix a typo that makes the output invalid PTX
It's surprisingly tricky to trigger this as it's only used by abs/neg which expand into and/xor in the integer domain.
-rw-r--r--llvm/lib/Target/NVPTX/NVPTXInstrInfo.td2
-rw-r--r--llvm/test/CodeGen/NVPTX/bf16x2-instructions.ll10
2 files changed, 11 insertions, 1 deletions
diff --git a/llvm/lib/Target/NVPTX/NVPTXInstrInfo.td b/llvm/lib/Target/NVPTX/NVPTXInstrInfo.td
index 58ff193..1366598 100644
--- a/llvm/lib/Target/NVPTX/NVPTXInstrInfo.td
+++ b/llvm/lib/Target/NVPTX/NVPTXInstrInfo.td
@@ -561,7 +561,7 @@ multiclass F2_Support_Half<string OpcStr, SDNode OpNode> {
[(set Int16Regs:$dst, (OpNode (bf16 Int16Regs:$a)))]>,
Requires<[hasSM<80>, hasPTX<70>]>;
def bf16x2 : NVPTXInst<(outs Int32Regs:$dst), (ins Int32Regs:$a),
- !strconcat(OpcStr, ".v2bf16 \t$dst, $a;"),
+ !strconcat(OpcStr, ".bf16x2 \t$dst, $a;"),
[(set Int32Regs:$dst, (OpNode (v2bf16 Int32Regs:$a)))]>,
Requires<[hasSM<80>, hasPTX<70>]>;
def f16_ftz : NVPTXInst<(outs Int16Regs:$dst), (ins Int16Regs:$a),
diff --git a/llvm/test/CodeGen/NVPTX/bf16x2-instructions.ll b/llvm/test/CodeGen/NVPTX/bf16x2-instructions.ll
index 7fba1aa..c08f16c 100644
--- a/llvm/test/CodeGen/NVPTX/bf16x2-instructions.ll
+++ b/llvm/test/CodeGen/NVPTX/bf16x2-instructions.ll
@@ -392,6 +392,16 @@ define <2 x bfloat> @test_fabs(<2 x bfloat> %a) #0 {
ret <2 x bfloat> %r
}
+; CHECK-LABEL: test_fabs_add(
+; CHECK: abs.bf16x2
+; CHECK: ret;
+define <2 x bfloat> @test_fabs_add(<2 x bfloat> %a, <2 x bfloat> %b) #0 {
+ %s = fadd <2 x bfloat> %a, %a
+ %r = call <2 x bfloat> @llvm.fabs.f16(<2 x bfloat> %s)
+ %d = fadd <2 x bfloat> %r, %b
+ ret <2 x bfloat> %d
+}
+
; CHECK-LABEL: test_minnum(
; CHECK-DAG: ld.param.b32 [[AF0:%r[0-9]+]], [test_minnum_param_0];