794 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc < %s -O0 -mtriple=x86_64-- -mcpu=corei7 -verify-machineinstrs | FileCheck %s --check-prefix X643; RUN: llc < %s -O0 -mtriple=i386-- -mcpu=i486 -verify-machineinstrs | FileCheck %s --check-prefix I4864 5@sc64 = external dso_local global i646@fsc64 = external dso_local global double7@psc64 = external dso_local global ptr8 9define void @atomic_fetch_add64() nounwind {10; X64-LABEL: atomic_fetch_add64:11; X64: # %bb.0: # %entry12; X64-NEXT: lock incq sc64(%rip)13; X64-NEXT: lock addq $3, sc64(%rip)14; X64-NEXT: movl $5, %eax15; X64-NEXT: lock xaddq %rax, sc64(%rip)16; X64-NEXT: lock addq %rax, sc64(%rip)17; X64-NEXT: retq18;19; I486-LABEL: atomic_fetch_add64:20; I486: # %bb.0: # %entry21; I486-NEXT: subl $16, %esp22; I486-NEXT: movl %esp, %eax23; I486-NEXT: movl $2, 12(%eax)24; I486-NEXT: movl $0, 8(%eax)25; I486-NEXT: movl $1, 4(%eax)26; I486-NEXT: movl $sc64, (%eax)27; I486-NEXT: calll __atomic_fetch_add_8@PLT28; I486-NEXT: movl %esp, %eax29; I486-NEXT: movl $2, 12(%eax)30; I486-NEXT: movl $0, 8(%eax)31; I486-NEXT: movl $3, 4(%eax)32; I486-NEXT: movl $sc64, (%eax)33; I486-NEXT: calll __atomic_fetch_add_8@PLT34; I486-NEXT: movl %esp, %eax35; I486-NEXT: movl $2, 12(%eax)36; I486-NEXT: movl $0, 8(%eax)37; I486-NEXT: movl $5, 4(%eax)38; I486-NEXT: movl $sc64, (%eax)39; I486-NEXT: calll __atomic_fetch_add_8@PLT40; I486-NEXT: movl %eax, %ecx41; I486-NEXT: movl %esp, %eax42; I486-NEXT: movl %edx, 8(%eax)43; I486-NEXT: movl %ecx, 4(%eax)44; I486-NEXT: movl $2, 12(%eax)45; I486-NEXT: movl $sc64, (%eax)46; I486-NEXT: calll __atomic_fetch_add_8@PLT47; I486-NEXT: addl $16, %esp48; I486-NEXT: retl49entry:50 %t1 = atomicrmw add ptr @sc64, i64 1 acquire51 %t2 = atomicrmw add ptr @sc64, i64 3 acquire52 %t3 = atomicrmw add ptr @sc64, i64 5 acquire53 %t4 = atomicrmw add ptr @sc64, i64 %t3 acquire54 ret void55}56 57define void @atomic_fetch_sub64() nounwind {58; X64-LABEL: atomic_fetch_sub64:59; X64: # %bb.0:60; X64-NEXT: lock decq sc64(%rip)61; X64-NEXT: lock subq $3, sc64(%rip)62; X64-NEXT: movq $-5, %rax63; X64-NEXT: lock xaddq %rax, sc64(%rip)64; X64-NEXT: lock subq %rax, sc64(%rip)65; X64-NEXT: retq66;67; I486-LABEL: atomic_fetch_sub64:68; I486: # %bb.0:69; I486-NEXT: subl $16, %esp70; I486-NEXT: movl %esp, %eax71; I486-NEXT: movl $2, 12(%eax)72; I486-NEXT: movl $0, 8(%eax)73; I486-NEXT: movl $1, 4(%eax)74; I486-NEXT: movl $sc64, (%eax)75; I486-NEXT: calll __atomic_fetch_sub_8@PLT76; I486-NEXT: movl %esp, %eax77; I486-NEXT: movl $2, 12(%eax)78; I486-NEXT: movl $0, 8(%eax)79; I486-NEXT: movl $3, 4(%eax)80; I486-NEXT: movl $sc64, (%eax)81; I486-NEXT: calll __atomic_fetch_sub_8@PLT82; I486-NEXT: movl %esp, %eax83; I486-NEXT: movl $2, 12(%eax)84; I486-NEXT: movl $0, 8(%eax)85; I486-NEXT: movl $5, 4(%eax)86; I486-NEXT: movl $sc64, (%eax)87; I486-NEXT: calll __atomic_fetch_sub_8@PLT88; I486-NEXT: movl %eax, %ecx89; I486-NEXT: movl %esp, %eax90; I486-NEXT: movl %edx, 8(%eax)91; I486-NEXT: movl %ecx, 4(%eax)92; I486-NEXT: movl $2, 12(%eax)93; I486-NEXT: movl $sc64, (%eax)94; I486-NEXT: calll __atomic_fetch_sub_8@PLT95; I486-NEXT: addl $16, %esp96; I486-NEXT: retl97 %t1 = atomicrmw sub ptr @sc64, i64 1 acquire98 %t2 = atomicrmw sub ptr @sc64, i64 3 acquire99 %t3 = atomicrmw sub ptr @sc64, i64 5 acquire100 %t4 = atomicrmw sub ptr @sc64, i64 %t3 acquire101 ret void102}103 104define void @atomic_fetch_and64() nounwind {105; X64-LABEL: atomic_fetch_and64:106; X64: # %bb.0:107; X64-NEXT: lock andq $3, sc64(%rip)108; X64-NEXT: movq sc64, %rax109; X64-NEXT: movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill110; X64-NEXT: .LBB2_1: # %atomicrmw.start111; X64-NEXT: # =>This Inner Loop Header: Depth=1112; X64-NEXT: movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload113; X64-NEXT: movl %eax, %ecx114; X64-NEXT: andl $5, %ecx115; X64-NEXT: # kill: def $rcx killed $ecx116; X64-NEXT: lock cmpxchgq %rcx, sc64(%rip)117; X64-NEXT: sete %cl118; X64-NEXT: movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill119; X64-NEXT: testb $1, %cl120; X64-NEXT: movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill121; X64-NEXT: jne .LBB2_2122; X64-NEXT: jmp .LBB2_1123; X64-NEXT: .LBB2_2: # %atomicrmw.end124; X64-NEXT: movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload125; X64-NEXT: lock andq %rax, sc64(%rip)126; X64-NEXT: retq127;128; I486-LABEL: atomic_fetch_and64:129; I486: # %bb.0:130; I486-NEXT: subl $16, %esp131; I486-NEXT: movl %esp, %eax132; I486-NEXT: movl $2, 12(%eax)133; I486-NEXT: movl $0, 8(%eax)134; I486-NEXT: movl $3, 4(%eax)135; I486-NEXT: movl $sc64, (%eax)136; I486-NEXT: calll __atomic_fetch_and_8@PLT137; I486-NEXT: movl %esp, %eax138; I486-NEXT: movl $2, 12(%eax)139; I486-NEXT: movl $0, 8(%eax)140; I486-NEXT: movl $5, 4(%eax)141; I486-NEXT: movl $sc64, (%eax)142; I486-NEXT: calll __atomic_fetch_and_8@PLT143; I486-NEXT: movl %eax, %ecx144; I486-NEXT: movl %esp, %eax145; I486-NEXT: movl %edx, 8(%eax)146; I486-NEXT: movl %ecx, 4(%eax)147; I486-NEXT: movl $2, 12(%eax)148; I486-NEXT: movl $sc64, (%eax)149; I486-NEXT: calll __atomic_fetch_and_8@PLT150; I486-NEXT: addl $16, %esp151; I486-NEXT: retl152 %t1 = atomicrmw and ptr @sc64, i64 3 acquire153 %t2 = atomicrmw and ptr @sc64, i64 5 acquire154 %t3 = atomicrmw and ptr @sc64, i64 %t2 acquire155 ret void156}157 158define void @atomic_fetch_or64() nounwind {159; X64-LABEL: atomic_fetch_or64:160; X64: # %bb.0:161; X64-NEXT: lock orq $3, sc64(%rip)162; X64-NEXT: movq sc64, %rax163; X64-NEXT: movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill164; X64-NEXT: .LBB3_1: # %atomicrmw.start165; X64-NEXT: # =>This Inner Loop Header: Depth=1166; X64-NEXT: movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload167; X64-NEXT: movq %rax, %rcx168; X64-NEXT: orq $5, %rcx169; X64-NEXT: lock cmpxchgq %rcx, sc64(%rip)170; X64-NEXT: sete %cl171; X64-NEXT: movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill172; X64-NEXT: testb $1, %cl173; X64-NEXT: movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill174; X64-NEXT: jne .LBB3_2175; X64-NEXT: jmp .LBB3_1176; X64-NEXT: .LBB3_2: # %atomicrmw.end177; X64-NEXT: movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload178; X64-NEXT: lock orq %rax, sc64(%rip)179; X64-NEXT: retq180;181; I486-LABEL: atomic_fetch_or64:182; I486: # %bb.0:183; I486-NEXT: subl $16, %esp184; I486-NEXT: movl %esp, %eax185; I486-NEXT: movl $2, 12(%eax)186; I486-NEXT: movl $0, 8(%eax)187; I486-NEXT: movl $3, 4(%eax)188; I486-NEXT: movl $sc64, (%eax)189; I486-NEXT: calll __atomic_fetch_or_8@PLT190; I486-NEXT: movl %esp, %eax191; I486-NEXT: movl $2, 12(%eax)192; I486-NEXT: movl $0, 8(%eax)193; I486-NEXT: movl $5, 4(%eax)194; I486-NEXT: movl $sc64, (%eax)195; I486-NEXT: calll __atomic_fetch_or_8@PLT196; I486-NEXT: movl %eax, %ecx197; I486-NEXT: movl %esp, %eax198; I486-NEXT: movl %edx, 8(%eax)199; I486-NEXT: movl %ecx, 4(%eax)200; I486-NEXT: movl $2, 12(%eax)201; I486-NEXT: movl $sc64, (%eax)202; I486-NEXT: calll __atomic_fetch_or_8@PLT203; I486-NEXT: addl $16, %esp204; I486-NEXT: retl205 %t1 = atomicrmw or ptr @sc64, i64 3 acquire206 %t2 = atomicrmw or ptr @sc64, i64 5 acquire207 %t3 = atomicrmw or ptr @sc64, i64 %t2 acquire208 ret void209}210 211define void @atomic_fetch_xor64() nounwind {212; X64-LABEL: atomic_fetch_xor64:213; X64: # %bb.0:214; X64-NEXT: lock xorq $3, sc64(%rip)215; X64-NEXT: movq sc64, %rax216; X64-NEXT: movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill217; X64-NEXT: .LBB4_1: # %atomicrmw.start218; X64-NEXT: # =>This Inner Loop Header: Depth=1219; X64-NEXT: movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload220; X64-NEXT: movq %rax, %rcx221; X64-NEXT: xorq $5, %rcx222; X64-NEXT: lock cmpxchgq %rcx, sc64(%rip)223; X64-NEXT: sete %cl224; X64-NEXT: movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill225; X64-NEXT: testb $1, %cl226; X64-NEXT: movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill227; X64-NEXT: jne .LBB4_2228; X64-NEXT: jmp .LBB4_1229; X64-NEXT: .LBB4_2: # %atomicrmw.end230; X64-NEXT: movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload231; X64-NEXT: lock xorq %rax, sc64(%rip)232; X64-NEXT: retq233;234; I486-LABEL: atomic_fetch_xor64:235; I486: # %bb.0:236; I486-NEXT: subl $16, %esp237; I486-NEXT: movl %esp, %eax238; I486-NEXT: movl $2, 12(%eax)239; I486-NEXT: movl $0, 8(%eax)240; I486-NEXT: movl $3, 4(%eax)241; I486-NEXT: movl $sc64, (%eax)242; I486-NEXT: calll __atomic_fetch_xor_8@PLT243; I486-NEXT: movl %esp, %eax244; I486-NEXT: movl $2, 12(%eax)245; I486-NEXT: movl $0, 8(%eax)246; I486-NEXT: movl $5, 4(%eax)247; I486-NEXT: movl $sc64, (%eax)248; I486-NEXT: calll __atomic_fetch_xor_8@PLT249; I486-NEXT: movl %eax, %ecx250; I486-NEXT: movl %esp, %eax251; I486-NEXT: movl %edx, 8(%eax)252; I486-NEXT: movl %ecx, 4(%eax)253; I486-NEXT: movl $2, 12(%eax)254; I486-NEXT: movl $sc64, (%eax)255; I486-NEXT: calll __atomic_fetch_xor_8@PLT256; I486-NEXT: addl $16, %esp257; I486-NEXT: retl258 %t1 = atomicrmw xor ptr @sc64, i64 3 acquire259 %t2 = atomicrmw xor ptr @sc64, i64 5 acquire260 %t3 = atomicrmw xor ptr @sc64, i64 %t2 acquire261 ret void262}263 264define void @atomic_fetch_nand64(i64 %x) nounwind {265; X64-LABEL: atomic_fetch_nand64:266; X64: # %bb.0:267; X64-NEXT: movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill268; X64-NEXT: movq sc64, %rax269; X64-NEXT: movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill270; X64-NEXT: .LBB5_1: # %atomicrmw.start271; X64-NEXT: # =>This Inner Loop Header: Depth=1272; X64-NEXT: movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload273; X64-NEXT: movq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Reload274; X64-NEXT: movq %rax, %rcx275; X64-NEXT: andq %rdx, %rcx276; X64-NEXT: notq %rcx277; X64-NEXT: lock cmpxchgq %rcx, sc64(%rip)278; X64-NEXT: sete %cl279; X64-NEXT: testb $1, %cl280; X64-NEXT: movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill281; X64-NEXT: jne .LBB5_2282; X64-NEXT: jmp .LBB5_1283; X64-NEXT: .LBB5_2: # %atomicrmw.end284; X64-NEXT: retq285;286; I486-LABEL: atomic_fetch_nand64:287; I486: # %bb.0:288; I486-NEXT: subl $16, %esp289; I486-NEXT: movl {{[0-9]+}}(%esp), %edx290; I486-NEXT: movl {{[0-9]+}}(%esp), %ecx291; I486-NEXT: movl %esp, %eax292; I486-NEXT: movl %edx, 8(%eax)293; I486-NEXT: movl %ecx, 4(%eax)294; I486-NEXT: movl $2, 12(%eax)295; I486-NEXT: movl $sc64, (%eax)296; I486-NEXT: calll __atomic_fetch_nand_8@PLT297; I486-NEXT: addl $16, %esp298; I486-NEXT: retl299 %t1 = atomicrmw nand ptr @sc64, i64 %x acquire300 ret void301}302 303define void @atomic_fetch_max64(i64 %x) nounwind {304; X64-LABEL: atomic_fetch_max64:305; X64: # %bb.0:306; X64-NEXT: movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill307; X64-NEXT: movq sc64, %rax308; X64-NEXT: movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill309; X64-NEXT: .LBB6_1: # %atomicrmw.start310; X64-NEXT: # =>This Inner Loop Header: Depth=1311; X64-NEXT: movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload312; X64-NEXT: movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload313; X64-NEXT: movq %rax, %rdx314; X64-NEXT: subq %rcx, %rdx315; X64-NEXT: cmovgq %rax, %rcx316; X64-NEXT: lock cmpxchgq %rcx, sc64(%rip)317; X64-NEXT: sete %cl318; X64-NEXT: testb $1, %cl319; X64-NEXT: movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill320; X64-NEXT: jne .LBB6_2321; X64-NEXT: jmp .LBB6_1322; X64-NEXT: .LBB6_2: # %atomicrmw.end323; X64-NEXT: retq324;325; I486-LABEL: atomic_fetch_max64:326; I486: # %bb.0:327; I486-NEXT: pushl %ebp328; I486-NEXT: movl %esp, %ebp329; I486-NEXT: pushl %esi330; I486-NEXT: andl $-8, %esp331; I486-NEXT: subl $72, %esp332; I486-NEXT: movl 12(%ebp), %eax333; I486-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill334; I486-NEXT: movl 8(%ebp), %eax335; I486-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill336; I486-NEXT: movl sc64+4, %eax337; I486-NEXT: movl sc64, %ecx338; I486-NEXT: movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill339; I486-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill340; I486-NEXT: jmp .LBB6_1341; I486-NEXT: .LBB6_1: # %atomicrmw.start342; I486-NEXT: # =>This Inner Loop Header: Depth=1343; I486-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %edx # 4-byte Reload344; I486-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %esi # 4-byte Reload345; I486-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload346; I486-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 4-byte Reload347; I486-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill348; I486-NEXT: movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill349; I486-NEXT: subl %ecx, %esi350; I486-NEXT: sbbl %eax, %edx351; I486-NEXT: movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill352; I486-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill353; I486-NEXT: jl .LBB6_4354; I486-NEXT: # %bb.3: # %atomicrmw.start355; I486-NEXT: # in Loop: Header=BB6_1 Depth=1356; I486-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 4-byte Reload357; I486-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload358; I486-NEXT: movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill359; I486-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill360; I486-NEXT: .LBB6_4: # %atomicrmw.start361; I486-NEXT: # in Loop: Header=BB6_1 Depth=1362; I486-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 4-byte Reload363; I486-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %esi # 4-byte Reload364; I486-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload365; I486-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %edx # 4-byte Reload366; I486-NEXT: movl %esi, {{[0-9]+}}(%esp)367; I486-NEXT: movl %eax, {{[0-9]+}}(%esp)368; I486-NEXT: movl %esp, %eax369; I486-NEXT: movl %edx, 12(%eax)370; I486-NEXT: movl %ecx, 8(%eax)371; I486-NEXT: leal {{[0-9]+}}(%esp), %ecx372; I486-NEXT: movl %ecx, 4(%eax)373; I486-NEXT: movl $2, 20(%eax)374; I486-NEXT: movl $2, 16(%eax)375; I486-NEXT: movl $sc64, (%eax)376; I486-NEXT: calll __atomic_compare_exchange_8@PLT377; I486-NEXT: movb %al, %dl378; I486-NEXT: movl {{[0-9]+}}(%esp), %ecx379; I486-NEXT: movl {{[0-9]+}}(%esp), %eax380; I486-NEXT: testb %dl, %dl381; I486-NEXT: movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill382; I486-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill383; I486-NEXT: je .LBB6_1384; I486-NEXT: jmp .LBB6_2385; I486-NEXT: .LBB6_2: # %atomicrmw.end386; I486-NEXT: leal -4(%ebp), %esp387; I486-NEXT: popl %esi388; I486-NEXT: popl %ebp389; I486-NEXT: retl390 %t1 = atomicrmw max ptr @sc64, i64 %x acquire391 392 ret void393}394 395define void @atomic_fetch_min64(i64 %x) nounwind {396; X64-LABEL: atomic_fetch_min64:397; X64: # %bb.0:398; X64-NEXT: movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill399; X64-NEXT: movq sc64, %rax400; X64-NEXT: movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill401; X64-NEXT: .LBB7_1: # %atomicrmw.start402; X64-NEXT: # =>This Inner Loop Header: Depth=1403; X64-NEXT: movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload404; X64-NEXT: movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload405; X64-NEXT: movq %rax, %rdx406; X64-NEXT: subq %rcx, %rdx407; X64-NEXT: cmovleq %rax, %rcx408; X64-NEXT: lock cmpxchgq %rcx, sc64(%rip)409; X64-NEXT: sete %cl410; X64-NEXT: testb $1, %cl411; X64-NEXT: movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill412; X64-NEXT: jne .LBB7_2413; X64-NEXT: jmp .LBB7_1414; X64-NEXT: .LBB7_2: # %atomicrmw.end415; X64-NEXT: retq416;417; I486-LABEL: atomic_fetch_min64:418; I486: # %bb.0:419; I486-NEXT: pushl %ebp420; I486-NEXT: movl %esp, %ebp421; I486-NEXT: pushl %esi422; I486-NEXT: andl $-8, %esp423; I486-NEXT: subl $72, %esp424; I486-NEXT: movl 12(%ebp), %eax425; I486-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill426; I486-NEXT: movl 8(%ebp), %eax427; I486-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill428; I486-NEXT: movl sc64+4, %eax429; I486-NEXT: movl sc64, %ecx430; I486-NEXT: movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill431; I486-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill432; I486-NEXT: jmp .LBB7_1433; I486-NEXT: .LBB7_1: # %atomicrmw.start434; I486-NEXT: # =>This Inner Loop Header: Depth=1435; I486-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %edx # 4-byte Reload436; I486-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %esi # 4-byte Reload437; I486-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload438; I486-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 4-byte Reload439; I486-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill440; I486-NEXT: movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill441; I486-NEXT: subl %ecx, %esi442; I486-NEXT: sbbl %eax, %edx443; I486-NEXT: movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill444; I486-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill445; I486-NEXT: jge .LBB7_4446; I486-NEXT: # %bb.3: # %atomicrmw.start447; I486-NEXT: # in Loop: Header=BB7_1 Depth=1448; I486-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 4-byte Reload449; I486-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload450; I486-NEXT: movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill451; I486-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill452; I486-NEXT: .LBB7_4: # %atomicrmw.start453; I486-NEXT: # in Loop: Header=BB7_1 Depth=1454; I486-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 4-byte Reload455; I486-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %esi # 4-byte Reload456; I486-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload457; I486-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %edx # 4-byte Reload458; I486-NEXT: movl %esi, {{[0-9]+}}(%esp)459; I486-NEXT: movl %eax, {{[0-9]+}}(%esp)460; I486-NEXT: movl %esp, %eax461; I486-NEXT: movl %edx, 12(%eax)462; I486-NEXT: movl %ecx, 8(%eax)463; I486-NEXT: leal {{[0-9]+}}(%esp), %ecx464; I486-NEXT: movl %ecx, 4(%eax)465; I486-NEXT: movl $2, 20(%eax)466; I486-NEXT: movl $2, 16(%eax)467; I486-NEXT: movl $sc64, (%eax)468; I486-NEXT: calll __atomic_compare_exchange_8@PLT469; I486-NEXT: movb %al, %dl470; I486-NEXT: movl {{[0-9]+}}(%esp), %ecx471; I486-NEXT: movl {{[0-9]+}}(%esp), %eax472; I486-NEXT: testb %dl, %dl473; I486-NEXT: movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill474; I486-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill475; I486-NEXT: je .LBB7_1476; I486-NEXT: jmp .LBB7_2477; I486-NEXT: .LBB7_2: # %atomicrmw.end478; I486-NEXT: leal -4(%ebp), %esp479; I486-NEXT: popl %esi480; I486-NEXT: popl %ebp481; I486-NEXT: retl482 %t1 = atomicrmw min ptr @sc64, i64 %x acquire483 484 ret void485}486 487define void @atomic_fetch_umax64(i64 %x) nounwind {488; X64-LABEL: atomic_fetch_umax64:489; X64: # %bb.0:490; X64-NEXT: movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill491; X64-NEXT: movq sc64, %rax492; X64-NEXT: movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill493; X64-NEXT: .LBB8_1: # %atomicrmw.start494; X64-NEXT: # =>This Inner Loop Header: Depth=1495; X64-NEXT: movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload496; X64-NEXT: movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload497; X64-NEXT: movq %rax, %rdx498; X64-NEXT: subq %rcx, %rdx499; X64-NEXT: cmovaq %rax, %rcx500; X64-NEXT: lock cmpxchgq %rcx, sc64(%rip)501; X64-NEXT: sete %cl502; X64-NEXT: testb $1, %cl503; X64-NEXT: movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill504; X64-NEXT: jne .LBB8_2505; X64-NEXT: jmp .LBB8_1506; X64-NEXT: .LBB8_2: # %atomicrmw.end507; X64-NEXT: retq508;509; I486-LABEL: atomic_fetch_umax64:510; I486: # %bb.0:511; I486-NEXT: pushl %ebp512; I486-NEXT: movl %esp, %ebp513; I486-NEXT: pushl %esi514; I486-NEXT: andl $-8, %esp515; I486-NEXT: subl $72, %esp516; I486-NEXT: movl 12(%ebp), %eax517; I486-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill518; I486-NEXT: movl 8(%ebp), %eax519; I486-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill520; I486-NEXT: movl sc64+4, %eax521; I486-NEXT: movl sc64, %ecx522; I486-NEXT: movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill523; I486-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill524; I486-NEXT: jmp .LBB8_1525; I486-NEXT: .LBB8_1: # %atomicrmw.start526; I486-NEXT: # =>This Inner Loop Header: Depth=1527; I486-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %edx # 4-byte Reload528; I486-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %esi # 4-byte Reload529; I486-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload530; I486-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 4-byte Reload531; I486-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill532; I486-NEXT: movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill533; I486-NEXT: subl %ecx, %esi534; I486-NEXT: sbbl %eax, %edx535; I486-NEXT: movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill536; I486-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill537; I486-NEXT: jb .LBB8_4538; I486-NEXT: # %bb.3: # %atomicrmw.start539; I486-NEXT: # in Loop: Header=BB8_1 Depth=1540; I486-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 4-byte Reload541; I486-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload542; I486-NEXT: movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill543; I486-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill544; I486-NEXT: .LBB8_4: # %atomicrmw.start545; I486-NEXT: # in Loop: Header=BB8_1 Depth=1546; I486-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 4-byte Reload547; I486-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %esi # 4-byte Reload548; I486-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload549; I486-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %edx # 4-byte Reload550; I486-NEXT: movl %esi, {{[0-9]+}}(%esp)551; I486-NEXT: movl %eax, {{[0-9]+}}(%esp)552; I486-NEXT: movl %esp, %eax553; I486-NEXT: movl %edx, 12(%eax)554; I486-NEXT: movl %ecx, 8(%eax)555; I486-NEXT: leal {{[0-9]+}}(%esp), %ecx556; I486-NEXT: movl %ecx, 4(%eax)557; I486-NEXT: movl $2, 20(%eax)558; I486-NEXT: movl $2, 16(%eax)559; I486-NEXT: movl $sc64, (%eax)560; I486-NEXT: calll __atomic_compare_exchange_8@PLT561; I486-NEXT: movb %al, %dl562; I486-NEXT: movl {{[0-9]+}}(%esp), %ecx563; I486-NEXT: movl {{[0-9]+}}(%esp), %eax564; I486-NEXT: testb %dl, %dl565; I486-NEXT: movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill566; I486-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill567; I486-NEXT: je .LBB8_1568; I486-NEXT: jmp .LBB8_2569; I486-NEXT: .LBB8_2: # %atomicrmw.end570; I486-NEXT: leal -4(%ebp), %esp571; I486-NEXT: popl %esi572; I486-NEXT: popl %ebp573; I486-NEXT: retl574 %t1 = atomicrmw umax ptr @sc64, i64 %x acquire575 576 ret void577}578 579define void @atomic_fetch_umin64(i64 %x) nounwind {580; X64-LABEL: atomic_fetch_umin64:581; X64: # %bb.0:582; X64-NEXT: movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill583; X64-NEXT: movq sc64, %rax584; X64-NEXT: movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill585; X64-NEXT: .LBB9_1: # %atomicrmw.start586; X64-NEXT: # =>This Inner Loop Header: Depth=1587; X64-NEXT: movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload588; X64-NEXT: movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload589; X64-NEXT: movq %rax, %rdx590; X64-NEXT: subq %rcx, %rdx591; X64-NEXT: cmovbeq %rax, %rcx592; X64-NEXT: lock cmpxchgq %rcx, sc64(%rip)593; X64-NEXT: sete %cl594; X64-NEXT: testb $1, %cl595; X64-NEXT: movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill596; X64-NEXT: jne .LBB9_2597; X64-NEXT: jmp .LBB9_1598; X64-NEXT: .LBB9_2: # %atomicrmw.end599; X64-NEXT: retq600;601; I486-LABEL: atomic_fetch_umin64:602; I486: # %bb.0:603; I486-NEXT: pushl %ebp604; I486-NEXT: movl %esp, %ebp605; I486-NEXT: pushl %esi606; I486-NEXT: andl $-8, %esp607; I486-NEXT: subl $72, %esp608; I486-NEXT: movl 12(%ebp), %eax609; I486-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill610; I486-NEXT: movl 8(%ebp), %eax611; I486-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill612; I486-NEXT: movl sc64+4, %eax613; I486-NEXT: movl sc64, %ecx614; I486-NEXT: movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill615; I486-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill616; I486-NEXT: jmp .LBB9_1617; I486-NEXT: .LBB9_1: # %atomicrmw.start618; I486-NEXT: # =>This Inner Loop Header: Depth=1619; I486-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %edx # 4-byte Reload620; I486-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %esi # 4-byte Reload621; I486-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload622; I486-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 4-byte Reload623; I486-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill624; I486-NEXT: movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill625; I486-NEXT: subl %ecx, %esi626; I486-NEXT: sbbl %eax, %edx627; I486-NEXT: movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill628; I486-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill629; I486-NEXT: jae .LBB9_4630; I486-NEXT: # %bb.3: # %atomicrmw.start631; I486-NEXT: # in Loop: Header=BB9_1 Depth=1632; I486-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 4-byte Reload633; I486-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload634; I486-NEXT: movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill635; I486-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill636; I486-NEXT: .LBB9_4: # %atomicrmw.start637; I486-NEXT: # in Loop: Header=BB9_1 Depth=1638; I486-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 4-byte Reload639; I486-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %esi # 4-byte Reload640; I486-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload641; I486-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %edx # 4-byte Reload642; I486-NEXT: movl %esi, {{[0-9]+}}(%esp)643; I486-NEXT: movl %eax, {{[0-9]+}}(%esp)644; I486-NEXT: movl %esp, %eax645; I486-NEXT: movl %edx, 12(%eax)646; I486-NEXT: movl %ecx, 8(%eax)647; I486-NEXT: leal {{[0-9]+}}(%esp), %ecx648; I486-NEXT: movl %ecx, 4(%eax)649; I486-NEXT: movl $2, 20(%eax)650; I486-NEXT: movl $2, 16(%eax)651; I486-NEXT: movl $sc64, (%eax)652; I486-NEXT: calll __atomic_compare_exchange_8@PLT653; I486-NEXT: movb %al, %dl654; I486-NEXT: movl {{[0-9]+}}(%esp), %ecx655; I486-NEXT: movl {{[0-9]+}}(%esp), %eax656; I486-NEXT: testb %dl, %dl657; I486-NEXT: movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill658; I486-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill659; I486-NEXT: je .LBB9_1660; I486-NEXT: jmp .LBB9_2661; I486-NEXT: .LBB9_2: # %atomicrmw.end662; I486-NEXT: leal -4(%ebp), %esp663; I486-NEXT: popl %esi664; I486-NEXT: popl %ebp665; I486-NEXT: retl666 %t1 = atomicrmw umin ptr @sc64, i64 %x acquire667 668 ret void669}670 671define void @atomic_fetch_cmpxchg64() nounwind {672; X64-LABEL: atomic_fetch_cmpxchg64:673; X64: # %bb.0:674; X64-NEXT: xorl %eax, %eax675; X64-NEXT: # kill: def $rax killed $eax676; X64-NEXT: movl $1, %ecx677; X64-NEXT: lock cmpxchgq %rcx, sc64(%rip)678; X64-NEXT: retq679;680; I486-LABEL: atomic_fetch_cmpxchg64:681; I486: # %bb.0:682; I486-NEXT: pushl %ebp683; I486-NEXT: movl %esp, %ebp684; I486-NEXT: andl $-8, %esp685; I486-NEXT: subl $32, %esp686; I486-NEXT: movl $0, {{[0-9]+}}(%esp)687; I486-NEXT: movl $0, {{[0-9]+}}(%esp)688; I486-NEXT: movl %esp, %eax689; I486-NEXT: leal {{[0-9]+}}(%esp), %ecx690; I486-NEXT: movl %ecx, 4(%eax)691; I486-NEXT: movl $2, 20(%eax)692; I486-NEXT: movl $2, 16(%eax)693; I486-NEXT: movl $0, 12(%eax)694; I486-NEXT: movl $1, 8(%eax)695; I486-NEXT: movl $sc64, (%eax)696; I486-NEXT: calll __atomic_compare_exchange_8@PLT697; I486-NEXT: movl %ebp, %esp698; I486-NEXT: popl %ebp699; I486-NEXT: retl700 %t1 = cmpxchg ptr @sc64, i64 0, i64 1 acquire acquire701 ret void702}703 704define void @atomic_fetch_store64(i64 %x) nounwind {705; X64-LABEL: atomic_fetch_store64:706; X64: # %bb.0:707; X64-NEXT: movq %rdi, sc64(%rip)708; X64-NEXT: retq709;710; I486-LABEL: atomic_fetch_store64:711; I486: # %bb.0:712; I486-NEXT: subl $16, %esp713; I486-NEXT: movl {{[0-9]+}}(%esp), %edx714; I486-NEXT: movl {{[0-9]+}}(%esp), %ecx715; I486-NEXT: movl %esp, %eax716; I486-NEXT: movl %edx, 8(%eax)717; I486-NEXT: movl %ecx, 4(%eax)718; I486-NEXT: movl $3, 12(%eax)719; I486-NEXT: movl $sc64, (%eax)720; I486-NEXT: calll __atomic_store_8@PLT721; I486-NEXT: addl $16, %esp722; I486-NEXT: retl723 store atomic i64 %x, ptr @sc64 release, align 8724 ret void725}726 727define void @atomic_fetch_swap64(i64 %x) nounwind {728; X64-LABEL: atomic_fetch_swap64:729; X64: # %bb.0:730; X64-NEXT: xchgq %rdi, sc64(%rip)731; X64-NEXT: retq732;733; I486-LABEL: atomic_fetch_swap64:734; I486: # %bb.0:735; I486-NEXT: subl $16, %esp736; I486-NEXT: movl {{[0-9]+}}(%esp), %edx737; I486-NEXT: movl {{[0-9]+}}(%esp), %ecx738; I486-NEXT: movl %esp, %eax739; I486-NEXT: movl %edx, 8(%eax)740; I486-NEXT: movl %ecx, 4(%eax)741; I486-NEXT: movl $2, 12(%eax)742; I486-NEXT: movl $sc64, (%eax)743; I486-NEXT: calll __atomic_exchange_8@PLT744; I486-NEXT: addl $16, %esp745; I486-NEXT: retl746 %t1 = atomicrmw xchg ptr @sc64, i64 %x acquire747 ret void748}749 750define void @atomic_fetch_swapf64(double %x) nounwind {751; X64-LABEL: atomic_fetch_swapf64:752; X64: # %bb.0:753; X64-NEXT: movq %xmm0, %rax754; X64-NEXT: xchgq %rax, fsc64(%rip)755; X64-NEXT: retq756;757; I486-LABEL: atomic_fetch_swapf64:758; I486: # %bb.0:759; I486-NEXT: pushl %ebp760; I486-NEXT: movl %esp, %ebp761; I486-NEXT: andl $-8, %esp762; I486-NEXT: subl $24, %esp763; I486-NEXT: fldl 8(%ebp)764; I486-NEXT: fstpl {{[0-9]+}}(%esp)765; I486-NEXT: movl {{[0-9]+}}(%esp), %ecx766; I486-NEXT: movl {{[0-9]+}}(%esp), %edx767; I486-NEXT: movl %esp, %eax768; I486-NEXT: movl %edx, 8(%eax)769; I486-NEXT: movl %ecx, 4(%eax)770; I486-NEXT: movl $2, 12(%eax)771; I486-NEXT: movl $fsc64, (%eax)772; I486-NEXT: calll __atomic_exchange_8@PLT773; I486-NEXT: movl %ebp, %esp774; I486-NEXT: popl %ebp775; I486-NEXT: retl776 %t1 = atomicrmw xchg ptr @fsc64, double %x acquire777 ret void778}779 780define void @atomic_fetch_swapptr(ptr %x) nounwind {781; X64-LABEL: atomic_fetch_swapptr:782; X64: # %bb.0:783; X64-NEXT: xchgq %rdi, psc64(%rip)784; X64-NEXT: retq785;786; I486-LABEL: atomic_fetch_swapptr:787; I486: # %bb.0:788; I486-NEXT: movl {{[0-9]+}}(%esp), %eax789; I486-NEXT: xchgl %eax, psc64790; I486-NEXT: retl791 %t1 = atomicrmw xchg ptr @psc64, ptr %x acquire792 ret void793}794