arm.md (*call_value_symbol): Fix operand for interworking.
authorChristian Bruel <christian.bruel@st.com>
Thu, 17 Sep 2015 15:57:59 +0000 (17:57 +0200)
committerChristian Bruel <chrbr@gcc.gnu.org>
Thu, 17 Sep 2015 15:57:59 +0000 (17:57 +0200)
2015-09-17  Christian Bruel  <christian.bruel@st.com>

* config/arm/arm.md (*call_value_symbol): Fix operand for interworking.

From-SVN: r227880

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

index 1e9cf70182f3e06c86f656f8a83860f12f808955..0faf86b48783f25516ab92b4cfdaacfeb91f0590 100644 (file)
@@ -1,3 +1,7 @@
+2015-09-17  Christian Bruel  <christian.bruel@st.com>
+
+       * config/arm/arm.md (*call_value_symbol): Fix operand for interworking.
+
 2015-09-17  Richard Henderson  <rth@redhat.com>
 
        PR libstdc++/65913
index 1a8f32fa6703af498b4d95bcd5e1a77f0b16ea41..ad5b02e5589ed0aaa47f869c8a1ccb2177e8d1c4 100644 (file)
    /* Switch mode now when possible.  */
    if (SYMBOL_REF_DECL (op) && !TREE_PUBLIC (SYMBOL_REF_DECL (op))
         && arm_arch5 && arm_change_mode_p (SYMBOL_REF_DECL (op)))
-      return NEED_PLT_RELOC ? \"blx%?\\t%a0(PLT)\" : \"blx%?\\t(%a0)\";
+      return NEED_PLT_RELOC ? \"blx%?\\t%a1(PLT)\" : \"blx%?\\t(%a1)\";
 
     return NEED_PLT_RELOC ? \"bl%?\\t%a1(PLT)\" : \"bl%?\\t%a1\";
   }"
index 0a3c7104539858cfce490f867aaa94930561a15b..86ba5b7e919896cb48a32ebe4664b17ef6c52c18 100644 (file)
@@ -1,3 +1,7 @@
+2015-09-17  Christian Bruel  <christian.bruel@st.com>
+
+       * gcc.target/arm/attr_thumb-static2.c: New test.
+
 2015-09-17  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gnat.dg/overflow_sum3.adb: New test.
diff --git a/gcc/testsuite/gcc.target/arm/attr_thumb-static2.c b/gcc/testsuite/gcc.target/arm/attr_thumb-static2.c
new file mode 100644 (file)
index 0000000..df8a6c0
--- /dev/null
@@ -0,0 +1,40 @@
+/* Check that interwork between static functions is correctly resolved. */
+
+/* { dg-skip-if "" { ! { arm_thumb1_ok || arm_thumb2_ok } } } */
+/* { dg-options "-O0 -march=armv7-a -mfloat-abi=hard" } */
+/* { dg-do compile } */
+
+struct _NSPoint
+{
+  float x;
+  float y;
+};
+
+typedef struct _NSPoint NSPoint;
+
+static NSPoint
+__attribute__ ((target("arm")))
+NSMakePoint (float x, float y)
+{
+  NSPoint point;
+  point.x = x;
+  point.y = y;
+  return point;
+}
+
+static NSPoint
+__attribute__ ((target("thumb")))
+RelativePoint (NSPoint point, NSPoint refPoint)
+{
+  return NSMakePoint (refPoint.x + point.x, refPoint.y + point.y);
+}
+
+NSPoint
+__attribute__ ((target("arm")))
+g(NSPoint refPoint)
+{
+  float pointA, pointB;
+  return RelativePoint (NSMakePoint (0, pointA), refPoint);
+}
+
+/* { dg-final { scan-assembler-times "blx" 2 } } */