summaryrefslogtreecommitdiff
path: root/TestPrograms
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2018-11-27 02:54:26 -0500
committerGitHub <noreply@github.com>2018-11-27 02:54:26 -0500
commit3db34abf2f9ec9c25b1140955fced60c8d40394c (patch)
tree96fb730bea5aeb85c6040c367fb5a5c800c4585b /TestPrograms
parent1966d13617b30e63068b056be90c75f37e549339 (diff)
downloadcryptopp-git-3db34abf2f9ec9c25b1140955fced60c8d40394c.tar.gz
Add Power9 Random Number Generator support (GH #747, PR #748)
Diffstat (limited to 'TestPrograms')
-rw-r--r--TestPrograms/test_ppc_power9.cxx33
1 files changed, 33 insertions, 0 deletions
diff --git a/TestPrograms/test_ppc_power9.cxx b/TestPrograms/test_ppc_power9.cxx
new file mode 100644
index 00000000..82e1e755
--- /dev/null
+++ b/TestPrograms/test_ppc_power9.cxx
@@ -0,0 +1,33 @@
+#include <altivec.h>
+int main(int argc, char* argv[])
+{
+ const unsigned char b = (unsigned char)argc;
+ const unsigned int r = (0xf << 24) | (0x3 << 16) | (0xf << 8) | (0x3 << 0);
+#if defined(__clang__)
+ bool x = __builtin_altivec_byte_in_range(b, r);
+#elif defined(__GNUC__)
+ bool x = __builtin_byte_in_range(b, r);
+#else
+ int XXX[-1];
+#endif
+
+#if UINTPTR_MAX == 0xffffffffffffffffULL
+# if defined(__clang__)
+ unsigned long long y = __builtin_altivec_darn();
+# elif defined(__GNUC__)
+ unsigned long long y = __builtin_darn();
+# else
+ int XXX[-1];
+# endif
+#else
+# if defined(__clang__)
+ unsigned int y = __builtin_altivec_darn_32();
+# elif defined(__GNUC__)
+ unsigned int y = __builtin_darn_32();
+# else
+ int XXX[-1];
+# endif
+#endif
+
+ return 0;
+}