Robin's patch to fix nonzero bits for the result of a popcount triggered a minor testsuite scan failure for loongarch.  Essentially it was expecting to see an ANDI for a zero-extend, but after the change we get a slli with a count 0, which is used for sign extension on loongarch.

Both are likely equally performant.  So this just adjusts the test to accept both forms.  Now one could argue that the result of the popcount is already sign extended and you'd be right -- that's a separate missed optimization issue and unrelated to this testsuite regression.

Anyway, pushing this to the trunk.

jeff

commit 8ad11691d3daab965fc34572e7683fe02b25e741
Author: Jeff Law <[email protected]>
Date:   Sat Feb 7 11:49:30 2026 -0700

    Fix testsuite scan failure on loongarch64
    
    Robin's patch to fix nonzero bits for the result of a popcount triggered a
    minor testsuite scan failure for loongarch.  Essentially it was expecting to
    see an ANDI for a zero-extend, but after the change we get a slli with a 
count
    0, which is used for sign extension on loongarch.
    
    Both are likely equally performant.  So this just adjusts the test to accept
    both forms.  Now one could argue that the result of the popcount is already
    sign extended and you'd be right -- that's a separate missed optimization 
issue
    and unrelated to this testsuite regression.
    
    Anyway, pushing this to the trunk.
    
    gcc/testsuite/
            * gcc.dg/pr90838.c: Adjust expected output for loongarch.

diff --git a/gcc/testsuite/gcc.dg/pr90838.c b/gcc/testsuite/gcc.dg/pr90838.c
index 8b06929cfdd..bb3567e6e75 100644
--- a/gcc/testsuite/gcc.dg/pr90838.c
+++ b/gcc/testsuite/gcc.dg/pr90838.c
@@ -87,4 +87,4 @@ int ctz4 (unsigned long x)
 /* { dg-final { scan-tree-dump-times {= \.CTZ} 4 "forwprop2" { target { 
loongarch64*-*-* } } } } */
 /* { dg-final { scan-assembler-times "ctz.d\t" 1 { target { loongarch64*-*-* } 
} } } */
 /* { dg-final { scan-assembler-times "ctz.w\t" 3 { target { loongarch64*-*-* } 
} } } */
-/* { dg-final { scan-assembler-times "andi\t" 4 { target { loongarch64*-*-* } 
} } } */
+/* { dg-final { scan-assembler-times "\(andi|slli.w\)\t" 4 { target { 
loongarch64*-*-* } } } } */

Reply via email to