This is an archive of the discontinued LLVM Phabricator instance.

[Clang] Add integer add reduction builtin
ClosedPublic

Authored by RKSimon on May 1 2022, 12:52 PM.

Details

Summary

Similar to the existing bitwise reduction builtins, this lowers to a llvm.vector.reduce.add intrinsic call.

For other reductions, we've tried to share builtins for float/integer vectors, but the fadd reduction builtins also take a starting value argument. Technically I could support float by using default values, but we're probably better off with specific fadd reduction builtins for both arguments.

(Split off from D117829)

Diff Detail

Event Timeline

RKSimon created this revision.May 1 2022, 12:52 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 1 2022, 12:52 PM
Herald added a subscriber: StephenFan. · View Herald Transcript
RKSimon requested review of this revision.May 1 2022, 12:52 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 1 2022, 12:52 PM
fhahn accepted this revision.May 1 2022, 1:04 PM

LGTM, thanks

For other reductions, we've tried to share builtins for float/integer vectors, but the fadd reduction builtins also take a starting value argument. Technically I could support float by using default values, but we're probably better off with specific fadd reduction builtins for both arguments.

I think them main issue for fadd reductions is that the fadd intrinsic can either do unordered or serialized, but not reduction-trees as specified for the builtins in Clang.

This revision is now accepted and ready to land.May 1 2022, 1:04 PM
This revision was automatically updated to reflect the committed changes.