================
@@ -306,9 +306,23 @@ void IRTranslator::addMachineCFGPred(CFGEdge Edge,
MachineBasicBlock *NewPred) {
MachinePreds[Edge].push_back(NewPred);
}
+static bool targetSupportsBF16Type(const MachineFunction *MF) {
+ return MF->getTarget().getTargetTriple().isSPIRV();
+}
+
+static bool containsBF16Type(const User &U) {
+ // BF16 cannot currently be represented by LLT, to avoid miscompiles we
+ // prevent any instructions using them. FIXME: This can be removed once LLT
+ // supports bfloat.
+ return U.getType()->getScalarType()->isBFloatTy() ||
+ any_of(U.operands(), [](Value *V) {
+ return V->getType()->getScalarType()->isBFloatTy();
+ });
+}
+
bool IRTranslator::translateBinaryOp(unsigned Opcode, const User &U,
MachineIRBuilder &MIRBuilder) {
- if (!mayTranslateUserTypes(U))
+ if (containsBF16Type(U) && !targetSupportsBF16Type(MF))
----------------
nvjle wrote:
Maybe a rebase is needed-- this and the related GISel changes above and below--
seem to undo: https://github.com/llvm/llvm-project/pull/188502/files
https://github.com/llvm/llvm-project/pull/191613
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits