[X86] Convert integer _mm_reduce_* intrinsics to emit llvm.reduction intrinsics ...
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Tue, 13 Oct 2020 08:28:21 +0000 (09:28 +0100)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Tue, 13 Oct 2020 08:28:39 +0000 (09:28 +0100)
commit6c23cbc5603cf0011f8d57b0354954aeca695daf
tree168853cd971eb920fe37f56cff03c02d1b4907ae
parent5df61724a171710570f37938eb229401fa0176c7
[X86] Convert integer _mm_reduce_* intrinsics to emit llvm.reduction intrinsics (PR47506)

Emit the equivalent integer reduction intrinsics 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.

Differential Revision: https://reviews.llvm.org/D87604
clang/include/clang/Basic/BuiltinsX86.def
clang/lib/CodeGen/CGBuiltin.cpp
clang/lib/Headers/avx512fintrin.h
clang/test/CodeGen/X86/avx512-reduceIntrin.c
clang/test/CodeGen/X86/avx512-reduceMinMaxIntrin.c