File: rtm.ll

package info (click to toggle)
llvm-toolchain-17 1%3A17.0.6-22
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,799,624 kB
  • sloc: cpp: 6,428,607; ansic: 1,383,196; asm: 793,408; python: 223,504; objc: 75,364; f90: 60,502; lisp: 33,869; pascal: 15,282; sh: 9,684; perl: 7,453; ml: 4,937; awk: 3,523; makefile: 2,889; javascript: 2,149; xml: 888; fortran: 619; cs: 573
file content (89 lines) | stat: -rw-r--r-- 2,276 bytes parent folder | download | duplicates (13)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -verify-machineinstrs < %s -mtriple=i686-unknown-unknown -mattr=+rtm | FileCheck %s --check-prefix=X86
; RUN: llc -verify-machineinstrs < %s -mtriple=x86_64-unknown-unknown -mattr=+rtm | FileCheck %s --check-prefix=X64

declare i32 @llvm.x86.xbegin() nounwind
declare void @llvm.x86.xend() nounwind
declare void @llvm.x86.xabort(i8) nounwind
declare void @f1()

define i32 @test_xbegin() nounwind uwtable {
; X86-LABEL: test_xbegin:
; X86:       # %bb.0: # %entry
; X86-NEXT:    xbegin .LBB0_2
; X86-NEXT:  # %bb.1: # %entry
; X86-NEXT:    movl $-1, %eax
; X86-NEXT:    retl
; X86-NEXT:  .LBB0_2: # %entry
; X86-NEXT:    # XABORT DEF
; X86-NEXT:    retl
;
; X64-LABEL: test_xbegin:
; X64:       # %bb.0: # %entry
; X64-NEXT:    xbegin .LBB0_2
; X64-NEXT:  # %bb.1: # %entry
; X64-NEXT:    movl $-1, %eax
; X64-NEXT:    retq
; X64-NEXT:  .LBB0_2: # %entry
; X64-NEXT:    # XABORT DEF
; X64-NEXT:    retq
entry:
  %0 = tail call i32 @llvm.x86.xbegin() nounwind
  ret i32 %0
}

define void @test_xend() nounwind uwtable {
; X86-LABEL: test_xend:
; X86:       # %bb.0: # %entry
; X86-NEXT:    xend
; X86-NEXT:    retl
;
; X64-LABEL: test_xend:
; X64:       # %bb.0: # %entry
; X64-NEXT:    xend
; X64-NEXT:    retq
entry:
  tail call void @llvm.x86.xend() nounwind
  ret void
}

define void @test_xabort() nounwind uwtable {
; X86-LABEL: test_xabort:
; X86:       # %bb.0: # %entry
; X86-NEXT:    xabort $2
; X86-NEXT:    retl
;
; X64-LABEL: test_xabort:
; X64:       # %bb.0: # %entry
; X64-NEXT:    xabort $2
; X64-NEXT:    retq
entry:
  tail call void @llvm.x86.xabort(i8 2)
  ret void
}

define void @f2(i32 %x) nounwind uwtable {
; X86-LABEL: f2:
; X86:       # %bb.0: # %entry
; X86-NEXT:    xabort $1
; X86-NEXT:    calll f1@PLT
; X86-NEXT:    retl
;
; X64-LABEL: f2:
; X64:       # %bb.0: # %entry
; X64-NEXT:    pushq %rax
; X64-NEXT:    .cfi_def_cfa_offset 16
; X64-NEXT:    movl %edi, {{[0-9]+}}(%rsp)
; X64-NEXT:    xabort $1
; X64-NEXT:    callq f1@PLT
; X64-NEXT:    popq %rax
; X64-NEXT:    .cfi_def_cfa_offset 8
; X64-NEXT:    retq
entry:
  %x.addr = alloca i32, align 4
  store i32 %x, ptr %x.addr, align 4
  call void @llvm.x86.xabort(i8 1)
  call void @f1()
  ret void
}