This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/52352] [x32] - Wrong code to access addresses 0x80000000 to 0xFFFFFFFF using registers
- From: "hjl.tools at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 24 Feb 2012 20:03:59 +0000
- Subject: [Bug target/52352] [x32] - Wrong code to access addresses 0x80000000 to 0xFFFFFFFF using registers
- Auto-submitted: auto-generated
- References: <bug-52352-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52352
--- Comment #13 from H.J. Lu <hjl.tools at gmail dot com> 2012-02-24 20:03:59 UTC ---
(In reply to comment #12)
> (In reply to comment #11)
>
> > I checked a similar fix into hjl/x32/addr32, hjl/x32/gcc-4_6-branch and
> > hjl/x32/gcc-4_6-branch+mx32 branches. I also added "I" code to print
> > constant address as positive 32bit integer for x32:
>
> I think we can simply disable these two patterns on x32.
>
> This is with disabled patterns:
>
> 0000000000000000 <x32_O3_main>:
> 0: b8 00 00 e0 fe mov $0xfee00000,%eax
> 5: 8b 00 mov (%rax),%eax
> 7: a8 01 test $0x1,%al
> 9: 74 01 je c <x32_O3_main+0xc>
> b: 90 nop
> c: b8 00 00 e0 fe mov $0xfee00000,%eax
> 11: 8b 50 08 mov 0x8(%rax),%edx
> 14: 89 50 04 mov %edx,0x4(%rax)
> 17: c3 retq
>
> and with enabled patterns:
>
> 0000000000000000 <x32_O3_main>:
> 0: a1 00 00 e0 fe 00 00 movabs 0xfee00000,%eax
> 7: 00 00
> 9: a8 01 test $0x1,%al
> b: 74 01 je e <x32_O3_main+0xe>
> d: 90 nop
> e: a1 08 00 e0 fe 00 00 movabs 0xfee00008,%eax
> 15: 00 00
> 17: a3 04 00 e0 fe 00 00 movabs %eax,0xfee00004
> 1e: 00 00
> 20: c3 retq
>
> There is simply no need for movabs from/to mem, since there is no 64bit
> addresses. And code size is horrible (and I bet that the former code runs
> faster).
I think it is a good idea.