This is an archive of the discontinued LLVM Phabricator instance.

[X86][BF16] Lower FP_EXTEND for vector types under AVX512BF16
ClosedPublic

Authored by pengfei on Aug 27 2023, 3:05 AM.

Diff Detail

Event Timeline

pengfei created this revision.Aug 27 2023, 3:05 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 27 2023, 3:05 AM
pengfei requested review of this revision.Aug 27 2023, 3:05 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 27 2023, 3:05 AM
RKSimon added inline comments.Aug 27 2023, 3:27 AM
llvm/lib/Target/X86/X86ISelLowering.h
1757–1758

is it necessary to keep this? or just always use the static variant inside X86ISelLowering.cpp?

llvm/test/CodeGen/X86/bfloat.ll
1518

how come this is scalarized given how easy it is to bit-twiddle bfloat to float?

pengfei updated this revision to Diff 553788.Aug 27 2023, 6:46 AM
pengfei marked an inline comment as done.

Just use static function.

llvm/test/CodeGen/X86/bfloat.ll
1518

We cannot do vector fptrunc without AVX512BF16, so I deferred to set vXbf16 legal until the feature ready.
I think we may make it asymmetry between fptrunc and fpext. We can do it in a follow up. This is to address #64460 and backport to 17.0 with a low risk.

RKSimon added inline comments.Aug 27 2023, 7:29 AM
llvm/lib/Target/X86/X86ISelLowering.cpp
21196

assert(VT.getVectorElementType() == MVT::f32 && "Unexpected fpext");

21208

Would it be better to do a shl(zext(In,vXi32),8) here?

pengfei updated this revision to Diff 553792.Aug 27 2023, 8:15 AM
pengfei marked an inline comment as done.

Address review comments.

llvm/lib/Target/X86/X86ISelLowering.cpp
21208

Yes, thanks!

RKSimon accepted this revision.Aug 27 2023, 10:06 AM

LGTM - cheers

This revision is now accepted and ready to land.Aug 27 2023, 10:06 AM
skan accepted this revision.Aug 27 2023, 7:02 PM

LGTM

This revision was landed with ongoing or failed builds.Aug 27 2023, 7:22 PM
This revision was automatically updated to reflect the committed changes.
pengfei added inline comments.Aug 27 2023, 11:48 PM
llvm/lib/Target/X86/X86ISelLowering.cpp
21208

Looks like the immediate should be 16 rather than 8

pengfei reopened this revision.Aug 28 2023, 5:53 AM
This revision is now accepted and ready to land.Aug 28 2023, 5:53 AM
RKSimon added inline comments.Aug 28 2023, 10:09 AM
llvm/lib/Target/X86/X86ISelLowering.cpp
21208

Sorry about that!

pengfei added inline comments.Aug 28 2023, 5:23 PM
llvm/lib/Target/X86/X86ISelLowering.cpp
21208

No problem. I didn't think it a bit further either :)