public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/105923] New: unsupported return type ‘complex double’ for simd
@ 2022-06-11  1:32 hjl.tools at gmail dot com
  2022-06-11  1:35 ` [Bug c/105923] " pinskia at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: hjl.tools at gmail dot com @ 2022-06-11  1:32 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 105923
           Summary: unsupported return type ‘complex double’ for simd
           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, wwwhhhyyy333 at gmail dot com
  Target Milestone: ---
            Target: x86-64

[hjl@gnu-tgl-3 tmp]$ cat c.c 
__attribute__ ((__simd__ ("notinbranch")))
double _Complex foo (double _Complex __x) __attribute__ ((__nothrow__ ,
__leaf__));
double _Complex foo (double _Complex __x) __attribute__ ((__nothrow__ ,
__leaf__));

int N = 3200;
double _Complex b[3200];
double _Complex a[3200];

void
bar (void)
{
  int i;

  for (i = 0; i < N; i += 1)
    b[i] = foo (a[i]);
}
[hjl@gnu-tgl-3 tmp]$ gcc -S -Ofast c.c
c.c:3:17: warning: unsupported return type ‘complex double’ for simd
    3 | double _Complex foo (double _Complex __x) __attribute__ ((__nothrow__ ,
__leaf__));
      |                 ^~~
[hjl@gnu-tgl-3 tmp]$

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

* [Bug c/105923] unsupported return type ‘complex double’ for simd
  2022-06-11  1:32 [Bug target/105923] New: unsupported return type ‘complex double’ for simd hjl.tools at gmail dot com
@ 2022-06-11  1:35 ` pinskia at gcc dot gnu.org
  2022-06-14  7:39 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-06-11  1:35 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|target                      |c
           Severity|normal                      |enhancement

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I think that is correct. Gcc does not support a vector of complex types yet.

Note this is not just a target issue as it  fails generically.

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

* [Bug c/105923] unsupported return type ‘complex double’ for simd
  2022-06-11  1:32 [Bug target/105923] New: unsupported return type ‘complex double’ for simd hjl.tools at gmail dot com
  2022-06-11  1:35 ` [Bug c/105923] " pinskia at gcc dot gnu.org
@ 2022-06-14  7:39 ` rguenth at gcc dot gnu.org
  2022-06-14  7:52 ` crazylht at gmail dot com
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-06-14  7:39 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
           Keywords|                            |ABI
   Last reconfirmed|                            |2022-06-14
             Target|x86-64                      |x86_64-*-*

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.

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

* [Bug c/105923] unsupported return type ‘complex double’ for simd
  2022-06-11  1:32 [Bug target/105923] New: unsupported return type ‘complex double’ for simd hjl.tools at gmail dot com
  2022-06-11  1:35 ` [Bug c/105923] " pinskia at gcc dot gnu.org
  2022-06-14  7:39 ` rguenth at gcc dot gnu.org
@ 2022-06-14  7:52 ` crazylht at gmail dot com
  2022-06-14  9:10 ` crazylht at gmail dot com
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: crazylht at gmail dot com @ 2022-06-14  7:52 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Hongtao.liu <crazylht at gmail dot com> ---
An alternative is taking vector complex as a 2*N length vector(just like
vectorizer did).

But __attribute__ ((__simd__ ("notinbranch"))) need to be extent for that.

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

* [Bug c/105923] unsupported return type ‘complex double’ for simd
  2022-06-11  1:32 [Bug target/105923] New: unsupported return type ‘complex double’ for simd hjl.tools at gmail dot com
                   ` (2 preceding siblings ...)
  2022-06-14  7:52 ` crazylht at gmail dot com
@ 2022-06-14  9:10 ` crazylht at gmail dot com
  2022-06-15  8:10 ` crazylht at gmail dot com
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: crazylht at gmail dot com @ 2022-06-14  9:10 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Hongtao.liu <crazylht at gmail dot com> ---
Hmm, it's in i386.cc


23455/* Set CLONEI->vecsize_mangle, CLONEI->mask_mode, CLONEI->vecsize_int,
23456   CLONEI->vecsize_float and if CLONEI->simdlen is 0, also
23457   CLONEI->simdlen.  Return 0 if SIMD clones shouldn't be emitted,
23458   or number of vecsize_mangle variants that should be emitted.  */
23459
23460static int
23461ix86_simd_clone_compute_vecsize_and_simdlen (struct cgraph_node *node,
23462                                             struct cgraph_simd_clone
*clonei,
23463                                             tree base_type, int num)
...
23509        case E_QImode:
23510        case E_HImode:
23511        case E_SImode:
23512        case E_DImode:
23513        case E_SFmode:
23514        case E_DFmode:
23515        /* case E_SCmode: */
23516        /* case E_DCmode: */
23517          if (!AGGREGATE_TYPE_P (arg_type))
23518            break;
23519          /* FALLTHRU */
23520        default:
23521          if (clonei->args[i].arg_type == SIMD_CLONE_ARG_TYPE_UNIFORM)
23522            break;
23523          warning_at (DECL_SOURCE_LOCATION (node->decl), 0,
23524                      "unsupported argument type %qT for simd", arg_type);
23525          return 0;
23526        }
23527    }

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

* [Bug c/105923] unsupported return type ‘complex double’ for simd
  2022-06-11  1:32 [Bug target/105923] New: unsupported return type ‘complex double’ for simd hjl.tools at gmail dot com
                   ` (3 preceding siblings ...)
  2022-06-14  9:10 ` crazylht at gmail dot com
@ 2022-06-15  8:10 ` crazylht at gmail dot com
  2022-06-15  8:12 ` crazylht at gmail dot com
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: crazylht at gmail dot com @ 2022-06-15  8:10 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Hongtao.liu <crazylht at gmail dot com> ---
after a rough hack to allow complex type in both omp-simd-clone and
vectorizer(get_related_vectype_for_scalar_type), testcase in PR could be
compiled to

.L4:
        vmovapd a(%rbx), %ymm0
        addq    $32, %rbx
        call    _ZGVdN4v_foo
        vmovapd %ymm0, b-32(%rbx)
        cmpq    %rbx, %r13
        jne     .L4
        movl    %r12d, %ebx
        andl    $-4, %ebx
        movl    %ebx, %r13d
        cmpl    %ebx, %r12d
        je      .L20
        vzeroupper
.L3:
        subl    %r13d, %r12d
        cmpl    $1, %r12d
        je      .L6
        salq    $4, %r13
        vmovapd a(%r13), %xmm0
        call    _ZGVbN2v_foo
        vmovapd %xmm0, b(%r13)
        testb   $1, %r12b
        je      .L17
        andl    $-2, %r12d
        addl    %r12d, %ebx
.L6:
        movslq  %ebx, %rbx
        salq    $4, %rbx
        vmovsd  a(%rbx), %xmm0
        vmovsd  a+8(%rbx), %xmm1
        call    foo
        vmovsd  %xmm0, b(%rbx)
        vmovsd  %xmm1, b+8(%rbx)

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

* [Bug c/105923] unsupported return type ‘complex double’ for simd
  2022-06-11  1:32 [Bug target/105923] New: unsupported return type ‘complex double’ for simd hjl.tools at gmail dot com
                   ` (4 preceding siblings ...)
  2022-06-15  8:10 ` crazylht at gmail dot com
@ 2022-06-15  8:12 ` crazylht at gmail dot com
  2022-06-15 18:41 ` hjl.tools at gmail dot com
  2022-07-20  8:15 ` crazylht at gmail dot com
  7 siblings, 0 replies; 9+ messages in thread
