diff options
author | Zhenqiang Chen <zhenqiang.chen@linaro.org> | 2013-08-09 06:38:26 +0000 |
---|---|---|
committer | Xuepeng Guo <xguo@gcc.gnu.org> | 2013-08-09 06:38:26 +0000 |
commit | ff522f7fd48070a5365880a0ea6b54ae8be7315b (patch) | |
tree | ea555bd51f37002eb52fb97999532595b6682a4c | |
parent | b9bfa45aad8f9f06a52439607764a7a960e2364b (diff) | |
download | gcc-ff522f7fd48070a5365880a0ea6b54ae8be7315b.zip gcc-ff522f7fd48070a5365880a0ea6b54ae8be7315b.tar.gz gcc-ff522f7fd48070a5365880a0ea6b54ae8be7315b.tar.bz2 |
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
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/config/arm/neon.md | 34 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/arm/lp1189445.c | 18 |
4 files changed, 56 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 33e54ef..c2240db 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +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> * lra-constraints.c (emit_spill_move): Remove assert. diff --git a/gcc/config/arm/neon.md b/gcc/config/arm/neon.md index d0ca6b9..e00ca2c 100644 --- a/gcc/config/arm/neon.md +++ b/gcc/config/arm/neon.md @@ -1671,6 +1671,7 @@ ? 3 : 1; rtx magic_rtx = GEN_INT (magic_word); int inverse = 0; + int use_zero_form = 0; int swap_bsl_operands = 0; rtx mask = gen_reg_rtx (<V_cmp_result>mode); rtx tmp = gen_reg_rtx (<V_cmp_result>mode); @@ -1681,12 +1682,16 @@ switch (GET_CODE (operands[3])) { case GE: + case GT: case LE: + case LT: case EQ: - if (!REG_P (operands[5]) - && (operands[5] != CONST0_RTX (<MODE>mode))) - operands[5] = force_reg (<MODE>mode, operands[5]); - break; + if (operands[5] == CONST0_RTX (<MODE>mode)) + { + use_zero_form = 1; + break; + } + /* Fall through. */ default: if (!REG_P (operands[5])) operands[5] = force_reg (<MODE>mode, operands[5]); @@ -1737,7 +1742,26 @@ a GT b -> a GT b a LE b -> b GE 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) emit_insn (base_comparison (mask, operands[4], operands[5], magic_rtx)); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d86db30..24efd3e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2013-08-09 Zhenqiang Chen <zhenqiang.chen@linaro.org> + + * gcc.target/arm/lp1189445.c: New testcase. + 2013-08-08 Richard Sandiford <rdsandiford@googlemail.com> * gcc.dg/torture/pr58079.c: New test. diff --git a/gcc/testsuite/gcc.target/arm/lp1189445.c b/gcc/testsuite/gcc.target/arm/lp1189445.c new file mode 100644 index 0000000..766748e --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/lp1189445.c @@ -0,0 +1,18 @@ +/* { 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); +} |