From b54097368e8d6977276aaaf3378bda6ec65adcf0 Mon Sep 17 00:00:00 2001 From: yroux Date: Mon, 6 Oct 2014 12:40:10 +0000 Subject: [PATCH] /gcc/ 2014-10-06 Yvan Roux Backport from trunk r215136. 2014-09-10 Xinliang David Li PR target/63209 * config/arm/arm.md (movcond_addsi): Handle case where source and target operands are the same. /gcc/testsuite/ 2014-10-06 Yvan Roux Backport from trunk r215136. 2014-09-10 Xinliang David Li PR target/63209 * gcc.c-torture/execute/pr63209.c: New test. git-svn-id: svn://gcc.gnu.org/svn/gcc/branches/linaro/gcc-4_9-branch@215932 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog.linaro | 9 +++++++++ gcc/config/arm/arm.md | 10 ++++++++-- gcc/testsuite/ChangeLog.linaro | 8 ++++++++ gcc/testsuite/gcc.c-torture/execute/pr63209.c | 27 +++++++++++++++++++++++++++ 4 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr63209.c diff --git a/gcc/ChangeLog.linaro b/gcc/ChangeLog.linaro index 537b86d..1204659 100644 --- a/gcc/ChangeLog.linaro +++ b/gcc/ChangeLog.linaro @@ -1,5 +1,14 @@ 2014-10-06 Yvan Roux + Backport from trunk r215136. + 2014-09-10 Xinliang David Li + + PR target/63209 + * config/arm/arm.md (movcond_addsi): Handle case where source + and target operands are the same. + +2014-10-06 Yvan Roux + Backport from trunk r215086. 2014-09-09 Marcus Shawcroft Ramana Radhakrishnan diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md index 0a695f6..86fe597 100644 --- a/gcc/config/arm/arm.md +++ b/gcc/config/arm/arm.md @@ -10956,10 +10956,16 @@ enum machine_mode mode = SELECT_CC_MODE (GET_CODE (operands[5]), operands[3], operands[4]); enum rtx_code rc = GET_CODE (operands[5]); - operands[6] = gen_rtx_REG (mode, CC_REGNUM); gcc_assert (!(mode == CCFPmode || mode == CCFPEmode)); - rc = reverse_condition (rc); + if (REGNO (operands[2]) != REGNO (operands[0])) + rc = reverse_condition (rc); + else + { + rtx tmp = operands[1]; + operands[1] = operands[2]; + operands[2] = tmp; + } operands[6] = gen_rtx_fmt_ee (rc, VOIDmode, operands[6], const0_rtx); } diff --git a/gcc/testsuite/ChangeLog.linaro b/gcc/testsuite/ChangeLog.linaro index ed0c0b8..33dae17 100644 --- a/gcc/testsuite/ChangeLog.linaro +++ b/gcc/testsuite/ChangeLog.linaro @@ -1,5 +1,13 @@ 2014-10-06 Yvan Roux + Backport from trunk r215136. + 2014-09-10 Xinliang David Li + + PR target/63209 + * gcc.c-torture/execute/pr63209.c: New test. + +2014-10-06 Yvan Roux + Backport from trunk r215067. 2014-09-09 Jiong Wang diff --git a/gcc/testsuite/gcc.c-torture/execute/pr63209.c b/gcc/testsuite/gcc.c-torture/execute/pr63209.c new file mode 100644 index 0000000..9bcb587 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr63209.c @@ -0,0 +1,27 @@ +static int Sub(int a, int b) { + return b -a; +} + +static unsigned Select(unsigned a, unsigned b, unsigned c) { + const int pa_minus_pb = + Sub((a >> 8) & 0xff, (b >> 8) & 0xff) + + Sub((a >> 0) & 0xff, (b >> 0) & 0xff); + return (pa_minus_pb <= 0) ? a : b; +} + +__attribute__((noinline)) unsigned Predictor(unsigned left, const unsigned* const top) { + const unsigned pred = Select(top[1], left, top[0]); + return pred; +} + +int main(void) { + const unsigned top[2] = {0xff7a7a7a, 0xff7a7a7a}; + const unsigned left = 0xff7b7b7b; + const unsigned pred = Predictor(left, top /*+ 1*/); + if (pred == left) + return 0; + return 1; +} + + + -- 2.7.4