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 rtl-optimization/102840] [12 Regression] gcc.target/i386/pr22076.c by r12-4475
Date: Tue, 19 Oct 2021 15:36:03 +0000	[thread overview]
Message-ID: <bug-102840-4-7wZvRzjcR4@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-102840-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Roger Sayle from comment #1)
> I believe this test case is poorly written, and not correctly testing the
> original issue in PR target/22076 which concerned suboptimal moving of
> arguments via memory (fixed by prohibiting reload using mmx registers).
> 
> Prior to my patch, with -m32 -O2 -fomit-frame-pointer -mmmx -mno-sse2, GCC
> generated:
> 
> test:   movq    .LC1, %mm0
>         paddb   .LC0, %mm0
>         movq    %mm0, x
>         ret
> 
> .x:     .zero 8
> .LC0:   .byte   1
>         .byte   2
>         .byte   3
>         .byte   4
>         .byte   5
>         .byte   6
>         .byte   7
>         .byte   8
> .LC1:   .byte   11
>         .byte   22
>         .byte   33
>         .byte   44
>         .byte   55
>         .byte   66
>         .byte   77
>         .byte   88
> 
> which indeed doesn't use movl, and requires two movq.
> 
> After my patch, we now generate the much more efficient (dare I say optimal):
> test:   movl    $807671820, %eax
>         movl    $1616136252, %edx
>         movl    %eax, x
>         movl    %edx, x+4
>         ret
> 
> which has evaluated the _mm_add_pi8 at compile-time, and effectively memsets
> x to the correct value in the minimum possible number of cycles.  In fact,
> failing to evaluate this at compile-time is a regression since v4.1
> (according to godbolt)

If your analysis is correct, why does -m64 stay the same?

  parent reply	other threads:[~2021-10-19 15:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-19 13:39 [Bug rtl-optimization/102840] New: " hjl.tools at gmail dot com
2021-10-19 14:12 ` [Bug rtl-optimization/102840] " rguenth at gcc dot gnu.org
2021-10-19 14:48 ` roger at nextmovesoftware dot com
2021-10-19 15:36 ` hjl.tools at gmail dot com [this message]
2021-10-19 17:42 ` roger at nextmovesoftware dot com
2021-10-19 18:08 ` hjl.tools at gmail dot com
2021-10-21 18:58 ` cvs-commit at gcc dot gnu.org
2021-10-21 18:59 ` ubizjak 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-102840-4-7wZvRzjcR4@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).