summaryrefslogtreecommitdiff
path: root/config_misc.h
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2021-04-19 13:58:29 -0400
committerJeffrey Walton <noloader@gmail.com>2021-04-19 13:58:29 -0400
commitc7c1f26676dc467e261b70fb85db4ea550f5bcc8 (patch)
tree5e801ab0acf9e07ac62304edf3311db2bc795ac2 /config_misc.h
parenteedd0ac934a897a885f799f393ded871beef0b8d (diff)
downloadcryptopp-git-c7c1f26676dc467e261b70fb85db4ea550f5bcc8.tar.gz
Move GCC target attribute into config_misc.h
Diffstat (limited to 'config_misc.h')
-rw-r--r--config_misc.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/config_misc.h b/config_misc.h
index 67b2d4ab..1f083ab9 100644
--- a/config_misc.h
+++ b/config_misc.h
@@ -191,4 +191,19 @@
# pragma GCC diagnostic ignored "-Wunused-function"
#endif
+// Should work for Clang 7 and above: https://stackoverflow.com/q/39958935.
+// But Clang 10 is broke: https://bugs.llvm.org/show_bug.cgi?id=50025.
+#if defined(__i386__) || defined(__i686__) || defined(__amd64__)
+# if (CRYPTOPP_GCC_VERSION >= 40800)
+# include <x86intrin.h>
+# define CRYPTOPP_HAVE_ATTRIBUTE_TARGET 1
+# define CRYPTOPP_TARGET_DEFAULT __attribute__ ((target ("default")))
+# define CRYPTOPP_TARGET_SSSE3 __attribute__ ((target ("ssse3")))
+# endif
+#endif
+
+#ifndef CRYPTOPP_TARGET_DEFAULT
+# define CRYPTOPP_TARGET_DEFAULT
+#endif
+
#endif // CRYPTOPP_CONFIG_MISC_H