xref: /freebsd/sys/contrib/libb2/blake2-config.h (revision 0e33efe4e4b5d24e2d416938af8bc6e6e4160ec8)
1*0e33efe4SConrad Meyer /*
2*0e33efe4SConrad Meyer    BLAKE2 reference source code package - optimized C implementations
3*0e33efe4SConrad Meyer 
4*0e33efe4SConrad Meyer    Written in 2012 by Samuel Neves <sneves@dei.uc.pt>
5*0e33efe4SConrad Meyer 
6*0e33efe4SConrad Meyer    To the extent possible under law, the author(s) have dedicated all copyright
7*0e33efe4SConrad Meyer    and related and neighboring rights to this software to the public domain
8*0e33efe4SConrad Meyer    worldwide. This software is distributed without any warranty.
9*0e33efe4SConrad Meyer 
10*0e33efe4SConrad Meyer    You should have received a copy of the CC0 Public Domain Dedication along with
11*0e33efe4SConrad Meyer    this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
12*0e33efe4SConrad Meyer */
13*0e33efe4SConrad Meyer #pragma once
14*0e33efe4SConrad Meyer #ifndef __BLAKE2_CONFIG_H__
15*0e33efe4SConrad Meyer #define __BLAKE2_CONFIG_H__
16*0e33efe4SConrad Meyer 
17*0e33efe4SConrad Meyer #if defined(__SSE2__)
18*0e33efe4SConrad Meyer #define HAVE_SSE2
19*0e33efe4SConrad Meyer #endif
20*0e33efe4SConrad Meyer 
21*0e33efe4SConrad Meyer #if defined(__SSSE3__)
22*0e33efe4SConrad Meyer #define HAVE_SSSE3
23*0e33efe4SConrad Meyer #endif
24*0e33efe4SConrad Meyer 
25*0e33efe4SConrad Meyer #if defined(__SSE4_1__)
26*0e33efe4SConrad Meyer #define HAVE_SSE4_1
27*0e33efe4SConrad Meyer #endif
28*0e33efe4SConrad Meyer 
29*0e33efe4SConrad Meyer #if defined(__AVX__)
30*0e33efe4SConrad Meyer #define HAVE_AVX
31*0e33efe4SConrad Meyer #endif
32*0e33efe4SConrad Meyer 
33*0e33efe4SConrad Meyer #if defined(__XOP__)
34*0e33efe4SConrad Meyer #define HAVE_XOP
35*0e33efe4SConrad Meyer #endif
36*0e33efe4SConrad Meyer 
37*0e33efe4SConrad Meyer 
38*0e33efe4SConrad Meyer #ifdef HAVE_AVX2
39*0e33efe4SConrad Meyer #ifndef HAVE_AVX
40*0e33efe4SConrad Meyer #define HAVE_AVX
41*0e33efe4SConrad Meyer #endif
42*0e33efe4SConrad Meyer #endif
43*0e33efe4SConrad Meyer 
44*0e33efe4SConrad Meyer #ifdef HAVE_XOP
45*0e33efe4SConrad Meyer #ifndef HAVE_AVX
46*0e33efe4SConrad Meyer #define HAVE_AVX
47*0e33efe4SConrad Meyer #endif
48*0e33efe4SConrad Meyer #endif
49*0e33efe4SConrad Meyer 
50*0e33efe4SConrad Meyer #ifdef HAVE_AVX
51*0e33efe4SConrad Meyer #ifndef HAVE_SSE4_1
52*0e33efe4SConrad Meyer #define HAVE_SSE4_1
53*0e33efe4SConrad Meyer #endif
54*0e33efe4SConrad Meyer #endif
55*0e33efe4SConrad Meyer 
56*0e33efe4SConrad Meyer #ifdef HAVE_SSE41
57*0e33efe4SConrad Meyer #ifndef HAVE_SSSE3
58*0e33efe4SConrad Meyer #define HAVE_SSSE3
59*0e33efe4SConrad Meyer #endif
60*0e33efe4SConrad Meyer #endif
61*0e33efe4SConrad Meyer 
62*0e33efe4SConrad Meyer #ifdef HAVE_SSSE3
63*0e33efe4SConrad Meyer #define HAVE_SSE2
64*0e33efe4SConrad Meyer #endif
65*0e33efe4SConrad Meyer 
66*0e33efe4SConrad Meyer #if !defined(HAVE_SSE2)
67*0e33efe4SConrad Meyer #error "This code requires at least SSE2."
68*0e33efe4SConrad Meyer #endif
69*0e33efe4SConrad Meyer 
70*0e33efe4SConrad Meyer #endif
71*0e33efe4SConrad Meyer 
72