From: Tom de Vries Date: Tue, 11 Aug 2020 16:20:17 +0000 (+0200) Subject: [testsuite] Add effective target large_initializer X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fb9b3c0ff7d347934b364e3ab06d4cf56726df33;p=gcc.git [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 --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 +}