public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "lis8215 at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/111384] missed optimization: GCC adds extra any extend when storing subreg#0 multiple times
Date: Tue, 12 Sep 2023 13:10:24 +0000	[thread overview]
Message-ID: <bug-111384-4-KBObXNg9O2@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-111384-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #2 from Siarhei Volkau <lis8215 at gmail dot com> ---
Well what the godbolt says with -O2 -fomit-frame-pointer.

ARM:
        uxth    r0, r0          @ << zero extend
        strh    r0, [r1]
        strh    r0, [r2]
        bx      lr

ARM64:
        and     w0, w0, 65535   @ << zero extend
        strh    w0, [x1]
        strh    w0, [x2]
        ret

MIPS64:
        andi    $4,$4,0xffff    @ << zero extend
        sh      $4,0($5)
        jr      $31
        sh      $4,0($6)

MRISC32:
        shuf    r1, r1, #2888   @ << zero extend
        sth     r1, [r2]
        sth     r1, [r3]
        ret

RISC-V:
        slli    a0,a0,16        @ << zero extend
        srli    a0,a0,16        @ << zero extend
        sh      a0,0(a1)
        sh      a0,0(a2)
        ret

RISC-V (64-bit):
        slli    a0,a0,48        @ << zero extend
        srli    a0,a0,48        @ << zero extend
        sh      a0,0(a1)
        sh      a0,0(a2)
        ret

Xtensa ESP32:
        entry   sp, 32
        extui   a2, a2, 0, 16   @ << zero extend
        s16i    a2, a3, 0
        s16i    a2, a4, 0
        retw.n

Loongarch64:
        bstrpick.w      $r4,$r4,15,0  @ << zero extend
        st.h    $r4,$r5,0
        st.h    $r4,$r6,0
        jr      $r1

MIPS:
        andi    $4,$4,0xffff    @ << zero extend
        sh      $4,0($5)
        jr      $31
        sh      $4,0($6)

SH:
        extu.w  r4,r4           @ << zero extend
        mov.w   r4,@r5
        rts     
        mov.w   r4,@r6


Other available at godbolt (x86-64/Power/Power64/s390) unaffected.

  parent reply	other threads:[~2023-09-12 13:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-12  9:25 [Bug middle-end/111384] New: " lis8215 at gmail dot com
2023-09-12 12:38 ` [Bug rtl-optimization/111384] " rguenth at gcc dot gnu.org
2023-09-12 13:10 ` lis8215 at gmail dot com [this message]
2023-09-12 15:27 ` pinskia at gcc dot gnu.org
2023-09-12 15:35 ` pinskia at gcc dot gnu.org
2023-10-07 20:54 ` law at gcc dot gnu.org
2023-11-01  6:30 ` lis8215 at gmail dot com

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-111384-4-KBObXNg9O2@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).