1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-linux-gnu | FileCheck %s --check-prefixes=ALL,X64
3 ; RUN: llc < %s -fast-isel -fast-isel-abort=1 -mtriple=x86_64-linux-gnu | FileCheck %s --check-prefixes=ALL,X64
4 ; RUN: llc < %s -global-isel -global-isel-abort=1 -mtriple=x86_64-linux-gnu | FileCheck %s --check-prefixes=ALL,GISEL-X64
5 ; RUN: llc < %s -mtriple=i686-linux-gnu | FileCheck %s --check-prefixes=ALL,X86
6 ; RUN: llc < %s -fast-isel -fast-isel-abort=1 -mtriple=i686-linux-gnu | FileCheck %s --check-prefixes=ALL,X86
7 ; RUN: llc < %s -global-isel -global-isel-abort=1 -mtriple=i686-linux-gnu | FileCheck %s --check-prefixes=ALL,GISEL-X86
9 declare void @llvm.trap()
11 define void @test_trap() {
12 ; ALL-LABEL: test_trap:
15 ; ALL-NEXT: ret{{[l|q]}}
16 tail call void @llvm.trap()
20 define void @test_debugtrap() {
21 ; ALL-LABEL: test_debugtrap:
24 ; ALL-NEXT: ret{{[l|q]}}
25 tail call void @llvm.debugtrap()
29 define void @test_ubsantrap() {
30 ; ALL-LABEL: test_ubsantrap:
32 ; ALL-NEXT: ud1l 12(%eax), %eax
33 ; ALL-NEXT: ret{{[l|q]}}
34 call void @llvm.ubsantrap(i8 12)
38 define void @test_ubsantrap_custom() nounwind {
39 ; X64-LABEL: test_ubsantrap_custom:
41 ; X64-NEXT: pushq %rax
42 ; X64-NEXT: movl $42, %edi
43 ; X64-NEXT: callq guide@PLT
47 ; GISEL-X64-LABEL: test_ubsantrap_custom:
49 ; GISEL-X64-NEXT: pushq %rax
50 ; GISEL-X64-NEXT: movl $42, %edi
51 ; GISEL-X64-NEXT: callq guide
52 ; GISEL-X64-NEXT: popq %rax
53 ; GISEL-X64-NEXT: retq
55 ; X86-LABEL: test_ubsantrap_custom:
57 ; X86-NEXT: subl $12, %esp
58 ; X86-NEXT: movl $42, (%esp)
59 ; X86-NEXT: calll guide
60 ; X86-NEXT: addl $12, %esp
63 ; GISEL-X86-LABEL: test_ubsantrap_custom:
65 ; GISEL-X86-NEXT: subl $12, %esp
66 ; GISEL-X86-NEXT: movl $42, %eax
67 ; GISEL-X86-NEXT: movl %eax, (%esp)
68 ; GISEL-X86-NEXT: calll guide
69 ; GISEL-X86-NEXT: addl $12, %esp
70 ; GISEL-X86-NEXT: retl
71 call void @llvm.ubsantrap(i8 42) "trap-func-name"="guide"