1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
2 ; RUN: llc < %s -march=nvptx -mcpu=sm_20 -verify-machineinstrs -trap-unreachable=false \
3 ; RUN: | FileCheck %s --check-prefixes=CHECK,NO-TRAP-UNREACHABLE
4 ; RUN: llc < %s -march=nvptx64 -mcpu=sm_20 -verify-machineinstrs -trap-unreachable=false \
5 ; RUN: | FileCheck %s --check-prefixes=CHECK,NO-TRAP-UNREACHABLE
6 ; RUN: llc < %s -march=nvptx -mcpu=sm_20 -verify-machineinstrs -trap-unreachable -no-trap-after-noreturn \
7 ; RUN: | FileCheck %s --check-prefixes=CHECK,NO-TRAP-AFTER-NORETURN
8 ; RUN: llc < %s -march=nvptx64 -mcpu=sm_20 -verify-machineinstrs -trap-unreachable -no-trap-after-noreturn \
9 ; RUN: | FileCheck %s --check-prefixes=CHECK,NO-TRAP-AFTER-NORETURN
10 ; RUN: llc < %s -march=nvptx -mcpu=sm_20 -verify-machineinstrs -trap-unreachable -no-trap-after-noreturn=false \
11 ; RUN: | FileCheck %s --check-prefixes=CHECK,TRAP
12 ; RUN: llc < %s -march=nvptx64 -mcpu=sm_20 -verify-machineinstrs -trap-unreachable -no-trap-after-noreturn=false \
13 ; RUN: | FileCheck %s --check-prefixes=CHECK,TRAP
14 ; RUN: llc < %s -march=nvptx64 -mcpu=sm_20 -verify-machineinstrs -trap-unreachable -mattr=+ptx83 \
15 ; RUN: | FileCheck %s --check-prefixes=BUG-FIXED
16 ; RUN: %if ptxas && !ptxas-12.0 %{ llc < %s -march=nvptx -mcpu=sm_20 -verify-machineinstrs | %ptxas-verify %}
17 ; RUN: %if ptxas %{ llc < %s -march=nvptx64 -mcpu=sm_20 -verify-machineinstrs | %ptxas-verify %}
19 target triple = "nvptx-unknown-cuda"
21 declare void @throw() #0
22 declare void @llvm.trap() #0
24 define void @kernel_func() {
25 ; NO-TRAP-UNREACHABLE-LABEL: kernel_func(
26 ; NO-TRAP-UNREACHABLE: {
27 ; NO-TRAP-UNREACHABLE-EMPTY:
28 ; NO-TRAP-UNREACHABLE-EMPTY:
29 ; NO-TRAP-UNREACHABLE-NEXT: // %bb.0:
30 ; NO-TRAP-UNREACHABLE-NEXT: { // callseq 0, 0
31 ; NO-TRAP-UNREACHABLE-NEXT: call.uni
32 ; NO-TRAP-UNREACHABLE-NEXT: throw,
33 ; NO-TRAP-UNREACHABLE-NEXT: (
34 ; NO-TRAP-UNREACHABLE-NEXT: );
35 ; NO-TRAP-UNREACHABLE-NEXT: } // callseq 0
36 ; NO-TRAP-UNREACHABLE-NEXT: // begin inline asm
37 ; NO-TRAP-UNREACHABLE-NEXT: exit;
38 ; NO-TRAP-UNREACHABLE-NEXT: // end inline asm
40 ; NO-TRAP-AFTER-NORETURN-LABEL: kernel_func(
41 ; NO-TRAP-AFTER-NORETURN: {
42 ; NO-TRAP-AFTER-NORETURN-EMPTY:
43 ; NO-TRAP-AFTER-NORETURN-EMPTY:
44 ; NO-TRAP-AFTER-NORETURN-NEXT: // %bb.0:
45 ; NO-TRAP-AFTER-NORETURN-NEXT: { // callseq 0, 0
46 ; NO-TRAP-AFTER-NORETURN-NEXT: call.uni
47 ; NO-TRAP-AFTER-NORETURN-NEXT: throw,
48 ; NO-TRAP-AFTER-NORETURN-NEXT: (
49 ; NO-TRAP-AFTER-NORETURN-NEXT: );
50 ; NO-TRAP-AFTER-NORETURN-NEXT: } // callseq 0
51 ; NO-TRAP-AFTER-NORETURN-NEXT: // begin inline asm
52 ; NO-TRAP-AFTER-NORETURN-NEXT: exit;
53 ; NO-TRAP-AFTER-NORETURN-NEXT: // end inline asm
54 ; NO-TRAP-AFTER-NORETURN-NEXT: trap; exit;
56 ; TRAP-LABEL: kernel_func(
60 ; TRAP-NEXT: // %bb.0:
61 ; TRAP-NEXT: { // callseq 0, 0
66 ; TRAP-NEXT: } // callseq 0
67 ; TRAP-NEXT: trap; exit;
69 ; BUG-FIXED-LABEL: kernel_func(
73 ; BUG-FIXED-NEXT: // %bb.0:
74 ; BUG-FIXED-NEXT: { // callseq 0, 0
75 ; BUG-FIXED-NEXT: call.uni
76 ; BUG-FIXED-NEXT: throw,
79 ; BUG-FIXED-NEXT: } // callseq 0
80 ; BUG-FIXED-NEXT: trap;
85 define void @kernel_func_2() {
86 ; CHECK-LABEL: kernel_func_2(
90 ; CHECK-NEXT: // %bb.0:
91 ; CHECK-NEXT: trap; exit;
93 ; BUG-FIXED-LABEL: kernel_func_2(
97 ; BUG-FIXED-NEXT: // %bb.0:
98 ; BUG-FIXED-NEXT: trap;
99 call void @llvm.trap()
100 ; Make sure we avoid emitting two trap instructions.
104 attributes #0 = { noreturn }
106 !nvvm.annotations = !{!1}
107 !1 = !{ptr @kernel_func, !"kernel", i32 1}