Skip to content

Commit 5d05416

Browse files
committed
[RISCV] Promote fixed-length bf16 arith vector ops with zvfbfmin
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 1fe1e5e commit 5d05416

File tree

2 files changed

+1044
-32617
lines changed

2 files changed

+1044
-32617
lines changed

llvm/lib/Target/RISCV/RISCVISelLowering.cpp

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

0 commit comments

Comments
 (0)