1 ; RUN: llc -mtriple=x86_64-linux-gnu %s -o - | FileCheck %s
2 ; RUN: llc -mtriple=x86_64-linux-gnu -pre-RA-sched=fast %s -o - | FileCheck %s
6 define i64 @test_intervening_call(i64* %foo, i64 %bar, i64 %baz) {
7 ; CHECK-LABEL: test_intervening_call:
10 ; CHECK: popq [[FLAGS:%.*]]
14 ; CHECK: pushq [[FLAGS]]
17 %cx = cmpxchg i64* %foo, i64 %bar, i64 %baz seq_cst seq_cst
18 %p = extractvalue { i64, i1 } %cx, 1
20 br i1 %p, label %t, label %f
29 ; Interesting in producing a clobber without any function calls.
30 define i32 @test_control_flow(i32* %p, i32 %i, i32 %j) {
31 ; CHECK-LABEL: test_control_flow:
36 %cmp = icmp sgt i32 %i, %j
37 br i1 %cmp, label %loop_start, label %cond.end
40 br label %while.condthread-pre-split.i
42 while.condthread-pre-split.i:
43 %.pr.i = load i32* %p, align 4
44 br label %while.cond.i
47 %0 = phi i32 [ %.pr.i, %while.condthread-pre-split.i ], [ 0, %while.cond.i ]
48 %tobool.i = icmp eq i32 %0, 0
49 br i1 %tobool.i, label %while.cond.i, label %while.body.i
52 %.lcssa = phi i32 [ %0, %while.cond.i ]
53 %1 = cmpxchg i32* %p, i32 %.lcssa, i32 %.lcssa seq_cst seq_cst
54 %2 = extractvalue { i32, i1 } %1, 1
55 br i1 %2, label %cond.end.loopexit, label %while.condthread-pre-split.i
61 %cond = phi i32 [ %i, %entry ], [ 0, %cond.end.loopexit ]
65 ; This one is an interesting case because CMOV doesn't have a chain
66 ; operand. Naive attempts to limit cmpxchg EFLAGS use are likely to fail here.
67 define i32 @test_feed_cmov(i32* %addr, i32 %desired, i32 %new) {
68 ; CHECK-LABEL: test_feed_cmov:
72 ; CHECK: popq [[FLAGS:%.*]]
76 ; CHECK: pushq [[FLAGS]]
79 %res = cmpxchg i32* %addr, i32 %desired, i32 %new seq_cst seq_cst
80 %success = extractvalue { i32, i1 } %res, 1
82 %rhs = call i32 @bar()
84 %ret = select i1 %success, i32 %new, i32 %rhs