public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/c++-modules] [testsuite] Add effective target large_initializer
@ 2020-08-27 18:07 Nathan Sidwell
  0 siblings, 0 replies; only message in thread
From: Nathan Sidwell @ 2020-08-27 18:07 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:fb9b3c0ff7d347934b364e3ab06d4cf56726df33

commit fb9b3c0ff7d347934b364e3ab06d4cf56726df33
Author: Tom de Vries <tdevries@suse.de>
Date:   Tue Aug 11 18:20:17 2020 +0200

    [testsuite] Add effective target large_initializer
    
    When compiling builtin-object-size-21.c for nvptx, cc1 times out while
    emitting the initializer for global variable xm3_3.
    
    With x86_64, we are able to emit the initializer with a few lines of assembly:
    ...
    xm3_3:
            .byte   0
            .zero   9223372036854775803
            .byte   1
            .byte   2
            .byte   3
    ...
    but with nvptx, we don't have some something similar available, and thus
    generate:
    ...
      .visible .global .align 1 .u32 xm3_3[2305843009213693952] =
      { 0, 0, 0, ...
    ...
    
    Introduce an effective target large_initializer, returning false for nvptx,
    and require it for test-cases with large initializers.
    
    Tested on nvptx with make check-gcc.
    
    gcc/testsuite/ChangeLog:
    
            PR testsuite/96566
            * lib/target-supports.exp (check_effective_target_large_initializer):
            New proc.
            * gcc.dg/builtin-object-size-21.c: Require large_initializer.
            * gcc.dg/strlenopt-55.c: Same.

Diff:
---
 gcc/testsuite/gcc.dg/builtin-object-size-21.c |  3 ++-
 gcc/testsuite/gcc.dg/strlenopt-55.c           |  3 ++-
 gcc/testsuite/lib/target-supports.exp         | 11 +++++++++++
 3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/gcc/testsuite/gcc.dg/builtin-object-size-21.c b/gcc/testsuite/gcc.dg/builtin-object-size-21.c
index 1c42374ba89..7e0f85ffdf3 100644
--- a/gcc/testsuite/gcc.dg/builtin-object-size-21.c
+++ b/gcc/testsuite/gcc.dg/builtin-object-size-21.c
@@ -1,7 +1,8 @@
 /* PR middle-end/92815 - spurious -Wstringop-overflow writing into
    a flexible array of an extern struct
    { dg-do compile }
-   { dg-options "-Wall -fdump-tree-optimized" } */
+   { dg-options "-Wall -fdump-tree-optimized" }
+   { dg-require-effective-target large_initializer } */
 
 #define PTRDIFF_MAX __PTRDIFF_MAX__
 
diff --git a/gcc/testsuite/gcc.dg/strlenopt-55.c b/gcc/testsuite/gcc.dg/strlenopt-55.c
index ea6fb22a2ed..ca89ecd3c53 100644
--- a/gcc/testsuite/gcc.dg/strlenopt-55.c
+++ b/gcc/testsuite/gcc.dg/strlenopt-55.c
@@ -3,7 +3,8 @@
 
    Verify that strlen() of braced initialized array is folded
    { dg-do compile }
-   { dg-options "-O1 -Wall -fdump-tree-gimple -fdump-tree-optimized" } */
+   { dg-options "-O1 -Wall -fdump-tree-gimple -fdump-tree-optimized" }
+   { dg-require-effective-target large_initializer } */
 
 #include "strlenopt.h"
 
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index e79015b4d54..4e0d45aaae5 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -10424,3 +10424,14 @@ proc check_effective_target_msp430_large {} {
 	#endif
     } ""]
 }
+
+# Return 1 if the target has an efficient means to encode large initializers
+# in the assembly.
+
+proc check_effective_target_large_initializer { } {
+    if { [istarget nvptx*-*-*] } {
+	return 0
+    }
+
+    return 1
+}


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-08-27 18:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-27 18:07 [gcc/devel/c++-modules] [testsuite] Add effective target large_initializer Nathan Sidwell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).