This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/71016] [6/7 Regression] Redundant sign extension with conditional __builtin_clzl


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71016

--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Actually, on x86_64-linux without -mbmi{,2} -mlzcnt the CLZ and CTZ is actually
undefined at zero, so there is nothing to do with that I'm afraid.  With those
additional options foo is optimized:
-       xorl    %edx, %edx
-       movl    $17, %eax
-       lzcntq  %rdi, %rdx
+       xorl    %eax, %eax
+       movl    $17, %edx
+       lzcntq  %rdi, %rax
        testq   %rdi, %rdi
-       cmovne  %edx, %eax
-       cltq
+       cmove   %rdx, %rax
with the patch and similarly baz:
-       xorl    %edx, %edx
-       movl    $17, %eax
-       tzcntq  %rdi, %rdx
-       addq    $1, %rdx
+       xorl    %eax, %eax
+       movl    $17, %edx
+       tzcntq  %rdi, %rax
+       addq    $1, %rax
        testq   %rdi, %rdi
-       cmovne  %edx, %eax
-       cltq
+       cmove   %rdx, %rax

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]