[PATCH] D117791: [X86] Remove __builtin_ia32_pabs intrinsics and use generic __builtin_elementwise_abs

Simon Pilgrim via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 20 08:23:08 PST 2022


RKSimon created this revision.
RKSimon added reviewers: pengfei, craig.topper, fhahn.
RKSimon requested review of this revision.
Herald added a project: clang.

D111986 <https://reviews.llvm.org/D111986> added the generic `__builtin_elementwise_abs()` intrinsic with the same integer absolute behaviour as the SSE/AVX instructions (abs(INT__MIN) == INT_MIN)

This patch removes the `__builtin_ia32_pabs*` intrinsics and just uses `__builtin_elementwise_abs` - the existing tests see no changes:

  __m256i test_mm256_abs_epi8(__m256i a) {
    // CHECK-LABEL: test_mm256_abs_epi8
    // CHECK: [[ABS:%.*]] = call <32 x i8> @llvm.abs.v32i8(<32 x i8> %{{.*}}, i1 false)
    return _mm256_abs_epi8(a);
  }

This requires us to add a `__v64qs` explicitly signed char vector type (we already have `__v16qs` and `__v32qs`).

NOTE: I'm intending to do the same for `__builtin_reduce_max + __builtin_reduce_min` in a future patch.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D117791

Files:
  clang/include/clang/Basic/BuiltinsX86.def
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/Headers/avx2intrin.h
  clang/lib/Headers/avx512bwintrin.h
  clang/lib/Headers/avx512fintrin.h
  clang/lib/Headers/avx512vlintrin.h
  clang/lib/Headers/tmmintrin.h
  clang/test/CodeGen/builtins-x86.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D117791.401647.patch
Type: text/x-patch
Size: 9846 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220120/569468a2/attachment.bin>


More information about the cfe-commits mailing list