This is an archive of the discontinued LLVM Phabricator instance.

[AArch64 - SVE]: Use SVE to lower reduce.fadd.
ClosedPublic

Authored by hassnaa-arm on Aug 24 2022, 9:59 AM.

Details

Summary

[AArch64 - SVE]: Use SVE to lower reduce.fadd.
Enable custom-lowering of NEON-like fixed-width vector versions of @llvm.vector.reduce.fadd to use SVE's fadda instruction, if SVE is enabled.

Diff Detail

Event Timeline

hassnaa-arm created this revision.Aug 24 2022, 9:59 AM
hassnaa-arm requested review of this revision.Aug 24 2022, 9:59 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 24 2022, 9:59 AM
Matt added a subscriber: Matt.Aug 24 2022, 11:16 AM
sdesmalen added inline comments.Aug 24 2022, 2:04 PM
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
1384–1385

This is quite a limited set of types. I wonder if it actually supports VECREDUCE_SEQ_FADD for e.g. <8 x float> when the vector length is 256, or <8 x double> when the vector length is 512. Can you try this out?

Some other code in this file iterates through all possible FP/integer values and uses useSVEForFixedLengthVectorVT() to determine whether SVE should be used. This function has an option named OverrideNEON, which you can use to make it work for 128bit vectors.

llvm/test/CodeGen/AArch64/sve-fixed-length-fadd-reduce.ll
2 ↗(On Diff #455261)

Could you also add some RUN lines for other vector lengths?

dmgreen added inline comments.
llvm/test/CodeGen/AArch64/sve-fixed-length-fadd-reduce.ll
65 ↗(On Diff #455261)

This is just an fadd, and is probably simpler to leave as it was before.

david-arm added inline comments.Aug 30 2022, 5:37 AM
llvm/test/CodeGen/AArch64/sve-fixed-length-fadd-reduce.ll
1 ↗(On Diff #455261)

Hi @hassnaa-arm, could you just reuse the existing fixed-length tests in CodeGen/AArch64/sve-fixed-length-fp-reduce.ll and just add another RUN line:

; RUN: llc -aarch64-sve-vector-bits-min=128 < %s | FileCheck %s -check-prefixes=CHECK,VBITS_GE_128

That test file already contains many of the tests added here.

2 ↗(On Diff #455261)

I think if we reuse sve-fixed-length-fp-reduce.ll, then we get the other lengths for free?

Changes of generated test code based on the new changes in codebase.

This revision is now accepted and ready to land.Aug 31 2022, 5:23 AM
This revision was landed with ongoing or failed builds.Aug 31 2022, 5:31 AM
This revision was automatically updated to reflect the committed changes.