Skip to content

Commit f6c2322

Browse files
authored
[RISCV] Promote fixed-length bf16 arith vector ops with zvfbfmin (#112393)
The aim is to have the same set of promotions on fixed-length bf16 vectors as on fixed-length f16 vectors, and then deduplicate them similarly to what was done for scalable vectors. It looks like fneg/fabs/fcopysign end up getting expanded because fsub is now legal, and the default operation action must be expand.
1 parent 01b78b2 commit f6c2322

File tree

2 files changed

+1656
-84
lines changed

2 files changed

+1656
-84
lines changed

llvm/lib/Target/RISCV/RISCVISelLowering.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1379,7 +1379,14 @@ RISCVTargetLowering::RISCVTargetLowering(const TargetMachine &TM,
13791379
setOperationAction(
13801380
{ISD::VP_MERGE, ISD::VP_SELECT, ISD::VSELECT, ISD::SELECT}, VT,
13811381
Custom);
1382-
// TODO: Promote to fp32.
1382+
MVT F32VecVT = MVT::getVectorVT(MVT::f32, VT.getVectorElementCount());
1383+
// Don't promote f16 vector operations to f32 if f32 vector type is
1384+
// not legal.
1385+
// TODO: could split the f16 vector into two vectors and do promotion.
1386+
if (!isTypeLegal(F32VecVT))
1387+
continue;
1388+
setOperationPromotedToType(ZvfhminZvfbfminPromoteOps, VT, F32VecVT);
1389+
// TODO: Promote VP ops to fp32.
13831390
continue;
13841391
}
13851392

0 commit comments

Comments
 (0)