public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/103571] New: ABI: V2HF, V4HF and V8HFmode argument passing issues
@ 2021-12-06  8:35 ubizjak at gmail dot com
  2021-12-06 11:37 ` [Bug target/103571] " crazylht at gmail dot com
                   ` (28 more replies)
  0 siblings, 29 replies; 30+ messages in thread
From: ubizjak at gmail dot com @ 2021-12-06  8:35 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 103571
           Summary: ABI: V2HF, V4HF and V8HFmode argument passing issues
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ubizjak at gmail dot com
  Target Milestone: ---

Following testcase:

--cut here--
typedef _Float16 v2hf __attribute__((vector_size(4)));
typedef _Float16 v4hf __attribute__((vector_size(8)));
typedef _Float16 v8hf __attribute__((vector_size(16)));

v2hf foo (v2hf a, v2hf b)
{
  return b;
}

v4hf bar (v4hf a, v4hf b)
{
  return b;
}

v8hf baz (v8hf a, v8hf b)
{
  return b;
}
--cut here--

compiles with -O2 -msse2 -m64 to:

foo:
        movl    16(%rsp), %edx  # 6     [c=9 l=4]  *movsi_internal/0
        movq    %rdi, %rax      # 2     [c=4 l=3]  *movdi_internal/3
        movl    %edx, (%rdi)    # 7     [c=4 l=2]  *movsi_internal/1
        ret             # 18    [c=0 l=1]  simple_return_internal

and with -O2 -msse2 -m32 to:

foo:
        movl    4(%esp), %eax   # 2     [c=9 l=4]  *movsi_internal/0
        movl    12(%esp), %edx  # 6     [c=9 l=4]  *movsi_internal/0
        movl    %edx, (%eax)    # 7     [c=4 l=2]  *movsi_internal/1
        ret     $4              # 17    [c=0 l=3]  simple_return_pop_internal

bar:
        movq    %mm1, %mm0      # 14    [c=4 l=3]  *movv4hf_internal/6
        ret             # 18    [c=0 l=1]  simple_return_internal

baz:

        pushl   %esi    # 53    [c=4 l=1]  *pushsi2/0
        pushl   %ebx    # 54    [c=4 l=1]  *pushsi2/0
        subl    $52, %esp       # 55    [c=4 l=3]  
        movaps  %xmm1, 16(%esp) # 5     [c=4 l=5]  movv8hf_internal/3
        movl    20(%esp), %ecx  # 34    [c=9 l=4]  *movsi_internal/0
        movl    24(%esp), %edx  # 35    [c=9 l=4]  *movsi_internal/0
        movl    28(%esp), %eax  # 36    [c=9 l=4]  *movsi_internal/0
        movd    %xmm1, (%esp)   # 46    [c=4 l=5]  *movsi_internal/11
        movl    %ecx, 4(%esp)   # 47    [c=4 l=4]  *movsi_internal/1
        movl    %edx, 8(%esp)   # 48    [c=4 l=4]  *movsi_internal/1
        movl    %eax, 12(%esp)  # 49    [c=4 l=4]  *movsi_internal/1
        movdqa  (%esp), %xmm0   # 50    [c=17 l=5]  *movti_internal/4
        addl    $52, %esp       # 58    [c=4 l=3]  
        popl    %ebx    # 59    [c=9 l=1]  *popsi1
        popl    %esi    # 60    [c=9 l=1]  *popsi1
        ret             # 61    [c=0 l=1]  simple_return_internal

Does ABI specify how to handle V2HF arguments and returns? foo looks a bit
suspicious to me, corresponding V2HI arguments are simply returned in %eax
register.

Also, baz iz highly un-optimal for 32bit targets.

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

end of thread, other threads:[~2021-12-16 19:22 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-06  8:35 [Bug target/103571] New: ABI: V2HF, V4HF and V8HFmode argument passing issues ubizjak at gmail dot com
2021-12-06 11:37 ` [Bug target/103571] " crazylht at gmail dot com
2021-12-07  3:05 ` crazylht at gmail dot com
2021-12-07  7:47 ` wwwhhhyyy333 at gmail dot com
2021-12-07  7:54 ` ubizjak at gmail dot com
2021-12-07  8:14 ` crazylht at gmail dot com
2021-12-07 11:04 ` ubizjak at gmail dot com
2021-12-07 11:17 ` ubizjak at gmail dot com
2021-12-08  5:27 ` crazylht at gmail dot com
2021-12-08  7:10 ` ubizjak at gmail dot com
2021-12-08  7:16 ` crazylht at gmail dot com
2021-12-08 14:25 ` ubizjak at gmail dot com
2021-12-08 14:38 ` ubizjak at gmail dot com
2021-12-08 15:05 ` ubizjak at gmail dot com
2021-12-08 15:07 ` ubizjak at gmail dot com
2021-12-09  0:39 ` crazylht at gmail dot com
2021-12-09  0:42 ` crazylht at gmail dot com
2021-12-09  4:15 ` crazylht at gmail dot com
2021-12-09  5:57 ` crazylht at gmail dot com
2021-12-09  7:07 ` crazylht at gmail dot com
2021-12-09  7:21 ` crazylht at gmail dot com
2021-12-09  8:15 ` ubizjak at gmail dot com
2021-12-09  8:36 ` crazylht at gmail dot com
2021-12-14 17:28 ` cvs-commit at gcc dot gnu.org
2021-12-14 18:30 ` ubizjak at gmail dot com
2021-12-16  8:51 ` ubizjak at gmail dot com
2021-12-16 18:35 ` cvs-commit at gcc dot gnu.org
2021-12-16 18:49 ` ubizjak at gmail dot com
2021-12-16 18:55 ` ubizjak at gmail dot com
2021-12-16 19:22 ` ubizjak 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).