From 72c605eea94065606b5ddcb5a51ef24a3d2841e9 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 2 Jun 2022 11:14:09 +0200 Subject: [PATCH] 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. --- gcc/testsuite/gcc.dg/tree-ssa/pr30314.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr30314.c b/gcc/testsuite/gcc.dg/tree-ssa/pr30314.c index 91388af..99e4ee2 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); +} -- 2.7.4