blob: 0bdf97c1bac908307e43ea4f54a103c13ded40db [file] [log] [blame]
XNNPACK Teamb455b122019-09-27 18:10:33 -07001// Copyright (c) Facebook, Inc. and its affiliates.
2// All rights reserved.
3//
4// Copyright 2019 Google LLC
5//
6// This source code is licensed under the BSD-style license found in the
7// LICENSE file in the root directory of this source tree.
8
9#pragma once
10
11#include <cpuinfo.h>
12
13
14#if CPUINFO_ARCH_PNACL || CPUINFO_ARCH_WASMSIMD
15 #define TEST_REQUIRES_PSIMD
16#else
17 #define TEST_REQUIRES_PSIMD \
18 do { \
19 if (!cpuinfo_initialize() || !(cpuinfo_has_arm_neon() || cpuinfo_has_x86_sse2())) { \
20 GTEST_SKIP(); \
21 } \
22 } while (0)
23#endif
24
25#define TEST_REQUIRES_X86_SSE \
26 do { \
27 if (!cpuinfo_initialize() || !cpuinfo_has_x86_sse()) { \
28 GTEST_SKIP(); \
29 } \
30 } while (0)
31
32#define TEST_REQUIRES_X86_SSE2 \
33 do { \
34 if (!cpuinfo_initialize() || !cpuinfo_has_x86_sse2()) { \
35 GTEST_SKIP(); \
36 } \
37 } while (0)
38
39#define TEST_REQUIRES_X86_AVX \
40 do { \
41 if (!cpuinfo_initialize() || !cpuinfo_has_x86_avx()) { \
42 GTEST_SKIP(); \
43 } \
44 } while (0)
45
46#define TEST_REQUIRES_X86_AVX2 \
47 do { \
48 if (!cpuinfo_initialize() || !cpuinfo_has_x86_avx2()) { \
49 GTEST_SKIP(); \
50 } \
51 } while (0)
52
53#define TEST_REQUIRES_X86_AVX512F \
54 do { \
55 if (!cpuinfo_initialize() || !cpuinfo_has_x86_avx512f()) { \
56 GTEST_SKIP(); \
57 } \
58 } while (0)
59
60#define TEST_REQUIRES_ARM_NEON \
61 do { \
62 if (!cpuinfo_initialize() || !cpuinfo_has_arm_neon()) { \
63 GTEST_SKIP(); \
64 } \
65 } while (0)
66
67#define TEST_REQUIRES_ARM_NEON_FMA \
68 do { \
69 if (!cpuinfo_initialize() || !cpuinfo_has_arm_neon_fma()) { \
70 GTEST_SKIP(); \
71 } \
72 } while (0)
73
74#define TEST_REQUIRES_ARM_NEON_FP16_ARITH \
75 do { \
76 if (!cpuinfo_initialize() || !cpuinfo_has_arm_neon_fp16_arith()) { \
77 GTEST_SKIP(); \
78 } \
79 } while (0)