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>
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 } } } } } */
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 } } } } } */