Re: [PATCH][testsuite]: Make bitint early vect test more accurate
On Wed, Jan 10, 2024 at 06:07:16PM +, Tamar Christina wrote: > --- a/gcc/testsuite/gcc.dg/vect/vect-early-break_100-pr113287.c > +++ b/gcc/testsuite/gcc.dg/vect/vect-early-break_100-pr113287.c When the testcase was being adjusted for unsigned long -> unsigned long long, two spots using long weren't changed to long long, so the testcase still warns about UB in shifts. Excess errors: .../gcc/gcc/testsuite/gcc.dg/vect/vect-early-break_100-pr113287.c:28:48: warning: right shift count >= width of type [-Wshift-count-overflow] Fixed thusly, committed to trunk as obvious. 2024-01-13 Jakub Jelinek PR tree-optimization/113287 * gcc.dg/vect/vect-early-break_100-pr113287.c: Use long long instead of long. --- gcc/testsuite/gcc.dg/vect/vect-early-break_100-pr113287.c.jj 2024-01-12 17:02:46.176055981 +0100 +++ gcc/testsuite/gcc.dg/vect/vect-early-break_100-pr113287.c 2024-01-13 10:30:25.452872016 +0100 @@ -18,14 +18,14 @@ foo (void) { unsigned long long r[142]; bar (r); - unsigned long long v = ((long) r[0] >> 31); + unsigned long long v = ((long long) r[0] >> 31); if (v + 1 > 1) return 1; for (unsigned long long i = 1; i <= 140; ++i) if (r[i] != v) return 1; unsigned long long w = r[141]; - if ((unsigned long long) (((long) (w << 60)) >> 60) != v) + if ((unsigned long long) (((long long) (w << 60)) >> 60) != v) return 1; return 0; } Jakub
Re: [PATCH][testsuite]: Make bitint early vect test more accurate
On Wed, Jan 10, 2024 at 06:07:16PM +, Tamar Christina wrote: > This changes the tests I committed for PR113287 to also > run on targets that don't support bitint. > > Regtested on aarch64-none-linux-gnu, x86_64-pc-linux-gnu and no issues and > tests run on both. > > Ok for master? Yes, thanks. > gcc/ChangeLog: > > * 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. Jakub
RE: [PATCH][testsuite]: Make bitint early vect test more accurate
> But I'm afraid I have no idea how is this supposed to work on > non-bitint targets or where __BITINT_MAXWIDTH__ is smaller than 9020. > There is no loop at all there, so what should be vectorized? > Yeah It was giving an unresolved and I didn't notice in diff. > I'd say introduce > # 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"] > } > > after bitint575 effective target and use it in the test. > Sure, how's: -- This changes the tests I committed for PR113287 to also run on targets that don't support bitint. Regtested on aarch64-none-linux-gnu, x86_64-pc-linux-gnu and no issues and tests run on both. Ok for master? Thanks, Tamar gcc/ChangeLog: * 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. ---inline copy of patch --- diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi index bd62b21f3b725936eae34c22159ccbc9db40873f..6fbb102f9971d54d66d77dcee8f10a1b57aa6e5a 100644 --- a/gcc/doc/sourcebuild.texi +++ b/gcc/doc/sourcebuild.texi @@ -2864,6 +2864,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}. diff --git a/gcc/testsuite/gcc.dg/vect/vect-early-break_100-pr113287.c b/gcc/testsuite/gcc.dg/vect/vect-early-break_100-pr113287.c index f908e5bc60779c148dc95bda3e200383d12b9e1e..05fb84e1d36d4d05f39e48e41fc70703074ecabd 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-early-break_100-pr113287.c +++ b/gcc/testsuite/gcc.dg/vect/vect-early-break_100-pr113287.c @@ -1,28 +1,29 @@ /* { 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" } } */ __attribute__((noipa)) void -bar (unsigned long *p) +bar (unsigned long long *p) { - __builtin_memset (p, 0, 142 * sizeof (unsigned long)); - p[17] = 0x500UL; + __builtin_memset (p, 0, 142 * sizeof (unsigned long long)); + p[17] = 0x500ULL; } __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; } diff --git a/gcc/testsuite/gcc.dg/vect/vect-early-break_99-pr113287.c b/gcc/testsuite/gcc.dg/vect/vect-early-break_99-pr113287.c index b92a8a268d803ab1656b4716b1a319ed4edc87a3..e141e8a9277f89527e8aff809fe101fdd91a4c46 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-early-break_99-pr113287.c +++ b/gcc/testsuite/gcc.dg/vect/vect-early-break_99-pr113287.c @@ -1,7 +1,8 @@ /* { 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" } } */ _BitInt(998) b; char c; diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index a9c76e0b290b19fd07574805bb2b87c86a5e9cf7..1ddcb3926a8d549b6a17b61e29e1d9836ecce897 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -3850,6 +3850,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. rb18146.patch Description: rb18146.patch
Re: [PATCH][testsuite]: Make bitint early vect test more accurate
On Wed, Jan 10, 2024 at 04:55:00PM +, Tamar Christina wrote: > PR tree-optimization/113287 > * gcc.dg/vect/vect-early-break_100-pr113287.c: Support non-bitint. This part is ok. > --- a/gcc/testsuite/gcc.dg/vect/vect-early-break_99-pr113287.c > +++ b/gcc/testsuite/gcc.dg/vect/vect-early-break_99-pr113287.c > @@ -1,9 +1,18 @@ > /* { 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 } */ > > -_BitInt(998) b; > +/* { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" } } */ > + > +#if __BITINT_MAXWIDTH__ >= 9020 > +typedef _BitInt(9020) B9020; > +typedef _BitInt(998) B998; > +#else > +typedef long long B998; > +typedef long long B9020; > +#endif > + > +B998 b; > char c; > char d; > char e; > @@ -14,7 +23,7 @@ char i; > char j; > > void > -foo(char y, _BitInt(9020) a, char *r) > +foo(char y, B9020 a, char *r) > { >char x = __builtin_mul_overflow_p(a << sizeof(a), y, 0); But I'm afraid I have no idea how is this supposed to work on non-bitint targets or where __BITINT_MAXWIDTH__ is smaller than 9020. There is no loop at all there, so what should be vectorized? I'd say introduce # 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"] } after bitint575 effective target and use it in the test. Jakub
[PATCH][testsuite]: Make bitint early vect test more accurate
Hi All, This changes the tests I committed for PR113287 to also run on targets that don't support bitint. Regtested on aarch64-none-linux-gnu, x86_64-pc-linux-gnu and no issues and tests run on both. Ok for master? Thanks, Tamar 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. --- inline copy of patch -- diff --git a/gcc/testsuite/gcc.dg/vect/vect-early-break_100-pr113287.c b/gcc/testsuite/gcc.dg/vect/vect-early-break_100-pr113287.c index f908e5bc60779c148dc95bda3e200383d12b9e1e..05fb84e1d36d4d05f39e48e41fc70703074ecabd 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-early-break_100-pr113287.c +++ b/gcc/testsuite/gcc.dg/vect/vect-early-break_100-pr113287.c @@ -1,28 +1,29 @@ /* { 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" } } */ __attribute__((noipa)) void -bar (unsigned long *p) +bar (unsigned long long *p) { - __builtin_memset (p, 0, 142 * sizeof (unsigned long)); - p[17] = 0x500UL; + __builtin_memset (p, 0, 142 * sizeof (unsigned long long)); + p[17] = 0x500ULL; } __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; } diff --git a/gcc/testsuite/gcc.dg/vect/vect-early-break_99-pr113287.c b/gcc/testsuite/gcc.dg/vect/vect-early-break_99-pr113287.c index b92a8a268d803ab1656b4716b1a319ed4edc87a3..fb99ef39402ee7b3c6c564e7db5f5543a5f0c2e0 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-early-break_99-pr113287.c +++ b/gcc/testsuite/gcc.dg/vect/vect-early-break_99-pr113287.c @@ -1,9 +1,18 @@ /* { 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 } */ -_BitInt(998) b; +/* { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" } } */ + +#if __BITINT_MAXWIDTH__ >= 9020 +typedef _BitInt(9020) B9020; +typedef _BitInt(998) B998; +#else +typedef long long B998; +typedef long long B9020; +#endif + +B998 b; char c; char d; char e; @@ -14,7 +23,7 @@ char i; char j; void -foo(char y, _BitInt(9020) a, char *r) +foo(char y, B9020 a, char *r) { char x = __builtin_mul_overflow_p(a << sizeof(a), y, 0); x += c + d + e + f + g + h + i + j + b; @@ -26,7 +35,12 @@ main(void) { char x; foo(5, 5, ); +#if __BITINT_MAXWIDTH__ >= 9020 if (x != 1) __builtin_abort(); +#else + if (x != 0) +__builtin_abort(); +#endif return 0; } -- diff --git a/gcc/testsuite/gcc.dg/vect/vect-early-break_100-pr113287.c b/gcc/testsuite/gcc.dg/vect/vect-early-break_100-pr113287.c index f908e5bc60779c148dc95bda3e200383d12b9e1e..05fb84e1d36d4d05f39e48e41fc70703074ecabd 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-early-break_100-pr113287.c +++ b/gcc/testsuite/gcc.dg/vect/vect-early-break_100-pr113287.c @@ -1,28 +1,29 @@ /* { 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" } } */ __attribute__((noipa)) void -bar (unsigned long *p) +bar (unsigned long long *p) { - __builtin_memset (p, 0, 142 * sizeof (unsigned long)); - p[17] = 0x500UL; + __builtin_memset (p, 0, 142 * sizeof (unsigned long long)); + p[17] = 0x500ULL; } __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; } diff --git a/gcc/testsuite/gcc.dg/vect/vect-early-break_99-pr113287.c b/gcc/testsuite/gcc.dg/vect/vect-early-break_99-pr113287.c index