[Clang] Add integer add reduction builtin
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Mon, 2 May 2022 10:03:19 +0000 (11:03 +0100)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Mon, 2 May 2022 10:03:25 +0000 (11:03 +0100)
commita23291b7db48670f7c57adcfb45877c826a97f22
treea5fe89e5a2f4bd7e0096ae4004b6ea10b83043c7
parent29dff0d4fb46fe8f1e9774fd5e64d3e07937ff35
[Clang] Add integer add reduction builtin

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 intrinsics also take a starting value argument and can either do unordered or serialized, but not reduction-trees as specified for the builtins. However we address fadd support this shouldn't affect the integer case.

(Split off from D117829)

Differential Revision: https://reviews.llvm.org/D124741
clang/include/clang/Basic/Builtins.def
clang/lib/CodeGen/CGBuiltin.cpp
clang/lib/Sema/SemaChecking.cpp
clang/test/CodeGen/builtins-reduction-math.c
clang/test/Sema/builtins-reduction-math.c