From: Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
To: gcc Patches <gcc-patches@gcc.gnu.org>,
Kyrill Tkachov <kyrylo.tkachov@arm.com>
Subject: Re: [ARM] PR97906 - Missed lowering abs(a) >= abs(b) to vacge
Date: Mon, 7 Jun 2021 12:46:10 +0530 [thread overview]
Message-ID: <CAAgBjMkpYpML4t75BLnPiWaxD0n=n0+ttfsr_LriTHtZ4u3G3Q@mail.gmail.com> (raw)
In-Reply-To: <CAAgBjMmtPyGFfDpktQYY885S40yUfEjPgw-Be-CbS1cwAFSy0w@mail.gmail.com>
On Tue, 1 Jun 2021 at 16:03, Prathamesh Kulkarni
<prathamesh.kulkarni@linaro.org> wrote:
>
> Hi,
> As mentioned in PR, for following test-case:
>
> #include <arm_neon.h>
>
> uint32x2_t f1(float32x2_t a, float32x2_t b)
> {
> return vabs_f32 (a) >= vabs_f32 (b);
> }
>
> uint32x2_t f2(float32x2_t a, float32x2_t b)
> {
> return (uint32x2_t) __builtin_neon_vcagev2sf (a, b);
> }
>
> We generate vacge for f2, but with -ffast-math, we generate following for f1:
> f1:
> vabs.f32 d1, d1
> vabs.f32 d0, d0
> vcge.f32 d0, d0, d1
> bx lr
>
> This happens because, the middle-end inverts the comparison to b <= a,
> .optimized dump:
> _8 = __builtin_neon_vabsv2sf (a_4(D));
> _7 = __builtin_neon_vabsv2sf (b_5(D));
> _1 = _7 <= _8;
> _2 = VIEW_CONVERT_EXPR<vector(2) int>(_1);
> _6 = VIEW_CONVERT_EXPR<uint32x2_t>(_2);
> return _6;
>
> and combine fails to match the following pattern:
> (set (reg:V2SI 121)
> (neg:V2SI (le:V2SI (abs:V2SF (reg:V2SF 123))
> (abs:V2SF (reg:V2SF 122)))))
>
> because neon_vca<cmp_op><mode> pattern has GTGE code iterator.
> The attached patch adjusts the neon_vca patterns to use GLTE instead
> similar to neon_vca<cmp_op><mode>_fp16insn, and removes NEON_VACMP iterator.
> Code-gen with patch:
> f1:
> vacle.f32 d0, d1, d0
> bx lr
>
> Bootstrapped + tested on arm-linux-gnueabihf and cross-tested on arm*-*-*.
> OK to commit ?
ping https://gcc.gnu.org/pipermail/gcc-patches/2021-June/571568.html
Thanks,
Prathamesh
>
> Thanks,
> Prathamesh
next prev parent reply other threads:[~2021-06-07 7:16 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-01 10:33 Prathamesh Kulkarni
2021-06-07 7:16 ` Prathamesh Kulkarni [this message]
2021-06-14 7:58 ` Prathamesh Kulkarni
2021-06-14 10:45 ` Kyrylo Tkachov
2021-06-16 10:19 ` Prathamesh Kulkarni
2021-06-21 8:32 ` Prathamesh Kulkarni
2021-06-21 8:38 ` Kyrylo Tkachov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAAgBjMkpYpML4t75BLnPiWaxD0n=n0+ttfsr_LriTHtZ4u3G3Q@mail.gmail.com' \
--to=prathamesh.kulkarni@linaro.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=kyrylo.tkachov@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).