diff mbox

[testsuite,committed,PR65941] Add and use effective target rdrand

Message ID e2dfb719-bcb2-5f78-be41-7446d5f96a82@mentor.com
State New
Headers show

Commit Message

Tom de Vries May 1, 2017, 2:28 p.m. UTC
Hi,

atm I get these failures for x86_64 -m32:
...
FAIL: g++.dg/other/pr59492.C  -std=gnu++11 (test for excess errors)
FAIL: g++.dg/other/pr59492.C  -std=gnu++14 (test for excess errors)
FAIL: g++.dg/other/pr59492.C  -std=gnu++98 (test for excess errors)
...

More specifically:
...
/tmp/ccSwV0hl.s: Assembler messages:
/tmp/ccSwV0hl.s:24: Error: no such instruction: `rdrand %edx'
compiler exited with status 1
...

This patch turns the FAIL into an UNSUPPORTED.

Committed as obvious.

Thanks,
- Tom

Comments

Rainer Orth May 11, 2017, 2:44 p.m. UTC | #1
Hi Tom,

> 2017-05-01  Tom de Vries  <tom@codesourcery.com>
>
> 	PR testsuite/65941
> 	* lib/target-supports.exp (check_effective_target_rdrand): New proc.

the new effective-target keyword needs documenting in sourcebuild.texi.

Thanks.
        Rainer
diff mbox

Patch

Add and use effective target rdrand

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.

---
 gcc/testsuite/g++.dg/other/pr59492.C  |  1 +
 gcc/testsuite/lib/target-supports.exp | 14 ++++++++++++++
 2 files changed, 15 insertions(+)

diff --git a/gcc/testsuite/g++.dg/other/pr59492.C b/gcc/testsuite/g++.dg/other/pr59492.C
index 84bd255..92694ae 100644
--- a/gcc/testsuite/g++.dg/other/pr59492.C
+++ b/gcc/testsuite/g++.dg/other/pr59492.C
@@ -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__));
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 342af27..83e7f26 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -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 { } {