public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/98435] New: [ARM NEON] Missed optimization in expanding vector constructor
@ 2020-12-24  6:56 prathamesh3492 at gcc dot gnu.org
  2020-12-24  6:58 ` [Bug target/98435] " prathamesh3492 at gcc dot gnu.org
  2021-07-12  7:55 ` cvs-commit at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: prathamesh3492 at gcc dot gnu.org @ 2020-12-24  6:56 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 98435
           Summary: [ARM NEON] Missed optimization in expanding vector
                    constructor
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: prathamesh3492 at gcc dot gnu.org
  Target Milestone: ---

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:
        @ args = 0, pretend = 0, frame = 0
        @ frame_needed = 0, uses_anonymous_args = 0
        @ link register save eliminated.
        vdup.16 d16, r0
        vmov    r0, r1, d16  @ v4bf
        bx      lr


f2:
        @ args = 0, pretend = 0, frame = 0
        @ frame_needed = 0, uses_anonymous_args = 0
        @ link register save eliminated.
        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


.optimized dump shows:
bfloat16x4_t f1 (bfloat16_t a)
{
  __simd64_bfloat16_t _3;

  <bb 2> [local count: 1073741824]:
  _3 = __builtin_neon_vdup_nv4bf (a_2(D)); [tail call]
  return _3;

}

bfloat16x4_t f2 (bfloat16_t a)
{
  bfloat16x4_t _2;

  <bb 2> [local count: 1073741824]:
  _2 = {a_1(D), a_1(D), a_1(D), a_1(D)};
  return _2;
}

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

* [Bug target/98435] [ARM NEON] Missed optimization in expanding vector constructor
  2020-12-24  6:56 [Bug target/98435] New: [ARM NEON] Missed optimization in expanding vector constructor prathamesh3492 at gcc dot gnu.org
@ 2020-12-24  6:58 ` prathamesh3492 at gcc dot gnu.org
  2021-07-12  7:55 ` cvs-commit at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: prathamesh3492 at gcc dot gnu.org @ 2020-12-24  6:58 UTC (permalink / raw)
  To: gcc-bugs

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

prathamesh3492 at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
              Build|                            |x86_64-unknown-linux-gnu
           Keywords|                            |missed-optimization
                 CC|                            |prathamesh3492 at gcc dot gnu.org
             Target|                            |arm-linux-gnueabi
               Host|                            |x86_64-unknown-linux-gnu

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

* [Bug target/98435] [ARM NEON] Missed optimization in expanding vector constructor
  2020-12-24  6:56 [Bug target/98435] New: [ARM NEON] Missed optimization in expanding vector constructor prathamesh3492 at gcc dot gnu.org
  2020-12-24  6:58 ` [Bug target/98435] " prathamesh3492 at gcc dot gnu.org
@ 2021-07-12  7:55 ` cvs-commit at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-07-12  7:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Prathamesh Kulkarni
<prathamesh3492@gcc.gnu.org>:

https://gcc.gnu.org/g:1e72c24d2f3b1427f5e117e371928e7af50d2036

commit r12-2239-g1e72c24d2f3b1427f5e117e371928e7af50d2036
Author: prathamesh.kulkarni <prathamesh.kulkarni@linaro.org>
Date:   Mon Jul 12 13:23:06 2021 +0530

    arm/98435: Missed optimization in expanding vector constructor.

    The patch moves vec_init pattern from neon.md to vec-common.md,
    and adjusts the mode to VDQX to accomodate binary floats. Also,
    the pattern is additionally gated on VALID_MVE_MODE.

    gcc/ChangeLog:
            PR target/98435
            * config/arm/neon.md (vec_init): Move to ...
            * config/arm/vec-common.md (vec_init): ... here.
            Change the pattern's mode to VDQX and gate it on VALID_MVE_MODE.

    gcc/testsuite/ChangeLog:
            PR target/98435
            * gcc.target/arm/simd/pr98435.c: New test.

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

end of thread, other threads:[~2021-07-12  7:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-24  6:56 [Bug target/98435] New: [ARM NEON] Missed optimization in expanding vector constructor prathamesh3492 at gcc dot gnu.org
2020-12-24  6:58 ` [Bug target/98435] " prathamesh3492 at gcc dot gnu.org
2021-07-12  7:55 ` cvs-commit at gcc dot gnu.org

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