1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 2; RUN: llc -O0 -mtriple=mipsel-unknown-linux-gnu -mcpu=mips32r2 -target-abi=o32 < %s -filetype=asm -o - \ 3; RUN: | FileCheck -check-prefixes=O32 %s 4; RUN: llc -O0 -mtriple=mips64el-unknown-linux-gnu -mcpu=mips64r2 -target-abi=n32 < %s -filetype=asm -o - \ 5; RUN: | FileCheck -check-prefixes=N32 %s 6; RUN: llc -O0 -mtriple=mips64el-unknown-linux-gnu -mcpu=mips64r2 -target-abi=n64 < %s -filetype=asm -o - \ 7; RUN: | FileCheck -check-prefixes=N64 %s 8 9@sym = external global i32 * 10 11define void @foo(i32 %new, i32 %old) { 12; O32-LABEL: foo: 13; O32: # %bb.0: # %entry 14; O32-NEXT: lui $1, %hi(sym) 15; O32-NEXT: lw $3, %lo(sym)($1) 16; O32-NEXT: sync 17; O32-NEXT: $BB0_1: # %entry 18; O32-NEXT: # =>This Inner Loop Header: Depth=1 19; O32-NEXT: ll $1, 0($3) 20; O32-NEXT: bne $1, $4, $BB0_3 21; O32-NEXT: nop 22; O32-NEXT: # %bb.2: # %entry 23; O32-NEXT: # in Loop: Header=BB0_1 Depth=1 24; O32-NEXT: move $2, $5 25; O32-NEXT: sc $2, 0($3) 26; O32-NEXT: beqz $2, $BB0_1 27; O32-NEXT: nop 28; O32-NEXT: $BB0_3: # %entry 29; O32-NEXT: sync 30; O32-NEXT: jr $ra 31; O32-NEXT: nop 32; 33; N32-LABEL: foo: 34; N32: # %bb.0: # %entry 35; N32-NEXT: move $1, $5 36; N32-NEXT: sll $5, $1, 0 37; N32-NEXT: move $1, $4 38; N32-NEXT: sll $4, $1, 0 39; N32-NEXT: lui $1, %hi(sym) 40; N32-NEXT: lw $3, %lo(sym)($1) 41; N32-NEXT: sync 42; N32-NEXT: .LBB0_1: # %entry 43; N32-NEXT: # =>This Inner Loop Header: Depth=1 44; N32-NEXT: ll $1, 0($3) 45; N32-NEXT: bne $1, $4, .LBB0_3 46; N32-NEXT: nop 47; N32-NEXT: # %bb.2: # %entry 48; N32-NEXT: # in Loop: Header=BB0_1 Depth=1 49; N32-NEXT: move $2, $5 50; N32-NEXT: sc $2, 0($3) 51; N32-NEXT: beqz $2, .LBB0_1 52; N32-NEXT: nop 53; N32-NEXT: .LBB0_3: # %entry 54; N32-NEXT: sync 55; N32-NEXT: jr $ra 56; N32-NEXT: nop 57; 58; N64-LABEL: foo: 59; N64: # %bb.0: # %entry 60; N64-NEXT: move $1, $5 61; N64-NEXT: sll $5, $1, 0 62; N64-NEXT: move $1, $4 63; N64-NEXT: sll $4, $1, 0 64; N64-NEXT: lui $1, %highest(sym) 65; N64-NEXT: daddiu $1, $1, %higher(sym) 66; N64-NEXT: dsll $1, $1, 16 67; N64-NEXT: daddiu $1, $1, %hi(sym) 68; N64-NEXT: dsll $1, $1, 16 69; N64-NEXT: ld $3, %lo(sym)($1) 70; N64-NEXT: sync 71; N64-NEXT: .LBB0_1: # %entry 72; N64-NEXT: # =>This Inner Loop Header: Depth=1 73; N64-NEXT: ll $1, 0($3) 74; N64-NEXT: bne $1, $4, .LBB0_3 75; N64-NEXT: nop 76; N64-NEXT: # %bb.2: # %entry 77; N64-NEXT: # in Loop: Header=BB0_1 Depth=1 78; N64-NEXT: move $2, $5 79; N64-NEXT: sc $2, 0($3) 80; N64-NEXT: beqz $2, .LBB0_1 81; N64-NEXT: nop 82; N64-NEXT: .LBB0_3: # %entry 83; N64-NEXT: sync 84; N64-NEXT: jr $ra 85; N64-NEXT: nop 86entry: 87 %0 = load i32 *, i32 ** @sym 88 cmpxchg i32 * %0, i32 %new, i32 %old seq_cst seq_cst 89 ret void 90} 91 92