summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authoribolton <ibolton@138bc75d-0d04-0410-961f-82ee72b054a4>2013-12-06 15:51:49 +0000
committeribolton <ibolton@138bc75d-0d04-0410-961f-82ee72b054a4>2013-12-06 15:51:49 +0000
commitad9d43990d777817dfdd1efc98db8df6fc33b82a (patch)
tree57fd954c2713a9109972e5899b217c4d795a3e32 /gcc
parent84ade58db7a58c310e42e55633c9d8d52fc5c994 (diff)
downloadgcc-ad9d43990d777817dfdd1efc98db8df6fc33b82a.tar.gz
[ARM] Add __builtin_trap support for A32
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@205749 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/config/arm/arm.md17
-rw-r--r--gcc/config/arm/types.md2
-rw-r--r--gcc/testsuite/ChangeLog7
-rw-r--r--gcc/testsuite/gcc.target/arm/builtin-trap.c10
-rw-r--r--gcc/testsuite/gcc.target/arm/thumb-builtin-trap.c11
6 files changed, 54 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index abf4283dc64..deb7eccbcc1 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md
index 841c624d485..389527cf21d 100644
--- a/gcc/config/arm/arm.md
+++ b/gcc/config/arm/arm.md
@@ -9927,6 +9927,23 @@
(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")]
+)
+
;; Patterns to allow combination of arithmetic, cond code and shifts
diff --git a/gcc/config/arm/types.md b/gcc/config/arm/types.md
index 1c4b9e33c7e..6351f080b32 100644
--- a/gcc/config/arm/types.md
+++ b/gcc/config/arm/types.md
@@ -152,6 +152,7 @@
; 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.
@@ -645,6 +646,7 @@
store2,\
store3,\
store4,\
+ trap,\
udiv,\
umaal,\
umlal,\
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index c47187d351d..bdc37205c73 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 00000000000..4ff8d253e75
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/builtin-trap.c
@@ -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
index 00000000000..22e90e7d2cf
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/thumb-builtin-trap.c
@@ -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" } } */