Skip to content

Commit ee45ba2

Browse files
authored
[AArch64] Use SVE for fixed-length bf16 operations with +sve-b16b16 (#169329)
This can avoid the promotion bf16 -> f32 -> bf16 round trip (or costly expansions).
1 parent 1b7ae0b commit ee45ba2

File tree

3 files changed

+960
-87
lines changed

3 files changed

+960
-87
lines changed

llvm/lib/Target/AArch64/AArch64ISelLowering.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1783,9 +1783,13 @@ AArch64TargetLowering::AArch64TargetLowering(const TargetMachine &TM,
17831783
setOperationAction(ISD::VECTOR_DEINTERLEAVE, VT, Custom);
17841784
setOperationAction(ISD::VECTOR_INTERLEAVE, VT, Custom);
17851785
setOperationAction(ISD::VECTOR_SPLICE, VT, Custom);
1786+
}
17861787

1787-
if (Subtarget->hasSVEB16B16() &&
1788-
Subtarget->isNonStreamingSVEorSME2Available()) {
1788+
if (Subtarget->hasSVEB16B16() &&
1789+
Subtarget->isNonStreamingSVEorSME2Available()) {
1790+
// Note: Use SVE for bfloat16 operations when +sve-b16b16 is available.
1791+
for (auto VT : {MVT::v4bf16, MVT::v8bf16, MVT::nxv2bf16, MVT::nxv4bf16,
1792+
MVT::nxv8bf16}) {
17891793
setOperationAction(ISD::FADD, VT, Custom);
17901794
setOperationAction(ISD::FMA, VT, Custom);
17911795
setOperationAction(ISD::FMAXIMUM, VT, Custom);

0 commit comments

Comments
 (0)