From: Jakub Jelinek Date: Thu, 2 Jun 2022 09:14:09 +0000 (+0200) Subject: testsuite: Also test swapped arguments of __builtin_mul_overflow_p [PR30314] X-Git-Tag: basepoints/gcc-14~6247 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=72c605eea94065606b5ddcb5a51ef24a3d2841e9;p=thirdparty%2Fgcc.git testsuite: Also test swapped arguments of __builtin_mul_overflow_p [PR30314] To test the commutativity of __builtin_mul_overflow* arguments in the optimization, I've added 2 further tests. 2022-06-02 Jakub Jelinek PR middle-end/30314 * gcc.dg/tree-ssa/pr30314.c: Add tests with swapped arguments. --- diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr30314.c b/gcc/testsuite/gcc.dg/tree-ssa/pr30314.c index 91388afde22..99e4ee255fa 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr30314.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr30314.c @@ -4,6 +4,8 @@ /* { dg-final { scan-tree-dump-not "\.MUL_OVERFLOW " "optimized" } } */ /* { dg-final { scan-tree-dump " > 122713351" "optimized" { target int32 } } } */ /* { dg-final { scan-tree-dump " > 527049830677415760" "optimized" { target lp64 } } } */ +/* { dg-final { scan-tree-dump " > 102261126" "optimized" { target int32 } } } */ +/* { dg-final { scan-tree-dump " > 439208192231179800" "optimized" { target lp64 } } } */ int foo (unsigned int x) @@ -16,3 +18,15 @@ bar (unsigned long int x) { return __builtin_mul_overflow_p (x, 35UL, 0UL); } + +int +baz (unsigned int x) +{ + return __builtin_mul_overflow_p (42, x, 0U); +} + +int +qux (unsigned long int x) +{ + return __builtin_mul_overflow_p (42, x, 0UL); +}