[ARM] Add __builtin_trap support for A32
authorIan Bolton <ian.bolton@arm.com>
Fri, 6 Dec 2013 15:51:49 +0000 (15:51 +0000)
committerIan Bolton <ibolton@gcc.gnu.org>
Fri, 6 Dec 2013 15:51:49 +0000 (15:51 +0000)
Co-Authored-By: Mark Mitchell <mark@codesourcery.com>
From-SVN: r205749

gcc/ChangeLog
gcc/config/arm/arm.md
gcc/config/arm/types.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/arm/builtin-trap.c [new file with mode: 0644]
gcc/testsuite/gcc.target/arm/thumb-builtin-trap.c [new file with mode: 0644]

index abf4283dc645b04df2da306512e04597e68c1144..deb7eccbcc125076cc964f7ddcd8872168cf5cf4 100644 (file)
@@ -1,3 +1,10 @@
+2013-12-06  Ian Bolton  <ian.bolton@arm.com>
+           Mark Mitchell  <mark@codesourcery.com>
+
+       PR target/59091
+       * config/arm/arm.md (trap): New pattern.
+       * config/arm/types.md: Added a type for trap.
+
 2013-12-06  Bernd Edlinger  <bernd.edlinger@hotmail.de>
 
        * expr.c (expand_assignment): Update bitregion_start and
index 841c624d485919a91bd01618679d4fe26bf2f74b..389527cf21d844a8059c0fa58ac08bf141478f84 100644 (file)
    (set_attr "type" "mov_reg")]
 )
 
+(define_insn "trap"
+  [(trap_if (const_int 1) (const_int 0))]
+  ""
+  "*
+  if (TARGET_ARM)
+    return \".inst\\t0xe7f000f0\";
+  else
+    return \".inst\\t0xdeff\";
+  "
+  [(set (attr "length")
+       (if_then_else (eq_attr "is_thumb" "yes")
+                     (const_int 2)
+                     (const_int 4)))
+   (set_attr "type" "trap")
+   (set_attr "conds" "unconditional")]
+)
+
 \f
 ;; Patterns to allow combination of arithmetic, cond code and shifts
 
index 1c4b9e33c7e5fb35b1fcdb987eb94286aab70d23..6351f080b32cb29c2f71f8f204abb00ff66a19b2 100644 (file)
 ; store2             store 2 words to memory from arm registers.
 ; store3             store 3 words to memory from arm registers.
 ; store4             store 4 (or more) words to memory from arm registers.
+; trap               cause a trap in the kernel.
 ; udiv               unsigned division.
 ; umaal              unsigned multiply accumulate accumulate long.
 ; umlal              unsigned multiply accumulate long.
   store2,\
   store3,\
   store4,\
+  trap,\
   udiv,\
   umaal,\
   umlal,\
index c47187d351dd206d2c9d2826f9b6b4c9474c51a4..bdc37205c73fd470b0b8109e4f0f0227ef0e49ca 100644 (file)
@@ -1,3 +1,10 @@
+2013-12-06  Ian Bolton  <ian.bolton@arm.com>
+            Mark Mitchell  <mark@codesourcery.com>
+
+       PR target/59091
+       * gcc.target/arm/builtin-trap.c: New test.
+       * gcc.target/arm/thumb-builtin-trap.c: Likewise.
+
 2013-12-06  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gcc.target/sparc/pdistn.c: New test.
diff --git a/gcc/testsuite/gcc.target/arm/builtin-trap.c b/gcc/testsuite/gcc.target/arm/builtin-trap.c
new file mode 100644 (file)
index 0000000..4ff8d25
--- /dev/null
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target arm32 } */
+
+void
+trap ()
+{
+  __builtin_trap ();
+}
+
+/* { dg-final { scan-assembler "0xe7f000f0" { target { arm_nothumb } } } } */
diff --git a/gcc/testsuite/gcc.target/arm/thumb-builtin-trap.c b/gcc/testsuite/gcc.target/arm/thumb-builtin-trap.c
new file mode 100644 (file)
index 0000000..22e90e7
--- /dev/null
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-mthumb" } */
+/* { dg-require-effective-target arm_thumb1_ok } */
+
+void
+trap ()
+{
+  __builtin_trap ();
+}
+
+/* { dg-final { scan-assembler "0xdeff" } } */