]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
testsuite: Make bitint early vect test more accurate
authorTamar Christina <tamar.christina@arm.com>
Fri, 12 Jan 2024 15:27:45 +0000 (15:27 +0000)
committerTamar Christina <tamar.christina@arm.com>
Fri, 12 Jan 2024 15:32:19 +0000 (15:32 +0000)
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.

gcc/doc/sourcebuild.texi
gcc/testsuite/gcc.dg/vect/vect-early-break_100-pr113287.c
gcc/testsuite/gcc.dg/vect/vect-early-break_99-pr113287.c
gcc/testsuite/lib/target-supports.exp

index 2a96927e8bb5570558909a39554c6739008ce270..8082100a3c9e70ab0e4b1f835cfba5bb7210090b 100644 (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}.
 
index f908e5bc60779c148dc95bda3e200383d12b9e1e..aa10062c915ae155ad1460630359a88462a2041d 100644 (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 ();
 }
index b92a8a268d803ab1656b4716b1a319ed4edc87a3..e616218db589fe1887029ffe2e2b6a492cb5ffcc 100644 (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)
index 43aa24a7c1d203f7d7ef516f654ba7e4cb158ec4..81ae92a026606a36851a5b3d6b91568ebc61c6bf 100644 (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.