public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/107238] New: aarch64: Wrong code converting pointer to __int128
@ 2022-10-12 16:25 acoplan at gcc dot gnu.org
  2022-10-12 23:21 ` [Bug target/107238] " pinskia at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: acoplan at gcc dot gnu.org @ 2022-10-12 16:25 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 107238
           Summary: aarch64: Wrong code converting pointer to __int128
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: acoplan at gcc dot gnu.org
  Target Milestone: ---

For this testcase:

__int128 f(int *p) {
    return (__int128)p;
}

AArch64 GCC at -O2 generates:

f:
        asr     x1, x0, 63
        ret

i.e. it sign-extends the pointer, but I think it should be a zero extend
instead. The ABI [1] says:

> Code and data pointers are either 64-bit or 32-bit unsigned types.

Indeed LLVM does a zero-extend:

f:                                      // @f
        mov     x1, xzr
        ret

[1] :
https://github.com/ARM-software/abi-aa/blob/main/aapcs64/aapcs64.rst#pointers

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-10-13  0:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-12 16:25 [Bug target/107238] New: aarch64: Wrong code converting pointer to __int128 acoplan at gcc dot gnu.org
2022-10-12 23:21 ` [Bug target/107238] " pinskia at gcc dot gnu.org
2022-10-12 23:25 ` pinskia at gcc dot gnu.org
2022-10-13  0:12 ` pinskia at gcc dot gnu.org

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).