From b0ec7b6b126f30ed03e73a47eb41fbd551b1c1b6 Mon Sep 17 00:00:00 2001 From: thopre01 Date: Wed, 4 Mar 2015 05:51:08 +0000 Subject: [PATCH] 2015-03-04 Thomas Preud'homme Backport from mainline 2014-11-27 Thomas Preud'homme gcc/ PR target/59593 * config/arm/arm.c (dump_minipool): dispatch to consttable pattern based on mode size. * config/arm/arm.md (consttable_1): Make it TARGET_EITHER. (consttable_2): Make it TARGET_EITHER and move HFmode handling from consttable_4 to it. (consttable_4): Move HFmode handling to consttable_2 pattern. gcc/testsuite/ PR target/59593 * gcc.target/arm/constant-pool.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_9-branch@221172 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 13 +++++++++ gcc/config/arm/arm.c | 2 +- gcc/config/arm/arm.md | 40 ++++++++++++++++------------ gcc/testsuite/ChangeLog | 8 ++++++ gcc/testsuite/gcc.target/arm/constant-pool.c | 27 +++++++++++++++++++ 5 files changed, 72 insertions(+), 18 deletions(-) create mode 100644 gcc/testsuite/gcc.target/arm/constant-pool.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4f9ce5cccec..11e4b475322 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,16 @@ +2015-03-04 Thomas Preud'homme + + Backport from mainline + 2014-11-27 Thomas Preud'homme + + PR target/59593 + * config/arm/arm.c (dump_minipool): dispatch to consttable pattern + based on mode size. + * config/arm/arm.md (consttable_1): Make it TARGET_EITHER. + (consttable_2): Make it TARGET_EITHER and move HFmode handling from + consttable_4 to it. + (consttable_4): Move HFmode handling to consttable_2 pattern. + 2015-03-03 Kaz Kojima PR target/65249 diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 0dd2167257d..4fea1a62f77 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -16274,7 +16274,7 @@ dump_minipool (rtx scan) fputc ('\n', dump_file); } - switch (mp->fix_size) + switch (GET_MODE_SIZE (mp->mode)) { #ifdef HAVE_consttable_1 case 1: diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md index 81193874396..93b25e99c5b 100644 --- a/gcc/config/arm/arm.md +++ b/gcc/config/arm/arm.md @@ -12224,7 +12224,7 @@ (define_insn "consttable_1" [(unspec_volatile [(match_operand 0 "" "")] VUNSPEC_POOL_1)] - "TARGET_THUMB1" + "TARGET_EITHER" "* making_const_table = TRUE; assemble_integer (operands[0], 1, BITS_PER_WORD, 1); @@ -12237,14 +12237,23 @@ (define_insn "consttable_2" [(unspec_volatile [(match_operand 0 "" "")] VUNSPEC_POOL_2)] - "TARGET_THUMB1" + "TARGET_EITHER" "* - making_const_table = TRUE; - gcc_assert (GET_MODE_CLASS (GET_MODE (operands[0])) != MODE_FLOAT); - assemble_integer (operands[0], 2, BITS_PER_WORD, 1); - assemble_zeros (2); - return \"\"; - " + { + rtx x = operands[0]; + making_const_table = TRUE; + switch (GET_MODE_CLASS (GET_MODE (x))) + { + case MODE_FLOAT: + arm_emit_fp16_const (x); + break; + default: + assemble_integer (operands[0], 2, BITS_PER_WORD, 1); + assemble_zeros (2); + break; + } + return \"\"; + }" [(set_attr "length" "4") (set_attr "type" "no_insn")] ) @@ -12259,15 +12268,12 @@ switch (GET_MODE_CLASS (GET_MODE (x))) { case MODE_FLOAT: - if (GET_MODE (x) == HFmode) - arm_emit_fp16_const (x); - else - { - REAL_VALUE_TYPE r; - REAL_VALUE_FROM_CONST_DOUBLE (r, x); - assemble_real (r, GET_MODE (x), BITS_PER_WORD); - } - break; + { + REAL_VALUE_TYPE r; + REAL_VALUE_FROM_CONST_DOUBLE (r, x); + assemble_real (r, GET_MODE (x), BITS_PER_WORD); + break; + } default: /* XXX: Sometimes gcc does something really dumb and ends up with a HIGH in a constant pool entry, usually because it's trying to diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3da05efe29d..8ad53a3f440 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2015-03-04 Thomas Preud'homme + + Backport from mainline + 2014-11-27 Thomas Preud'homme + + PR target/59593 + * gcc.target/arm/constant-pool.c: New test. + 2015-03-03 Georg-Johann Lay PR target/64331 diff --git a/gcc/testsuite/gcc.target/arm/constant-pool.c b/gcc/testsuite/gcc.target/arm/constant-pool.c new file mode 100644 index 00000000000..8427dfb1a80 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/constant-pool.c @@ -0,0 +1,27 @@ +/* { dg-do run } */ +/* { dg-options "-O1" } */ + +unsigned short v = 0x5678; +int i; +int j = 0; +int *ptr = &j; + +int +func (void) +{ + for (i = 0; i < 1; ++i) + { + *ptr = -1; + v = 0x1234; + } + return v; +} + +int +main (void) +{ + func (); + if (v != 0x1234) + __builtin_abort (); + return 0; +} -- 2.11.4.GIT