diff mbox

[ARM] : Fix static interworking call

Message ID 55FA7DD9.8090108@st.com
State New
Headers show

Commit Message

Christian Bruel Sept. 17, 2015, 8:46 a.m. UTC
As obvious, bad operand number.

OK for trunk ?

Christian

Comments

Kyrylo Tkachov Sept. 17, 2015, 9:06 a.m. UTC | #1
On 17/09/15 09:46, Christian Bruel wrote:
> As obvious, bad operand number.
>
> OK for trunk ?
>
> Christian
>
>
> p1.patch
>
>
> 2015-09-18  Christian Bruel<christian.bruel@st.com>
>
> 	* config/arm/arm.md (*call_value_symbol): Fix operand for interworking.
>
> 2015-09-18  Christian Bruel<christian.bruel@st.com>
>
> 	* gcc.target/arm/attr_thumb-static2.c: New test.

Ok, assuming testing is clean.
Thanks,
Kyrill
Richard Earnshaw Sept. 18, 2015, 2:16 p.m. UTC | #2
On 17/09/15 09:46, Christian Bruel wrote:
> As obvious, bad operand number.
> 
> OK for trunk ?
> 
> Christian
> 
> 
> p1.patch
> 
> 
> 2015-09-18  Christian Bruel  <christian.bruel@st.com>
> 
> 	* config/arm/arm.md (*call_value_symbol): Fix operand for interworking.
> 
> 2015-09-18  Christian Bruel  <christian.bruel@st.com>
> 
> 	* gcc.target/arm/attr_thumb-static2.c: New test.
> 
> --- gnu_trunk.ref/gcc/gcc/config/arm/arm.md	2015-09-14 09:52:37.697264500 +0200
> +++ gnu_trunk.p0/gcc/gcc/config/arm/arm.md	2015-09-17 10:03:33.849451705 +0200
> @@ -7891,7 +7891,7 @@
>     /* 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\";
>    }"
> diff -ruNp gnu_trunk.ref/gcc/gcc/testsuite/gcc.target/arm/attr_thumb-static2.c gnu_trunk.p0/gcc/gcc/testsuite/gcc.target/arm/attr_thumb-static2.c
> --- gnu_trunk.ref/gcc/gcc/testsuite/gcc.target/arm/attr_thumb-static2.c	1970-01-01 01:00:00.000000000 +0100
> +++ gnu_trunk.p0/gcc/gcc/testsuite/gcc.target/arm/attr_thumb-static2.c	2015-09-17 10:08:08.350064131 +0200
> @@ -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" } */

You can't have thumb1 and hard float, so the skip unless thumb1 seems a
nonsense.

R.

> +/* { 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 } } */
>
diff mbox

Patch

2015-09-18  Christian Bruel  <christian.bruel@st.com>

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

2015-09-18  Christian Bruel  <christian.bruel@st.com>

	* gcc.target/arm/attr_thumb-static2.c: New test.

--- gnu_trunk.ref/gcc/gcc/config/arm/arm.md	2015-09-14 09:52:37.697264500 +0200
+++ gnu_trunk.p0/gcc/gcc/config/arm/arm.md	2015-09-17 10:03:33.849451705 +0200
@@ -7891,7 +7891,7 @@ 
    /* 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\";
   }"
diff -ruNp gnu_trunk.ref/gcc/gcc/testsuite/gcc.target/arm/attr_thumb-static2.c gnu_trunk.p0/gcc/gcc/testsuite/gcc.target/arm/attr_thumb-static2.c
--- gnu_trunk.ref/gcc/gcc/testsuite/gcc.target/arm/attr_thumb-static2.c	1970-01-01 01:00:00.000000000 +0100
+++ gnu_trunk.p0/gcc/gcc/testsuite/gcc.target/arm/attr_thumb-static2.c	2015-09-17 10:08:08.350064131 +0200
@@ -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 } } */