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 8 9declare void @llvm.trap() 10 11define void @test_trap() { 12; ALL-LABEL: test_trap: 13; ALL: # %bb.0: 14; ALL-NEXT: ud2 15; ALL-NEXT: ret{{[l|q]}} 16 tail call void @llvm.trap() 17 ret void 18} 19 20define void @test_debugtrap() { 21; ALL-LABEL: test_debugtrap: 22; ALL: # %bb.0: 23; ALL-NEXT: int3 24; ALL-NEXT: ret{{[l|q]}} 25 tail call void @llvm.debugtrap() 26 ret void 27} 28 29define void @test_ubsantrap() { 30; ALL-LABEL: test_ubsantrap: 31; ALL: # %bb.0: 32; ALL-NEXT: ud1l 12(%eax), %eax 33; ALL-NEXT: ret{{[l|q]}} 34 call void @llvm.ubsantrap(i8 12) 35 ret void 36} 37 38define void @test_ubsantrap_custom() nounwind { 39; X64-LABEL: test_ubsantrap_custom: 40; X64: # %bb.0: 41; X64-NEXT: pushq %rax 42; X64-NEXT: movl $42, %edi 43; X64-NEXT: callq guide@PLT 44; X64-NEXT: popq %rax 45; X64-NEXT: retq 46; 47; GISEL-X64-LABEL: test_ubsantrap_custom: 48; GISEL-X64: # %bb.0: 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 54; 55; X86-LABEL: test_ubsantrap_custom: 56; X86: # %bb.0: 57; X86-NEXT: subl $12, %esp 58; X86-NEXT: movl $42, (%esp) 59; X86-NEXT: calll guide 60; X86-NEXT: addl $12, %esp 61; X86-NEXT: retl 62; 63; GISEL-X86-LABEL: test_ubsantrap_custom: 64; GISEL-X86: # %bb.0: 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" 72 ret void 73} 74