This is an archive of the discontinued LLVM Phabricator instance.

[X86] Convert integer _mm_reduce_* intrinsics to emit llvm.reduction intrinsics (PR47506)
ClosedPublic

Authored by RKSimon on Sep 14 2020, 4:41 AM.

Details

Summary

Placeholder patch for when the reduction intrinsics drop their experimental status, emitting the equivalent reduction intrinsic in IR instead of expanding to shuffle+arithmetic sequences.

The fadd/fmul reductions might be trickier as they assume a similar bisection reduction while the generic intrinsics assume a sequential reduction (intel docs are ambiguous on the correct approach) - I'm not sure if we want to always tag them with reassoc? Anyway, that issue can wait until a separate fp patch along with the fmin/fmax reductions.

Diff Detail

Event Timeline

RKSimon created this revision.Sep 14 2020, 4:41 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 14 2020, 4:41 AM
RKSimon requested review of this revision.Sep 14 2020, 4:41 AM

Longer term should we have a variadic version of this like builtin_shufflevector or builtin_convertvector that can handle any reduction?

Longer term should we have a variadic version of this like builtin_shufflevector or builtin_convertvector that can handle any reduction?

Yes, I was looking at what would be necessary for that as well - I think that is what is proposed in PR36691.

RKSimon planned changes to this revision.Sep 18 2020, 2:34 PM

WIP until reductions are no longer experimental

RKSimon updated this revision to Diff 296930.Oct 8 2020, 5:03 AM

rebased now that the reduction intrinsics are no longer experiemental

This revision is now accepted and ready to land.Oct 12 2020, 1:30 PM
This revision was landed with ongoing or failed builds.Oct 13 2020, 1:32 AM
This revision was automatically updated to reflect the committed changes.