This is an archive of the discontinued LLVM Phabricator instance.

[GlobalISel] Add support for *_fpmode intrinsics
ClosedPublic

Authored by sepavloff on Aug 18 2023, 1:57 AM.

Details

Summary

The change implements support of the intrinsics get_fpmode,
set_fpmode and reset_fpmode in Global Instruction Selector. Now they
are lowered into library function calls.

Diff Detail

Event Timeline

sepavloff created this revision.Aug 18 2023, 1:57 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 18 2023, 1:57 AM
sepavloff requested review of this revision.Aug 18 2023, 1:57 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 18 2023, 1:57 AM
Herald added a subscriber: wdng. · View Herald Transcript
arsenm requested changes to this revision.Aug 18 2023, 5:37 AM
arsenm added inline comments.
llvm/include/llvm/Target/GenericOpcodes.td
1017

"use this way" doesn't read right

llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
837

TLI is already available as a member of LegalizerHelper

845

StateTy.getStoreSize

863

Need to erase the original instruction

877

TLI already a member

897

Didn't erase original instruction?

917–918

This is a roundabout way of doing DL.getPointerSizeInBits()

921–922

can fold these together with auto Dest = buildIntToPtr(MemTy)

925

Didn't erase original instruction?

970–971

Unrelated?

llvm/lib/CodeGen/GlobalISel/LegalizerInfo.cpp
123

Were there really no other typeless G_* instructions before?

This revision now requires changes to proceed.Aug 18 2023, 5:37 AM
tschuett added inline comments.
llvm/include/llvm/Target/GenericOpcodes.td
1016

side effects and access.

Address review comments, rebase

sepavloff marked 6 inline comments as done.Sep 28 2023, 11:26 PM
sepavloff added inline comments.
llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
863

This function is called from LegalizerHelper::libcall, which erases the original instruction.

897

LegalizerHelper::libcall will remove it.

925

LegalizerHelper::libcall will remove it.

970–971

As LLTy is not calculated at the beginning of the function anymore, it should be introduced when needed.

llvm/lib/CodeGen/GlobalISel/LegalizerInfo.cpp
123

G_RESET_FPMODE does not have nor input operands, nor output value, this is the first such instruction.

arsenm accepted this revision.Oct 4 2023, 3:49 PM
arsenm added inline comments.
llvm/test/CodeGen/AArch64/GlobalISel/legalize-fpmode.mir
5

Probably don't need the IR section

This revision is now accepted and ready to land.Oct 4 2023, 3:49 PM
This revision was automatically updated to reflect the committed changes.