blob: c26415233d0b23c60fb3ec4434fefecc7f7a1207 [file] [log] [blame]
Reed Kotleraebb8b02012-10-29 16:16:54 +00001; RUN: llc -march=mipsel -mcpu=mips16 -relocation-model=pic -O3 < %s | FileCheck %s -check-prefix=16
2
3@.str = private unnamed_addr constant [8 x i8] c"%d, %d\0A\00", align 1
4
5define i32 @foo(i32* %mem, i32 %val, i32 %c) nounwind {
6entry:
7 %0 = atomicrmw add i32* %mem, i32 %val seq_cst
8 %add = add nsw i32 %0, %c
9 ret i32 %add
Stephen Lind24ab202013-07-14 06:24:09 +000010; 16-LABEL: foo:
Reed Kotleraebb8b02012-10-29 16:16:54 +000011; 16: lw ${{[0-9]+}}, %call16(__sync_synchronize)(${{[0-9]+}})
12; 16: lw ${{[0-9]+}}, %call16(__sync_fetch_and_add_4)(${{[0-9]+}})
13}
14
15define i32 @main() nounwind {
16entry:
17 %x = alloca i32, align 4
18 store volatile i32 0, i32* %x, align 4
19 %0 = atomicrmw add i32* %x, i32 1 seq_cst
20 %add.i = add nsw i32 %0, 2
21 %1 = load volatile i32* %x, align 4
22 %call1 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([8 x i8]* @.str, i32 0, i32 0), i32 %add.i, i32 %1) nounwind
Tim Northover420a2162014-06-13 14:24:07 +000023 %pair = cmpxchg i32* %x, i32 1, i32 2 seq_cst seq_cst
24 %2 = extractvalue { i32, i1 } %pair, 0
Reed Kotleraebb8b02012-10-29 16:16:54 +000025 %3 = load volatile i32* %x, align 4
26 %call2 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([8 x i8]* @.str, i32 0, i32 0), i32 %2, i32 %3) nounwind
27 %4 = atomicrmw xchg i32* %x, i32 1 seq_cst
28 %5 = load volatile i32* %x, align 4
29 %call3 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([8 x i8]* @.str, i32 0, i32 0), i32 %4, i32 %5) nounwind
Stephen Lind24ab202013-07-14 06:24:09 +000030; 16-LABEL: main:
Reed Kotleraebb8b02012-10-29 16:16:54 +000031; 16: lw ${{[0-9]+}}, %call16(__sync_synchronize)(${{[0-9]+}})
32; 16: lw ${{[0-9]+}}, %call16(__sync_fetch_and_add_4)(${{[0-9]+}})
33; 16: lw ${{[0-9]+}}, %call16(__sync_val_compare_and_swap_4)(${{[0-9]+}})
34; 16: lw ${{[0-9]+}}, %call16(__sync_lock_test_and_set_4)(${{[0-9]+}})
35
36 ret i32 0
37}
38
39declare i32 @printf(i8* nocapture, ...) nounwind
40
41