[TESTSUITE] Add effective target keyword to check for 64-bit long long

Message ID 20190614104505.3c258078@jozef-kubuntu
State New
Headers show
Series
  • [TESTSUITE] Add effective target keyword to check for 64-bit long long
Related show

Commit Message

Jozef Lawrynowicz June 14, 2019, 9:45 a.m.
For tests that specifically require 64-bit long long, it would be useful to
check this is supported with an effective target keyword.
Currently it appears that either overly-restrictive effective target keywords
such as int32plus are used, or code is guarded at runtime by checking
sizeof(long long).
The attached patch adds the "longlong64" effective target keyword, which
only checks that sizeof(long long) == 8.

Ok for trunk?

Comments

Jeff Law June 14, 2019, 7:53 p.m. | #1
On 6/14/19 3:45 AM, Jozef Lawrynowicz wrote:
> For tests that specifically require 64-bit long long, it would be useful to

> check this is supported with an effective target keyword.

> Currently it appears that either overly-restrictive effective target keywords

> such as int32plus are used, or code is guarded at runtime by checking

> sizeof(long long).

> The attached patch adds the "longlong64" effective target keyword, which

> only checks that sizeof(long long) == 8.

> 

> Ok for trunk?

> 

OK
jeff

Patch

From b89d7957b2265b1f30166d35685236a3db8752eb Mon Sep 17 00:00:00 2001
From: Jozef Lawrynowicz <jozef.l@mittosystems.com>
Date: Fri, 14 Jun 2019 09:54:00 +0100
Subject: [PATCH] Add DejaGNU effective target keyword to check for 64-bit long
 long

gcc/ChangeLog:

2019-06-14  Jozef Lawrynowicz  <jozef.l@mittosystems.com>

	* doc/sourcebuild.texi: Document new effective target keyword
	longlong64.

gcc/testsuite/ChangeLog:

2019-06-14  Jozef Lawrynowicz  <jozef.l@mittosystems.com>

	* lib/target-supports.exp: Add check_effective_target_longlong64. 
---
 gcc/doc/sourcebuild.texi              | 3 +++
 gcc/testsuite/lib/target-supports.exp | 9 +++++++++
 2 files changed, 12 insertions(+)

diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi
index 546af7f7261..85efadb3ca1 100644
--- a/gcc/doc/sourcebuild.texi
+++ b/gcc/doc/sourcebuild.texi
@@ -1357,6 +1357,9 @@  Target has @code{int} that is at 32 bits or longer.
 @item int16
 Target has @code{int} that is 16 bits or shorter.
 
+@item longlong64
+Target has 64-bit @code{long long}.
+
 @item long_neq_int
 Target has @code{int} and @code{long} with different sizes.
 
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 01472879062..1d4aaa2a87e 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -2617,6 +2617,15 @@  proc check_effective_target_int32plus { } {
     }]
 }
 
+# Return 1 if we're generating 64-bit long long using default options,
+# 0 otherwise.
+
+proc check_effective_target_longlong64 { } {
+    return [check_no_compiler_messages longlong64 object {
+	int dummy[sizeof (long long) == 8 ? 1 : -1];
+    }]
+}
+
 # Return 1 if we're generating 32-bit or larger pointers using default
 # options, 0 otherwise.
 
-- 
2.17.1