]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
testsuite: Fix up pr122569*.c tests [PR122569]
authorJakub Jelinek <jakub@redhat.com>
Tue, 5 May 2026 08:45:37 +0000 (10:45 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 5 May 2026 08:45:37 +0000 (10:45 +0200)
On Tue, May 05, 2026 at 02:27:23PM +0800, H.J. Lu wrote:
> The new tests failed with -m32 on Linux/x86-64:
>
> FAIL: gcc.dg/tree-ssa/pr122569-1.c scan-tree-dump forwprop1
> "__builtin_ctz|\\.CTZ"
> FAIL: gcc.dg/tree-ssa/pr122569-2.c scan-tree-dump forwprop1
> "__builtin_clz|\\.CLZ"
>
> Should these tests require int128?

They should first of all require ctzll resp. clzll effective targets,
if there is a function call for those, then it certainly isn't optimized.

The problem is that that isn't enough, ia32 is both ctzll and clzll
effective target.  That is because we handle double-word __builtin_c[tl]zll
by doing 2 word ops and one conditional.
The tree-ssa-forwprop.cc optimization is checking for whether it can use
IFN_CLZ/IFN_CTZ, and that is not the case, because we only use direct optab
for that and don't have the double-word unop fallback for that.

Rather than int128 I think it is more natural to test for lp64 || llp64.

2026-05-05  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/122569
* gcc.dg/tree-ssa/pr122569-1.c: Only require __builtin_ctz/.CTZ
on ctzll 64-bit targets.
* gcc.dg/tree-ssa/pr122569-2.c: Only require __builtin_clz/.CLZ
on clzll 64-bit targets.

Reviewed-by: Richard Biener <rguenth@suse.de>
gcc/testsuite/gcc.dg/tree-ssa/pr122569-1.c
gcc/testsuite/gcc.dg/tree-ssa/pr122569-2.c

index f400505bc18a8c8cce710daaec8c6d1444687ea3..f6fa77ab7ac11ef0d27a8aa2d78762fd7fdd4f8c 100644 (file)
@@ -27,4 +27,4 @@ stockfish_lsb (uint64_t b)
   return magictable[((b & -b) * magic) >> 58];
 }
 
-/* { dg-final { scan-tree-dump "__builtin_ctz|\\.CTZ" "forwprop1" } } */
+/* { dg-final { scan-tree-dump "__builtin_ctz|\\.CTZ" "forwprop1" { target { ctzll && { lp64 || llp64 } } } } } */
index e61586cbd5609d382b7306ef98bd0c1957283ee0..e937cf60f8ed41d068e29843dd7efcd4406cdc5c 100644 (file)
@@ -40,4 +40,4 @@ stockfish_msb (uint64_t b)
   return magictable[(b * magic) >> 58];
 }
 
-/* { dg-final { scan-tree-dump "__builtin_clz|\\.CLZ" "forwprop1" } } */
+/* { dg-final { scan-tree-dump "__builtin_clz|\\.CLZ" "forwprop1" { target { clzll && { lp64 || llp64 } } } } } */