1*9880d681SAndroid Build Coastguard Worker; RUN: llc -march=mipsel -mattr=mips16 -relocation-model=pic -O3 < %s | FileCheck %s -check-prefix=16 2*9880d681SAndroid Build Coastguard Worker 3*9880d681SAndroid Build Coastguard Worker@.str = private unnamed_addr constant [8 x i8] c"%d, %d\0A\00", align 1 4*9880d681SAndroid Build Coastguard Worker 5*9880d681SAndroid Build Coastguard Workerdefine i32 @foo(i32* %mem, i32 %val, i32 %c) nounwind { 6*9880d681SAndroid Build Coastguard Workerentry: 7*9880d681SAndroid Build Coastguard Worker %0 = atomicrmw add i32* %mem, i32 %val seq_cst 8*9880d681SAndroid Build Coastguard Worker %add = add nsw i32 %0, %c 9*9880d681SAndroid Build Coastguard Worker ret i32 %add 10*9880d681SAndroid Build Coastguard Worker; 16-LABEL: foo: 11*9880d681SAndroid Build Coastguard Worker; 16: lw ${{[0-9]+}}, %call16(__sync_synchronize)(${{[0-9]+}}) 12*9880d681SAndroid Build Coastguard Worker; 16: lw ${{[0-9]+}}, %call16(__sync_fetch_and_add_4)(${{[0-9]+}}) 13*9880d681SAndroid Build Coastguard Worker} 14*9880d681SAndroid Build Coastguard Worker 15*9880d681SAndroid Build Coastguard Workerdefine i32 @main() nounwind { 16*9880d681SAndroid Build Coastguard Workerentry: 17*9880d681SAndroid Build Coastguard Worker %x = alloca i32, align 4 18*9880d681SAndroid Build Coastguard Worker store volatile i32 0, i32* %x, align 4 19*9880d681SAndroid Build Coastguard Worker %0 = atomicrmw add i32* %x, i32 1 seq_cst 20*9880d681SAndroid Build Coastguard Worker %add.i = add nsw i32 %0, 2 21*9880d681SAndroid Build Coastguard Worker %1 = load volatile i32, i32* %x, align 4 22*9880d681SAndroid Build Coastguard Worker %call1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0), i32 %add.i, i32 %1) nounwind 23*9880d681SAndroid Build Coastguard Worker %pair = cmpxchg i32* %x, i32 1, i32 2 seq_cst seq_cst 24*9880d681SAndroid Build Coastguard Worker %2 = extractvalue { i32, i1 } %pair, 0 25*9880d681SAndroid Build Coastguard Worker %3 = load volatile i32, i32* %x, align 4 26*9880d681SAndroid Build Coastguard Worker %call2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0), i32 %2, i32 %3) nounwind 27*9880d681SAndroid Build Coastguard Worker %4 = atomicrmw xchg i32* %x, i32 1 seq_cst 28*9880d681SAndroid Build Coastguard Worker %5 = load volatile i32, i32* %x, align 4 29*9880d681SAndroid Build Coastguard Worker %call3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0), i32 %4, i32 %5) nounwind 30*9880d681SAndroid Build Coastguard Worker; 16-LABEL: main: 31*9880d681SAndroid Build Coastguard Worker; 16: lw ${{[0-9]+}}, %call16(__sync_synchronize)(${{[0-9]+}}) 32*9880d681SAndroid Build Coastguard Worker; 16: lw ${{[0-9]+}}, %call16(__sync_fetch_and_add_4)(${{[0-9]+}}) 33*9880d681SAndroid Build Coastguard Worker; 16: lw ${{[0-9]+}}, %call16(__sync_val_compare_and_swap_4)(${{[0-9]+}}) 34*9880d681SAndroid Build Coastguard Worker; 16: lw ${{[0-9]+}}, %call16(__sync_lock_test_and_set_4)(${{[0-9]+}}) 35*9880d681SAndroid Build Coastguard Worker 36*9880d681SAndroid Build Coastguard Worker ret i32 0 37*9880d681SAndroid Build Coastguard Worker} 38*9880d681SAndroid Build Coastguard Worker 39*9880d681SAndroid Build Coastguard Workerdeclare i32 @printf(i8* nocapture, ...) nounwind 40*9880d681SAndroid Build Coastguard Worker 41*9880d681SAndroid Build Coastguard Worker 42