Home | History | Annotate | Download | only in Mips
      1 ; 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 
      5 define i32 @foo(i32* %mem, i32 %val, i32 %c) nounwind {
      6 entry:
      7   %0 = atomicrmw add i32* %mem, i32 %val seq_cst
      8   %add = add nsw i32 %0, %c
      9   ret i32 %add
     10 ; 16-LABEL: foo:
     11 ; 16:	lw	${{[0-9]+}}, %call16(__sync_synchronize)(${{[0-9]+}})
     12 ; 16: 	lw	${{[0-9]+}}, %call16(__sync_fetch_and_add_4)(${{[0-9]+}})
     13 }
     14 
     15 define i32 @main() nounwind {
     16 entry:
     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
     23   %pair = cmpxchg i32* %x, i32 1, i32 2 seq_cst seq_cst
     24   %2 = extractvalue { i32, i1 } %pair, 0
     25   %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
     30 ; 16-LABEL: main:
     31 ; 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 
     39 declare i32 @printf(i8* nocapture, ...) nounwind
     40 
     41 
     42