This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][ARM] Handle unordered comparison cases in NEON vcond
- From: Ramana Radhakrishnan <ramrad01 at arm dot com>
- To: Kyrylo Tkachov <Kyrylo dot Tkachov at arm dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, Richard Earnshaw <Richard dot Earnshaw at arm dot com>
- Date: Mon, 25 Mar 2013 11:17:03 +0000
- Subject: Re: [PATCH][ARM] Handle unordered comparison cases in NEON vcond
- References: <013b01ce23d1$6e04d2f0$4a0e78d0$ at tkachov@arm.com>
- Reply-to: ramrad01 at arm dot com
On 03/18/13 12:09, Kyrylo Tkachov wrote:
Hi all,
Given code:
#define MAX(a, b) (a > b ? a : b)
void foo (int ilast, float* w, float* w2)
{
int i;
for (i = 0; i < ilast; ++i)
{
w[i] = MAX (0.0f, w2[i]);
}
}
compiled with
-O1 -funsafe-math-optimizations -ftree-vectorize -mfpu=neon -mfloat-abi=hard
on
arm-none-eabi will cause an ICE when trying to expand the vcond pattern.
Looking at the vcond pattern in neon.md, the predicate for the
comparison operator (arm_comparison_operator) uses
maybe_get_arm_condition_code
which is not needed for vcond since we don't care about the ARM condition
code
(we can handle all the comparison cases ourselves in the expander).
Changing the predicate to comparison_operator allows the expander to proceed
but it ICEs again because the pattern doesn't handle the floating point
unordered cases! (i.e. UNGT, UNORDERED, UNLE etc).
Adding support for the unordered cases is very similar to the aarch64 port
added
here:
http://gcc.gnu.org/ml/gcc-patches/2013-01/msg00957.html
This patch adapts that code to the arm port.
Added the testcase that exposed the ICE initially and also the UNORDERED and
LTGT
variations of it.
No regressions on arm-none-eabi.
Ok for trunk?
Please file a ticket in bugzilla with this testcase and triage with
respect to other release branches as well as this is likely to show up
in 4.8 as well.
Can you please also check what happens with 4.6 and 4.7 ?
This is OK for trunk with the appropriate bug id in the changelog(s)
regards
Ramana
Thanks,
Kyrill
gcc/ChangeLog
2013-03-18 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* config/arm/iterators.md (v_cmp_result): New mode attribute.
* config/arm/neon.md (vcond<mode><mode>): Handle unordered cases.
gcc/testsuite/ChangeLog
2013-03-18 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* gcc.target/arm/neon-vcond-gt.c: New test.
* gcc.target/arm/neon-vcond-ltgt.c: Likewise.
* gcc.target/arm/neon-vcond-unordered.c: Likewise.