File: 2009-10-19-atomic-cmp-eflags.ll

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,998,492 kB
  • sloc: cpp: 6,951,680; ansic: 1,486,157; asm: 913,598; python: 232,024; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,009; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,167; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (65 lines) | stat: -rw-r--r-- 3,316 bytes parent folder | download | duplicates (20)
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
; RUN: llvm-as < %s | llc | FileCheck %s
; PR 5247
; check that cmp/test is not scheduled before the add
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
target triple = "x86_64-unknown-linux-gnu"

@.str76843 = external dso_local constant [45 x i8]          ; <ptr> [#uses=1]
@__profiling_callsite_timestamps_live = external dso_local global [1216 x i64] ; <ptr> [#uses=2]

define i32 @cl_init(i32 %initoptions) nounwind {
entry:
  %retval.i = alloca i32                          ; <ptr> [#uses=3]
  %retval = alloca i32                            ; <ptr> [#uses=2]
  %initoptions.addr = alloca i32                  ; <ptr> [#uses=2]
  tail call void asm sideeffect "cpuid", "~{ax},~{bx},~{cx},~{dx},~{memory},~{dirflag},~{fpsr},~{flags}"() nounwind
  %0 = tail call i64 @llvm.readcyclecounter() nounwind ; <i64> [#uses=1]
  store i32 %initoptions, ptr %initoptions.addr
  call void asm sideeffect "cpuid", "~{ax},~{bx},~{cx},~{dx},~{memory},~{dirflag},~{fpsr},~{flags}"() nounwind
  %1 = call i64 @llvm.readcyclecounter() nounwind ; <i64> [#uses=1]
  %call.i = call i32 @lt_dlinit() nounwind        ; <i32> [#uses=1]
  %tobool.i = icmp ne i32 %call.i, 0              ; <i1> [#uses=1]
  br i1 %tobool.i, label %if.then.i, label %if.end.i

if.then.i:                                        ; preds = %entry
  %call1.i = call i32 @warn_dlerror(ptr @.str76843) nounwind ; <i32> [#uses=0]
  store i32 -1, ptr %retval.i
  br label %lt_init.exit

if.end.i:                                         ; preds = %entry
  store i32 0, ptr %retval.i
  br label %lt_init.exit

lt_init.exit:                                     ; preds = %if.end.i, %if.then.i
  %2 = load i32, ptr %retval.i                        ; <i32> [#uses=1]
  call void asm sideeffect "cpuid", "~{ax},~{bx},~{cx},~{dx},~{memory},~{dirflag},~{fpsr},~{flags}"() nounwind
  %3 = call i64 @llvm.readcyclecounter() nounwind ; <i64> [#uses=1]
  %4 = sub i64 %3, %1                             ; <i64> [#uses=1]
  %5 = atomicrmw add ptr getelementptr inbounds ([1216 x i64], ptr @__profiling_callsite_timestamps_live, i32 0, i32 51), i64 %4 monotonic
;CHECK: lock {{xadd|addq}} %rdx, __profiling_callsite_timestamps_live
;CHECK-NEXT: testl [[REG:%e[a-z]+]], [[REG]]
;CHECK-NEXT: jne
  %cmp = icmp eq i32 %2, 0                        ; <i1> [#uses=1]
  br i1 %cmp, label %if.then, label %if.end

if.then:                                          ; preds = %lt_init.exit
  call void @cli_rarload()
  br label %if.end

if.end:                                           ; preds = %if.then, %lt_init.exit
  store i32 0, ptr %retval
  %6 = load i32, ptr %retval                          ; <i32> [#uses=1]
  tail call void asm sideeffect "cpuid", "~{ax},~{bx},~{cx},~{dx},~{memory},~{dirflag},~{fpsr},~{flags}"() nounwind
  %7 = tail call i64 @llvm.readcyclecounter() nounwind ; <i64> [#uses=1]
  %8 = sub i64 %7, %0                             ; <i64> [#uses=1]
  %9 = atomicrmw add ptr getelementptr inbounds ([1216 x i64], ptr @__profiling_callsite_timestamps_live, i32 0, i32 50), i64 %8 monotonic
  ret i32 %6
}

declare void @cli_rarload() nounwind

declare i32 @lt_dlinit()

declare i32 @warn_dlerror(ptr) nounwind

declare i64 @llvm.readcyclecounter() nounwind