Add and use effective target rdrand
authorTom de Vries <tom@codesourcery.com>
Mon, 1 May 2017 14:15:33 +0000 (14:15 +0000)
committerTom de Vries <vries@gcc.gnu.org>
Mon, 1 May 2017 14:15:33 +0000 (14:15 +0000)
2017-05-01  Tom de Vries  <tom@codesourcery.com>

PR testsuite/65941
* lib/target-supports.exp (check_effective_target_rdrand): New proc.
* g++.dg/other/pr59492.C: Require effective target rdrand.

From-SVN: r247438

gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/other/pr59492.C
gcc/testsuite/lib/target-supports.exp

index 818e002b7bf07cc618a1f3f83d997f9f2602546a..f1c61a668c5422613de8fc715f01276e90c3e9b1 100644 (file)
@@ -1,3 +1,9 @@
+2017-05-01  Tom de Vries  <tom@codesourcery.com>
+
+       PR testsuite/65941
+       * lib/target-supports.exp (check_effective_target_rdrand): New proc.
+       * g++.dg/other/pr59492.C: Require effective target rdrand.
+
 2017-04-29  Volker Reichelt  <v.reichelt@netcologne.de>
 
        * g++.dg/diagnostic/member-decl-1.C: New test.
index 84bd25554f37f7af96963887c7247ec7150e7da0..92694ae6dde23099bca4bb2ebad1d65a98a4e789 100644 (file)
@@ -2,6 +2,7 @@
 // { dg-options "-mx32 -fPIC" }
 // { dg-require-ifunc "" }
 // { dg-require-effective-target maybe_x32 }
+// { dg-require-effective-target rdrand }
 
 void
 __throw_runtime_error(const char*) __attribute__((__noreturn__));
index 342af270ab1098a3a4871a8f4b0474682a798c9f..83e7f2670e6279f3c293cbda8692686724c67c24 100644 (file)
@@ -8296,6 +8296,20 @@ proc check_effective_target_store_merge { } {
     return 0
 }
 
+# Return 1 if we're able to assemble rdrand
+
+proc check_effective_target_rdrand { } {
+    return [check_no_compiler_messages_nocache rdrand object {
+       unsigned int
+       __foo(void)
+       {
+           unsigned int val;
+           __builtin_ia32_rdrand32_step(&val);
+           return val;
+       }
+    } "-mrdrnd" ]
+}
+
 # Return 1 if the target supports coprocessor instructions: cdp, ldc, stc, mcr and
 # mrc.
 proc check_effective_target_arm_coproc1_ok_nocache { } {