public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "hjl.tools at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/52876] [x32] - Sign extend 32 to 64bit then clear upper 32bits fails O1 or higher
Date: Thu, 05 Apr 2012 13:43:00 -0000	[thread overview]
Message-ID: <bug-52876-4-Z7iit4sVQF@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-52876-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52876

--- Comment #8 from H.J. Lu <hjl.tools at gmail dot com> 2012-04-05 13:42:30 UTC ---
The reason why GCC 4.6 works is it uses SImode for Pmode.
On trunk, I got

[hjl@gnu-6 pr52876]$ cat x.i
long long li;

long long testfunc(void* addr) __attribute__ ((noinline));
long long testfunc(void* addr)
{
  li = (long long)(int)addr;

  // next line is important, if the address from pv
  // has been sign extended with leading ONEs
  li &= 0xffffffff;

  return li;
}
[hjl@gnu-6 pr52876]$ /export/build/gnu/gcc-x32/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/gcc-x32/build-x86_64-linux/gcc/ -S -o x.s -mx32 -O  x.i
-maddress-mode=long
[hjl@gnu-6 pr52876]$ cat x.s
    .file    "x.i"
    .text
    .globl    testfunc
    .type    testfunc, @function
testfunc:
.LFB0:
    .cfi_startproc
    movslq    %edi, %rax
    movq    %rax, li(%rip)
    ret
    .cfi_endproc
.LFE0:
    .size    testfunc, .-testfunc
    .comm    li,8,8
    .ident    "GCC: (GNU) 4.8.0 20120403 (experimental)"
    .section    .note.GNU-stack,"",@progbits
[hjl@gnu-6 pr52876]$ /export/build/gnu/gcc-x32/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/gcc-x32/build-x86_64-linux/gcc/ -S -o x.s -mx32 -O  x.i
-maddress-mode=short
[hjl@gnu-6 pr52876]$ cat x.s
    .file    "x.i"
    .text
    .globl    testfunc
    .type    testfunc, @function
testfunc:
.LFB0:
    .cfi_startproc
    movq    %rdi, %rax
    movq    %rdi, li(%rip)
    ret
    .cfi_endproc
.LFE0:
    .size    testfunc, .-testfunc
    .comm    li,8,8
    .ident    "GCC: (GNU) 4.8.0 20120403 (experimental)"
    .section    .note.GNU-stack,"",@progbits
[hjl@gnu-6 pr52876]$ 

-maddress-mode=long generates the wrong code.  We have a
POINTERS_EXTEND_UNSIGNED bug.


  parent reply	other threads:[~2012-04-05 13:43 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-05  8:17 [Bug target/52876] New: " steffen-schmidt at siemens dot com
2012-04-05  8:19 ` [Bug target/52876] " steffen-schmidt at siemens dot com
2012-04-05  8:20 ` steffen-schmidt at siemens dot com
2012-04-05  8:20 ` steffen-schmidt at siemens dot com
2012-04-05  8:21 ` steffen-schmidt at siemens dot com
2012-04-05  8:21 ` steffen-schmidt at siemens dot com
2012-04-05 10:16 ` ubizjak at gmail dot com
2012-04-05 10:17 ` ubizjak at gmail dot com
2012-04-05 13:43 ` hjl.tools at gmail dot com [this message]
2012-04-05 13:50 ` hjl.tools at gmail dot com
2012-04-05 14:31 ` hjl.tools at gmail dot com
2012-04-05 15:17 ` [Bug rtl-optimization/52876] " ubizjak at gmail dot com
2012-04-05 15:21 ` [Bug target/52876] " hjl.tools at gmail dot com
2012-04-05 15:46 ` hjl.tools at gmail dot com
2012-04-10 14:50 ` [Bug rtl-optimization/52876] " hjl.tools at gmail dot com
2012-04-11 19:32 ` hjl at gcc dot gnu.org
2013-02-07 11:50 ` steffen-schmidt at siemens dot com
2013-02-07 16:34 ` hjl.tools at gmail dot com
2024-03-26 23:34 ` pinskia at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-52876-4-Z7iit4sVQF@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).