XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 1 | // 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 | |
Marat Dukhan | 1dadbf7 | 2019-10-01 10:46:20 -0700 | [diff] [blame] | 13 | #include <xnnpack/common.h> |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 14 | |
Marat Dukhan | 1dadbf7 | 2019-10-01 10:46:20 -0700 | [diff] [blame] | 15 | |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 16 | #define TEST_REQUIRES_X86_SSE \ |
| 17 | do { \ |
| 18 | if (!cpuinfo_initialize() || !cpuinfo_has_x86_sse()) { \ |
| 19 | GTEST_SKIP(); \ |
| 20 | } \ |
| 21 | } while (0) |
| 22 | |
| 23 | #define TEST_REQUIRES_X86_SSE2 \ |
| 24 | do { \ |
| 25 | if (!cpuinfo_initialize() || !cpuinfo_has_x86_sse2()) { \ |
| 26 | GTEST_SKIP(); \ |
| 27 | } \ |
| 28 | } while (0) |
| 29 | |
Marat Dukhan | 595e170 | 2020-07-31 10:12:52 -0700 | [diff] [blame] | 30 | #define TEST_REQUIRES_X86_SSSE3 \ |
| 31 | do { \ |
| 32 | if (!cpuinfo_initialize() || !cpuinfo_has_x86_ssse3()) { \ |
| 33 | GTEST_SKIP(); \ |
| 34 | } \ |
| 35 | } while (0) |
| 36 | |
Marat Dukhan | 69c3f2c | 2019-11-06 12:30:01 -0800 | [diff] [blame] | 37 | #define TEST_REQUIRES_X86_SSE41 \ |
| 38 | do { \ |
| 39 | if (!cpuinfo_initialize() || !cpuinfo_has_x86_sse4_1()) { \ |
| 40 | GTEST_SKIP(); \ |
| 41 | } \ |
| 42 | } while (0) |
| 43 | |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 44 | #define TEST_REQUIRES_X86_AVX \ |
| 45 | do { \ |
| 46 | if (!cpuinfo_initialize() || !cpuinfo_has_x86_avx()) { \ |
| 47 | GTEST_SKIP(); \ |
| 48 | } \ |
| 49 | } while (0) |
| 50 | |
Marat Dukhan | f1a6ed3 | 2021-09-26 13:40:19 -0700 | [diff] [blame^] | 51 | #define TEST_REQUIRES_X86_F16C \ |
| 52 | do { \ |
| 53 | if (!cpuinfo_initialize() || !cpuinfo_has_x86_f16c()) { \ |
| 54 | GTEST_SKIP(); \ |
| 55 | } \ |
| 56 | } while (0) |
| 57 | |
Marat Dukhan | 1566fee | 2020-08-02 21:55:41 -0700 | [diff] [blame] | 58 | #define TEST_REQUIRES_X86_XOP \ |
| 59 | do { \ |
| 60 | if (!cpuinfo_initialize() || !cpuinfo_has_x86_xop()) { \ |
| 61 | GTEST_SKIP(); \ |
| 62 | } \ |
| 63 | } while (0) |
| 64 | |
Marat Dukhan | fda12b8 | 2019-11-21 12:27:59 -0800 | [diff] [blame] | 65 | #define TEST_REQUIRES_X86_FMA3 \ |
| 66 | do { \ |
| 67 | if (!cpuinfo_initialize() || !cpuinfo_has_x86_fma3()) { \ |
| 68 | GTEST_SKIP(); \ |
| 69 | } \ |
| 70 | } while (0) |
| 71 | |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 72 | #define TEST_REQUIRES_X86_AVX2 \ |
| 73 | do { \ |
| 74 | if (!cpuinfo_initialize() || !cpuinfo_has_x86_avx2()) { \ |
| 75 | GTEST_SKIP(); \ |
| 76 | } \ |
| 77 | } while (0) |
| 78 | |
| 79 | #define TEST_REQUIRES_X86_AVX512F \ |
| 80 | do { \ |
| 81 | if (!cpuinfo_initialize() || !cpuinfo_has_x86_avx512f()) { \ |
| 82 | GTEST_SKIP(); \ |
| 83 | } \ |
| 84 | } while (0) |
| 85 | |
Marat Dukhan | bb00b1d | 2020-08-10 11:37:23 -0700 | [diff] [blame] | 86 | #define TEST_REQUIRES_X86_AVX512SKX \ |
| 87 | do { \ |
| 88 | if (!cpuinfo_initialize() || !cpuinfo_has_x86_avx512f() || !cpuinfo_has_x86_avx512cd() || !cpuinfo_has_x86_avx512dq() || !cpuinfo_has_x86_avx512bw() || !cpuinfo_has_x86_avx512vl()) { \ |
| 89 | GTEST_SKIP(); \ |
| 90 | } \ |
| 91 | } while (0) |
| 92 | |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 93 | #define TEST_REQUIRES_ARM_NEON \ |
| 94 | do { \ |
| 95 | if (!cpuinfo_initialize() || !cpuinfo_has_arm_neon()) { \ |
| 96 | GTEST_SKIP(); \ |
| 97 | } \ |
| 98 | } while (0) |
| 99 | |
| 100 | #define TEST_REQUIRES_ARM_NEON_FMA \ |
| 101 | do { \ |
| 102 | if (!cpuinfo_initialize() || !cpuinfo_has_arm_neon_fma()) { \ |
| 103 | GTEST_SKIP(); \ |
| 104 | } \ |
| 105 | } while (0) |
| 106 | |
Marat Dukhan | eecf8fd | 2020-06-09 08:59:37 -0700 | [diff] [blame] | 107 | #define TEST_REQUIRES_ARM_NEON_V8 \ |
| 108 | do { \ |
| 109 | if (!cpuinfo_initialize() || !cpuinfo_has_arm_neon_v8()) { \ |
| 110 | GTEST_SKIP(); \ |
| 111 | } \ |
| 112 | } while (0) |
| 113 | |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 114 | #define TEST_REQUIRES_ARM_NEON_FP16_ARITH \ |
| 115 | do { \ |
| 116 | if (!cpuinfo_initialize() || !cpuinfo_has_arm_neon_fp16_arith()) { \ |
| 117 | GTEST_SKIP(); \ |
| 118 | } \ |
| 119 | } while (0) |
Benoit Jacob | a964473 | 2020-08-13 12:48:55 -0700 | [diff] [blame] | 120 | |
| 121 | #define TEST_REQUIRES_ARM_NEON_DOT \ |
| 122 | do { \ |
| 123 | if (!cpuinfo_initialize() || !cpuinfo_has_arm_neon_dot()) { \ |
| 124 | GTEST_SKIP(); \ |
| 125 | } \ |
| 126 | } while (0) |