Commit ff522f7f by Zhenqiang Chen Committed by Xuepeng Guo

neon.md (vcond): Fix floating-point vector comparisons against 0.

ChangeLog:
2013-08-09  Zhenqiang Chen  <zhenqiang.chen@linaro.org>

        * config/arm/neon.md (vcond): Fix floating-point vector
        comparisons against 0.

testsuite/ChangeLog:
2013-08-09  Zhenqiang Chen  <zhenqiang.chen@linaro.org>

        * gcc.target/arm/lp1189445.c: New testcase.

From-SVN: r201618
parent b9bfa45a
2013-08-09 Zhenqiang Chen <zhenqiang.chen@linaro.org>
* config/arm/neon.md (vcond): Fix floating-point vector
comparisons against 0.
2013-08-08 Vladimir Makarov <vmakarov@redhat.com> 2013-08-08 Vladimir Makarov <vmakarov@redhat.com>
* lra-constraints.c (emit_spill_move): Remove assert. * lra-constraints.c (emit_spill_move): Remove assert.
......
...@@ -1671,6 +1671,7 @@ ...@@ -1671,6 +1671,7 @@
? 3 : 1; ? 3 : 1;
rtx magic_rtx = GEN_INT (magic_word); rtx magic_rtx = GEN_INT (magic_word);
int inverse = 0; int inverse = 0;
int use_zero_form = 0;
int swap_bsl_operands = 0; int swap_bsl_operands = 0;
rtx mask = gen_reg_rtx (<V_cmp_result>mode); rtx mask = gen_reg_rtx (<V_cmp_result>mode);
rtx tmp = gen_reg_rtx (<V_cmp_result>mode); rtx tmp = gen_reg_rtx (<V_cmp_result>mode);
...@@ -1681,12 +1682,16 @@ ...@@ -1681,12 +1682,16 @@
switch (GET_CODE (operands[3])) switch (GET_CODE (operands[3]))
{ {
case GE: case GE:
case GT:
case LE: case LE:
case LT:
case EQ: case EQ:
if (!REG_P (operands[5]) if (operands[5] == CONST0_RTX (<MODE>mode))
&& (operands[5] != CONST0_RTX (<MODE>mode))) {
operands[5] = force_reg (<MODE>mode, operands[5]); use_zero_form = 1;
break; break;
}
/* Fall through. */
default: default:
if (!REG_P (operands[5])) if (!REG_P (operands[5]))
operands[5] = force_reg (<MODE>mode, operands[5]); operands[5] = force_reg (<MODE>mode, operands[5]);
...@@ -1737,7 +1742,26 @@ ...@@ -1737,7 +1742,26 @@
a GT b -> a GT b a GT b -> a GT b
a LE b -> b GE a a LE b -> b GE a
a LT b -> b GT a a LT b -> b GT a
a EQ b -> a EQ b */ a EQ b -> a EQ b
Note that there also exist direct comparison against 0 forms,
so catch those as a special case. */
if (use_zero_form)
{
inverse = 0;
switch (GET_CODE (operands[3]))
{
case LT:
base_comparison = gen_neon_vclt<mode>;
break;
case LE:
base_comparison = gen_neon_vcle<mode>;
break;
default:
/* Do nothing, other zero form cases already have the correct
base_comparison. */
break;
}
}
if (!inverse) if (!inverse)
emit_insn (base_comparison (mask, operands[4], operands[5], magic_rtx)); emit_insn (base_comparison (mask, operands[4], operands[5], magic_rtx));
......
2013-08-09 Zhenqiang Chen <zhenqiang.chen@linaro.org>
* gcc.target/arm/lp1189445.c: New testcase.
2013-08-08 Richard Sandiford <rdsandiford@googlemail.com> 2013-08-08 Richard Sandiford <rdsandiford@googlemail.com>
* gcc.dg/torture/pr58079.c: New test. * gcc.dg/torture/pr58079.c: New test.
......
/* { dg-do compile } */
/* { dg-require-effective-target arm_neon } */
/* { dg-add-options arm_neon } */
/* { dg-options "-O3" } */
int id;
int
test (const long int *data)
{
int i, retval;
retval = id;
for (i = 0; i < id; i++)
{
retval &= (data[i] <= 0);
}
return (retval);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment