blob: e75e1a16d327e8c223f739d2b7dc86860851bd8f [file] [log] [blame]
Austin Schuh36244a12019-09-21 17:52:38 -07001// Copyright 2018 The Abseil Authors.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Shared config probing for SSE instructions used in Swiss tables.
16#ifndef ABSL_CONTAINER_INTERNAL_HAVE_SSE_H_
17#define ABSL_CONTAINER_INTERNAL_HAVE_SSE_H_
18
Austin Schuhb4691e92020-12-31 12:37:18 -080019#ifndef ABSL_INTERNAL_RAW_HASH_SET_HAVE_SSE2
Austin Schuh36244a12019-09-21 17:52:38 -070020#if defined(__SSE2__) || \
21 (defined(_MSC_VER) && \
22 (defined(_M_X64) || (defined(_M_IX86) && _M_IX86_FP >= 2)))
Austin Schuhb4691e92020-12-31 12:37:18 -080023#define ABSL_INTERNAL_RAW_HASH_SET_HAVE_SSE2 1
Austin Schuh36244a12019-09-21 17:52:38 -070024#else
Austin Schuhb4691e92020-12-31 12:37:18 -080025#define ABSL_INTERNAL_RAW_HASH_SET_HAVE_SSE2 0
Austin Schuh36244a12019-09-21 17:52:38 -070026#endif
27#endif
28
Austin Schuhb4691e92020-12-31 12:37:18 -080029#ifndef ABSL_INTERNAL_RAW_HASH_SET_HAVE_SSSE3
Austin Schuh36244a12019-09-21 17:52:38 -070030#ifdef __SSSE3__
Austin Schuhb4691e92020-12-31 12:37:18 -080031#define ABSL_INTERNAL_RAW_HASH_SET_HAVE_SSSE3 1
Austin Schuh36244a12019-09-21 17:52:38 -070032#else
Austin Schuhb4691e92020-12-31 12:37:18 -080033#define ABSL_INTERNAL_RAW_HASH_SET_HAVE_SSSE3 0
Austin Schuh36244a12019-09-21 17:52:38 -070034#endif
35#endif
36
Austin Schuhb4691e92020-12-31 12:37:18 -080037#if ABSL_INTERNAL_RAW_HASH_SET_HAVE_SSSE3 && \
38 !ABSL_INTERNAL_RAW_HASH_SET_HAVE_SSE2
Austin Schuh36244a12019-09-21 17:52:38 -070039#error "Bad configuration!"
40#endif
41
Austin Schuhb4691e92020-12-31 12:37:18 -080042#if ABSL_INTERNAL_RAW_HASH_SET_HAVE_SSE2
Austin Schuh36244a12019-09-21 17:52:38 -070043#include <emmintrin.h>
44#endif
45
Austin Schuhb4691e92020-12-31 12:37:18 -080046#if ABSL_INTERNAL_RAW_HASH_SET_HAVE_SSSE3
Austin Schuh36244a12019-09-21 17:52:38 -070047#include <tmmintrin.h>
48#endif
49
50#endif // ABSL_CONTAINER_INTERNAL_HAVE_SSE_H_