[all-commits] [llvm/llvm-project] c00db9: [Clang] Add elementwise saturated add/sub builtins

Simon Pilgrim via All-commits all-commits at lists.llvm.org
Tue Feb 8 03:22:17 PST 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c00db971597557e952901eac4be131157d1d5eb9
  Author: Simon Pilgrim <llvm-dev at redking.me.uk>
  Date:   2022-02-08 (Tue, 08 Feb 2022)

  Changed paths:
    M clang/docs/LanguageExtensions.rst
    M clang/include/clang/Basic/Builtins.def
    M clang/lib/CodeGen/CGBuiltin.cpp
    M clang/lib/Sema/SemaChecking.cpp
    M clang/test/CodeGen/builtins-elementwise-math.c
    M clang/test/Sema/builtins-elementwise-math.c
    M clang/test/SemaCXX/builtins-elementwise-math.cpp

  Log Message:
  [Clang] Add elementwise saturated add/sub builtins

This patch implements `__builtin_elementwise_add_sat` and `__builtin_elementwise_sub_sat` builtins.

These map to the add/sub saturated math intrinsics described here:

With this in place we should then be able to replace the x86 SSE adds/subs intrinsics with these generic variants - it looks like other targets should be able to use these as well (arm/aarch64/webassembly all have similar examples in cgbuiltin).

Differential Revision: https://reviews.llvm.org/D117898

More information about the All-commits mailing list