aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorDavid Holsgrove <david.holsgrove@xilinx.com>2014-01-23 14:37:44 +0000
committerMichael Eager <eager@gcc.gnu.org>2014-01-23 14:37:44 +0000
commitf3eeb82c28c0028b2151ea8ac7ab8f1170b66304 (patch)
treedb475878ea46ec3cb642b8594143922b2297b6e9 /gcc
parent4a7eaf5f94ee68466b2c6419ffbf5b99dcf4d969 (diff)
downloadgcc-f3eeb82c28c0028b2151ea8ac7ab8f1170b66304.zip
gcc-f3eeb82c28c0028b2151ea8ac7ab8f1170b66304.tar.gz
gcc-f3eeb82c28c0028b2151ea8ac7ab8f1170b66304.tar.bz2
microblaze.md: Add trap insn and attribute
2014-01-23 David Holsgrove <david.holsgrove@xilinx.com> * config/microblaze/microblaze.md: Add trap insn and attribute From-SVN: r206967
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/config/microblaze/microblaze.md10
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.target/microblaze/others/builtin-trap.c8
4 files changed, 25 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index c67c6ff..f52752d 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,7 @@
+2014-01-23 David Holsgrove <david.holsgrove@xilinx.com>
+
+ * config/microblaze/microblaze.md: Add trap insn and attribute
+
2014-01-23 Dodji Seketeli <dodji@redhat.com>
PR preprocessor/58580
diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md
index 46a7edd..367f253 100644
--- a/gcc/config/microblaze/microblaze.md
+++ b/gcc/config/microblaze/microblaze.md
@@ -74,7 +74,7 @@
;; bshift Shift operations
(define_attr "type"
- "unknown,branch,jump,call,load,store,move,arith,darith,imul,idiv,icmp,multi,nop,no_delay_arith,no_delay_load,no_delay_store,no_delay_imul,no_delay_move,bshift,fadd,frsub,fmul,fdiv,fcmp,fsl,fsqrt,fcvt"
+ "unknown,branch,jump,call,load,store,move,arith,darith,imul,idiv,icmp,multi,nop,no_delay_arith,no_delay_load,no_delay_store,no_delay_imul,no_delay_move,bshift,fadd,frsub,fmul,fdiv,fcmp,fsl,fsqrt,fcvt,trap"
(const_string "unknown"))
;; Main data type used by the insn
@@ -2201,6 +2201,14 @@
(set_attr "mode" "none")
(set_attr "length" "4")])
+;; Trap instruction pattern for __builtin_trap. Same as the glibc ABORT_INSTRUCTION
+(define_insn "trap"
+ [(trap_if (const_int 1) (const_int 0))]
+ ""
+ "brki\tr0,-1"
+ [(set_attr "type" "trap")]
+)
+
;; The insn to set GOT. The hardcoded number "8" accounts for $pc difference
;; between "mfs" and "addik" instructions.
(define_insn "set_got"
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 2180cb8..5b33fbb 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2014-01-23 David Holsgrove <david.holsgrove@xilinx.com>
+
+ * gcc.target/microblaze/others/builtin-trap.c: New test,
+
2014-01-23 Jakub Jelinek <jakub@redhat.com>
PR middle-end/58809
diff --git a/gcc/testsuite/gcc.target/microblaze/others/builtin-trap.c b/gcc/testsuite/gcc.target/microblaze/others/builtin-trap.c
new file mode 100644
index 0000000..fdcde1f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/microblaze/others/builtin-trap.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+
+void trap ()
+{
+ __builtin_trap ();
+}
+
+/* { dg-final { scan-assembler "brki\tr0,-1" } } */ \ No newline at end of file