This is an archive of the discontinued LLVM Phabricator instance.

[AArch64][SME]: Generate streaming-compatible code for fp_to_int and int_to_fp, fp-convert, trunk.
ClosedPublic

Authored by hassnaa-arm on Nov 18 2022, 2:56 AM.

Details

Summary

1-To generate code compatible to streaming mode:

  • enable custom lowering fp_to_int, int_to_fp, fp_round, fmul, trunc.
  • disable fp_to_int combining into invalid NEON intrinsic.

2-Add testing files:

  • fp_to_int.ll
  • fp-convert.ll
  • int_to_fp.ll
  • trunc.ll

Diff Detail

Event Timeline

hassnaa-arm created this revision.Nov 18 2022, 2:56 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 18 2022, 2:56 AM
hassnaa-arm requested review of this revision.Nov 18 2022, 2:56 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 18 2022, 2:56 AM

Add new testing file: fp-convert.ll

hassnaa-arm edited the summary of this revision. (Show Details)Nov 18 2022, 5:06 AM
hassnaa-arm edited the summary of this revision. (Show Details)Nov 18 2022, 5:07 AM

Hi @hassnaa-arm, the patch looks fine to me, but given you've added custom lowering for ISD::TRUNCATE should there are also be a sve-streaming-mode-fixed-length-trunc.ll in this patch to cover the truncates? There is already a sve-fixed-length-trunc.ll test I think.

hassnaa-arm retitled this revision from [AArch64][SME]: Generate streaming-compatible code for fp_to_int and int_to_fp. to [AArch64][SME]: Generate streaming-compatible code for fp_to_int and int_to_fp, fp-convert, trunk..Nov 18 2022, 7:37 AM
hassnaa-arm edited the summary of this revision. (Show Details)

Add trunc.ll test file

david-arm accepted this revision.Nov 18 2022, 8:01 AM

LGTM! Thanks for adding the test.

This revision is now accepted and ready to land.Nov 18 2022, 8:01 AM

LGTM with nit addressed

llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
15434–15438

nit: These conditions can be combined into:

if (!Subtarget->hasNEON() || Subtarget->forceStreamingCompatibleSVE())
  return SDValue();
llvm/test/CodeGen/AArch64/sve-streaming-mode-fixed-length-trunc.ll
609

I think it's only the XTN here that's not legal, so I expect this test to be improved by the patch that implements the lowering for TRUNCATE. Do you already have a patch for that?

hassnaa-arm marked an inline comment as done.

fix format

llvm/test/CodeGen/AArch64/sve-streaming-mode-fixed-length-trunc.ll
609

Yes, It will be improved by lowering for TRUNCATE.
But that the patch for that is not created yet.
Until now, I don't need to change the function of LowerTRUNCATE which will cause the improvement.

sdesmalen added inline comments.Nov 21 2022, 9:20 AM
llvm/test/CodeGen/AArch64/sve-streaming-mode-fixed-length-trunc.ll
609

Okay, that's good enough then, I'm happy for that to be improved in one of the follow-up patches.

Matt added a subscriber: Matt.Nov 22 2022, 11:01 AM