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
[nvptx] Make trap insn noreturn
2018-05-09 Tom de Vries <t...@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"