Skip to content

Commit

Permalink
Merge pull request #8 from mfrischknecht/fix-aesni-on-msvc
Browse files Browse the repository at this point in the history
Fix CPU architecture guards for x86 and x64 on MSVC
  • Loading branch information
jedisct1 authored Apr 25, 2024
2 parents 5b0af70 + 20bba29 commit 3dac3ad
Show file tree
Hide file tree
Showing 19 changed files with 21 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/aegis128l/aegis128l.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ aegis128l_pick_best_implementation(void)
}
#endif

#if defined(__x86_64__) || defined(__i386__)
#if defined(__x86_64__) || defined(_M_AMD64) || defined(__i386__) || defined(_M_IX86)
if (aegis_runtime_has_aesni() && aegis_runtime_has_avx()) {
implementation = &aegis128l_aesni_implementation;
return 0;
Expand Down
2 changes: 1 addition & 1 deletion src/aegis128l/aegis128l_aesni.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if defined(__i386__) || defined(__x86_64__)
#if defined(__i386__) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_AMD64)

# include <errno.h>
# include <stddef.h>
Expand Down
2 changes: 1 addition & 1 deletion src/aegis128x2/aegis128x2.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ aegis128x2_pick_best_implementation(void)
}
#endif

#if defined(__x86_64__) || defined(__i386__)
#if defined(__x86_64__) || defined(_M_AMD64) || defined(__i386__) || defined(_M_IX86)
if (aegis_runtime_has_vaes() && aegis_runtime_has_avx2()) {
implementation = &aegis128x2_avx2_implementation;
return 0;
Expand Down
2 changes: 1 addition & 1 deletion src/aegis128x2/aegis128x2_aesni.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if defined(__i386__) || defined(__x86_64__)
#if defined(__i386__) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_AMD64)

# include <errno.h>
# include <stddef.h>
Expand Down
2 changes: 1 addition & 1 deletion src/aegis128x2/aegis128x2_avx2.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if defined(__i386__) || defined(__x86_64__)
#if defined(__i386__) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_AMD64)

# include <errno.h>
# include <stddef.h>
Expand Down
2 changes: 1 addition & 1 deletion src/aegis128x4/aegis128x4.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ aegis128x4_pick_best_implementation(void)
}
#endif

#if defined(__x86_64__) || defined(__i386__)
#if defined(__x86_64__) || defined(_M_AMD64) || defined(__i386__) || defined(_M_IX86)
# ifdef HAVE_VAESINTRIN_H
if (aegis_runtime_has_vaes() && aegis_runtime_has_avx512f()) {
implementation = &aegis128x4_avx512_implementation;
Expand Down
2 changes: 1 addition & 1 deletion src/aegis128x4/aegis128x4_aesni.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if defined(__i386__) || defined(__x86_64__)
#if defined(__i386__) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_AMD64)

# include <errno.h>
# include <stddef.h>
Expand Down
2 changes: 1 addition & 1 deletion src/aegis128x4/aegis128x4_avx2.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if defined(__i386__) || defined(__x86_64__)
#if defined(__i386__) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_AMD64)

# include <errno.h>
# include <stddef.h>
Expand Down
2 changes: 1 addition & 1 deletion src/aegis128x4/aegis128x4_avx512.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if defined(__i386__) || defined(__x86_64__)
#if defined(__i386__) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_AMD64)

# include <errno.h>
# include <stddef.h>
Expand Down
2 changes: 1 addition & 1 deletion src/aegis256/aegis256.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ aegis256_pick_best_implementation(void)
}
#endif

#if defined(__x86_64__) || defined(__i386__)
#if defined(__x86_64__) || defined(_M_AMD64) || defined(__i386__) || defined(_M_IX86)
if (aegis_runtime_has_aesni() && aegis_runtime_has_avx()) {
implementation = &aegis256_aesni_implementation;
return 0;
Expand Down
2 changes: 1 addition & 1 deletion src/aegis256/aegis256_aesni.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if defined(__i386__) || defined(__x86_64__)
#if defined(__i386__) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_AMD64)

# include <errno.h>
# include <stddef.h>
Expand Down
2 changes: 1 addition & 1 deletion src/aegis256x2/aegis256x2.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ aegis256x2_pick_best_implementation(void)
}
#endif

#if defined(__x86_64__) || defined(__i386__)
#if defined(__x86_64__) || defined(_M_AMD64) || defined(__i386__) || defined(_M_IX86)
if (aegis_runtime_has_vaes() && aegis_runtime_has_avx2()) {
implementation = &aegis256x2_avx2_implementation;
return 0;
Expand Down
2 changes: 1 addition & 1 deletion src/aegis256x2/aegis256x2_aesni.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if defined(__i386__) || defined(__x86_64__)
#if defined(__i386__) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_AMD64)

# include <errno.h>
# include <stddef.h>
Expand Down
2 changes: 1 addition & 1 deletion src/aegis256x2/aegis256x2_avx2.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if defined(__i386__) || defined(__x86_64__)
#if defined(__i386__) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_AMD64)

# include <errno.h>
# include <stddef.h>
Expand Down
2 changes: 1 addition & 1 deletion src/aegis256x4/aegis256x4.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ aegis256x4_pick_best_implementation(void)
}
#endif

#if defined(__x86_64__) || defined(__i386__)
#if defined(__x86_64__) || defined(_M_AMD64) || defined(__i386__) || defined(_M_IX86)
# ifdef HAVE_VAESINTRIN_H
if (aegis_runtime_has_vaes() && aegis_runtime_has_avx512f()) {
implementation = &aegis256x4_avx512_implementation;
Expand Down
2 changes: 1 addition & 1 deletion src/aegis256x4/aegis256x4_aesni.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if defined(__i386__) || defined(__x86_64__)
#if defined(__i386__) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_AMD64)

# include <errno.h>
# include <stddef.h>
Expand Down
2 changes: 1 addition & 1 deletion src/aegis256x4/aegis256x4_avx2.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if defined(__i386__) || defined(__x86_64__)
#if defined(__i386__) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_AMD64)

# include <errno.h>
# include <stddef.h>
Expand Down
2 changes: 1 addition & 1 deletion src/aegis256x4/aegis256x4_avx512.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if defined(__i386__) || defined(__x86_64__)
#if defined(__i386__) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_AMD64)

# include <errno.h>
# include <stddef.h>
Expand Down
5 changes: 3 additions & 2 deletions src/common/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@
# endif
# define HAVE_ANDROID_GETCPUFEATURES
#endif
#if defined(__i386__) || defined(__x86_64__)
#if defined(__i386__) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_AMD64)

# define HAVE_CPUID
# define NATIVE_LITTLE_ENDIAN
# if defined(__clang__) || defined(__GNUC__)
# define HAVE_AVX_ASM
# endif
#endif
#ifdef __x86_64__
#if defined(__x86_64__) || defined(_M_AMD64)
# define HAVE_AVXINTRIN_H
# define HAVE_AVX2INTRIN_H
# define HAVE_AVX512FINTRIN_H
Expand Down

0 comments on commit 3dac3ad

Please sign in to comment.