Skip to content

Commit

Permalink
Include immintrin.h instead of wmmintrin.h (abseil#1015)
Browse files Browse the repository at this point in the history
immintrin.h is the de-factor standard header for clang and GCC to
include Intel intrinsics. Using this header avoids requiring the
compiler to use the `-maes` and `-msse4.1` compiler options on systems
that may not have AES or SSE instruction support.

clang: As seen in
https://github.com/llvm-mirror/clang/blob/master/lib/Headers/immintrin.h,
specific intrinsic header files are conditionally included depending on
whether the feature is available.

gcc: As seen in
https://github.com/gcc-mirror/gcc/blob/master/gcc/config/i386/immintrin.h,
gcc includes all intrinsic header files, but each individual file guards
against the feature not being available.

This came out of an investigation in
grpc/grpc#27121.
  • Loading branch information
stanhu authored and razmser committed Sep 12, 2023
1 parent 68ed817 commit e77a167
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion absl/random/internal/randen_hwaes.cc
Expand Up @@ -211,7 +211,7 @@ inline ABSL_TARGET_CRYPTO void SwapEndian(void*) {}

#elif defined(ABSL_ARCH_X86_64) || defined(ABSL_ARCH_X86_32)
// On x86 we rely on the aesni instructions
#include <wmmintrin.h>
#include <immintrin.h>

namespace {

Expand Down

0 comments on commit e77a167

Please sign in to comment.