This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/51821] [4.5/4.6/4.7 Regression] 64bit > 32bit conversion produces incorrect results with optimizations
- From: "ubizjak at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 11 Jan 2012 12:33:59 +0000
- Subject: [Bug target/51821] [4.5/4.6/4.7 Regression] 64bit > 32bit conversion produces incorrect results with optimizations
- Auto-submitted: auto-generated
- References: <bug-51821-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51821
--- Comment #3 from Uros Bizjak <ubizjak at gmail dot com> 2012-01-11 12:33:59 UTC ---
(In reply to comment #2)
> I believe this is a target issue. We produce
>
> test:
> .LFB0:
> .cfi_startproc
> movl 4(%esp), %ecx
> movl $-1, %eax
> xorl %edx, %edx
> sall %cl, %eax
> testb $32, %cl
> cmovne %eax, %edx <-- wrong
> cmovne %edx, %eax
> ret
>
> but as this is a SHIFT_COUNT_TRUNCATED target the sall instruction does
> nothing, so shifting DImode by 32 is not implemented correctly on i?86
> (ix86_split_ashl).
There is one cmovne too much. -O2 -m32 -msse2 is needed to trigger this bug,
without cmove we produce correct code.