public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/104704] New: [12 Regression] ix86_gen_scratch_sse_rtx doesn't work explicit XMM7/XMM15/XMM31 usage
@ 2022-02-26 20:09 hjl.tools at gmail dot com
  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
                   ` (15 more replies)
  0 siblings, 16 replies; 17+ messages in thread
From: hjl.tools at gmail dot com @ 2022-02-26 20:09 UTC (permalink / raw)
  To: gcc-bugs

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]$

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

end of thread, other threads:[~2022-03-04  3:03 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-26 20:09 [Bug target/104704] New: [12 Regression] ix86_gen_scratch_sse_rtx doesn't work explicit XMM7/XMM15/XMM31 usage hjl.tools at gmail dot com
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

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