public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [ARM] PR98435: Missed optimization in expanding vector constructor
@ 2021-06-04  7:25 Prathamesh Kulkarni
  2021-06-04  7:45 ` Christophe Lyon
  0 siblings, 1 reply; 29+ messages in thread
From: Prathamesh Kulkarni @ 2021-06-04  7:25 UTC (permalink / raw)
  To: gcc Patches, Kyrill Tkachov

Hi,
As mentioned in PR, for the following test-case:

#include <arm_neon.h>

bfloat16x4_t f1 (bfloat16_t a)
{
  return vdup_n_bf16 (a);
}

bfloat16x4_t f2 (bfloat16_t a)
{
  return (bfloat16x4_t) {a, a, a, a};
}

Compiling with arm-linux-gnueabi -O3 -mfpu=neon -mfloat-abi=softfp
-march=armv8.2-a+bf16+fp16 results in f2 not being vectorized:

f1:
        vdup.16 d16, r0
        vmov    r0, r1, d16  @ v4bf
        bx      lr

f2:
        mov     r3, r0  @ __bf16
        adr     r1, .L4
        ldrd    r0, [r1]
        mov     r2, r3  @ __bf16
        mov     ip, r3  @ __bf16
        bfi     r1, r2, #0, #16
        bfi     r0, ip, #0, #16
        bfi     r1, r3, #16, #16
        bfi     r0, r2, #16, #16
        bx      lr

This seems to happen because vec_init pattern in neon.md has VDQ mode
iterator, which doesn't include V4BF. In attached patch, I changed
mode
to VDQX which seems to work for the test-case, and the compiler now generates:

f2:
        vdup.16 d16, r0
        vmov    r0, r1, d16  @ v4bf
        bx      lr

However, the pattern is also gated on TARGET_HAVE_MVE and I am not
sure if either VDQ or VDQX are correct modes for MVE since MVE has
only 128-bit vectors ?

Thanks,
Prathamesh

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

end of thread, other threads:[~2021-08-13  7:04 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-04  7:25 [ARM] PR98435: Missed optimization in expanding vector constructor Prathamesh Kulkarni
2021-06-04  7:45 ` Christophe Lyon
2021-06-09 10:28   ` Prathamesh Kulkarni
2021-06-14  8:01     ` Prathamesh Kulkarni
2021-06-21  8:34       ` Prathamesh Kulkarni
2021-06-24 16:31       ` Kyrylo Tkachov
2021-06-28  8:37         ` Prathamesh Kulkarni
2021-06-28  8:40           ` Kyrylo Tkachov
2021-06-28  9:17             ` Christophe LYON
2021-06-29 10:46               ` Prathamesh Kulkarni
2021-06-30 15:21                 ` Christophe LYON
2021-07-01 10:56                   ` Prathamesh Kulkarni
2021-07-06  7:05                     ` Prathamesh Kulkarni
2021-07-06  8:03                       ` Kyrylo Tkachov
2021-07-06  9:25                         ` Prathamesh Kulkarni
2021-07-06  9:28                           ` Kyrylo Tkachov
2021-07-06 10:16                             ` Christophe Lyon
2021-08-03  9:29                           ` Christophe Lyon
2021-08-03 10:56                             ` Prathamesh Kulkarni
2021-08-03 15:22                               ` Christophe Lyon
2021-08-05 12:27                                 ` Prathamesh Kulkarni
2021-08-05 12:34                                   ` Christophe Lyon
2021-08-06  8:59                                     ` Prathamesh Kulkarni
2021-08-06  9:19                                       ` Christophe Lyon
2021-08-06  9:50                                         ` Prathamesh Kulkarni
2021-08-06 12:01                                           ` Christophe Lyon
2021-08-09  5:07                                             ` Prathamesh Kulkarni
2021-08-09 16:19                                               ` Christophe Lyon
2021-08-13  7:04                                                 ` Prathamesh Kulkarni

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