diff mbox series

[nvptx,PR85626,committed] Make trap insn noreturn

Message ID 4a871331-ef08-78cb-b8b1-fa9b36f2bb43@mentor.com
State New
Headers show
Series [nvptx,PR85626,committed] Make trap insn noreturn | expand

Commit Message

Tom de Vries May 9, 2018, 10:38 a.m. UTC
Hi,

the nvptx trap* define_insns are implemented using the ptx insn 'trap' . 
The ptx insn 'trap' may however return, and therefore the ptx insn 
'exit' is needed after the 'trap'.

Fixed by attached patch.

Build x86_64 with nvptx accelerator.

Committed to trunk.

Thanks,
- Tom
diff mbox series

Patch

[nvptx] Make trap insn noreturn

2018-05-09  Tom de Vries  <tom@codesourcery.com>

	PR target/85626
	* config/nvptx/nvptx.md (define_insn "trap", define_insn "trap_if_true")
	(define_insn "trap_if_false"): Add exit after trap.

---
 gcc/config/nvptx/nvptx.md | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gcc/config/nvptx/nvptx.md b/gcc/config/nvptx/nvptx.md
index 9754219..2988f5d 100644
--- a/gcc/config/nvptx/nvptx.md
+++ b/gcc/config/nvptx/nvptx.md
@@ -1101,14 +1101,14 @@ 
 (define_insn "trap"
   [(trap_if (const_int 1) (const_int 0))]
   ""
-  "trap;")
+  "trap; exit;")
 
 (define_insn "trap_if_true"
   [(trap_if (ne (match_operand:BI 0 "nvptx_register_operand" "R")
 		(const_int 0))
 	    (const_int 0))]
   ""
-  "%j0 trap;"
+  "%j0 trap; %j0 exit;"
   [(set_attr "predicable" "false")])
 
 (define_insn "trap_if_false"
@@ -1116,7 +1116,7 @@ 
 		(const_int 0))
 	    (const_int 0))]
   ""
-  "%J0 trap;"
+  "%J0 trap; %J0 exit;"
   [(set_attr "predicable" "false")])
 
 (define_expand "ctrap<mode>4"