[llvm] [AMDGPU][GlobalISel] Allow bitcast of bf16 (PR #81674)
Shilei Tian via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 13 13:55:41 PST 2024
https://github.com/shiltian created https://github.com/llvm/llvm-project/pull/81674
None
>From 65dcb559afc6bb25a32a028657be5ccb64cbff7a Mon Sep 17 00:00:00 2001
From: Shilei Tian <i at tianshilei.me>
Date: Tue, 13 Feb 2024 16:47:17 -0500
Subject: [PATCH] [AMDGPU][GlobalISel] Allow bitcast of bf16
---
llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
index 311dd9d9739a6d..3290262816ef0a 100644
--- a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
@@ -1562,8 +1562,9 @@ bool IRTranslator::translateBitCast(const User &U,
bool IRTranslator::translateCast(unsigned Opcode, const User &U,
MachineIRBuilder &MIRBuilder) {
- if (U.getType()->getScalarType()->isBFloatTy() ||
- U.getOperand(0)->getType()->getScalarType()->isBFloatTy())
+ if (Opcode != TargetOpcode::G_BITCAST &&
+ (U.getType()->getScalarType()->isBFloatTy() ||
+ U.getOperand(0)->getType()->getScalarType()->isBFloatTy()))
return false;
Register Op = getOrCreateVReg(*U.getOperand(0));
Register Res = getOrCreateVReg(U);
More information about the llvm-commits
mailing list