public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/107627] New: [13] Regression int128_t shift generates extra xor/or.
@ 2022-11-11  2:06 crazylht at gmail dot com
  2022-11-11  7:05 ` [Bug target/107627] " crazylht at gmail dot com
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: crazylht at gmail dot com @ 2022-11-11  2:06 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 107627
           Summary: [13] Regression int128_t shift generates extra xor/or.
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: crazylht at gmail dot com
  Target Milestone: ---
            Target: x86_64-*-* i?86-*-*

The case is from PR106220.

#include<stdint.h>
static __inline
unsigned __int128 mk_u128(uint64_t hi, uint64_t lo)
{
  return ((unsigned __int128)hi << 64) | lo;
}

static __inline
uint64_t shrdq(uint64_t hi, uint64_t lo, unsigned rshift)
{
  return (uint64_t)(mk_u128(hi, lo) >> (rshift % 64));
}


void foo1to1(uint64_t *dst, const uint64_t* src, unsigned rshift)
{
  uint64_t r0 = shrdq(src[0], src[1], rshift);
  dst[0] = r0;
}


GCC trunk generates 

foo1to1:
        mov     rax, QWORD PTR [rsi]
        mov     r8, QWORD PTR [rsi+8]
        mov     ecx, edx
        xor     r9d, r9d
        mov     rdx, rax
        xor     eax, eax
        or      rax, r8
        or      rdx, r9
        shrd    rax, rdx, cl
        mov     QWORD PTR [rdi], rax

GCC12.2 generates

foo1to1:
        mov     rax, QWORD PTR [rsi+8]
        mov     r8, rdi
        mov     rdi, QWORD PTR [rsi]
        mov     ecx, edx
        shrd    rax, rdi, cl
        mov     QWORD PTR [r8], rax
        ret

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

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

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-11  2:06 [Bug target/107627] New: [13] Regression int128_t shift generates extra xor/or crazylht at gmail dot com
2022-11-11  7:05 ` [Bug target/107627] " crazylht at gmail dot com
2022-11-11  7:09 ` [Bug target/107627] [13 Regression] " pinskia at gcc dot gnu.org
2022-11-11  9:41 ` rguenth at gcc dot gnu.org
2022-11-21 10:34 ` marxin at gcc dot gnu.org
2022-11-22 12:52 ` jakub at gcc dot gnu.org
2022-11-25 23:40 ` roger at nextmovesoftware dot com
2022-11-29 19:12 ` jakub at gcc dot gnu.org
2022-11-29 19:55 ` jakub at gcc dot gnu.org
2022-11-30 13:03 ` jakub at gcc dot gnu.org
2022-12-01  8:35 ` cvs-commit at gcc dot gnu.org
2022-12-01  8:36 ` jakub at gcc dot gnu.org
2022-12-07 14:31 ` jakub at gcc dot gnu.org
2022-12-08 13:57 ` cvs-commit 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).