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 04:53:04 +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
H.J. Lu <hjl.tools at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|REOPENED |RESOLVED
Resolution| |FIXED
--- Comment #9 from H.J. Lu <hjl.tools at gmail dot com> 2012-02-24 04:53:04 UTC ---
It is fixed on hjl/x32/addr32, hjl/x32/gcc-4_6-branch and
hjl/x32/gcc-4_6-branch+mx32 branches.
The problem is
;; Stores and loads of ax to arbitrary constant address.
;; We fake an second form of instruction to force reload to load address
;; into register when rax is not available
(define_insn "*movabs<mode>_1"
[(set (mem:SWI1248x (match_operand:DI 0 "x86_64_movabs_operand" "i,r"))
(match_operand:SWI1248x 1 "nonmemory_operand" "a,er"))]
"TARGET_64BIT && ix86_check_movabs (insn, 0)"
"@
movabs{<imodesuffix>}\t{%1, %P0|%P0, %1}
mov{<imodesuffix>}\t{%1, %a0|%a0, %1}"
DImode is incorrect for x32, especially for register operand.
That is where
movq $-18874360, %rax
movl (%rax), %edx
comes from. It should be in Pmode. However, the immediate operand
must be in DImode for x86_64_movabs_operand. Changing this condition
is very intrusive. On the other hand, the second form is redundant
and I opened PR 52364 for it. My fix simply removes the second form:
http://gcc.gnu.org/git/?p=gcc.git;a=commit;h=eb7964e69f1d7d478ae99ae6eff080f15af2b074