From: crazylht at gmail dot com @ 2022-06-15  8:12 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Hongtao.liu <crazylht at gmail dot com> ---
> .L3:
>         subl    %r13d, %r12d
>         cmpl    $1, %r12d
>         je      .L6
>         salq    $4, %r13
>         vmovapd a(%r13), %xmm0
>         call    _ZGVbN2v_foo
>         vmovapd %xmm0, b(%r13)

hmm,  xmm version should be abandoned since it's just 1 complex double.

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

* [Bug c/105923] unsupported return type ‘complex double’ for simd
  2022-06-11  1:32 [Bug target/105923] New: unsupported return type ‘complex double’ for simd hjl.tools at gmail dot com
                   ` (5 preceding siblings ...)
  2022-06-15  8:12 ` crazylht at gmail dot com
@ 2022-06-15 18:41 ` hjl.tools at gmail dot com
  2022-07-20  8:15 ` crazylht at gmail dot com
  7 siblings, 0 replies; 9+ messages in thread
From: hjl.tools at gmail dot com @ 2022-06-15 18:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Hongtao.liu from comment #6)
> > .L3:
> >         subl    %r13d, %r12d
> >         cmpl    $1, %r12d
> >         je      .L6
> >         salq    $4, %r13
> >         vmovapd a(%r13), %xmm0
> >         call    _ZGVbN2v_foo
> >         vmovapd %xmm0, b(%r13)
> 
> hmm,  xmm version should be abandoned since it's just 1 complex double.

If there is an XMM version of a vector complex, will it be faster than
passing complex double as a struct in 2 registers.

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

* [Bug c/105923] unsupported return type ‘complex double’ for simd
  2022-06-11  1:32 [Bug target/105923] New: unsupported return type ‘complex double’ for simd hjl.tools at gmail dot com
                   ` (6 preceding siblings ...)
  2022-06-15 18:41 ` hjl.tools at gmail dot com
@ 2022-07-20  8:15 ` crazylht at gmail dot com
  7 siblings, 0 replies; 9+ messages in thread
From: crazylht at gmail dot com @ 2022-07-20  8:15 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105923
Bug 105923 depends on bug 106010, which changed state.

Bug 106010 Summary: Miss vectorization for complex type copy.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106010

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

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

end of thread, other threads:[~2022-07-20  8:15 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-11  1:32 [Bug target/105923] New: unsupported return type ‘complex double’ for simd hjl.tools at gmail dot com
2022-06-11  1:35 ` [Bug c/105923] " pinskia at gcc dot gnu.org
2022-06-14  7:39 ` rguenth at gcc dot gnu.org
2022-06-14  7:52 ` crazylht at gmail dot com
2022-06-14  9:10 ` crazylht at gmail dot com
2022-06-15  8:10 ` crazylht at gmail dot com
2022-06-15  8:12 ` crazylht at gmail dot com
2022-06-15 18:41 ` hjl.tools at gmail dot com
2022-07-20  8:15 ` crazylht 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).