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/104704] New: [12 Regression] ix86_gen_scratch_sse_rtx doesn't work explicit XMM7/XMM15/XMM31 usage
Date: Sat, 26 Feb 2022 20:09:39 +0000	[thread overview]
Message-ID: <bug-104704-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 104704
           Summary: [12 Regression] ix86_gen_scratch_sse_rtx doesn't work
                    explicit XMM7/XMM15/XMM31 usage
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hjl.tools at gmail dot com
                CC: crazylht at gmail dot com, ubizjak at gmail dot com
  Target Milestone: ---

ix86_gen_scratch_sse_rtx returns XMM7/XMM15/XMM31 as a scratch register to
prevent RTL optimizer from removing scratch vector register.  But it introduces
a conflict with explicit XMM7/XMM15/XMM31 usage:

[hjl@gnu-tgl-2 scratch-2]$ cat x-2.c 
/* { dg-do compile { target { ! ia32 } } } */
/* { dg-options "-O2 -march=x86-64 -mavx2" } */

#include <immintrin.h>

__m256d y, z;

int i;

__attribute__((noipa))
int
do_test (void)
{
  register int xmm15 __asm ("xmm15") = i;
  asm volatile ("" : "+v" (xmm15));
  z = y;
  register int xmm2 __asm ("xmm2") = xmm15;
  asm volatile ("" : "+v" (xmm2));
  return xmm2;
}

__attribute__((target("arch=x86-64")))
int
main (void)
{
 if (__builtin_cpu_supports ("avx2"))
   {
     i = 4;
     if (do_test () != 4)
       __builtin_abort ();
   }
  return 0;
}
[hjl@gnu-tgl-2 scratch-2]$ make x-2
/export/build/gnu/tools-build/gcc-debug/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/tools-build/gcc-debug/build-x86_64-linux/gcc/ -O2
-march=x86-64 -mavx2 -S x-2.c
/export/build/gnu/tools-build/gcc-debug/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/tools-build/gcc-debug/build-x86_64-linux/gcc/ -O2
-march=x86-64 -o x-2 x-2.s
[hjl@gnu-tgl-2 scratch-2]$ ./x-2
Aborted (core dumped)
[hjl@gnu-tgl-2 scratch-2]$

             reply	other threads:[~2022-02-26 20:09 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-26 20:09 hjl.tools at gmail dot com [this message]
2022-02-27  0:55 ` [Bug target/104704] [12 Regression] ix86_gen_scratch_sse_rtx doesn't work with " hjl.tools at gmail dot com
2022-02-28  1:36 ` crazylht at gmail dot com
2022-02-28  1:44 ` crazylht at gmail dot com
2022-02-28  1:59 ` hjl.tools at gmail dot com
2022-02-28  8:31 ` crazylht at gmail dot com
2022-02-28  9:27 ` crazylht at gmail dot com
2022-02-28  9:33 ` crazylht at gmail dot com
2022-03-01  7:37 ` rguenth at gcc dot gnu.org
2022-03-02  5:29 ` crazylht at gmail dot com
2022-03-02 14:49 ` hjl.tools at gmail dot com
2022-03-02 22:22 ` hjl.tools at gmail dot com
2022-03-03  1:14 ` crazylht at gmail dot com
2022-03-03  1:28 ` crazylht at gmail dot com
2022-03-03  8:51 ` crazylht at gmail dot com
2022-03-04  3:02 ` cvs-commit at gcc dot gnu.org
2022-03-04  3:03 ` hjl.tools 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-104704-4@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).