1 ; RUN: llc < %s -march=hexagon
3 @si = common global i32 0, align 4
4 @sll = common global i64 0, align 8
6 define void @test_op_ignore() nounwind {
8 %t00 = atomicrmw add ptr @si, i32 1 monotonic
9 %t01 = atomicrmw add ptr @sll, i64 1 monotonic
10 %t10 = atomicrmw sub ptr @si, i32 1 monotonic
11 %t11 = atomicrmw sub ptr @sll, i64 1 monotonic
12 %t20 = atomicrmw or ptr @si, i32 1 monotonic
13 %t21 = atomicrmw or ptr @sll, i64 1 monotonic
14 %t30 = atomicrmw xor ptr @si, i32 1 monotonic
15 %t31 = atomicrmw xor ptr @sll, i64 1 monotonic
16 %t40 = atomicrmw and ptr @si, i32 1 monotonic
17 %t41 = atomicrmw and ptr @sll, i64 1 monotonic
18 %t50 = atomicrmw nand ptr @si, i32 1 monotonic
19 %t51 = atomicrmw nand ptr @sll, i64 1 monotonic
22 return: ; preds = %entry
26 define void @test_fetch_and_op() nounwind {
28 %t00 = atomicrmw add ptr @si, i32 11 monotonic
29 store i32 %t00, ptr @si, align 4
30 %t01 = atomicrmw add ptr @sll, i64 11 monotonic
31 store i64 %t01, ptr @sll, align 8
32 %t10 = atomicrmw sub ptr @si, i32 11 monotonic
33 store i32 %t10, ptr @si, align 4
34 %t11 = atomicrmw sub ptr @sll, i64 11 monotonic
35 store i64 %t11, ptr @sll, align 8
36 %t20 = atomicrmw or ptr @si, i32 11 monotonic
37 store i32 %t20, ptr @si, align 4
38 %t21 = atomicrmw or ptr @sll, i64 11 monotonic
39 store i64 %t21, ptr @sll, align 8
40 %t30 = atomicrmw xor ptr @si, i32 11 monotonic
41 store i32 %t30, ptr @si, align 4
42 %t31 = atomicrmw xor ptr @sll, i64 11 monotonic
43 store i64 %t31, ptr @sll, align 8
44 %t40 = atomicrmw and ptr @si, i32 11 monotonic
45 store i32 %t40, ptr @si, align 4
46 %t41 = atomicrmw and ptr @sll, i64 11 monotonic
47 store i64 %t41, ptr @sll, align 8
48 %t50 = atomicrmw nand ptr @si, i32 11 monotonic
49 store i32 %t50, ptr @si, align 4
50 %t51 = atomicrmw nand ptr @sll, i64 11 monotonic
51 store i64 %t51, ptr @sll, align 8
54 return: ; preds = %entry
58 define void @test_lock() nounwind {
60 %t00 = atomicrmw xchg ptr @si, i32 1 monotonic
61 store i32 %t00, ptr @si, align 4
62 %t01 = atomicrmw xchg ptr @sll, i64 1 monotonic
63 store i64 %t01, ptr @sll, align 8
65 store volatile i32 0, ptr @si, align 4
66 store volatile i64 0, ptr @sll, align 8
69 return: ; preds = %entry
74 define i64 @fred() nounwind {
76 %s0 = cmpxchg ptr undef, i32 undef, i32 undef seq_cst seq_cst
77 %s1 = extractvalue { i32, i1 } %s0, 0
78 %t0 = cmpxchg ptr undef, i64 undef, i64 undef seq_cst seq_cst
79 %t1 = extractvalue { i64, i1 } %t0, 0
80 %u0 = zext i32 %s1 to i64
81 %u1 = add i64 %u0, %t1