[TTI] getTypeBasedIntrinsicInstrCost - add basic handling for strided load/store...
[llvm-project.git] / llvm / test / CodeGen / X86 / unreachable-trap.ll
blob486ee0f7a0e24635848e3c77adf54f561321acab
1 ; RUN: llc -o - %s -mtriple=x86_64-linux-gnu | FileCheck %s --check-prefixes=CHECK
2 ; RUN: llc -o - %s -mtriple=x86_64-windows-msvc | FileCheck %s --check-prefixes=CHECK
3 ; RUN: llc -o - %s -mtriple=x86_64-apple-darwin | FileCheck %s --check-prefixes=CHECK,NO_TRAP_AFTER_NORETURN
5 ; On PS4/PS5, always emit trap instructions regardless of of trap-unreachable or no-trap-after-noreturn.
6 ; RUN: llc -o - %s -mtriple=x86_64-scei-ps4 -trap-unreachable | FileCheck %s --check-prefixes=CHECK,TRAP_AFTER_NORETURN
7 ; RUN: llc -o - %s -mtriple=x86_64-sie-ps5 -trap-unreachable | FileCheck %s --check-prefixes=CHECK,TRAP_AFTER_NORETURN
8 ; RUN: llc -o - %s -mtriple=x86_64-scei-ps4 -trap-unreachable=false | FileCheck %s --check-prefixes=CHECK,TRAP_AFTER_NORETURN
9 ; RUN: llc -o - %s -mtriple=x86_64-sie-ps5 -trap-unreachable=false | FileCheck %s --check-prefixes=CHECK,TRAP_AFTER_NORETURN
10 ; RUN: llc -o - %s -mtriple=x86_64-scei-ps4 -trap-unreachable -no-trap-after-noreturn=false | FileCheck %s --check-prefixes=CHECK,TRAP_AFTER_NORETURN
11 ; RUN: llc -o - %s -mtriple=x86_64-sie-ps5 -trap-unreachable -no-trap-after-noreturn=false | FileCheck %s --check-prefixes=CHECK,TRAP_AFTER_NORETURN
13 ; RUN: llc --trap-unreachable -o - %s -mtriple=x86_64-linux-gnu | FileCheck %s --check-prefixes=CHECK,TRAP_AFTER_NORETURN
14 ; RUN: llc --trap-unreachable -global-isel -o - %s -mtriple=x86_64-linux-gnu | FileCheck %s --check-prefixes=CHECK,TRAP_AFTER_NORETURN
15 ; RUN: llc --trap-unreachable -fast-isel -o - %s -mtriple=x86_64-linux-gnu | FileCheck %s --check-prefixes=CHECK,TRAP_AFTER_NORETURN
17 ; CHECK-LABEL: call_exit:
18 ; CHECK: callq {{_?}}exit
19 ; TRAP_AFTER_NORETURN: ud2
20 ; CHECK-NOT: ud2
21 define i32 @call_exit() noreturn nounwind {
22   tail call void @exit(i32 0)
23   unreachable
26 ; CHECK-LABEL: trap:
27 ; CHECK: ud2
28 ; CHECK-NOT: ud2
29 define i32 @trap() noreturn nounwind {
30   tail call void @llvm.trap()
31   unreachable
34 ; CHECK-LABEL: trap_fn_attr:
35 ; CHECK: callq {{_?}}trap_func
36 ; TRAP_AFTER_NORETURN: ud2
37 ; CHECK-NOT: ud2
38 define i32 @trap_fn_attr() noreturn nounwind {
39   tail call void @llvm.trap() "trap-func-name"="trap_func"
40   unreachable
43 ; CHECK-LABEL: noreturn_indirect:
44 ; CHECK: callq *%r{{.+}}
45 ; TRAP_AFTER_NORETURN: ud2
46 ; CHECK-NOT: ud2
47 define i32 @noreturn_indirect(ptr %fptr) noreturn nounwind {
48   tail call void (...) %fptr() noreturn nounwind
49   unreachable
52 ; CHECK-LABEL: unreachable:
53 ; TRAP_AFTER_NORETURN: ud2
54 ; NO_TRAP_AFTER_NORETURN: ud2
55 ; CHECK-NOT: ud2
56 ; CHECK: # -- End function
57 define i32 @unreachable() noreturn nounwind {
58   unreachable
61 declare void @llvm.trap() nounwind noreturn
62 declare void @exit(i32 %rc) nounwind noreturn