testsuite: Make bitint early vect test more accurate

This changes the tests I committed for PR113287 to also
run on targets that don't support bitint.

gcc/ChangeLog:

	PR tree-optimization/113287
	* doc/sourcebuild.texi (check_effective_target_bitint65535): New.

gcc/testsuite/ChangeLog:

	PR tree-optimization/113287
	* gcc.dg/vect/vect-early-break_100-pr113287.c: Support non-bitint.
	* gcc.dg/vect/vect-early-break_99-pr113287.c: Likewise.
	* lib/target-supports.exp (bitint, bitint128, bitint575, bitint65535):
	Document them.
This commit is contained in:
Tamar Christina 2024-01-12 15:27:45 +00:00
parent a8dbae4592
commit d14ef0987d
4 changed files with 43 additions and 12 deletions

View file

@ -2877,6 +2877,18 @@ Target supports Graphite optimizations.
@item fixed_point
Target supports fixed-point extension to C.
@item bitint
Target supports _BitInt(N).
@item bitint128
Target supports _BitInt(128).
@item bitint575
Target supports _BitInt(575).
@item bitint65535
Target supports _BitInt(65535).
@item fopenacc
Target supports OpenACC via @option{-fopenacc}.

View file

@ -1,28 +1,31 @@
/* { dg-add-options vect_early_break } */
/* { dg-require-effective-target vect_early_break } */
/* { dg-require-effective-target vect_int } */
/* { dg-require-effective-target bitint } */
/* { dg-require-effective-target vect_long_long } */
/* { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" } } */
#include "tree-vect.h"
__attribute__((noipa)) void
bar (unsigned long *p)
bar (unsigned long long *p)
{
__builtin_memset (p, 0, 142 * sizeof (unsigned long));
p[17] = 0x50000000000UL;
__builtin_memset (p, 0, 142 * sizeof (unsigned long long));
p[17] = 0x50000000000ULL;
}
__attribute__((noipa)) int
foo (void)
{
unsigned long r[142];
unsigned long long r[142];
bar (r);
unsigned long v = ((long) r[0] >> 31);
unsigned long long v = ((long) r[0] >> 31);
if (v + 1 > 1)
return 1;
for (unsigned long i = 1; i <= 140; ++i)
for (unsigned long long i = 1; i <= 140; ++i)
if (r[i] != v)
return 1;
unsigned long w = r[141];
if ((unsigned long) (((long) (w << 60)) >> 60) != v)
unsigned long long w = r[141];
if ((unsigned long long) (((long) (w << 60)) >> 60) != v)
return 1;
return 0;
}
@ -30,6 +33,8 @@ foo (void)
int
main ()
{
check_vect ();
if (foo () != 1)
__builtin_abort ();
}

View file

@ -1,7 +1,10 @@
/* { dg-add-options vect_early_break } */
/* { dg-require-effective-target vect_early_break } */
/* { dg-require-effective-target vect_int } */
/* { dg-require-effective-target bitint } */
/* { dg-require-effective-target bitint65535 } */
/* { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" } } */
#include "tree-vect.h"
_BitInt(998) b;
char c;
@ -24,6 +27,8 @@ foo(char y, _BitInt(9020) a, char *r)
int
main(void)
{
check_vect ();
char x;
foo(5, 5, &x);
if (x != 1)

View file

@ -3858,6 +3858,15 @@ proc check_effective_target_bitint575 { } {
} "-std=c23"]
}
# Return 1 if the target supports _BitInt(65535), 0 otherwise.
proc check_effective_target_bitint65535 { } {
return [check_no_compiler_messages bitint65535 object {
_BitInt (2) a = 1wb;
unsigned _BitInt (65535) b = 0uwb;
} "-std=c23"]
}
# Return 1 if the target supports compiling decimal floating point,
# 0 otherwise.