This is an archive of the discontinued LLVM Phabricator instance.

[X86] Refactor X86ScalarSSEf16/32/64 with hasFP16/SSE1/SSE2. NFCI
ClosedPublic

Authored by pengfei on Mar 25 2022, 5:11 AM.

Details

Summary

This is used for f16 emulation. We emulate f16 for SSE2 targets and
above. Refactoring makes the future code to be more clean.

Diff Detail

Event Timeline

pengfei created this revision.Mar 25 2022, 5:11 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 25 2022, 5:11 AM
pengfei requested review of this revision.Mar 25 2022, 5:11 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 25 2022, 5:11 AM
pengfei added inline comments.Mar 25 2022, 5:16 AM
llvm/lib/Target/X86/X86FastISel.cpp
534

This looks a bug to me, but no test is affected by this change.

RKSimon added inline comments.Mar 25 2022, 7:49 AM
llvm/lib/Target/X86/X86FastISel.cpp
534

Agreed - its probably worth adding additional X87/SSE1 only test runs to fast-isel-nontemporal.ll in this patch?

LuoYuanke added inline comments.Mar 26 2022, 12:52 AM
llvm/lib/Target/X86/X86FastISel.cpp
521

This fix a bug? Should previous code be X86ScalarSSEf64?

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

Just be curious. Why move those implementation from .h file?

pengfei added inline comments.Mar 26 2022, 5:14 AM
llvm/lib/Target/X86/X86FastISel.cpp
521

Yes and no. It's a mistake but we never have a chance to trigger it :)

534

We can't add them to fast-isel-nontemporal.ll due to some tests have double type in arguments.
On the other hand, we can't create a test case for this. X86FastEmitStore is called in 4 different places, but none of them can reach here without SSE2 enabled. One of the reason is we have checked it in isTypeLegal. That says we can remove the else case for both f32 and f64 and add an assert instead. But I'd like to keep it as is so that we may use it in future.

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

We can't access the member functions of Subtarget in .h file due to X86Subtarget is incomplete at that point. See https://github.com/llvm/llvm-project/blob/main/llvm/lib/Target/X86/X86ISelLowering.h#L21

LuoYuanke accepted this revision.Mar 26 2022, 5:22 AM

LGTM, thanks.

This revision is now accepted and ready to land.Mar 26 2022, 5:22 AM
This revision was landed with ongoing or failed builds.Mar 26 2022, 10:54 PM
This revision was automatically updated to reflect the committed changes.