2014-09-23 Christian Bruel <christian.bruel@st.com>
* gcc.target/arm/attr_arm.c: New test.
* gcc.target/arm/attr_thumb.c: New test.
* gcc.target/arm/attr_thumb-static.c: New test.
@@ -0,0 +1,13 @@
+/* Check that attribute target arm is recogniwed. */
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_arm_ok } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler ".arm" } } */
+/* { dg-final { scan-assembler-not "ite" } } */
+
+int __attribute__((target("arm")))
+foo(int a)
+{
+ return a ? 1 : 5;
+}
+
@@ -0,0 +1,12 @@
+/* Check that attribute target arm is rejected for M profile. */
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_arm_ok } */
+/* { dg-add-options arm_arch_v6m } */
+
+int __attribute__((target("arm")))
+foo(int a)
+{ /* { dg-error "does not support" } */
+ return a ? 1 : 5;
+}
+
+
@@ -0,0 +1,13 @@
+/* Check that attribute target thumb is recogniwed. */
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_thumb2_ok } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler ".thumb" } } */
+/* { dg-final { scan-assembler "ite" } } */
+
+int __attribute__((target("thumb")))
+foo(int a)
+{
+ return a ? 1 : 5;
+}
+
@@ -0,0 +1,24 @@
+/* Check that a change mode to a static function is correctly handled. */
+/* { dg-do run } */
+/* { dg-require-effective-target arm_thumb1_ok } */
+
+static void
+ __attribute__((__noinline__))
+foo (void)
+{
+ __asm__ ("");
+}
+
+static void
+__attribute__((__noinline__))
+__attribute__((target("thumb")))
+bar (void)
+{
+ __asm__ ("");
+}
+
+int main()
+{
+ foo();
+ bar();
+}