aboutsummaryrefslogtreecommitdiff
path: root/src/xnnpack/isa-checks.h
blob: a18c2d7065e7a576cdb9e208509cd3773b054f79 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
// Copyright (c) Facebook, Inc. and its affiliates.
// All rights reserved.
//
// Copyright 2019 Google LLC
//
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the root directory of this source tree.

#pragma once

#include <cpuinfo.h>

#include <xnnpack/common.h>


#define TEST_REQUIRES_X86_SSE \
  do { \
    if (!cpuinfo_initialize() || !cpuinfo_has_x86_sse()) { \
      GTEST_SKIP(); \
    } \
  } while (0)

#define TEST_REQUIRES_X86_SSE2 \
  do { \
    if (!cpuinfo_initialize() || !cpuinfo_has_x86_sse2()) { \
      GTEST_SKIP(); \
    } \
  } while (0)

#define TEST_REQUIRES_X86_SSSE3 \
  do { \
    if (!cpuinfo_initialize() || !cpuinfo_has_x86_ssse3()) { \
      GTEST_SKIP(); \
    } \
  } while (0)

#define TEST_REQUIRES_X86_SSE41 \
  do { \
    if (!cpuinfo_initialize() || !cpuinfo_has_x86_sse4_1()) { \
      GTEST_SKIP(); \
    } \
  } while (0)

#define TEST_REQUIRES_X86_AVX \
  do { \
    if (!cpuinfo_initialize() || !cpuinfo_has_x86_avx()) { \
      GTEST_SKIP(); \
    } \
  } while (0)

#define TEST_REQUIRES_X86_F16C \
  do { \
    if (!cpuinfo_initialize() || !cpuinfo_has_x86_f16c()) { \
      GTEST_SKIP(); \
    } \
  } while (0)

#define TEST_REQUIRES_X86_XOP \
  do { \
    if (!cpuinfo_initialize() || !cpuinfo_has_x86_xop()) { \
      GTEST_SKIP(); \
    } \
  } while (0)

#define TEST_REQUIRES_X86_FMA3 \
  do { \
    if (!cpuinfo_initialize() || !cpuinfo_has_x86_fma3()) { \
      GTEST_SKIP(); \
    } \
  } while (0)

#define TEST_REQUIRES_X86_AVX2 \
  do { \
    if (!cpuinfo_initialize() || !cpuinfo_has_x86_avx2()) { \
      GTEST_SKIP(); \
    } \
  } while (0)

#define TEST_REQUIRES_X86_AVX512F \
  do { \
    if (!cpuinfo_initialize() || !cpuinfo_has_x86_avx512f()) { \
      GTEST_SKIP(); \
    } \
  } while (0)

#define TEST_REQUIRES_X86_AVX512SKX \
  do { \
    if (!cpuinfo_initialize() || !cpuinfo_has_x86_avx512f() || !cpuinfo_has_x86_avx512cd() || !cpuinfo_has_x86_avx512dq() || !cpuinfo_has_x86_avx512bw() || !cpuinfo_has_x86_avx512vl()) { \
      GTEST_SKIP(); \
    } \
  } while (0)

#define TEST_REQUIRES_ARM_SIMD32 \
  do { \
    if (!cpuinfo_initialize() || !cpuinfo_has_arm_v6()) { \
      GTEST_SKIP(); \
    } \
  } while (0)

#define TEST_REQUIRES_ARM_NEON \
  do { \
    if (!cpuinfo_initialize() || !cpuinfo_has_arm_neon()) { \
      GTEST_SKIP(); \
    } \
  } while (0)

#define TEST_REQUIRES_ARM_NEON_FP16 \
  do { \
    if (!cpuinfo_initialize() || !cpuinfo_has_arm_neon_fp16()) { \
      GTEST_SKIP(); \
    } \
  } while (0)

#define TEST_REQUIRES_ARM_NEON_FMA \
  do { \
    if (!cpuinfo_initialize() || !cpuinfo_has_arm_neon_fma()) { \
      GTEST_SKIP(); \
    } \
  } while (0)

#define TEST_REQUIRES_ARM_NEON_V8 \
  do { \
    if (!cpuinfo_initialize() || !cpuinfo_has_arm_neon_v8()) { \
      GTEST_SKIP(); \
    } \
  } while (0)

#define TEST_REQUIRES_ARM_NEON_FP16_ARITH \
  do { \
    if (!cpuinfo_initialize() || !cpuinfo_has_arm_neon_fp16_arith()) { \
      GTEST_SKIP(); \
    } \
  } while (0)

#define TEST_REQUIRES_ARM_NEON_BF16 \
  do { \
    if (!cpuinfo_initialize() || !cpuinfo_has_arm_neon_bf16()) { \
      GTEST_SKIP(); \
    } \
  } while (0)

#define TEST_REQUIRES_ARM_NEON_DOT \
  do { \
    if (!cpuinfo_initialize() || !cpuinfo_has_arm_neon_dot()) { \
      GTEST_SKIP(); \
    } \
  } while (0)