]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR target/59593 ([arm big-endian] using "ldrh" access a immediate ...
authorThomas Preud'homme <thomas.preudhomme@arm.com>
Wed, 4 Mar 2015 05:56:54 +0000 (05:56 +0000)
committerThomas Preud'homme <thopre01@gcc.gnu.org>
Wed, 4 Mar 2015 05:56:54 +0000 (05:56 +0000)
2015-03-04  Thomas Preud'homme  <thomas.preudhomme@arm.com>

    Backport from mainline
    2014-11-27  Thomas Preud'homme  <thomas.preudhomme@arm.com>

    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.

From-SVN: r221173

gcc/ChangeLog
gcc/config/arm/arm.c
gcc/config/arm/arm.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/arm/constant-pool.c [new file with mode: 0644]

index 3671cf1fe8229f602ad84f5a65458a68bccfe451..cf80bc16d8e2d6eda254cafe359a7fb0a0034488 100644 (file)
@@ -1,3 +1,16 @@
+2015-03-04  Thomas Preud'homme  <thomas.preudhomme@arm.com>
+
+       Backport from mainline
+       2014-11-27  Thomas Preud'homme  <thomas.preudhomme@arm.com>
+
+       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-04  Thomas Preud'homme  <thomas.preudhomme@arm.com>
 
        Backport from mainline
index 346a2c979249603560e229df0a918fa11e9a2519..a699951a13201a7c49f7fcf75c4b37ed4e803aab 100644 (file)
@@ -13337,7 +13337,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:
index 611c4eae95f4fb506246b2a0fe1b66f86ca1db50..64b56b2fe685758fd5e6ee5862fe7b5d93c86aef 100644 (file)
 
 (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);
 
 (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")]
 )
 
     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
index d0aa70edb62936fcd42cd773bafafefb5897358e..c723897c22707686b5f3c9ce0574fc8a96d8a46b 100644 (file)
@@ -1,3 +1,11 @@
+2015-03-04  Thomas Preud'homme  <thomas.preudhomme@arm.com>
+
+       Backport from mainline
+       2014-11-27  Thomas Preud'homme  <thomas.preudhomme@arm.com>
+
+       PR target/59593
+       * gcc.target/arm/constant-pool.c: New test.
+
 2015-03-04  Thomas Preud'homme  <thomas.preudhomme@arm.com>
 
        PR target/64453
diff --git a/gcc/testsuite/gcc.target/arm/constant-pool.c b/gcc/testsuite/gcc.target/arm/constant-pool.c
new file mode 100644 (file)
index 0000000..8427dfb
--- /dev/null
@@ -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;
+}