1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 2 ; RUN: llc -verify-machineinstrs < %s -mtriple=i686-unknown-unknown -mattr=+rtm | FileCheck %s --check-prefix=X86 3 ; RUN: llc -verify-machineinstrs < %s -mtriple=x86_64-unknown-unknown -mattr=+rtm | FileCheck %s --check-prefix=X64 4 5 declare i32 @llvm.x86.xbegin() nounwind 6 declare void @llvm.x86.xend() nounwind 7 declare void @llvm.x86.xabort(i8) nounwind 8 declare void @f1() 9 10 define i32 @test_xbegin() nounwind uwtable { 11 ; X86-LABEL: test_xbegin: 12 ; X86: # %bb.0: # %entry 13 ; X86-NEXT: xbegin .LBB0_2 14 ; X86-NEXT: # %bb.1: # %entry 15 ; X86-NEXT: movl $-1, %eax 16 ; X86: .LBB0_2: # %entry 17 ; X86-NEXT: # XABORT DEF 18 ; X86-NEXT: retl 19 ; 20 ; X64-LABEL: test_xbegin: 21 ; X64: # %bb.0: # %entry 22 ; X64-NEXT: xbegin .LBB0_2 23 ; X64-NEXT: # %bb.1: # %entry 24 ; X64-NEXT: movl $-1, %eax 25 ; X64: .LBB0_2: # %entry 26 ; X64-NEXT: # XABORT DEF 27 ; X64-NEXT: retq 28 entry: 29 %0 = tail call i32 @llvm.x86.xbegin() nounwind 30 ret i32 %0 31 } 32 33 define void @test_xend() nounwind uwtable { 34 ; X86-LABEL: test_xend: 35 ; X86: # %bb.0: # %entry 36 ; X86-NEXT: xend 37 ; X86-NEXT: retl 38 ; 39 ; X64-LABEL: test_xend: 40 ; X64: # %bb.0: # %entry 41 ; X64-NEXT: xend 42 ; X64-NEXT: retq 43 entry: 44 tail call void @llvm.x86.xend() nounwind 45 ret void 46 } 47 48 define void @test_xabort() nounwind uwtable { 49 ; X86-LABEL: test_xabort: 50 ; X86: # %bb.0: # %entry 51 ; X86-NEXT: xabort $2 52 ; X86-NEXT: retl 53 ; 54 ; X64-LABEL: test_xabort: 55 ; X64: # %bb.0: # %entry 56 ; X64-NEXT: xabort $2 57 ; X64-NEXT: retq 58 entry: 59 tail call void @llvm.x86.xabort(i8 2) 60 ret void 61 } 62 63 define void @f2(i32 %x) nounwind uwtable { 64 ; X86-LABEL: f2: 65 ; X86: # %bb.0: # %entry 66 ; X86-NEXT: xabort $1 67 ; X86-NEXT: calll f1 68 ; X86-NEXT: retl 69 ; 70 ; X64-LABEL: f2: 71 ; X64: # %bb.0: # %entry 72 ; X64-NEXT: pushq %rax 73 ; X64-NEXT: .cfi_def_cfa_offset 16 74 ; X64-NEXT: movl %edi, {{[0-9]+}}(%rsp) 75 ; X64-NEXT: xabort $1 76 ; X64-NEXT: callq f1 77 ; X64-NEXT: popq %rax 78 ; X64-NEXT: .cfi_def_cfa_offset 8 79 ; X64-NEXT: retq 80 entry: 81 %x.addr = alloca i32, align 4 82 store i32 %x, i32* %x.addr, align 4 83 call void @llvm.x86.xabort(i8 1) 84 call void @f1() 85 ret void 86 } 87 88