7017 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc -mtriple=i686-unknown-linux-gnu < %s | FileCheck %s --check-prefixes=X863; RUN: llc -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s --check-prefixes=X644 5define zeroext i8 @atomic_shl1_or_8_gpr_val(ptr %v, i8 zeroext %c) nounwind {6; X86-LABEL: atomic_shl1_or_8_gpr_val:7; X86: # %bb.0: # %entry8; X86-NEXT: pushl %esi9; X86-NEXT: movl {{[0-9]+}}(%esp), %esi10; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx11; X86-NEXT: movl $1, %edx12; X86-NEXT: shll %cl, %edx13; X86-NEXT: movzbl (%esi), %eax14; X86-NEXT: .p2align 415; X86-NEXT: .LBB0_1: # %atomicrmw.start16; X86-NEXT: # =>This Inner Loop Header: Depth=117; X86-NEXT: movl %eax, %ecx18; X86-NEXT: orb %dl, %cl19; X86-NEXT: lock cmpxchgb %cl, (%esi)20; X86-NEXT: jne .LBB0_121; X86-NEXT: # %bb.2: # %atomicrmw.end22; X86-NEXT: andb %al, %dl23; X86-NEXT: movl %edx, %eax24; X86-NEXT: popl %esi25; X86-NEXT: retl26;27; X64-LABEL: atomic_shl1_or_8_gpr_val:28; X64: # %bb.0: # %entry29; X64-NEXT: movl %esi, %ecx30; X64-NEXT: movl $1, %edx31; X64-NEXT: # kill: def $cl killed $cl killed $ecx32; X64-NEXT: shll %cl, %edx33; X64-NEXT: movzbl (%rdi), %eax34; X64-NEXT: .p2align 435; X64-NEXT: .LBB0_1: # %atomicrmw.start36; X64-NEXT: # =>This Inner Loop Header: Depth=137; X64-NEXT: movl %eax, %ecx38; X64-NEXT: orb %dl, %cl39; X64-NEXT: lock cmpxchgb %cl, (%rdi)40; X64-NEXT: jne .LBB0_141; X64-NEXT: # %bb.2: # %atomicrmw.end42; X64-NEXT: andb %al, %dl43; X64-NEXT: movl %edx, %eax44; X64-NEXT: retq45entry:46 %conv = zext i8 %c to i3247 %shl = shl nuw i32 1, %conv48 %conv1 = trunc i32 %shl to i849 %0 = atomicrmw or ptr %v, i8 %conv1 monotonic, align 150 %conv5 = and i8 %conv1, %051 ret i8 %conv552}53 54define zeroext i8 @atomic_shl1_mask0_or_8_gpr_val(ptr %v, i8 zeroext %c) nounwind {55; X86-LABEL: atomic_shl1_mask0_or_8_gpr_val:56; X86: # %bb.0: # %entry57; X86-NEXT: pushl %ebx58; X86-NEXT: pushl %esi59; X86-NEXT: movzbl {{[0-9]+}}(%esp), %edx60; X86-NEXT: movl {{[0-9]+}}(%esp), %esi61; X86-NEXT: movl %edx, %ecx62; X86-NEXT: andb $7, %cl63; X86-NEXT: movb $1, %ah64; X86-NEXT: shlb %cl, %ah65; X86-NEXT: movb (%esi), %al66; X86-NEXT: .p2align 467; X86-NEXT: .LBB1_1: # %atomicrmw.start68; X86-NEXT: # =>This Inner Loop Header: Depth=169; X86-NEXT: movl %eax, %ecx70; X86-NEXT: orb %ah, %cl71; X86-NEXT: lock cmpxchgb %cl, (%esi)72; X86-NEXT: jne .LBB1_173; X86-NEXT: # %bb.2: # %atomicrmw.end74; X86-NEXT: movl $1, %ebx75; X86-NEXT: movl %edx, %ecx76; X86-NEXT: shll %cl, %ebx77; X86-NEXT: andb %bl, %al78; X86-NEXT: popl %esi79; X86-NEXT: popl %ebx80; X86-NEXT: retl81;82; X64-LABEL: atomic_shl1_mask0_or_8_gpr_val:83; X64: # %bb.0: # %entry84; X64-NEXT: movl %esi, %ecx85; X64-NEXT: andb $7, %cl86; X64-NEXT: movb $1, %dl87; X64-NEXT: shlb %cl, %dl88; X64-NEXT: movzbl (%rdi), %eax89; X64-NEXT: .p2align 490; X64-NEXT: .LBB1_1: # %atomicrmw.start91; X64-NEXT: # =>This Inner Loop Header: Depth=192; X64-NEXT: movl %eax, %ecx93; X64-NEXT: orb %dl, %cl94; X64-NEXT: lock cmpxchgb %cl, (%rdi)95; X64-NEXT: jne .LBB1_196; X64-NEXT: # %bb.2: # %atomicrmw.end97; X64-NEXT: movl $1, %edx98; X64-NEXT: movl %esi, %ecx99; X64-NEXT: shll %cl, %edx100; X64-NEXT: andb %dl, %al101; X64-NEXT: retq102entry:103 %0 = and i8 %c, 7104 %shl = shl nuw i8 1, %0105 %1 = atomicrmw or ptr %v, i8 %shl monotonic, align 1106 %conv3 = zext i8 %c to i32107 %shl4 = shl nuw i32 1, %conv3108 %2 = trunc i32 %shl4 to i8109 %conv5 = and i8 %1, %2110 ret i8 %conv5111}112 113define zeroext i8 @atomic_shl1_mask01_or_8_gpr_val(ptr %v, i8 zeroext %c) nounwind {114; X86-LABEL: atomic_shl1_mask01_or_8_gpr_val:115; X86: # %bb.0: # %entry116; X86-NEXT: pushl %esi117; X86-NEXT: movl {{[0-9]+}}(%esp), %esi118; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx119; X86-NEXT: andb $7, %cl120; X86-NEXT: movb $1, %dl121; X86-NEXT: shlb %cl, %dl122; X86-NEXT: movzbl (%esi), %eax123; X86-NEXT: .p2align 4124; X86-NEXT: .LBB2_1: # %atomicrmw.start125; X86-NEXT: # =>This Inner Loop Header: Depth=1126; X86-NEXT: movl %eax, %ecx127; X86-NEXT: orb %dl, %cl128; X86-NEXT: lock cmpxchgb %cl, (%esi)129; X86-NEXT: jne .LBB2_1130; X86-NEXT: # %bb.2: # %atomicrmw.end131; X86-NEXT: andb %al, %dl132; X86-NEXT: movl %edx, %eax133; X86-NEXT: popl %esi134; X86-NEXT: retl135;136; X64-LABEL: atomic_shl1_mask01_or_8_gpr_val:137; X64: # %bb.0: # %entry138; X64-NEXT: movl %esi, %ecx139; X64-NEXT: andb $7, %cl140; X64-NEXT: movb $1, %dl141; X64-NEXT: # kill: def $cl killed $cl killed $ecx142; X64-NEXT: shlb %cl, %dl143; X64-NEXT: movzbl (%rdi), %eax144; X64-NEXT: .p2align 4145; X64-NEXT: .LBB2_1: # %atomicrmw.start146; X64-NEXT: # =>This Inner Loop Header: Depth=1147; X64-NEXT: movl %eax, %ecx148; X64-NEXT: orb %dl, %cl149; X64-NEXT: lock cmpxchgb %cl, (%rdi)150; X64-NEXT: jne .LBB2_1151; X64-NEXT: # %bb.2: # %atomicrmw.end152; X64-NEXT: andb %al, %dl153; X64-NEXT: movl %edx, %eax154; X64-NEXT: retq155entry:156 %0 = and i8 %c, 7157 %shl = shl nuw i8 1, %0158 %1 = atomicrmw or ptr %v, i8 %shl monotonic, align 1159 %conv7 = and i8 %shl, %1160 ret i8 %conv7161}162 163define zeroext i8 @atomic_shl1_xor_8_gpr_valz(ptr %v, i8 zeroext %c) nounwind {164; X86-LABEL: atomic_shl1_xor_8_gpr_valz:165; X86: # %bb.0: # %entry166; X86-NEXT: pushl %esi167; X86-NEXT: movl {{[0-9]+}}(%esp), %esi168; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx169; X86-NEXT: movl $1, %edx170; X86-NEXT: shll %cl, %edx171; X86-NEXT: movzbl (%esi), %eax172; X86-NEXT: .p2align 4173; X86-NEXT: .LBB3_1: # %atomicrmw.start174; X86-NEXT: # =>This Inner Loop Header: Depth=1175; X86-NEXT: movl %eax, %ecx176; X86-NEXT: xorb %dl, %cl177; X86-NEXT: lock cmpxchgb %cl, (%esi)178; X86-NEXT: jne .LBB3_1179; X86-NEXT: # %bb.2: # %atomicrmw.end180; X86-NEXT: movzbl %al, %eax181; X86-NEXT: testl %eax, %edx182; X86-NEXT: sete %al183; X86-NEXT: popl %esi184; X86-NEXT: retl185;186; X64-LABEL: atomic_shl1_xor_8_gpr_valz:187; X64: # %bb.0: # %entry188; X64-NEXT: movl %esi, %ecx189; X64-NEXT: movl $1, %edx190; X64-NEXT: # kill: def $cl killed $cl killed $ecx191; X64-NEXT: shll %cl, %edx192; X64-NEXT: movzbl (%rdi), %eax193; X64-NEXT: .p2align 4194; X64-NEXT: .LBB3_1: # %atomicrmw.start195; X64-NEXT: # =>This Inner Loop Header: Depth=1196; X64-NEXT: movl %eax, %ecx197; X64-NEXT: xorb %dl, %cl198; X64-NEXT: lock cmpxchgb %cl, (%rdi)199; X64-NEXT: jne .LBB3_1200; X64-NEXT: # %bb.2: # %atomicrmw.end201; X64-NEXT: movzbl %al, %eax202; X64-NEXT: testl %eax, %edx203; X64-NEXT: sete %al204; X64-NEXT: retq205entry:206 %conv = zext i8 %c to i32207 %shl = shl nuw i32 1, %conv208 %conv1 = trunc i32 %shl to i8209 %0 = atomicrmw xor ptr %v, i8 %conv1 monotonic, align 1210 %conv2 = zext i8 %0 to i32211 %and = and i32 %shl, %conv2212 %tobool.not = icmp eq i32 %and, 0213 %conv5 = zext i1 %tobool.not to i8214 ret i8 %conv5215}216 217define zeroext i8 @atomic_shl1_mask0_xor_8_gpr_valz(ptr %v, i8 zeroext %c) nounwind {218; X86-LABEL: atomic_shl1_mask0_xor_8_gpr_valz:219; X86: # %bb.0: # %entry220; X86-NEXT: pushl %esi221; X86-NEXT: movzbl {{[0-9]+}}(%esp), %edx222; X86-NEXT: movl {{[0-9]+}}(%esp), %esi223; X86-NEXT: movl %edx, %ecx224; X86-NEXT: andb $7, %cl225; X86-NEXT: movb $1, %ah226; X86-NEXT: shlb %cl, %ah227; X86-NEXT: movb (%esi), %al228; X86-NEXT: .p2align 4229; X86-NEXT: .LBB4_1: # %atomicrmw.start230; X86-NEXT: # =>This Inner Loop Header: Depth=1231; X86-NEXT: movl %eax, %ecx232; X86-NEXT: xorb %ah, %cl233; X86-NEXT: lock cmpxchgb %cl, (%esi)234; X86-NEXT: jne .LBB4_1235; X86-NEXT: # %bb.2: # %atomicrmw.end236; X86-NEXT: movzbl %al, %eax237; X86-NEXT: movzbl %dl, %ecx238; X86-NEXT: btl %ecx, %eax239; X86-NEXT: setae %al240; X86-NEXT: popl %esi241; X86-NEXT: retl242;243; X64-LABEL: atomic_shl1_mask0_xor_8_gpr_valz:244; X64: # %bb.0: # %entry245; X64-NEXT: movl %esi, %ecx246; X64-NEXT: andb $7, %cl247; X64-NEXT: movb $1, %dl248; X64-NEXT: shlb %cl, %dl249; X64-NEXT: movzbl (%rdi), %eax250; X64-NEXT: .p2align 4251; X64-NEXT: .LBB4_1: # %atomicrmw.start252; X64-NEXT: # =>This Inner Loop Header: Depth=1253; X64-NEXT: movl %eax, %ecx254; X64-NEXT: xorb %dl, %cl255; X64-NEXT: lock cmpxchgb %cl, (%rdi)256; X64-NEXT: jne .LBB4_1257; X64-NEXT: # %bb.2: # %atomicrmw.end258; X64-NEXT: movzbl %al, %eax259; X64-NEXT: movzbl %sil, %ecx260; X64-NEXT: btl %ecx, %eax261; X64-NEXT: setae %al262; X64-NEXT: retq263entry:264 %0 = and i8 %c, 7265 %shl = shl nuw i8 1, %0266 %1 = atomicrmw xor ptr %v, i8 %shl monotonic, align 1267 %conv2 = zext i8 %1 to i32268 %conv3 = zext i8 %c to i32269 %shl4 = shl nuw i32 1, %conv3270 %and = and i32 %shl4, %conv2271 %tobool.not = icmp eq i32 %and, 0272 %conv5 = zext i1 %tobool.not to i8273 ret i8 %conv5274}275 276define zeroext i8 @atomic_shl1_mask01_xor_8_gpr_valz(ptr %v, i8 zeroext %c) nounwind {277; X86-LABEL: atomic_shl1_mask01_xor_8_gpr_valz:278; X86: # %bb.0: # %entry279; X86-NEXT: pushl %ebx280; X86-NEXT: movl {{[0-9]+}}(%esp), %edx281; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx282; X86-NEXT: andb $7, %cl283; X86-NEXT: movl $1, %ebx284; X86-NEXT: shll %cl, %ebx285; X86-NEXT: movzbl (%edx), %eax286; X86-NEXT: .p2align 4287; X86-NEXT: .LBB5_1: # %atomicrmw.start288; X86-NEXT: # =>This Inner Loop Header: Depth=1289; X86-NEXT: movl %eax, %ecx290; X86-NEXT: xorb %bl, %cl291; X86-NEXT: lock cmpxchgb %cl, (%edx)292; X86-NEXT: jne .LBB5_1293; X86-NEXT: # %bb.2: # %atomicrmw.end294; X86-NEXT: movzbl %al, %eax295; X86-NEXT: testl %eax, %ebx296; X86-NEXT: sete %al297; X86-NEXT: popl %ebx298; X86-NEXT: retl299;300; X64-LABEL: atomic_shl1_mask01_xor_8_gpr_valz:301; X64: # %bb.0: # %entry302; X64-NEXT: movl %esi, %ecx303; X64-NEXT: andb $7, %cl304; X64-NEXT: movl $1, %edx305; X64-NEXT: # kill: def $cl killed $cl killed $ecx306; X64-NEXT: shll %cl, %edx307; X64-NEXT: movzbl (%rdi), %eax308; X64-NEXT: .p2align 4309; X64-NEXT: .LBB5_1: # %atomicrmw.start310; X64-NEXT: # =>This Inner Loop Header: Depth=1311; X64-NEXT: movl %eax, %ecx312; X64-NEXT: xorb %dl, %cl313; X64-NEXT: lock cmpxchgb %cl, (%rdi)314; X64-NEXT: jne .LBB5_1315; X64-NEXT: # %bb.2: # %atomicrmw.end316; X64-NEXT: movzbl %al, %eax317; X64-NEXT: testl %eax, %edx318; X64-NEXT: sete %al319; X64-NEXT: retq320entry:321 %0 = and i8 %c, 7322 %sh_prom = zext i8 %0 to i32323 %shl = shl nuw nsw i32 1, %sh_prom324 %conv1 = trunc i32 %shl to i8325 %1 = atomicrmw xor ptr %v, i8 %conv1 monotonic, align 1326 %conv2 = zext i8 %1 to i32327 %and = and i32 %shl, %conv2328 %tobool.not = icmp eq i32 %and, 0329 %conv7 = zext i1 %tobool.not to i8330 ret i8 %conv7331}332 333define zeroext i8 @atomic_shl1_and_8_gpr_brnz(ptr %v, i8 zeroext %c) nounwind {334; X86-LABEL: atomic_shl1_and_8_gpr_brnz:335; X86: # %bb.0: # %entry336; X86-NEXT: pushl %ebx337; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx338; X86-NEXT: movl {{[0-9]+}}(%esp), %edx339; X86-NEXT: movl $1, %ebx340; X86-NEXT: shll %cl, %ebx341; X86-NEXT: movb %bl, %ah342; X86-NEXT: notb %ah343; X86-NEXT: movb (%edx), %al344; X86-NEXT: .p2align 4345; X86-NEXT: .LBB6_1: # %atomicrmw.start346; X86-NEXT: # =>This Inner Loop Header: Depth=1347; X86-NEXT: movb %al, %ch348; X86-NEXT: andb %ah, %ch349; X86-NEXT: lock cmpxchgb %ch, (%edx)350; X86-NEXT: jne .LBB6_1351; X86-NEXT: # %bb.2: # %atomicrmw.end352; X86-NEXT: movzbl %al, %eax353; X86-NEXT: testl %eax, %ebx354; X86-NEXT: je .LBB6_3355; X86-NEXT: # %bb.4: # %if.then356; X86-NEXT: movzbl %cl, %eax357; X86-NEXT: movzbl (%edx,%eax), %eax358; X86-NEXT: popl %ebx359; X86-NEXT: retl360; X86-NEXT: .LBB6_3:361; X86-NEXT: movb $123, %al362; X86-NEXT: popl %ebx363; X86-NEXT: retl364;365; X64-LABEL: atomic_shl1_and_8_gpr_brnz:366; X64: # %bb.0: # %entry367; X64-NEXT: movl %esi, %ecx368; X64-NEXT: movl $1, %edx369; X64-NEXT: shll %cl, %edx370; X64-NEXT: movl %edx, %esi371; X64-NEXT: notb %sil372; X64-NEXT: movzbl (%rdi), %eax373; X64-NEXT: .p2align 4374; X64-NEXT: .LBB6_1: # %atomicrmw.start375; X64-NEXT: # =>This Inner Loop Header: Depth=1376; X64-NEXT: movl %eax, %r8d377; X64-NEXT: andb %sil, %r8b378; X64-NEXT: lock cmpxchgb %r8b, (%rdi)379; X64-NEXT: jne .LBB6_1380; X64-NEXT: # %bb.2: # %atomicrmw.end381; X64-NEXT: movzbl %al, %eax382; X64-NEXT: testl %eax, %edx383; X64-NEXT: je .LBB6_3384; X64-NEXT: # %bb.4: # %if.then385; X64-NEXT: movzbl %cl, %eax386; X64-NEXT: movzbl (%rdi,%rax), %eax387; X64-NEXT: retq388; X64-NEXT: .LBB6_3:389; X64-NEXT: movb $123, %al390; X64-NEXT: retq391entry:392 %conv = zext i8 %c to i32393 %shl = shl nuw i32 1, %conv394 %0 = trunc i32 %shl to i8395 %conv1 = xor i8 %0, -1396 %1 = atomicrmw and ptr %v, i8 %conv1 monotonic, align 1397 %conv2 = zext i8 %1 to i32398 %and = and i32 %shl, %conv2399 %tobool.not = icmp eq i32 %and, 0400 br i1 %tobool.not, label %return, label %if.then401 402if.then: ; preds = %entry403 %idxprom = zext i8 %c to i64404 %arrayidx = getelementptr inbounds i8, ptr %v, i64 %idxprom405 %2 = load i8, ptr %arrayidx, align 1406 br label %return407 408return: ; preds = %entry, %if.then409 %retval.0 = phi i8 [ %2, %if.then ], [ 123, %entry ]410 ret i8 %retval.0411}412 413define zeroext i8 @atomic_shl1_mask0_and_8_gpr_brnz(ptr %v, i8 zeroext %c) nounwind {414; X86-LABEL: atomic_shl1_mask0_and_8_gpr_brnz:415; X86: # %bb.0: # %entry416; X86-NEXT: pushl %esi417; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx418; X86-NEXT: movl {{[0-9]+}}(%esp), %edx419; X86-NEXT: movb $-2, %ah420; X86-NEXT: rolb %cl, %ah421; X86-NEXT: movb (%edx), %al422; X86-NEXT: .p2align 4423; X86-NEXT: .LBB7_1: # %atomicrmw.start424; X86-NEXT: # =>This Inner Loop Header: Depth=1425; X86-NEXT: movb %al, %ch426; X86-NEXT: andb %ah, %ch427; X86-NEXT: lock cmpxchgb %ch, (%edx)428; X86-NEXT: jne .LBB7_1429; X86-NEXT: # %bb.2: # %atomicrmw.end430; X86-NEXT: movzbl %al, %esi431; X86-NEXT: movzbl %cl, %eax432; X86-NEXT: btl %eax, %esi433; X86-NEXT: jae .LBB7_3434; X86-NEXT: # %bb.4: # %if.then435; X86-NEXT: movzbl (%edx,%eax), %eax436; X86-NEXT: popl %esi437; X86-NEXT: retl438; X86-NEXT: .LBB7_3:439; X86-NEXT: movb $123, %al440; X86-NEXT: popl %esi441; X86-NEXT: retl442;443; X64-LABEL: atomic_shl1_mask0_and_8_gpr_brnz:444; X64: # %bb.0: # %entry445; X64-NEXT: movl %esi, %ecx446; X64-NEXT: movb $-2, %dl447; X64-NEXT: rolb %cl, %dl448; X64-NEXT: movzbl (%rdi), %eax449; X64-NEXT: .p2align 4450; X64-NEXT: .LBB7_1: # %atomicrmw.start451; X64-NEXT: # =>This Inner Loop Header: Depth=1452; X64-NEXT: movl %eax, %esi453; X64-NEXT: andb %dl, %sil454; X64-NEXT: lock cmpxchgb %sil, (%rdi)455; X64-NEXT: jne .LBB7_1456; X64-NEXT: # %bb.2: # %atomicrmw.end457; X64-NEXT: movzbl %al, %edx458; X64-NEXT: movzbl %cl, %eax459; X64-NEXT: btl %eax, %edx460; X64-NEXT: jae .LBB7_3461; X64-NEXT: # %bb.4: # %if.then462; X64-NEXT: movzbl (%rdi,%rax), %eax463; X64-NEXT: retq464; X64-NEXT: .LBB7_3:465; X64-NEXT: movb $123, %al466; X64-NEXT: retq467entry:468 %0 = and i8 %c, 7469 %shl = shl nuw i8 1, %0470 %not = xor i8 %shl, -1471 %1 = atomicrmw and ptr %v, i8 %not monotonic, align 1472 %conv2 = zext i8 %1 to i32473 %conv3 = zext i8 %c to i32474 %shl4 = shl nuw i32 1, %conv3475 %and = and i32 %shl4, %conv2476 %tobool.not = icmp eq i32 %and, 0477 br i1 %tobool.not, label %return, label %if.then478 479if.then: ; preds = %entry480 %conv = zext i8 %c to i64481 %arrayidx = getelementptr inbounds i8, ptr %v, i64 %conv482 %2 = load i8, ptr %arrayidx, align 1483 br label %return484 485return: ; preds = %entry, %if.then486 %retval.0 = phi i8 [ %2, %if.then ], [ 123, %entry ]487 ret i8 %retval.0488}489 490define zeroext i8 @atomic_shl1_mask01_and_8_gpr_brnz(ptr %v, i8 zeroext %c) nounwind {491; X86-LABEL: atomic_shl1_mask01_and_8_gpr_brnz:492; X86: # %bb.0: # %entry493; X86-NEXT: pushl %ebx494; X86-NEXT: movb {{[0-9]+}}(%esp), %ah495; X86-NEXT: movl {{[0-9]+}}(%esp), %edx496; X86-NEXT: movb %ah, %cl497; X86-NEXT: andb $7, %cl498; X86-NEXT: movl $1, %ebx499; X86-NEXT: shll %cl, %ebx500; X86-NEXT: movl %ebx, %ecx501; X86-NEXT: notb %cl502; X86-NEXT: movb (%edx), %al503; X86-NEXT: .p2align 4504; X86-NEXT: .LBB8_1: # %atomicrmw.start505; X86-NEXT: # =>This Inner Loop Header: Depth=1506; X86-NEXT: movb %al, %ch507; X86-NEXT: andb %cl, %ch508; X86-NEXT: lock cmpxchgb %ch, (%edx)509; X86-NEXT: jne .LBB8_1510; X86-NEXT: # %bb.2: # %atomicrmw.end511; X86-NEXT: movzbl %al, %ecx512; X86-NEXT: testl %ecx, %ebx513; X86-NEXT: je .LBB8_3514; X86-NEXT: # %bb.4: # %if.then515; X86-NEXT: movzbl %ah, %eax516; X86-NEXT: movzbl (%edx,%eax), %eax517; X86-NEXT: popl %ebx518; X86-NEXT: retl519; X86-NEXT: .LBB8_3:520; X86-NEXT: movb $123, %al521; X86-NEXT: popl %ebx522; X86-NEXT: retl523;524; X64-LABEL: atomic_shl1_mask01_and_8_gpr_brnz:525; X64: # %bb.0: # %entry526; X64-NEXT: movl %esi, %ecx527; X64-NEXT: andb $7, %cl528; X64-NEXT: movl $1, %edx529; X64-NEXT: shll %cl, %edx530; X64-NEXT: movl %edx, %ecx531; X64-NEXT: notb %cl532; X64-NEXT: movzbl (%rdi), %eax533; X64-NEXT: .p2align 4534; X64-NEXT: .LBB8_1: # %atomicrmw.start535; X64-NEXT: # =>This Inner Loop Header: Depth=1536; X64-NEXT: movl %eax, %r8d537; X64-NEXT: andb %cl, %r8b538; X64-NEXT: lock cmpxchgb %r8b, (%rdi)539; X64-NEXT: jne .LBB8_1540; X64-NEXT: # %bb.2: # %atomicrmw.end541; X64-NEXT: movzbl %al, %eax542; X64-NEXT: testl %eax, %edx543; X64-NEXT: je .LBB8_3544; X64-NEXT: # %bb.4: # %if.then545; X64-NEXT: movzbl %sil, %eax546; X64-NEXT: movzbl (%rdi,%rax), %eax547; X64-NEXT: retq548; X64-NEXT: .LBB8_3:549; X64-NEXT: movb $123, %al550; X64-NEXT: retq551entry:552 %0 = and i8 %c, 7553 %sh_prom = zext i8 %0 to i32554 %shl = shl nuw nsw i32 1, %sh_prom555 %1 = trunc i32 %shl to i8556 %conv1 = xor i8 %1, -1557 %2 = atomicrmw and ptr %v, i8 %conv1 monotonic, align 1558 %conv2 = zext i8 %2 to i32559 %and = and i32 %shl, %conv2560 %tobool.not = icmp eq i32 %and, 0561 br i1 %tobool.not, label %return, label %if.then562 563if.then: ; preds = %entry564 %conv = zext i8 %c to i64565 %arrayidx = getelementptr inbounds i8, ptr %v, i64 %conv566 %3 = load i8, ptr %arrayidx, align 1567 br label %return568 569return: ; preds = %entry, %if.then570 %retval.0 = phi i8 [ %3, %if.then ], [ 123, %entry ]571 ret i8 %retval.0572}573 574define zeroext i8 @atomic_shl1_and_8_gpr_val(ptr %v) nounwind {575; X86-LABEL: atomic_shl1_and_8_gpr_val:576; X86: # %bb.0: # %entry577; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx578; X86-NEXT: movzbl (%ecx), %eax579; X86-NEXT: .p2align 4580; X86-NEXT: .LBB9_1: # %atomicrmw.start581; X86-NEXT: # =>This Inner Loop Header: Depth=1582; X86-NEXT: movl %eax, %edx583; X86-NEXT: andb $-17, %dl584; X86-NEXT: lock cmpxchgb %dl, (%ecx)585; X86-NEXT: jne .LBB9_1586; X86-NEXT: # %bb.2: # %atomicrmw.end587; X86-NEXT: andb $16, %al588; X86-NEXT: retl589;590; X64-LABEL: atomic_shl1_and_8_gpr_val:591; X64: # %bb.0: # %entry592; X64-NEXT: movzbl (%rdi), %eax593; X64-NEXT: .p2align 4594; X64-NEXT: .LBB9_1: # %atomicrmw.start595; X64-NEXT: # =>This Inner Loop Header: Depth=1596; X64-NEXT: movl %eax, %ecx597; X64-NEXT: andb $-17, %cl598; X64-NEXT: lock cmpxchgb %cl, (%rdi)599; X64-NEXT: jne .LBB9_1600; X64-NEXT: # %bb.2: # %atomicrmw.end601; X64-NEXT: andb $16, %al602; X64-NEXT: retq603entry:604 %0 = atomicrmw and ptr %v, i8 -17 monotonic, align 1605 %1 = and i8 %0, 16606 ret i8 %1607}608 609define zeroext i8 @atomic_shl1_or_8_gpr_valnz(ptr %v) nounwind {610; X86-LABEL: atomic_shl1_or_8_gpr_valnz:611; X86: # %bb.0: # %entry612; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx613; X86-NEXT: movzbl (%ecx), %eax614; X86-NEXT: .p2align 4615; X86-NEXT: .LBB10_1: # %atomicrmw.start616; X86-NEXT: # =>This Inner Loop Header: Depth=1617; X86-NEXT: movl %eax, %edx618; X86-NEXT: orb $16, %dl619; X86-NEXT: lock cmpxchgb %dl, (%ecx)620; X86-NEXT: jne .LBB10_1621; X86-NEXT: # %bb.2: # %atomicrmw.end622; X86-NEXT: shrb $4, %al623; X86-NEXT: andb $1, %al624; X86-NEXT: retl625;626; X64-LABEL: atomic_shl1_or_8_gpr_valnz:627; X64: # %bb.0: # %entry628; X64-NEXT: movzbl (%rdi), %eax629; X64-NEXT: .p2align 4630; X64-NEXT: .LBB10_1: # %atomicrmw.start631; X64-NEXT: # =>This Inner Loop Header: Depth=1632; X64-NEXT: movl %eax, %ecx633; X64-NEXT: orb $16, %cl634; X64-NEXT: lock cmpxchgb %cl, (%rdi)635; X64-NEXT: jne .LBB10_1636; X64-NEXT: # %bb.2: # %atomicrmw.end637; X64-NEXT: shrb $4, %al638; X64-NEXT: andb $1, %al639; X64-NEXT: retq640entry:641 %0 = atomicrmw or ptr %v, i8 16 monotonic, align 1642 %1 = lshr i8 %0, 4643 %.lobit = and i8 %1, 1644 ret i8 %.lobit645}646 647define zeroext i8 @atomic_shl1_xor_8_gpr_brz(ptr %v) nounwind {648; X86-LABEL: atomic_shl1_xor_8_gpr_brz:649; X86: # %bb.0: # %entry650; X86-NEXT: movl {{[0-9]+}}(%esp), %edx651; X86-NEXT: movzbl (%edx), %eax652; X86-NEXT: .p2align 4653; X86-NEXT: .LBB11_1: # %atomicrmw.start654; X86-NEXT: # =>This Inner Loop Header: Depth=1655; X86-NEXT: movl %eax, %ecx656; X86-NEXT: xorb $16, %cl657; X86-NEXT: lock cmpxchgb %cl, (%edx)658; X86-NEXT: jne .LBB11_1659; X86-NEXT: # %bb.2: # %atomicrmw.end660; X86-NEXT: movb $123, %cl661; X86-NEXT: testb $16, %al662; X86-NEXT: jne .LBB11_4663; X86-NEXT: # %bb.3: # %if.then664; X86-NEXT: movzbl 4(%edx), %ecx665; X86-NEXT: .LBB11_4: # %return666; X86-NEXT: movl %ecx, %eax667; X86-NEXT: retl668;669; X64-LABEL: atomic_shl1_xor_8_gpr_brz:670; X64: # %bb.0: # %entry671; X64-NEXT: movzbl (%rdi), %eax672; X64-NEXT: .p2align 4673; X64-NEXT: .LBB11_1: # %atomicrmw.start674; X64-NEXT: # =>This Inner Loop Header: Depth=1675; X64-NEXT: movl %eax, %ecx676; X64-NEXT: xorb $16, %cl677; X64-NEXT: lock cmpxchgb %cl, (%rdi)678; X64-NEXT: jne .LBB11_1679; X64-NEXT: # %bb.2: # %atomicrmw.end680; X64-NEXT: movb $123, %cl681; X64-NEXT: testb $16, %al682; X64-NEXT: jne .LBB11_4683; X64-NEXT: # %bb.3: # %if.then684; X64-NEXT: movzbl 4(%rdi), %ecx685; X64-NEXT: .LBB11_4: # %return686; X64-NEXT: movl %ecx, %eax687; X64-NEXT: retq688entry:689 %0 = atomicrmw xor ptr %v, i8 16 monotonic, align 1690 %1 = and i8 %0, 16691 %tobool.not = icmp eq i8 %1, 0692 br i1 %tobool.not, label %if.then, label %return693 694if.then: ; preds = %entry695 %arrayidx = getelementptr inbounds i8, ptr %v, i64 4696 %2 = load i8, ptr %arrayidx, align 1697 br label %return698 699return: ; preds = %entry, %if.then700 %retval.0 = phi i8 [ %2, %if.then ], [ 123, %entry ]701 ret i8 %retval.0702}703 704define zeroext i16 @atomic_shl1_xor_16_gpr_val(ptr %v, i16 zeroext %c) nounwind {705; X86-LABEL: atomic_shl1_xor_16_gpr_val:706; X86: # %bb.0: # %entry707; X86-NEXT: pushl %esi708; X86-NEXT: movl {{[0-9]+}}(%esp), %esi709; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx710; X86-NEXT: movl $1, %edx711; X86-NEXT: shll %cl, %edx712; X86-NEXT: movzwl (%esi), %eax713; X86-NEXT: .p2align 4714; X86-NEXT: .LBB12_1: # %atomicrmw.start715; X86-NEXT: # =>This Inner Loop Header: Depth=1716; X86-NEXT: movl %eax, %ecx717; X86-NEXT: xorl %edx, %ecx718; X86-NEXT: # kill: def $ax killed $ax killed $eax719; X86-NEXT: lock cmpxchgw %cx, (%esi)720; X86-NEXT: # kill: def $ax killed $ax def $eax721; X86-NEXT: jne .LBB12_1722; X86-NEXT: # %bb.2: # %atomicrmw.end723; X86-NEXT: andl %edx, %eax724; X86-NEXT: # kill: def $ax killed $ax killed $eax725; X86-NEXT: popl %esi726; X86-NEXT: retl727;728; X64-LABEL: atomic_shl1_xor_16_gpr_val:729; X64: # %bb.0: # %entry730; X64-NEXT: movl %esi, %ecx731; X64-NEXT: movl $1, %edx732; X64-NEXT: # kill: def $cl killed $cl killed $ecx733; X64-NEXT: shll %cl, %edx734; X64-NEXT: movzwl (%rdi), %eax735; X64-NEXT: .p2align 4736; X64-NEXT: .LBB12_1: # %atomicrmw.start737; X64-NEXT: # =>This Inner Loop Header: Depth=1738; X64-NEXT: movl %eax, %ecx739; X64-NEXT: xorl %edx, %ecx740; X64-NEXT: # kill: def $ax killed $ax killed $eax741; X64-NEXT: lock cmpxchgw %cx, (%rdi)742; X64-NEXT: # kill: def $ax killed $ax def $eax743; X64-NEXT: jne .LBB12_1744; X64-NEXT: # %bb.2: # %atomicrmw.end745; X64-NEXT: andl %edx, %eax746; X64-NEXT: # kill: def $ax killed $ax killed $eax747; X64-NEXT: retq748entry:749 %conv = zext i16 %c to i32750 %shl = shl nuw i32 1, %conv751 %conv1 = trunc i32 %shl to i16752 %0 = atomicrmw xor ptr %v, i16 %conv1 monotonic, align 2753 %conv5 = and i16 %0, %conv1754 ret i16 %conv5755}756 757define zeroext i16 @atomic_shl1_small_mask_xor_16_gpr_val(ptr %v, i16 zeroext %c) nounwind {758; X86-LABEL: atomic_shl1_small_mask_xor_16_gpr_val:759; X86: # %bb.0: # %entry760; X86-NEXT: movl {{[0-9]+}}(%esp), %edx761; X86-NEXT: movzwl {{[0-9]+}}(%esp), %ecx762; X86-NEXT: andl $7, %ecx763; X86-NEXT: xorl %eax, %eax764; X86-NEXT: lock btcw %cx, (%edx)765; X86-NEXT: setb %al766; X86-NEXT: # kill: def $cl killed $cl killed $ecx767; X86-NEXT: shll %cl, %eax768; X86-NEXT: # kill: def $ax killed $ax killed $eax769; X86-NEXT: retl770;771; X64-LABEL: atomic_shl1_small_mask_xor_16_gpr_val:772; X64: # %bb.0: # %entry773; X64-NEXT: movl %esi, %ecx774; X64-NEXT: andl $7, %ecx775; X64-NEXT: xorl %eax, %eax776; X64-NEXT: lock btcw %cx, (%rdi)777; X64-NEXT: setb %al778; X64-NEXT: # kill: def $cl killed $cl killed $ecx779; X64-NEXT: shll %cl, %eax780; X64-NEXT: # kill: def $ax killed $ax killed $eax781; X64-NEXT: retq782entry:783 %0 = and i16 %c, 7784 %shl = shl nuw nsw i16 1, %0785 %1 = atomicrmw xor ptr %v, i16 %shl monotonic, align 2786 %and = and i16 %shl, %1787 ret i16 %and788}789 790define zeroext i16 @atomic_shl1_mask0_xor_16_gpr_val(ptr %v, i16 zeroext %c) nounwind {791; X86-LABEL: atomic_shl1_mask0_xor_16_gpr_val:792; X86: # %bb.0: # %entry793; X86-NEXT: pushl %edi794; X86-NEXT: pushl %esi795; X86-NEXT: movzwl {{[0-9]+}}(%esp), %edx796; X86-NEXT: movl {{[0-9]+}}(%esp), %esi797; X86-NEXT: movl %edx, %ecx798; X86-NEXT: andb $15, %cl799; X86-NEXT: movl $1, %edi800; X86-NEXT: shll %cl, %edi801; X86-NEXT: movzwl (%esi), %eax802; X86-NEXT: .p2align 4803; X86-NEXT: .LBB14_1: # %atomicrmw.start804; X86-NEXT: # =>This Inner Loop Header: Depth=1805; X86-NEXT: movl %eax, %ecx806; X86-NEXT: xorl %edi, %ecx807; X86-NEXT: # kill: def $ax killed $ax killed $eax808; X86-NEXT: lock cmpxchgw %cx, (%esi)809; X86-NEXT: # kill: def $ax killed $ax def $eax810; X86-NEXT: jne .LBB14_1811; X86-NEXT: # %bb.2: # %atomicrmw.end812; X86-NEXT: movl $1, %esi813; X86-NEXT: movl %edx, %ecx814; X86-NEXT: shll %cl, %esi815; X86-NEXT: andl %esi, %eax816; X86-NEXT: # kill: def $ax killed $ax killed $eax817; X86-NEXT: popl %esi818; X86-NEXT: popl %edi819; X86-NEXT: retl820;821; X64-LABEL: atomic_shl1_mask0_xor_16_gpr_val:822; X64: # %bb.0: # %entry823; X64-NEXT: movl %esi, %ecx824; X64-NEXT: andb $15, %cl825; X64-NEXT: movl $1, %edx826; X64-NEXT: shll %cl, %edx827; X64-NEXT: movzwl (%rdi), %eax828; X64-NEXT: .p2align 4829; X64-NEXT: .LBB14_1: # %atomicrmw.start830; X64-NEXT: # =>This Inner Loop Header: Depth=1831; X64-NEXT: movl %eax, %ecx832; X64-NEXT: xorl %edx, %ecx833; X64-NEXT: # kill: def $ax killed $ax killed $eax834; X64-NEXT: lock cmpxchgw %cx, (%rdi)835; X64-NEXT: # kill: def $ax killed $ax def $eax836; X64-NEXT: jne .LBB14_1837; X64-NEXT: # %bb.2: # %atomicrmw.end838; X64-NEXT: movl $1, %edx839; X64-NEXT: movl %esi, %ecx840; X64-NEXT: shll %cl, %edx841; X64-NEXT: andl %edx, %eax842; X64-NEXT: # kill: def $ax killed $ax killed $eax843; X64-NEXT: retq844entry:845 %0 = and i16 %c, 15846 %shl = shl nuw i16 1, %0847 %1 = atomicrmw xor ptr %v, i16 %shl monotonic, align 2848 %conv3 = zext i16 %c to i32849 %shl4 = shl nuw i32 1, %conv3850 %2 = trunc i32 %shl4 to i16851 %conv5 = and i16 %1, %2852 ret i16 %conv5853}854 855define zeroext i16 @atomic_shl1_mask1_xor_16_gpr_val(ptr %v, i16 zeroext %c) nounwind {856; X86-LABEL: atomic_shl1_mask1_xor_16_gpr_val:857; X86: # %bb.0: # %entry858; X86-NEXT: pushl %edi859; X86-NEXT: pushl %esi860; X86-NEXT: movzwl {{[0-9]+}}(%esp), %ecx861; X86-NEXT: movl {{[0-9]+}}(%esp), %edx862; X86-NEXT: movl $1, %esi863; X86-NEXT: shll %cl, %esi864; X86-NEXT: movzwl (%edx), %eax865; X86-NEXT: .p2align 4866; X86-NEXT: .LBB15_1: # %atomicrmw.start867; X86-NEXT: # =>This Inner Loop Header: Depth=1868; X86-NEXT: movl %eax, %edi869; X86-NEXT: xorl %esi, %edi870; X86-NEXT: # kill: def $ax killed $ax killed $eax871; X86-NEXT: lock cmpxchgw %di, (%edx)872; X86-NEXT: # kill: def $ax killed $ax def $eax873; X86-NEXT: jne .LBB15_1874; X86-NEXT: # %bb.2: # %atomicrmw.end875; X86-NEXT: andb $15, %cl876; X86-NEXT: movl $1, %edx877; X86-NEXT: # kill: def $cl killed $cl killed $cx878; X86-NEXT: shll %cl, %edx879; X86-NEXT: andl %edx, %eax880; X86-NEXT: # kill: def $ax killed $ax killed $eax881; X86-NEXT: popl %esi882; X86-NEXT: popl %edi883; X86-NEXT: retl884;885; X64-LABEL: atomic_shl1_mask1_xor_16_gpr_val:886; X64: # %bb.0: # %entry887; X64-NEXT: movl %esi, %ecx888; X64-NEXT: movl $1, %edx889; X64-NEXT: shll %cl, %edx890; X64-NEXT: movzwl (%rdi), %eax891; X64-NEXT: .p2align 4892; X64-NEXT: .LBB15_1: # %atomicrmw.start893; X64-NEXT: # =>This Inner Loop Header: Depth=1894; X64-NEXT: movl %eax, %esi895; X64-NEXT: xorl %edx, %esi896; X64-NEXT: # kill: def $ax killed $ax killed $eax897; X64-NEXT: lock cmpxchgw %si, (%rdi)898; X64-NEXT: # kill: def $ax killed $ax def $eax899; X64-NEXT: jne .LBB15_1900; X64-NEXT: # %bb.2: # %atomicrmw.end901; X64-NEXT: andb $15, %cl902; X64-NEXT: movl $1, %edx903; X64-NEXT: # kill: def $cl killed $cl killed $ecx904; X64-NEXT: shll %cl, %edx905; X64-NEXT: andl %edx, %eax906; X64-NEXT: # kill: def $ax killed $ax killed $eax907; X64-NEXT: retq908entry:909 %conv = zext i16 %c to i32910 %shl = shl nuw i32 1, %conv911 %conv1 = trunc i32 %shl to i16912 %0 = atomicrmw xor ptr %v, i16 %conv1 monotonic, align 2913 %1 = and i16 %c, 15914 %shl4 = shl nuw i16 1, %1915 %and = and i16 %0, %shl4916 ret i16 %and917}918 919define zeroext i16 @atomic_shl1_mask01_xor_16_gpr_val(ptr %v, i16 zeroext %c) nounwind {920; X86-LABEL: atomic_shl1_mask01_xor_16_gpr_val:921; X86: # %bb.0: # %entry922; X86-NEXT: movl {{[0-9]+}}(%esp), %edx923; X86-NEXT: movzwl {{[0-9]+}}(%esp), %ecx924; X86-NEXT: andl $15, %ecx925; X86-NEXT: xorl %eax, %eax926; X86-NEXT: lock btcw %cx, (%edx)927; X86-NEXT: setb %al928; X86-NEXT: # kill: def $cl killed $cl killed $ecx929; X86-NEXT: shll %cl, %eax930; X86-NEXT: # kill: def $ax killed $ax killed $eax931; X86-NEXT: retl932;933; X64-LABEL: atomic_shl1_mask01_xor_16_gpr_val:934; X64: # %bb.0: # %entry935; X64-NEXT: movl %esi, %ecx936; X64-NEXT: andl $15, %ecx937; X64-NEXT: xorl %eax, %eax938; X64-NEXT: lock btcw %cx, (%rdi)939; X64-NEXT: setb %al940; X64-NEXT: # kill: def $cl killed $cl killed $ecx941; X64-NEXT: shll %cl, %eax942; X64-NEXT: # kill: def $ax killed $ax killed $eax943; X64-NEXT: retq944entry:945 %0 = and i16 %c, 15946 %shl = shl nuw i16 1, %0947 %1 = atomicrmw xor ptr %v, i16 %shl monotonic, align 2948 %conv7 = and i16 %1, %shl949 ret i16 %conv7950}951 952define zeroext i16 @atomic_blsi_xor_16_gpr_val(ptr %v, i16 zeroext %c) nounwind {953; X86-LABEL: atomic_blsi_xor_16_gpr_val:954; X86: # %bb.0: # %entry955; X86-NEXT: pushl %esi956; X86-NEXT: movl {{[0-9]+}}(%esp), %edx957; X86-NEXT: movl {{[0-9]+}}(%esp), %eax958; X86-NEXT: movl %eax, %ecx959; X86-NEXT: negl %ecx960; X86-NEXT: andl %eax, %ecx961; X86-NEXT: movzwl (%edx), %eax962; X86-NEXT: .p2align 4963; X86-NEXT: .LBB17_1: # %atomicrmw.start964; X86-NEXT: # =>This Inner Loop Header: Depth=1965; X86-NEXT: movl %eax, %esi966; X86-NEXT: xorl %ecx, %esi967; X86-NEXT: # kill: def $ax killed $ax killed $eax968; X86-NEXT: lock cmpxchgw %si, (%edx)969; X86-NEXT: # kill: def $ax killed $ax def $eax970; X86-NEXT: jne .LBB17_1971; X86-NEXT: # %bb.2: # %atomicrmw.end972; X86-NEXT: andl %ecx, %eax973; X86-NEXT: # kill: def $ax killed $ax killed $eax974; X86-NEXT: popl %esi975; X86-NEXT: retl976;977; X64-LABEL: atomic_blsi_xor_16_gpr_val:978; X64: # %bb.0: # %entry979; X64-NEXT: movl %esi, %ecx980; X64-NEXT: negl %ecx981; X64-NEXT: andl %esi, %ecx982; X64-NEXT: movzwl (%rdi), %eax983; X64-NEXT: .p2align 4984; X64-NEXT: .LBB17_1: # %atomicrmw.start985; X64-NEXT: # =>This Inner Loop Header: Depth=1986; X64-NEXT: movl %eax, %edx987; X64-NEXT: xorl %ecx, %edx988; X64-NEXT: # kill: def $ax killed $ax killed $eax989; X64-NEXT: lock cmpxchgw %dx, (%rdi)990; X64-NEXT: # kill: def $ax killed $ax def $eax991; X64-NEXT: jne .LBB17_1992; X64-NEXT: # %bb.2: # %atomicrmw.end993; X64-NEXT: andl %ecx, %eax994; X64-NEXT: # kill: def $ax killed $ax killed $eax995; X64-NEXT: retq996entry:997 %sub = sub i16 0, %c998 %and = and i16 %sub, %c999 %0 = atomicrmw xor ptr %v, i16 %and monotonic, align 21000 %conv9 = and i16 %0, %and1001 ret i16 %conv91002}1003 1004define zeroext i16 @atomic_shl1_xor_16_gpr_valz(ptr %v, i16 zeroext %c) nounwind {1005; X86-LABEL: atomic_shl1_xor_16_gpr_valz:1006; X86: # %bb.0: # %entry1007; X86-NEXT: pushl %esi1008; X86-NEXT: movl {{[0-9]+}}(%esp), %esi1009; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx1010; X86-NEXT: movl $1, %edx1011; X86-NEXT: shll %cl, %edx1012; X86-NEXT: movzwl (%esi), %eax1013; X86-NEXT: .p2align 41014; X86-NEXT: .LBB18_1: # %atomicrmw.start1015; X86-NEXT: # =>This Inner Loop Header: Depth=11016; X86-NEXT: movl %eax, %ecx1017; X86-NEXT: xorl %edx, %ecx1018; X86-NEXT: # kill: def $ax killed $ax killed $eax1019; X86-NEXT: lock cmpxchgw %cx, (%esi)1020; X86-NEXT: # kill: def $ax killed $ax def $eax1021; X86-NEXT: jne .LBB18_11022; X86-NEXT: # %bb.2: # %atomicrmw.end1023; X86-NEXT: movzwl %ax, %ecx1024; X86-NEXT: xorl %eax, %eax1025; X86-NEXT: testl %ecx, %edx1026; X86-NEXT: sete %al1027; X86-NEXT: # kill: def $ax killed $ax killed $eax1028; X86-NEXT: popl %esi1029; X86-NEXT: retl1030;1031; X64-LABEL: atomic_shl1_xor_16_gpr_valz:1032; X64: # %bb.0: # %entry1033; X64-NEXT: movl %esi, %ecx1034; X64-NEXT: movl $1, %edx1035; X64-NEXT: # kill: def $cl killed $cl killed $ecx1036; X64-NEXT: shll %cl, %edx1037; X64-NEXT: movzwl (%rdi), %eax1038; X64-NEXT: .p2align 41039; X64-NEXT: .LBB18_1: # %atomicrmw.start1040; X64-NEXT: # =>This Inner Loop Header: Depth=11041; X64-NEXT: movl %eax, %ecx1042; X64-NEXT: xorl %edx, %ecx1043; X64-NEXT: # kill: def $ax killed $ax killed $eax1044; X64-NEXT: lock cmpxchgw %cx, (%rdi)1045; X64-NEXT: # kill: def $ax killed $ax def $eax1046; X64-NEXT: jne .LBB18_11047; X64-NEXT: # %bb.2: # %atomicrmw.end1048; X64-NEXT: movzwl %ax, %ecx1049; X64-NEXT: xorl %eax, %eax1050; X64-NEXT: testl %ecx, %edx1051; X64-NEXT: sete %al1052; X64-NEXT: # kill: def $ax killed $ax killed $eax1053; X64-NEXT: retq1054entry:1055 %conv = zext i16 %c to i321056 %shl = shl nuw i32 1, %conv1057 %conv1 = trunc i32 %shl to i161058 %0 = atomicrmw xor ptr %v, i16 %conv1 monotonic, align 21059 %conv2 = zext i16 %0 to i321060 %and = and i32 %shl, %conv21061 %tobool.not = icmp eq i32 %and, 01062 %conv5 = zext i1 %tobool.not to i161063 ret i16 %conv51064}1065 1066define zeroext i16 @atomic_shl1_small_mask_xor_16_gpr_valz(ptr %v, i16 zeroext %c) nounwind {1067; X86-LABEL: atomic_shl1_small_mask_xor_16_gpr_valz:1068; X86: # %bb.0: # %entry1069; X86-NEXT: pushl %edi1070; X86-NEXT: pushl %esi1071; X86-NEXT: movl {{[0-9]+}}(%esp), %edx1072; X86-NEXT: movzwl {{[0-9]+}}(%esp), %ecx1073; X86-NEXT: andl $7, %ecx1074; X86-NEXT: movl $1, %esi1075; X86-NEXT: shll %cl, %esi1076; X86-NEXT: movzwl (%edx), %eax1077; X86-NEXT: movzwl %si, %esi1078; X86-NEXT: .p2align 41079; X86-NEXT: .LBB19_1: # %atomicrmw.start1080; X86-NEXT: # =>This Inner Loop Header: Depth=11081; X86-NEXT: movl %eax, %edi1082; X86-NEXT: xorl %esi, %edi1083; X86-NEXT: # kill: def $ax killed $ax killed $eax1084; X86-NEXT: lock cmpxchgw %di, (%edx)1085; X86-NEXT: # kill: def $ax killed $ax def $eax1086; X86-NEXT: jne .LBB19_11087; X86-NEXT: # %bb.2: # %atomicrmw.end1088; X86-NEXT: movzwl %ax, %edx1089; X86-NEXT: xorl %eax, %eax1090; X86-NEXT: btl %ecx, %edx1091; X86-NEXT: setae %al1092; X86-NEXT: # kill: def $ax killed $ax killed $eax1093; X86-NEXT: popl %esi1094; X86-NEXT: popl %edi1095; X86-NEXT: retl1096;1097; X64-LABEL: atomic_shl1_small_mask_xor_16_gpr_valz:1098; X64: # %bb.0: # %entry1099; X64-NEXT: movl %esi, %ecx1100; X64-NEXT: andl $7, %ecx1101; X64-NEXT: movl $1, %edx1102; X64-NEXT: shll %cl, %edx1103; X64-NEXT: movzwl (%rdi), %eax1104; X64-NEXT: movzwl %dx, %edx1105; X64-NEXT: .p2align 41106; X64-NEXT: .LBB19_1: # %atomicrmw.start1107; X64-NEXT: # =>This Inner Loop Header: Depth=11108; X64-NEXT: movl %eax, %esi1109; X64-NEXT: xorl %edx, %esi1110; X64-NEXT: # kill: def $ax killed $ax killed $eax1111; X64-NEXT: lock cmpxchgw %si, (%rdi)1112; X64-NEXT: # kill: def $ax killed $ax def $eax1113; X64-NEXT: jne .LBB19_11114; X64-NEXT: # %bb.2: # %atomicrmw.end1115; X64-NEXT: movzwl %ax, %edx1116; X64-NEXT: xorl %eax, %eax1117; X64-NEXT: btl %ecx, %edx1118; X64-NEXT: setae %al1119; X64-NEXT: # kill: def $ax killed $ax killed $eax1120; X64-NEXT: retq1121entry:1122 %0 = and i16 %c, 71123 %shl = shl nuw nsw i16 1, %01124 %1 = atomicrmw xor ptr %v, i16 %shl monotonic, align 21125 %conv5 = zext i16 %1 to i321126 %conv6 = zext i16 %0 to i321127 %shl7 = shl nuw nsw i32 1, %conv61128 %and = and i32 %shl7, %conv51129 %tobool.not = icmp eq i32 %and, 01130 %conv8 = zext i1 %tobool.not to i161131 ret i16 %conv81132}1133 1134define zeroext i16 @atomic_shl1_mask0_xor_16_gpr_valz(ptr %v, i16 zeroext %c) nounwind {1135; X86-LABEL: atomic_shl1_mask0_xor_16_gpr_valz:1136; X86: # %bb.0: # %entry1137; X86-NEXT: pushl %edi1138; X86-NEXT: pushl %esi1139; X86-NEXT: movzwl {{[0-9]+}}(%esp), %edx1140; X86-NEXT: movl {{[0-9]+}}(%esp), %esi1141; X86-NEXT: movl %edx, %ecx1142; X86-NEXT: andb $15, %cl1143; X86-NEXT: movl $1, %edi1144; X86-NEXT: shll %cl, %edi1145; X86-NEXT: movzwl (%esi), %eax1146; X86-NEXT: .p2align 41147; X86-NEXT: .LBB20_1: # %atomicrmw.start1148; X86-NEXT: # =>This Inner Loop Header: Depth=11149; X86-NEXT: movl %eax, %ecx1150; X86-NEXT: xorl %edi, %ecx1151; X86-NEXT: # kill: def $ax killed $ax killed $eax1152; X86-NEXT: lock cmpxchgw %cx, (%esi)1153; X86-NEXT: # kill: def $ax killed $ax def $eax1154; X86-NEXT: jne .LBB20_11155; X86-NEXT: # %bb.2: # %atomicrmw.end1156; X86-NEXT: movzwl %ax, %ecx1157; X86-NEXT: xorl %eax, %eax1158; X86-NEXT: btl %edx, %ecx1159; X86-NEXT: setae %al1160; X86-NEXT: # kill: def $ax killed $ax killed $eax1161; X86-NEXT: popl %esi1162; X86-NEXT: popl %edi1163; X86-NEXT: retl1164;1165; X64-LABEL: atomic_shl1_mask0_xor_16_gpr_valz:1166; X64: # %bb.0: # %entry1167; X64-NEXT: movl %esi, %ecx1168; X64-NEXT: andb $15, %cl1169; X64-NEXT: movl $1, %edx1170; X64-NEXT: shll %cl, %edx1171; X64-NEXT: movzwl (%rdi), %eax1172; X64-NEXT: .p2align 41173; X64-NEXT: .LBB20_1: # %atomicrmw.start1174; X64-NEXT: # =>This Inner Loop Header: Depth=11175; X64-NEXT: movl %eax, %ecx1176; X64-NEXT: xorl %edx, %ecx1177; X64-NEXT: # kill: def $ax killed $ax killed $eax1178; X64-NEXT: lock cmpxchgw %cx, (%rdi)1179; X64-NEXT: # kill: def $ax killed $ax def $eax1180; X64-NEXT: jne .LBB20_11181; X64-NEXT: # %bb.2: # %atomicrmw.end1182; X64-NEXT: movzwl %ax, %ecx1183; X64-NEXT: xorl %eax, %eax1184; X64-NEXT: btl %esi, %ecx1185; X64-NEXT: setae %al1186; X64-NEXT: # kill: def $ax killed $ax killed $eax1187; X64-NEXT: retq1188entry:1189 %0 = and i16 %c, 151190 %shl = shl nuw i16 1, %01191 %1 = atomicrmw xor ptr %v, i16 %shl monotonic, align 21192 %conv2 = zext i16 %1 to i321193 %conv3 = zext i16 %c to i321194 %shl4 = shl nuw i32 1, %conv31195 %and = and i32 %shl4, %conv21196 %tobool.not = icmp eq i32 %and, 01197 %conv5 = zext i1 %tobool.not to i161198 ret i16 %conv51199}1200 1201define zeroext i16 @atomic_shl1_mask1_xor_16_gpr_valz(ptr %v, i16 zeroext %c) nounwind {1202; X86-LABEL: atomic_shl1_mask1_xor_16_gpr_valz:1203; X86: # %bb.0: # %entry1204; X86-NEXT: pushl %edi1205; X86-NEXT: pushl %esi1206; X86-NEXT: movzwl {{[0-9]+}}(%esp), %ecx1207; X86-NEXT: movl {{[0-9]+}}(%esp), %edx1208; X86-NEXT: movl $1, %esi1209; X86-NEXT: shll %cl, %esi1210; X86-NEXT: movzwl (%edx), %eax1211; X86-NEXT: .p2align 41212; X86-NEXT: .LBB21_1: # %atomicrmw.start1213; X86-NEXT: # =>This Inner Loop Header: Depth=11214; X86-NEXT: movl %eax, %edi1215; X86-NEXT: xorl %esi, %edi1216; X86-NEXT: # kill: def $ax killed $ax killed $eax1217; X86-NEXT: lock cmpxchgw %di, (%edx)1218; X86-NEXT: # kill: def $ax killed $ax def $eax1219; X86-NEXT: jne .LBB21_11220; X86-NEXT: # %bb.2: # %atomicrmw.end1221; X86-NEXT: movzwl %ax, %edx1222; X86-NEXT: andl $15, %ecx1223; X86-NEXT: xorl %eax, %eax1224; X86-NEXT: btl %ecx, %edx1225; X86-NEXT: setae %al1226; X86-NEXT: # kill: def $ax killed $ax killed $eax1227; X86-NEXT: popl %esi1228; X86-NEXT: popl %edi1229; X86-NEXT: retl1230;1231; X64-LABEL: atomic_shl1_mask1_xor_16_gpr_valz:1232; X64: # %bb.0: # %entry1233; X64-NEXT: movl %esi, %ecx1234; X64-NEXT: movl $1, %edx1235; X64-NEXT: shll %cl, %edx1236; X64-NEXT: movzwl (%rdi), %eax1237; X64-NEXT: .p2align 41238; X64-NEXT: .LBB21_1: # %atomicrmw.start1239; X64-NEXT: # =>This Inner Loop Header: Depth=11240; X64-NEXT: movl %eax, %esi1241; X64-NEXT: xorl %edx, %esi1242; X64-NEXT: # kill: def $ax killed $ax killed $eax1243; X64-NEXT: lock cmpxchgw %si, (%rdi)1244; X64-NEXT: # kill: def $ax killed $ax def $eax1245; X64-NEXT: jne .LBB21_11246; X64-NEXT: # %bb.2: # %atomicrmw.end1247; X64-NEXT: movzwl %ax, %edx1248; X64-NEXT: andl $15, %ecx1249; X64-NEXT: xorl %eax, %eax1250; X64-NEXT: btl %ecx, %edx1251; X64-NEXT: setae %al1252; X64-NEXT: # kill: def $ax killed $ax killed $eax1253; X64-NEXT: retq1254entry:1255 %conv = zext i16 %c to i321256 %shl = shl nuw i32 1, %conv1257 %conv1 = trunc i32 %shl to i161258 %0 = atomicrmw xor ptr %v, i16 %conv1 monotonic, align 21259 %conv2 = zext i16 %0 to i321260 %1 = and i16 %c, 151261 %sh_prom = zext i16 %1 to i321262 %shl4 = shl nuw nsw i32 1, %sh_prom1263 %and = and i32 %shl4, %conv21264 %tobool.not = icmp eq i32 %and, 01265 %conv5 = zext i1 %tobool.not to i161266 ret i16 %conv51267}1268 1269define zeroext i16 @atomic_shl1_mask01_xor_16_gpr_valz(ptr %v, i16 zeroext %c) nounwind {1270; X86-LABEL: atomic_shl1_mask01_xor_16_gpr_valz:1271; X86: # %bb.0: # %entry1272; X86-NEXT: pushl %esi1273; X86-NEXT: movl {{[0-9]+}}(%esp), %edx1274; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx1275; X86-NEXT: andb $15, %cl1276; X86-NEXT: movl $1, %esi1277; X86-NEXT: shll %cl, %esi1278; X86-NEXT: movzwl (%edx), %eax1279; X86-NEXT: .p2align 41280; X86-NEXT: .LBB22_1: # %atomicrmw.start1281; X86-NEXT: # =>This Inner Loop Header: Depth=11282; X86-NEXT: movl %eax, %ecx1283; X86-NEXT: xorl %esi, %ecx1284; X86-NEXT: # kill: def $ax killed $ax killed $eax1285; X86-NEXT: lock cmpxchgw %cx, (%edx)1286; X86-NEXT: # kill: def $ax killed $ax def $eax1287; X86-NEXT: jne .LBB22_11288; X86-NEXT: # %bb.2: # %atomicrmw.end1289; X86-NEXT: movzwl %ax, %ecx1290; X86-NEXT: xorl %eax, %eax1291; X86-NEXT: testl %ecx, %esi1292; X86-NEXT: sete %al1293; X86-NEXT: # kill: def $ax killed $ax killed $eax1294; X86-NEXT: popl %esi1295; X86-NEXT: retl1296;1297; X64-LABEL: atomic_shl1_mask01_xor_16_gpr_valz:1298; X64: # %bb.0: # %entry1299; X64-NEXT: movl %esi, %ecx1300; X64-NEXT: andb $15, %cl1301; X64-NEXT: movl $1, %edx1302; X64-NEXT: # kill: def $cl killed $cl killed $ecx1303; X64-NEXT: shll %cl, %edx1304; X64-NEXT: movzwl (%rdi), %eax1305; X64-NEXT: .p2align 41306; X64-NEXT: .LBB22_1: # %atomicrmw.start1307; X64-NEXT: # =>This Inner Loop Header: Depth=11308; X64-NEXT: movl %eax, %ecx1309; X64-NEXT: xorl %edx, %ecx1310; X64-NEXT: # kill: def $ax killed $ax killed $eax1311; X64-NEXT: lock cmpxchgw %cx, (%rdi)1312; X64-NEXT: # kill: def $ax killed $ax def $eax1313; X64-NEXT: jne .LBB22_11314; X64-NEXT: # %bb.2: # %atomicrmw.end1315; X64-NEXT: movzwl %ax, %ecx1316; X64-NEXT: xorl %eax, %eax1317; X64-NEXT: testl %ecx, %edx1318; X64-NEXT: sete %al1319; X64-NEXT: # kill: def $ax killed $ax killed $eax1320; X64-NEXT: retq1321entry:1322 %0 = and i16 %c, 151323 %sh_prom = zext i16 %0 to i321324 %shl = shl nuw nsw i32 1, %sh_prom1325 %conv1 = trunc i32 %shl to i161326 %1 = atomicrmw xor ptr %v, i16 %conv1 monotonic, align 21327 %conv2 = zext i16 %1 to i321328 %and = and i32 %shl, %conv21329 %tobool.not = icmp eq i32 %and, 01330 %conv7 = zext i1 %tobool.not to i161331 ret i16 %conv71332}1333 1334define zeroext i16 @atomic_blsi_xor_16_gpr_valz(ptr %v, i16 zeroext %c) nounwind {1335; X86-LABEL: atomic_blsi_xor_16_gpr_valz:1336; X86: # %bb.0: # %entry1337; X86-NEXT: pushl %esi1338; X86-NEXT: movl {{[0-9]+}}(%esp), %edx1339; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax1340; X86-NEXT: movl %eax, %ecx1341; X86-NEXT: negl %ecx1342; X86-NEXT: andl %eax, %ecx1343; X86-NEXT: movzwl (%edx), %eax1344; X86-NEXT: .p2align 41345; X86-NEXT: .LBB23_1: # %atomicrmw.start1346; X86-NEXT: # =>This Inner Loop Header: Depth=11347; X86-NEXT: movl %eax, %esi1348; X86-NEXT: xorl %ecx, %esi1349; X86-NEXT: # kill: def $ax killed $ax killed $eax1350; X86-NEXT: lock cmpxchgw %si, (%edx)1351; X86-NEXT: # kill: def $ax killed $ax def $eax1352; X86-NEXT: jne .LBB23_11353; X86-NEXT: # %bb.2: # %atomicrmw.end1354; X86-NEXT: movzwl %ax, %edx1355; X86-NEXT: xorl %eax, %eax1356; X86-NEXT: testl %edx, %ecx1357; X86-NEXT: sete %al1358; X86-NEXT: # kill: def $ax killed $ax killed $eax1359; X86-NEXT: popl %esi1360; X86-NEXT: retl1361;1362; X64-LABEL: atomic_blsi_xor_16_gpr_valz:1363; X64: # %bb.0: # %entry1364; X64-NEXT: movl %esi, %ecx1365; X64-NEXT: negl %ecx1366; X64-NEXT: andl %esi, %ecx1367; X64-NEXT: movzwl (%rdi), %eax1368; X64-NEXT: .p2align 41369; X64-NEXT: .LBB23_1: # %atomicrmw.start1370; X64-NEXT: # =>This Inner Loop Header: Depth=11371; X64-NEXT: movl %eax, %edx1372; X64-NEXT: xorl %ecx, %edx1373; X64-NEXT: # kill: def $ax killed $ax killed $eax1374; X64-NEXT: lock cmpxchgw %dx, (%rdi)1375; X64-NEXT: # kill: def $ax killed $ax def $eax1376; X64-NEXT: jne .LBB23_11377; X64-NEXT: # %bb.2: # %atomicrmw.end1378; X64-NEXT: movzwl %ax, %edx1379; X64-NEXT: xorl %eax, %eax1380; X64-NEXT: testl %edx, %ecx1381; X64-NEXT: sete %al1382; X64-NEXT: # kill: def $ax killed $ax killed $eax1383; X64-NEXT: retq1384entry:1385 %conv = zext i16 %c to i321386 %sub = sub nsw i32 0, %conv1387 %and = and i32 %conv, %sub1388 %conv2 = trunc i32 %and to i161389 %0 = atomicrmw xor ptr %v, i16 %conv2 monotonic, align 21390 %conv3 = zext i16 %0 to i321391 %and8 = and i32 %and, %conv31392 %tobool.not = icmp eq i32 %and8, 01393 %conv9 = zext i1 %tobool.not to i161394 ret i16 %conv91395}1396 1397define zeroext i16 @atomic_shl1_xor_16_gpr_valnz(ptr %v, i16 zeroext %c) nounwind {1398; X86-LABEL: atomic_shl1_xor_16_gpr_valnz:1399; X86: # %bb.0: # %entry1400; X86-NEXT: pushl %esi1401; X86-NEXT: movl {{[0-9]+}}(%esp), %esi1402; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx1403; X86-NEXT: movl $1, %edx1404; X86-NEXT: shll %cl, %edx1405; X86-NEXT: movzwl (%esi), %eax1406; X86-NEXT: .p2align 41407; X86-NEXT: .LBB24_1: # %atomicrmw.start1408; X86-NEXT: # =>This Inner Loop Header: Depth=11409; X86-NEXT: movl %eax, %ecx1410; X86-NEXT: xorl %edx, %ecx1411; X86-NEXT: # kill: def $ax killed $ax killed $eax1412; X86-NEXT: lock cmpxchgw %cx, (%esi)1413; X86-NEXT: # kill: def $ax killed $ax def $eax1414; X86-NEXT: jne .LBB24_11415; X86-NEXT: # %bb.2: # %atomicrmw.end1416; X86-NEXT: movzwl %ax, %ecx1417; X86-NEXT: xorl %eax, %eax1418; X86-NEXT: testl %ecx, %edx1419; X86-NEXT: setne %al1420; X86-NEXT: # kill: def $ax killed $ax killed $eax1421; X86-NEXT: popl %esi1422; X86-NEXT: retl1423;1424; X64-LABEL: atomic_shl1_xor_16_gpr_valnz:1425; X64: # %bb.0: # %entry1426; X64-NEXT: movl %esi, %ecx1427; X64-NEXT: movl $1, %edx1428; X64-NEXT: # kill: def $cl killed $cl killed $ecx1429; X64-NEXT: shll %cl, %edx1430; X64-NEXT: movzwl (%rdi), %eax1431; X64-NEXT: .p2align 41432; X64-NEXT: .LBB24_1: # %atomicrmw.start1433; X64-NEXT: # =>This Inner Loop Header: Depth=11434; X64-NEXT: movl %eax, %ecx1435; X64-NEXT: xorl %edx, %ecx1436; X64-NEXT: # kill: def $ax killed $ax killed $eax1437; X64-NEXT: lock cmpxchgw %cx, (%rdi)1438; X64-NEXT: # kill: def $ax killed $ax def $eax1439; X64-NEXT: jne .LBB24_11440; X64-NEXT: # %bb.2: # %atomicrmw.end1441; X64-NEXT: movzwl %ax, %ecx1442; X64-NEXT: xorl %eax, %eax1443; X64-NEXT: testl %ecx, %edx1444; X64-NEXT: setne %al1445; X64-NEXT: # kill: def $ax killed $ax killed $eax1446; X64-NEXT: retq1447entry:1448 %conv = zext i16 %c to i321449 %shl = shl nuw i32 1, %conv1450 %conv1 = trunc i32 %shl to i161451 %0 = atomicrmw xor ptr %v, i16 %conv1 monotonic, align 21452 %conv2 = zext i16 %0 to i321453 %and = and i32 %shl, %conv21454 %tobool = icmp ne i32 %and, 01455 %conv6 = zext i1 %tobool to i161456 ret i16 %conv61457}1458 1459define zeroext i16 @atomic_shl1_small_mask_xor_16_gpr_valnz(ptr %v, i16 zeroext %c) nounwind {1460; X86-LABEL: atomic_shl1_small_mask_xor_16_gpr_valnz:1461; X86: # %bb.0: # %entry1462; X86-NEXT: pushl %edi1463; X86-NEXT: pushl %esi1464; X86-NEXT: movl {{[0-9]+}}(%esp), %edx1465; X86-NEXT: movzwl {{[0-9]+}}(%esp), %ecx1466; X86-NEXT: andl $7, %ecx1467; X86-NEXT: movl $1, %esi1468; X86-NEXT: shll %cl, %esi1469; X86-NEXT: movzwl (%edx), %eax1470; X86-NEXT: movzwl %si, %esi1471; X86-NEXT: .p2align 41472; X86-NEXT: .LBB25_1: # %atomicrmw.start1473; X86-NEXT: # =>This Inner Loop Header: Depth=11474; X86-NEXT: movl %eax, %edi1475; X86-NEXT: xorl %esi, %edi1476; X86-NEXT: # kill: def $ax killed $ax killed $eax1477; X86-NEXT: lock cmpxchgw %di, (%edx)1478; X86-NEXT: # kill: def $ax killed $ax def $eax1479; X86-NEXT: jne .LBB25_11480; X86-NEXT: # %bb.2: # %atomicrmw.end1481; X86-NEXT: movzwl %ax, %edx1482; X86-NEXT: xorl %eax, %eax1483; X86-NEXT: btl %ecx, %edx1484; X86-NEXT: setb %al1485; X86-NEXT: # kill: def $ax killed $ax killed $eax1486; X86-NEXT: popl %esi1487; X86-NEXT: popl %edi1488; X86-NEXT: retl1489;1490; X64-LABEL: atomic_shl1_small_mask_xor_16_gpr_valnz:1491; X64: # %bb.0: # %entry1492; X64-NEXT: movl %esi, %ecx1493; X64-NEXT: andl $7, %ecx1494; X64-NEXT: movl $1, %edx1495; X64-NEXT: shll %cl, %edx1496; X64-NEXT: movzwl (%rdi), %eax1497; X64-NEXT: movzwl %dx, %edx1498; X64-NEXT: .p2align 41499; X64-NEXT: .LBB25_1: # %atomicrmw.start1500; X64-NEXT: # =>This Inner Loop Header: Depth=11501; X64-NEXT: movl %eax, %esi1502; X64-NEXT: xorl %edx, %esi1503; X64-NEXT: # kill: def $ax killed $ax killed $eax1504; X64-NEXT: lock cmpxchgw %si, (%rdi)1505; X64-NEXT: # kill: def $ax killed $ax def $eax1506; X64-NEXT: jne .LBB25_11507; X64-NEXT: # %bb.2: # %atomicrmw.end1508; X64-NEXT: movzwl %ax, %edx1509; X64-NEXT: xorl %eax, %eax1510; X64-NEXT: btl %ecx, %edx1511; X64-NEXT: setb %al1512; X64-NEXT: # kill: def $ax killed $ax killed $eax1513; X64-NEXT: retq1514entry:1515 %0 = and i16 %c, 71516 %shl = shl nuw nsw i16 1, %01517 %1 = atomicrmw xor ptr %v, i16 %shl monotonic, align 21518 %conv5 = zext i16 %1 to i321519 %conv6 = zext i16 %0 to i321520 %shl7 = shl nuw nsw i32 1, %conv61521 %and = and i32 %shl7, %conv51522 %tobool = icmp ne i32 %and, 01523 %conv9 = zext i1 %tobool to i161524 ret i16 %conv91525}1526 1527define zeroext i16 @atomic_shl1_mask0_xor_16_gpr_valnz(ptr %v, i16 zeroext %c) nounwind {1528; X86-LABEL: atomic_shl1_mask0_xor_16_gpr_valnz:1529; X86: # %bb.0: # %entry1530; X86-NEXT: pushl %edi1531; X86-NEXT: pushl %esi1532; X86-NEXT: movzwl {{[0-9]+}}(%esp), %edx1533; X86-NEXT: movl {{[0-9]+}}(%esp), %esi1534; X86-NEXT: movl %edx, %ecx1535; X86-NEXT: andb $15, %cl1536; X86-NEXT: movl $1, %edi1537; X86-NEXT: shll %cl, %edi1538; X86-NEXT: movzwl (%esi), %eax1539; X86-NEXT: .p2align 41540; X86-NEXT: .LBB26_1: # %atomicrmw.start1541; X86-NEXT: # =>This Inner Loop Header: Depth=11542; X86-NEXT: movl %eax, %ecx1543; X86-NEXT: xorl %edi, %ecx1544; X86-NEXT: # kill: def $ax killed $ax killed $eax1545; X86-NEXT: lock cmpxchgw %cx, (%esi)1546; X86-NEXT: # kill: def $ax killed $ax def $eax1547; X86-NEXT: jne .LBB26_11548; X86-NEXT: # %bb.2: # %atomicrmw.end1549; X86-NEXT: movzwl %ax, %ecx1550; X86-NEXT: xorl %eax, %eax1551; X86-NEXT: btl %edx, %ecx1552; X86-NEXT: setb %al1553; X86-NEXT: # kill: def $ax killed $ax killed $eax1554; X86-NEXT: popl %esi1555; X86-NEXT: popl %edi1556; X86-NEXT: retl1557;1558; X64-LABEL: atomic_shl1_mask0_xor_16_gpr_valnz:1559; X64: # %bb.0: # %entry1560; X64-NEXT: movl %esi, %ecx1561; X64-NEXT: andb $15, %cl1562; X64-NEXT: movl $1, %edx1563; X64-NEXT: shll %cl, %edx1564; X64-NEXT: movzwl (%rdi), %eax1565; X64-NEXT: .p2align 41566; X64-NEXT: .LBB26_1: # %atomicrmw.start1567; X64-NEXT: # =>This Inner Loop Header: Depth=11568; X64-NEXT: movl %eax, %ecx1569; X64-NEXT: xorl %edx, %ecx1570; X64-NEXT: # kill: def $ax killed $ax killed $eax1571; X64-NEXT: lock cmpxchgw %cx, (%rdi)1572; X64-NEXT: # kill: def $ax killed $ax def $eax1573; X64-NEXT: jne .LBB26_11574; X64-NEXT: # %bb.2: # %atomicrmw.end1575; X64-NEXT: movzwl %ax, %ecx1576; X64-NEXT: xorl %eax, %eax1577; X64-NEXT: btl %esi, %ecx1578; X64-NEXT: setb %al1579; X64-NEXT: # kill: def $ax killed $ax killed $eax1580; X64-NEXT: retq1581entry:1582 %0 = and i16 %c, 151583 %shl = shl nuw i16 1, %01584 %1 = atomicrmw xor ptr %v, i16 %shl monotonic, align 21585 %conv2 = zext i16 %1 to i321586 %conv3 = zext i16 %c to i321587 %shl4 = shl nuw i32 1, %conv31588 %and = and i32 %shl4, %conv21589 %tobool = icmp ne i32 %and, 01590 %conv6 = zext i1 %tobool to i161591 ret i16 %conv61592}1593 1594define zeroext i16 @atomic_shl1_mask1_xor_16_gpr_valnz(ptr %v, i16 zeroext %c) nounwind {1595; X86-LABEL: atomic_shl1_mask1_xor_16_gpr_valnz:1596; X86: # %bb.0: # %entry1597; X86-NEXT: pushl %edi1598; X86-NEXT: pushl %esi1599; X86-NEXT: movzwl {{[0-9]+}}(%esp), %ecx1600; X86-NEXT: movl {{[0-9]+}}(%esp), %edx1601; X86-NEXT: movl $1, %esi1602; X86-NEXT: shll %cl, %esi1603; X86-NEXT: movzwl (%edx), %eax1604; X86-NEXT: .p2align 41605; X86-NEXT: .LBB27_1: # %atomicrmw.start1606; X86-NEXT: # =>This Inner Loop Header: Depth=11607; X86-NEXT: movl %eax, %edi1608; X86-NEXT: xorl %esi, %edi1609; X86-NEXT: # kill: def $ax killed $ax killed $eax1610; X86-NEXT: lock cmpxchgw %di, (%edx)1611; X86-NEXT: # kill: def $ax killed $ax def $eax1612; X86-NEXT: jne .LBB27_11613; X86-NEXT: # %bb.2: # %atomicrmw.end1614; X86-NEXT: movzwl %ax, %edx1615; X86-NEXT: andl $15, %ecx1616; X86-NEXT: xorl %eax, %eax1617; X86-NEXT: btl %ecx, %edx1618; X86-NEXT: setb %al1619; X86-NEXT: # kill: def $ax killed $ax killed $eax1620; X86-NEXT: popl %esi1621; X86-NEXT: popl %edi1622; X86-NEXT: retl1623;1624; X64-LABEL: atomic_shl1_mask1_xor_16_gpr_valnz:1625; X64: # %bb.0: # %entry1626; X64-NEXT: movl %esi, %ecx1627; X64-NEXT: movl $1, %edx1628; X64-NEXT: shll %cl, %edx1629; X64-NEXT: movzwl (%rdi), %eax1630; X64-NEXT: .p2align 41631; X64-NEXT: .LBB27_1: # %atomicrmw.start1632; X64-NEXT: # =>This Inner Loop Header: Depth=11633; X64-NEXT: movl %eax, %esi1634; X64-NEXT: xorl %edx, %esi1635; X64-NEXT: # kill: def $ax killed $ax killed $eax1636; X64-NEXT: lock cmpxchgw %si, (%rdi)1637; X64-NEXT: # kill: def $ax killed $ax def $eax1638; X64-NEXT: jne .LBB27_11639; X64-NEXT: # %bb.2: # %atomicrmw.end1640; X64-NEXT: movzwl %ax, %edx1641; X64-NEXT: andl $15, %ecx1642; X64-NEXT: xorl %eax, %eax1643; X64-NEXT: btl %ecx, %edx1644; X64-NEXT: setb %al1645; X64-NEXT: # kill: def $ax killed $ax killed $eax1646; X64-NEXT: retq1647entry:1648 %conv = zext i16 %c to i321649 %shl = shl nuw i32 1, %conv1650 %conv1 = trunc i32 %shl to i161651 %0 = atomicrmw xor ptr %v, i16 %conv1 monotonic, align 21652 %conv2 = zext i16 %0 to i321653 %1 = and i16 %c, 151654 %sh_prom = zext i16 %1 to i321655 %shl4 = shl nuw nsw i32 1, %sh_prom1656 %and = and i32 %shl4, %conv21657 %tobool = icmp ne i32 %and, 01658 %conv6 = zext i1 %tobool to i161659 ret i16 %conv61660}1661 1662define zeroext i16 @atomic_shl1_mask01_xor_16_gpr_valnz(ptr %v, i16 zeroext %c) nounwind {1663; X86-LABEL: atomic_shl1_mask01_xor_16_gpr_valnz:1664; X86: # %bb.0: # %entry1665; X86-NEXT: pushl %esi1666; X86-NEXT: movl {{[0-9]+}}(%esp), %edx1667; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx1668; X86-NEXT: andb $15, %cl1669; X86-NEXT: movl $1, %esi1670; X86-NEXT: shll %cl, %esi1671; X86-NEXT: movzwl (%edx), %eax1672; X86-NEXT: .p2align 41673; X86-NEXT: .LBB28_1: # %atomicrmw.start1674; X86-NEXT: # =>This Inner Loop Header: Depth=11675; X86-NEXT: movl %eax, %ecx1676; X86-NEXT: xorl %esi, %ecx1677; X86-NEXT: # kill: def $ax killed $ax killed $eax1678; X86-NEXT: lock cmpxchgw %cx, (%edx)1679; X86-NEXT: # kill: def $ax killed $ax def $eax1680; X86-NEXT: jne .LBB28_11681; X86-NEXT: # %bb.2: # %atomicrmw.end1682; X86-NEXT: movzwl %ax, %ecx1683; X86-NEXT: xorl %eax, %eax1684; X86-NEXT: testl %ecx, %esi1685; X86-NEXT: setne %al1686; X86-NEXT: # kill: def $ax killed $ax killed $eax1687; X86-NEXT: popl %esi1688; X86-NEXT: retl1689;1690; X64-LABEL: atomic_shl1_mask01_xor_16_gpr_valnz:1691; X64: # %bb.0: # %entry1692; X64-NEXT: movl %esi, %ecx1693; X64-NEXT: andb $15, %cl1694; X64-NEXT: movl $1, %edx1695; X64-NEXT: # kill: def $cl killed $cl killed $ecx1696; X64-NEXT: shll %cl, %edx1697; X64-NEXT: movzwl (%rdi), %eax1698; X64-NEXT: .p2align 41699; X64-NEXT: .LBB28_1: # %atomicrmw.start1700; X64-NEXT: # =>This Inner Loop Header: Depth=11701; X64-NEXT: movl %eax, %ecx1702; X64-NEXT: xorl %edx, %ecx1703; X64-NEXT: # kill: def $ax killed $ax killed $eax1704; X64-NEXT: lock cmpxchgw %cx, (%rdi)1705; X64-NEXT: # kill: def $ax killed $ax def $eax1706; X64-NEXT: jne .LBB28_11707; X64-NEXT: # %bb.2: # %atomicrmw.end1708; X64-NEXT: movzwl %ax, %ecx1709; X64-NEXT: xorl %eax, %eax1710; X64-NEXT: testl %ecx, %edx1711; X64-NEXT: setne %al1712; X64-NEXT: # kill: def $ax killed $ax killed $eax1713; X64-NEXT: retq1714entry:1715 %0 = and i16 %c, 151716 %sh_prom = zext i16 %0 to i321717 %shl = shl nuw nsw i32 1, %sh_prom1718 %conv1 = trunc i32 %shl to i161719 %1 = atomicrmw xor ptr %v, i16 %conv1 monotonic, align 21720 %conv2 = zext i16 %1 to i321721 %and = and i32 %shl, %conv21722 %tobool = icmp ne i32 %and, 01723 %conv8 = zext i1 %tobool to i161724 ret i16 %conv81725}1726 1727define zeroext i16 @atomic_blsi_xor_16_gpr_valnz(ptr %v, i16 zeroext %c) nounwind {1728; X86-LABEL: atomic_blsi_xor_16_gpr_valnz:1729; X86: # %bb.0: # %entry1730; X86-NEXT: pushl %esi1731; X86-NEXT: movl {{[0-9]+}}(%esp), %edx1732; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax1733; X86-NEXT: movl %eax, %ecx1734; X86-NEXT: negl %ecx1735; X86-NEXT: andl %eax, %ecx1736; X86-NEXT: movzwl (%edx), %eax1737; X86-NEXT: .p2align 41738; X86-NEXT: .LBB29_1: # %atomicrmw.start1739; X86-NEXT: # =>This Inner Loop Header: Depth=11740; X86-NEXT: movl %eax, %esi1741; X86-NEXT: xorl %ecx, %esi1742; X86-NEXT: # kill: def $ax killed $ax killed $eax1743; X86-NEXT: lock cmpxchgw %si, (%edx)1744; X86-NEXT: # kill: def $ax killed $ax def $eax1745; X86-NEXT: jne .LBB29_11746; X86-NEXT: # %bb.2: # %atomicrmw.end1747; X86-NEXT: movzwl %ax, %edx1748; X86-NEXT: xorl %eax, %eax1749; X86-NEXT: testl %edx, %ecx1750; X86-NEXT: setne %al1751; X86-NEXT: # kill: def $ax killed $ax killed $eax1752; X86-NEXT: popl %esi1753; X86-NEXT: retl1754;1755; X64-LABEL: atomic_blsi_xor_16_gpr_valnz:1756; X64: # %bb.0: # %entry1757; X64-NEXT: movl %esi, %ecx1758; X64-NEXT: negl %ecx1759; X64-NEXT: andl %esi, %ecx1760; X64-NEXT: movzwl (%rdi), %eax1761; X64-NEXT: .p2align 41762; X64-NEXT: .LBB29_1: # %atomicrmw.start1763; X64-NEXT: # =>This Inner Loop Header: Depth=11764; X64-NEXT: movl %eax, %edx1765; X64-NEXT: xorl %ecx, %edx1766; X64-NEXT: # kill: def $ax killed $ax killed $eax1767; X64-NEXT: lock cmpxchgw %dx, (%rdi)1768; X64-NEXT: # kill: def $ax killed $ax def $eax1769; X64-NEXT: jne .LBB29_11770; X64-NEXT: # %bb.2: # %atomicrmw.end1771; X64-NEXT: movzwl %ax, %edx1772; X64-NEXT: xorl %eax, %eax1773; X64-NEXT: testl %edx, %ecx1774; X64-NEXT: setne %al1775; X64-NEXT: # kill: def $ax killed $ax killed $eax1776; X64-NEXT: retq1777entry:1778 %conv = zext i16 %c to i321779 %sub = sub nsw i32 0, %conv1780 %and = and i32 %conv, %sub1781 %conv2 = trunc i32 %and to i161782 %0 = atomicrmw xor ptr %v, i16 %conv2 monotonic, align 21783 %conv3 = zext i16 %0 to i321784 %and8 = and i32 %and, %conv31785 %tobool = icmp ne i32 %and8, 01786 %conv10 = zext i1 %tobool to i161787 ret i16 %conv101788}1789 1790define zeroext i16 @atomic_shl1_xor_16_gpr_brz(ptr %v, i16 zeroext %c) nounwind {1791; X86-LABEL: atomic_shl1_xor_16_gpr_brz:1792; X86: # %bb.0: # %entry1793; X86-NEXT: pushl %edi1794; X86-NEXT: pushl %esi1795; X86-NEXT: movzwl {{[0-9]+}}(%esp), %ecx1796; X86-NEXT: movl {{[0-9]+}}(%esp), %edx1797; X86-NEXT: movl $1, %esi1798; X86-NEXT: shll %cl, %esi1799; X86-NEXT: movzwl (%edx), %eax1800; X86-NEXT: .p2align 41801; X86-NEXT: .LBB30_1: # %atomicrmw.start1802; X86-NEXT: # =>This Inner Loop Header: Depth=11803; X86-NEXT: movl %eax, %edi1804; X86-NEXT: xorl %esi, %edi1805; X86-NEXT: # kill: def $ax killed $ax killed $eax1806; X86-NEXT: lock cmpxchgw %di, (%edx)1807; X86-NEXT: # kill: def $ax killed $ax def $eax1808; X86-NEXT: jne .LBB30_11809; X86-NEXT: # %bb.2: # %atomicrmw.end1810; X86-NEXT: movzwl %ax, %edi1811; X86-NEXT: movw $123, %ax1812; X86-NEXT: testl %edi, %esi1813; X86-NEXT: jne .LBB30_41814; X86-NEXT: # %bb.3: # %if.then1815; X86-NEXT: movzwl %cx, %eax1816; X86-NEXT: movzwl (%edx,%eax,2), %eax1817; X86-NEXT: .LBB30_4: # %return1818; X86-NEXT: popl %esi1819; X86-NEXT: popl %edi1820; X86-NEXT: retl1821;1822; X64-LABEL: atomic_shl1_xor_16_gpr_brz:1823; X64: # %bb.0: # %entry1824; X64-NEXT: movl %esi, %ecx1825; X64-NEXT: movl $1, %edx1826; X64-NEXT: shll %cl, %edx1827; X64-NEXT: movzwl (%rdi), %eax1828; X64-NEXT: .p2align 41829; X64-NEXT: .LBB30_1: # %atomicrmw.start1830; X64-NEXT: # =>This Inner Loop Header: Depth=11831; X64-NEXT: movl %eax, %esi1832; X64-NEXT: xorl %edx, %esi1833; X64-NEXT: # kill: def $ax killed $ax killed $eax1834; X64-NEXT: lock cmpxchgw %si, (%rdi)1835; X64-NEXT: # kill: def $ax killed $ax def $eax1836; X64-NEXT: jne .LBB30_11837; X64-NEXT: # %bb.2: # %atomicrmw.end1838; X64-NEXT: movzwl %ax, %esi1839; X64-NEXT: movw $123, %ax1840; X64-NEXT: testl %esi, %edx1841; X64-NEXT: je .LBB30_31842; X64-NEXT: # %bb.4: # %return1843; X64-NEXT: retq1844; X64-NEXT: .LBB30_3: # %if.then1845; X64-NEXT: movzwl %cx, %eax1846; X64-NEXT: movzwl (%rdi,%rax,2), %eax1847; X64-NEXT: retq1848entry:1849 %conv = zext i16 %c to i321850 %shl = shl nuw i32 1, %conv1851 %conv1 = trunc i32 %shl to i161852 %0 = atomicrmw xor ptr %v, i16 %conv1 monotonic, align 21853 %conv2 = zext i16 %0 to i321854 %and = and i32 %shl, %conv21855 %tobool.not = icmp eq i32 %and, 01856 br i1 %tobool.not, label %if.then, label %return1857 1858if.then: ; preds = %entry1859 %idxprom = zext i16 %c to i641860 %arrayidx = getelementptr inbounds i16, ptr %v, i64 %idxprom1861 %1 = load i16, ptr %arrayidx, align 21862 br label %return1863 1864return: ; preds = %entry, %if.then1865 %retval.0 = phi i16 [ %1, %if.then ], [ 123, %entry ]1866 ret i16 %retval.01867}1868 1869define zeroext i16 @atomic_shl1_small_mask_xor_16_gpr_brz(ptr %v, i16 zeroext %c) nounwind {1870; X86-LABEL: atomic_shl1_small_mask_xor_16_gpr_brz:1871; X86: # %bb.0: # %entry1872; X86-NEXT: pushl %edi1873; X86-NEXT: pushl %esi1874; X86-NEXT: movl {{[0-9]+}}(%esp), %edx1875; X86-NEXT: movzwl {{[0-9]+}}(%esp), %ecx1876; X86-NEXT: andl $7, %ecx1877; X86-NEXT: movl $1, %esi1878; X86-NEXT: shll %cl, %esi1879; X86-NEXT: movzwl (%edx), %eax1880; X86-NEXT: movzwl %si, %esi1881; X86-NEXT: .p2align 41882; X86-NEXT: .LBB31_1: # %atomicrmw.start1883; X86-NEXT: # =>This Inner Loop Header: Depth=11884; X86-NEXT: movl %eax, %edi1885; X86-NEXT: xorl %esi, %edi1886; X86-NEXT: # kill: def $ax killed $ax killed $eax1887; X86-NEXT: lock cmpxchgw %di, (%edx)1888; X86-NEXT: # kill: def $ax killed $ax def $eax1889; X86-NEXT: jne .LBB31_11890; X86-NEXT: # %bb.2: # %atomicrmw.end1891; X86-NEXT: movzwl %ax, %esi1892; X86-NEXT: movw $123, %ax1893; X86-NEXT: btl %ecx, %esi1894; X86-NEXT: jb .LBB31_41895; X86-NEXT: # %bb.3: # %if.then1896; X86-NEXT: movzwl %cx, %eax1897; X86-NEXT: movzwl (%edx,%eax,2), %eax1898; X86-NEXT: .LBB31_4: # %return1899; X86-NEXT: popl %esi1900; X86-NEXT: popl %edi1901; X86-NEXT: retl1902;1903; X64-LABEL: atomic_shl1_small_mask_xor_16_gpr_brz:1904; X64: # %bb.0: # %entry1905; X64-NEXT: movl %esi, %ecx1906; X64-NEXT: andl $7, %ecx1907; X64-NEXT: movl $1, %edx1908; X64-NEXT: shll %cl, %edx1909; X64-NEXT: movzwl (%rdi), %eax1910; X64-NEXT: movzwl %dx, %edx1911; X64-NEXT: .p2align 41912; X64-NEXT: .LBB31_1: # %atomicrmw.start1913; X64-NEXT: # =>This Inner Loop Header: Depth=11914; X64-NEXT: movl %eax, %esi1915; X64-NEXT: xorl %edx, %esi1916; X64-NEXT: # kill: def $ax killed $ax killed $eax1917; X64-NEXT: lock cmpxchgw %si, (%rdi)1918; X64-NEXT: # kill: def $ax killed $ax def $eax1919; X64-NEXT: jne .LBB31_11920; X64-NEXT: # %bb.2: # %atomicrmw.end1921; X64-NEXT: movzwl %ax, %edx1922; X64-NEXT: movw $123, %ax1923; X64-NEXT: btl %ecx, %edx1924; X64-NEXT: jae .LBB31_31925; X64-NEXT: # %bb.4: # %return1926; X64-NEXT: retq1927; X64-NEXT: .LBB31_3: # %if.then1928; X64-NEXT: movzwl %cx, %eax1929; X64-NEXT: movzwl (%rdi,%rax,2), %eax1930; X64-NEXT: retq1931entry:1932 %0 = and i16 %c, 71933 %shl = shl nuw nsw i16 1, %01934 %1 = atomicrmw xor ptr %v, i16 %shl monotonic, align 21935 %conv5 = zext i16 %1 to i321936 %conv6 = zext i16 %0 to i321937 %shl7 = shl nuw nsw i32 1, %conv61938 %and = and i32 %shl7, %conv51939 %tobool.not = icmp eq i32 %and, 01940 br i1 %tobool.not, label %if.then, label %return1941 1942if.then: ; preds = %entry1943 %conv2 = zext i16 %0 to i641944 %arrayidx = getelementptr inbounds i16, ptr %v, i64 %conv21945 %2 = load i16, ptr %arrayidx, align 21946 br label %return1947 1948return: ; preds = %entry, %if.then1949 %retval.0 = phi i16 [ %2, %if.then ], [ 123, %entry ]1950 ret i16 %retval.01951}1952 1953define zeroext i16 @atomic_shl1_mask0_xor_16_gpr_brz(ptr %v, i16 zeroext %c) nounwind {1954; X86-LABEL: atomic_shl1_mask0_xor_16_gpr_brz:1955; X86: # %bb.0: # %entry1956; X86-NEXT: pushl %ebx1957; X86-NEXT: pushl %esi1958; X86-NEXT: movzwl {{[0-9]+}}(%esp), %ebx1959; X86-NEXT: movl {{[0-9]+}}(%esp), %edx1960; X86-NEXT: movl %ebx, %ecx1961; X86-NEXT: andb $15, %cl1962; X86-NEXT: movl $1, %esi1963; X86-NEXT: shll %cl, %esi1964; X86-NEXT: movzwl (%edx), %eax1965; X86-NEXT: .p2align 41966; X86-NEXT: .LBB32_1: # %atomicrmw.start1967; X86-NEXT: # =>This Inner Loop Header: Depth=11968; X86-NEXT: movl %eax, %ecx1969; X86-NEXT: xorl %esi, %ecx1970; X86-NEXT: # kill: def $ax killed $ax killed $eax1971; X86-NEXT: lock cmpxchgw %cx, (%edx)1972; X86-NEXT: # kill: def $ax killed $ax def $eax1973; X86-NEXT: jne .LBB32_11974; X86-NEXT: # %bb.2: # %atomicrmw.end1975; X86-NEXT: movzwl %ax, %ecx1976; X86-NEXT: movw $123, %ax1977; X86-NEXT: btl %ebx, %ecx1978; X86-NEXT: jb .LBB32_41979; X86-NEXT: # %bb.3: # %if.then1980; X86-NEXT: movzwl %bx, %eax1981; X86-NEXT: movzwl (%edx,%eax,2), %eax1982; X86-NEXT: .LBB32_4: # %return1983; X86-NEXT: popl %esi1984; X86-NEXT: popl %ebx1985; X86-NEXT: retl1986;1987; X64-LABEL: atomic_shl1_mask0_xor_16_gpr_brz:1988; X64: # %bb.0: # %entry1989; X64-NEXT: movl %esi, %ecx1990; X64-NEXT: andb $15, %cl1991; X64-NEXT: movl $1, %edx1992; X64-NEXT: shll %cl, %edx1993; X64-NEXT: movzwl (%rdi), %eax1994; X64-NEXT: .p2align 41995; X64-NEXT: .LBB32_1: # %atomicrmw.start1996; X64-NEXT: # =>This Inner Loop Header: Depth=11997; X64-NEXT: movl %eax, %ecx1998; X64-NEXT: xorl %edx, %ecx1999; X64-NEXT: # kill: def $ax killed $ax killed $eax2000; X64-NEXT: lock cmpxchgw %cx, (%rdi)2001; X64-NEXT: # kill: def $ax killed $ax def $eax2002; X64-NEXT: jne .LBB32_12003; X64-NEXT: # %bb.2: # %atomicrmw.end2004; X64-NEXT: movzwl %ax, %ecx2005; X64-NEXT: movw $123, %ax2006; X64-NEXT: btl %esi, %ecx2007; X64-NEXT: jae .LBB32_32008; X64-NEXT: # %bb.4: # %return2009; X64-NEXT: retq2010; X64-NEXT: .LBB32_3: # %if.then2011; X64-NEXT: movzwl %si, %eax2012; X64-NEXT: movzwl (%rdi,%rax,2), %eax2013; X64-NEXT: retq2014entry:2015 %0 = and i16 %c, 152016 %shl = shl nuw i16 1, %02017 %1 = atomicrmw xor ptr %v, i16 %shl monotonic, align 22018 %conv2 = zext i16 %1 to i322019 %conv3 = zext i16 %c to i322020 %shl4 = shl nuw i32 1, %conv32021 %and = and i32 %shl4, %conv22022 %tobool.not = icmp eq i32 %and, 02023 br i1 %tobool.not, label %if.then, label %return2024 2025if.then: ; preds = %entry2026 %conv = zext i16 %c to i642027 %arrayidx = getelementptr inbounds i16, ptr %v, i64 %conv2028 %2 = load i16, ptr %arrayidx, align 22029 br label %return2030 2031return: ; preds = %entry, %if.then2032 %retval.0 = phi i16 [ %2, %if.then ], [ 123, %entry ]2033 ret i16 %retval.02034}2035 2036define zeroext i16 @atomic_shl1_mask1_xor_16_gpr_brz(ptr %v, i16 zeroext %c) nounwind {2037; X86-LABEL: atomic_shl1_mask1_xor_16_gpr_brz:2038; X86: # %bb.0: # %entry2039; X86-NEXT: pushl %edi2040; X86-NEXT: pushl %esi2041; X86-NEXT: movzwl {{[0-9]+}}(%esp), %ecx2042; X86-NEXT: movl {{[0-9]+}}(%esp), %edx2043; X86-NEXT: movl $1, %esi2044; X86-NEXT: shll %cl, %esi2045; X86-NEXT: movzwl (%edx), %eax2046; X86-NEXT: .p2align 42047; X86-NEXT: .LBB33_1: # %atomicrmw.start2048; X86-NEXT: # =>This Inner Loop Header: Depth=12049; X86-NEXT: movl %eax, %edi2050; X86-NEXT: xorl %esi, %edi2051; X86-NEXT: # kill: def $ax killed $ax killed $eax2052; X86-NEXT: lock cmpxchgw %di, (%edx)2053; X86-NEXT: # kill: def $ax killed $ax def $eax2054; X86-NEXT: jne .LBB33_12055; X86-NEXT: # %bb.2: # %atomicrmw.end2056; X86-NEXT: movzwl %ax, %esi2057; X86-NEXT: movl %ecx, %edi2058; X86-NEXT: andl $15, %edi2059; X86-NEXT: movw $123, %ax2060; X86-NEXT: btl %edi, %esi2061; X86-NEXT: jb .LBB33_42062; X86-NEXT: # %bb.3: # %if.then2063; X86-NEXT: movzwl %cx, %eax2064; X86-NEXT: movzwl (%edx,%eax,2), %eax2065; X86-NEXT: .LBB33_4: # %return2066; X86-NEXT: popl %esi2067; X86-NEXT: popl %edi2068; X86-NEXT: retl2069;2070; X64-LABEL: atomic_shl1_mask1_xor_16_gpr_brz:2071; X64: # %bb.0: # %entry2072; X64-NEXT: movl %esi, %ecx2073; X64-NEXT: movl $1, %edx2074; X64-NEXT: shll %cl, %edx2075; X64-NEXT: movzwl (%rdi), %eax2076; X64-NEXT: .p2align 42077; X64-NEXT: .LBB33_1: # %atomicrmw.start2078; X64-NEXT: # =>This Inner Loop Header: Depth=12079; X64-NEXT: movl %eax, %esi2080; X64-NEXT: xorl %edx, %esi2081; X64-NEXT: # kill: def $ax killed $ax killed $eax2082; X64-NEXT: lock cmpxchgw %si, (%rdi)2083; X64-NEXT: # kill: def $ax killed $ax def $eax2084; X64-NEXT: jne .LBB33_12085; X64-NEXT: # %bb.2: # %atomicrmw.end2086; X64-NEXT: movzwl %ax, %edx2087; X64-NEXT: movl %ecx, %esi2088; X64-NEXT: andl $15, %esi2089; X64-NEXT: movw $123, %ax2090; X64-NEXT: btl %esi, %edx2091; X64-NEXT: jae .LBB33_32092; X64-NEXT: # %bb.4: # %return2093; X64-NEXT: retq2094; X64-NEXT: .LBB33_3: # %if.then2095; X64-NEXT: movzwl %cx, %eax2096; X64-NEXT: movzwl (%rdi,%rax,2), %eax2097; X64-NEXT: retq2098entry:2099 %conv = zext i16 %c to i322100 %shl = shl nuw i32 1, %conv2101 %conv1 = trunc i32 %shl to i162102 %0 = atomicrmw xor ptr %v, i16 %conv1 monotonic, align 22103 %conv2 = zext i16 %0 to i322104 %1 = and i16 %c, 152105 %sh_prom = zext i16 %1 to i322106 %shl4 = shl nuw nsw i32 1, %sh_prom2107 %and = and i32 %shl4, %conv22108 %tobool.not = icmp eq i32 %and, 02109 br i1 %tobool.not, label %if.then, label %return2110 2111if.then: ; preds = %entry2112 %conv3 = zext i16 %c to i642113 %arrayidx = getelementptr inbounds i16, ptr %v, i64 %conv32114 %2 = load i16, ptr %arrayidx, align 22115 br label %return2116 2117return: ; preds = %entry, %if.then2118 %retval.0 = phi i16 [ %2, %if.then ], [ 123, %entry ]2119 ret i16 %retval.02120}2121 2122define zeroext i16 @atomic_shl1_mask01_xor_16_gpr_brz(ptr %v, i16 zeroext %c) nounwind {2123; X86-LABEL: atomic_shl1_mask01_xor_16_gpr_brz:2124; X86: # %bb.0: # %entry2125; X86-NEXT: pushl %ebx2126; X86-NEXT: pushl %esi2127; X86-NEXT: movzwl {{[0-9]+}}(%esp), %ebx2128; X86-NEXT: movl {{[0-9]+}}(%esp), %edx2129; X86-NEXT: movl %ebx, %ecx2130; X86-NEXT: andb $15, %cl2131; X86-NEXT: movl $1, %esi2132; X86-NEXT: shll %cl, %esi2133; X86-NEXT: movzwl (%edx), %eax2134; X86-NEXT: .p2align 42135; X86-NEXT: .LBB34_1: # %atomicrmw.start2136; X86-NEXT: # =>This Inner Loop Header: Depth=12137; X86-NEXT: movl %eax, %ecx2138; X86-NEXT: xorl %esi, %ecx2139; X86-NEXT: # kill: def $ax killed $ax killed $eax2140; X86-NEXT: lock cmpxchgw %cx, (%edx)2141; X86-NEXT: # kill: def $ax killed $ax def $eax2142; X86-NEXT: jne .LBB34_12143; X86-NEXT: # %bb.2: # %atomicrmw.end2144; X86-NEXT: movzwl %ax, %ecx2145; X86-NEXT: movw $123, %ax2146; X86-NEXT: testl %ecx, %esi2147; X86-NEXT: jne .LBB34_42148; X86-NEXT: # %bb.3: # %if.then2149; X86-NEXT: movzwl %bx, %eax2150; X86-NEXT: movzwl (%edx,%eax,2), %eax2151; X86-NEXT: .LBB34_4: # %return2152; X86-NEXT: popl %esi2153; X86-NEXT: popl %ebx2154; X86-NEXT: retl2155;2156; X64-LABEL: atomic_shl1_mask01_xor_16_gpr_brz:2157; X64: # %bb.0: # %entry2158; X64-NEXT: movl %esi, %ecx2159; X64-NEXT: movl %ecx, %edx2160; X64-NEXT: andb $15, %cl2161; X64-NEXT: movl $1, %esi2162; X64-NEXT: # kill: def $cl killed $cl killed $ecx2163; X64-NEXT: shll %cl, %esi2164; X64-NEXT: movzwl (%rdi), %eax2165; X64-NEXT: .p2align 42166; X64-NEXT: .LBB34_1: # %atomicrmw.start2167; X64-NEXT: # =>This Inner Loop Header: Depth=12168; X64-NEXT: movl %eax, %ecx2169; X64-NEXT: xorl %esi, %ecx2170; X64-NEXT: # kill: def $ax killed $ax killed $eax2171; X64-NEXT: lock cmpxchgw %cx, (%rdi)2172; X64-NEXT: # kill: def $ax killed $ax def $eax2173; X64-NEXT: jne .LBB34_12174; X64-NEXT: # %bb.2: # %atomicrmw.end2175; X64-NEXT: movzwl %ax, %ecx2176; X64-NEXT: movw $123, %ax2177; X64-NEXT: testl %ecx, %esi2178; X64-NEXT: je .LBB34_32179; X64-NEXT: # %bb.4: # %return2180; X64-NEXT: retq2181; X64-NEXT: .LBB34_3: # %if.then2182; X64-NEXT: movzwl %dx, %eax2183; X64-NEXT: movzwl (%rdi,%rax,2), %eax2184; X64-NEXT: retq2185entry:2186 %0 = and i16 %c, 152187 %sh_prom = zext i16 %0 to i322188 %shl = shl nuw nsw i32 1, %sh_prom2189 %conv1 = trunc i32 %shl to i162190 %1 = atomicrmw xor ptr %v, i16 %conv1 monotonic, align 22191 %conv2 = zext i16 %1 to i322192 %and = and i32 %shl, %conv22193 %tobool.not = icmp eq i32 %and, 02194 br i1 %tobool.not, label %if.then, label %return2195 2196if.then: ; preds = %entry2197 %conv = zext i16 %c to i642198 %arrayidx = getelementptr inbounds i16, ptr %v, i64 %conv2199 %2 = load i16, ptr %arrayidx, align 22200 br label %return2201 2202return: ; preds = %entry, %if.then2203 %retval.0 = phi i16 [ %2, %if.then ], [ 123, %entry ]2204 ret i16 %retval.02205}2206 2207define zeroext i16 @atomic_blsi_xor_16_gpr_brz(ptr %v, i16 zeroext %c) nounwind {2208; X86-LABEL: atomic_blsi_xor_16_gpr_brz:2209; X86: # %bb.0: # %entry2210; X86-NEXT: pushl %edi2211; X86-NEXT: pushl %esi2212; X86-NEXT: movzwl {{[0-9]+}}(%esp), %ecx2213; X86-NEXT: movl {{[0-9]+}}(%esp), %edx2214; X86-NEXT: movl %ecx, %esi2215; X86-NEXT: negl %esi2216; X86-NEXT: andl %ecx, %esi2217; X86-NEXT: movzwl (%edx), %eax2218; X86-NEXT: .p2align 42219; X86-NEXT: .LBB35_1: # %atomicrmw.start2220; X86-NEXT: # =>This Inner Loop Header: Depth=12221; X86-NEXT: movl %eax, %edi2222; X86-NEXT: xorl %esi, %edi2223; X86-NEXT: # kill: def $ax killed $ax killed $eax2224; X86-NEXT: lock cmpxchgw %di, (%edx)2225; X86-NEXT: # kill: def $ax killed $ax def $eax2226; X86-NEXT: jne .LBB35_12227; X86-NEXT: # %bb.2: # %atomicrmw.end2228; X86-NEXT: movzwl %ax, %edi2229; X86-NEXT: movw $123, %ax2230; X86-NEXT: testl %edi, %esi2231; X86-NEXT: jne .LBB35_42232; X86-NEXT: # %bb.3: # %if.then2233; X86-NEXT: movzwl %cx, %eax2234; X86-NEXT: movzwl (%edx,%eax,2), %eax2235; X86-NEXT: .LBB35_4: # %return2236; X86-NEXT: popl %esi2237; X86-NEXT: popl %edi2238; X86-NEXT: retl2239;2240; X64-LABEL: atomic_blsi_xor_16_gpr_brz:2241; X64: # %bb.0: # %entry2242; X64-NEXT: movl %esi, %ecx2243; X64-NEXT: negl %ecx2244; X64-NEXT: andl %esi, %ecx2245; X64-NEXT: movzwl (%rdi), %eax2246; X64-NEXT: .p2align 42247; X64-NEXT: .LBB35_1: # %atomicrmw.start2248; X64-NEXT: # =>This Inner Loop Header: Depth=12249; X64-NEXT: movl %eax, %edx2250; X64-NEXT: xorl %ecx, %edx2251; X64-NEXT: # kill: def $ax killed $ax killed $eax2252; X64-NEXT: lock cmpxchgw %dx, (%rdi)2253; X64-NEXT: # kill: def $ax killed $ax def $eax2254; X64-NEXT: jne .LBB35_12255; X64-NEXT: # %bb.2: # %atomicrmw.end2256; X64-NEXT: movzwl %ax, %edx2257; X64-NEXT: movw $123, %ax2258; X64-NEXT: testl %edx, %ecx2259; X64-NEXT: je .LBB35_32260; X64-NEXT: # %bb.4: # %return2261; X64-NEXT: retq2262; X64-NEXT: .LBB35_3: # %if.then2263; X64-NEXT: movzwl %si, %eax2264; X64-NEXT: movzwl (%rdi,%rax,2), %eax2265; X64-NEXT: retq2266entry:2267 %conv = zext i16 %c to i322268 %sub = sub nsw i32 0, %conv2269 %and = and i32 %conv, %sub2270 %conv2 = trunc i32 %and to i162271 %0 = atomicrmw xor ptr %v, i16 %conv2 monotonic, align 22272 %conv3 = zext i16 %0 to i322273 %and8 = and i32 %and, %conv32274 %tobool.not = icmp eq i32 %and8, 02275 br i1 %tobool.not, label %if.then, label %return2276 2277if.then: ; preds = %entry2278 %idxprom = zext i16 %c to i642279 %arrayidx = getelementptr inbounds i16, ptr %v, i64 %idxprom2280 %1 = load i16, ptr %arrayidx, align 22281 br label %return2282 2283return: ; preds = %entry, %if.then2284 %retval.0 = phi i16 [ %1, %if.then ], [ 123, %entry ]2285 ret i16 %retval.02286}2287 2288define zeroext i16 @atomic_shl1_and_16_gpr_val(ptr %v, i16 zeroext %c) nounwind {2289; X86-LABEL: atomic_shl1_and_16_gpr_val:2290; X86: # %bb.0: # %entry2291; X86-NEXT: pushl %edi2292; X86-NEXT: pushl %esi2293; X86-NEXT: movl {{[0-9]+}}(%esp), %esi2294; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx2295; X86-NEXT: movl $1, %edx2296; X86-NEXT: shll %cl, %edx2297; X86-NEXT: movl $-2, %edi2298; X86-NEXT: roll %cl, %edi2299; X86-NEXT: movzwl (%esi), %eax2300; X86-NEXT: .p2align 42301; X86-NEXT: .LBB36_1: # %atomicrmw.start2302; X86-NEXT: # =>This Inner Loop Header: Depth=12303; X86-NEXT: movl %eax, %ecx2304; X86-NEXT: andl %edi, %ecx2305; X86-NEXT: # kill: def $ax killed $ax killed $eax2306; X86-NEXT: lock cmpxchgw %cx, (%esi)2307; X86-NEXT: # kill: def $ax killed $ax def $eax2308; X86-NEXT: jne .LBB36_12309; X86-NEXT: # %bb.2: # %atomicrmw.end2310; X86-NEXT: andl %edx, %eax2311; X86-NEXT: # kill: def $ax killed $ax killed $eax2312; X86-NEXT: popl %esi2313; X86-NEXT: popl %edi2314; X86-NEXT: retl2315;2316; X64-LABEL: atomic_shl1_and_16_gpr_val:2317; X64: # %bb.0: # %entry2318; X64-NEXT: movl %esi, %ecx2319; X64-NEXT: movl $1, %edx2320; X64-NEXT: shll %cl, %edx2321; X64-NEXT: movl $-2, %esi2322; X64-NEXT: # kill: def $cl killed $cl killed $ecx2323; X64-NEXT: roll %cl, %esi2324; X64-NEXT: movzwl (%rdi), %eax2325; X64-NEXT: .p2align 42326; X64-NEXT: .LBB36_1: # %atomicrmw.start2327; X64-NEXT: # =>This Inner Loop Header: Depth=12328; X64-NEXT: movl %eax, %ecx2329; X64-NEXT: andl %esi, %ecx2330; X64-NEXT: # kill: def $ax killed $ax killed $eax2331; X64-NEXT: lock cmpxchgw %cx, (%rdi)2332; X64-NEXT: # kill: def $ax killed $ax def $eax2333; X64-NEXT: jne .LBB36_12334; X64-NEXT: # %bb.2: # %atomicrmw.end2335; X64-NEXT: andl %edx, %eax2336; X64-NEXT: # kill: def $ax killed $ax killed $eax2337; X64-NEXT: retq2338entry:2339 %conv = zext i16 %c to i322340 %shl = shl nuw i32 1, %conv2341 %0 = trunc i32 %shl to i162342 %conv1 = xor i16 %0, -12343 %1 = atomicrmw and ptr %v, i16 %conv1 monotonic, align 22344 %conv5 = and i16 %1, %02345 ret i16 %conv52346}2347 2348define zeroext i16 @atomic_shl1_small_mask_and_16_gpr_val(ptr %v, i16 zeroext %c) nounwind {2349; X86-LABEL: atomic_shl1_small_mask_and_16_gpr_val:2350; X86: # %bb.0: # %entry2351; X86-NEXT: movl {{[0-9]+}}(%esp), %edx2352; X86-NEXT: movzwl {{[0-9]+}}(%esp), %ecx2353; X86-NEXT: andl $7, %ecx2354; X86-NEXT: xorl %eax, %eax2355; X86-NEXT: lock btrw %cx, (%edx)2356; X86-NEXT: setb %al2357; X86-NEXT: # kill: def $cl killed $cl killed $ecx2358; X86-NEXT: shll %cl, %eax2359; X86-NEXT: # kill: def $ax killed $ax killed $eax2360; X86-NEXT: retl2361;2362; X64-LABEL: atomic_shl1_small_mask_and_16_gpr_val:2363; X64: # %bb.0: # %entry2364; X64-NEXT: movl %esi, %ecx2365; X64-NEXT: andl $7, %ecx2366; X64-NEXT: xorl %eax, %eax2367; X64-NEXT: lock btrw %cx, (%rdi)2368; X64-NEXT: setb %al2369; X64-NEXT: # kill: def $cl killed $cl killed $ecx2370; X64-NEXT: shll %cl, %eax2371; X64-NEXT: # kill: def $ax killed $ax killed $eax2372; X64-NEXT: retq2373entry:2374 %0 = and i16 %c, 72375 %shl = shl nuw nsw i16 1, %02376 %not = xor i16 %shl, -12377 %1 = atomicrmw and ptr %v, i16 %not monotonic, align 22378 %and = and i16 %shl, %12379 ret i16 %and2380}2381 2382define zeroext i16 @atomic_shl1_mask0_and_16_gpr_val(ptr %v, i16 zeroext %c) nounwind {2383; X86-LABEL: atomic_shl1_mask0_and_16_gpr_val:2384; X86: # %bb.0: # %entry2385; X86-NEXT: pushl %edi2386; X86-NEXT: pushl %esi2387; X86-NEXT: movzwl {{[0-9]+}}(%esp), %ecx2388; X86-NEXT: movl {{[0-9]+}}(%esp), %edx2389; X86-NEXT: movw $-2, %si2390; X86-NEXT: rolw %cl, %si2391; X86-NEXT: movzwl (%edx), %eax2392; X86-NEXT: .p2align 42393; X86-NEXT: .LBB38_1: # %atomicrmw.start2394; X86-NEXT: # =>This Inner Loop Header: Depth=12395; X86-NEXT: movl %eax, %edi2396; X86-NEXT: andl %esi, %edi2397; X86-NEXT: # kill: def $ax killed $ax killed $eax2398; X86-NEXT: lock cmpxchgw %di, (%edx)2399; X86-NEXT: # kill: def $ax killed $ax def $eax2400; X86-NEXT: jne .LBB38_12401; X86-NEXT: # %bb.2: # %atomicrmw.end2402; X86-NEXT: movl $1, %edx2403; X86-NEXT: # kill: def $cl killed $cl killed $cx2404; X86-NEXT: shll %cl, %edx2405; X86-NEXT: andl %edx, %eax2406; X86-NEXT: # kill: def $ax killed $ax killed $eax2407; X86-NEXT: popl %esi2408; X86-NEXT: popl %edi2409; X86-NEXT: retl2410;2411; X64-LABEL: atomic_shl1_mask0_and_16_gpr_val:2412; X64: # %bb.0: # %entry2413; X64-NEXT: movl %esi, %ecx2414; X64-NEXT: movw $-2, %dx2415; X64-NEXT: rolw %cl, %dx2416; X64-NEXT: movzwl (%rdi), %eax2417; X64-NEXT: .p2align 42418; X64-NEXT: .LBB38_1: # %atomicrmw.start2419; X64-NEXT: # =>This Inner Loop Header: Depth=12420; X64-NEXT: movl %eax, %esi2421; X64-NEXT: andl %edx, %esi2422; X64-NEXT: # kill: def $ax killed $ax killed $eax2423; X64-NEXT: lock cmpxchgw %si, (%rdi)2424; X64-NEXT: # kill: def $ax killed $ax def $eax2425; X64-NEXT: jne .LBB38_12426; X64-NEXT: # %bb.2: # %atomicrmw.end2427; X64-NEXT: movl $1, %edx2428; X64-NEXT: # kill: def $cl killed $cl killed $ecx2429; X64-NEXT: shll %cl, %edx2430; X64-NEXT: andl %edx, %eax2431; X64-NEXT: # kill: def $ax killed $ax killed $eax2432; X64-NEXT: retq2433entry:2434 %0 = and i16 %c, 152435 %shl = shl nuw i16 1, %02436 %not = xor i16 %shl, -12437 %1 = atomicrmw and ptr %v, i16 %not monotonic, align 22438 %conv3 = zext i16 %c to i322439 %shl4 = shl nuw i32 1, %conv32440 %2 = trunc i32 %shl4 to i162441 %conv5 = and i16 %1, %22442 ret i16 %conv52443}2444 2445define zeroext i16 @atomic_shl1_mask1_and_16_gpr_val(ptr %v, i16 zeroext %c) nounwind {2446; X86-LABEL: atomic_shl1_mask1_and_16_gpr_val:2447; X86: # %bb.0: # %entry2448; X86-NEXT: pushl %edi2449; X86-NEXT: pushl %esi2450; X86-NEXT: movzwl {{[0-9]+}}(%esp), %ecx2451; X86-NEXT: movl {{[0-9]+}}(%esp), %edx2452; X86-NEXT: movl $-2, %esi2453; X86-NEXT: roll %cl, %esi2454; X86-NEXT: movzwl (%edx), %eax2455; X86-NEXT: .p2align 42456; X86-NEXT: .LBB39_1: # %atomicrmw.start2457; X86-NEXT: # =>This Inner Loop Header: Depth=12458; X86-NEXT: movl %eax, %edi2459; X86-NEXT: andl %esi, %edi2460; X86-NEXT: # kill: def $ax killed $ax killed $eax2461; X86-NEXT: lock cmpxchgw %di, (%edx)2462; X86-NEXT: # kill: def $ax killed $ax def $eax2463; X86-NEXT: jne .LBB39_12464; X86-NEXT: # %bb.2: # %atomicrmw.end2465; X86-NEXT: andb $15, %cl2466; X86-NEXT: movl $1, %edx2467; X86-NEXT: # kill: def $cl killed $cl killed $cx2468; X86-NEXT: shll %cl, %edx2469; X86-NEXT: andl %edx, %eax2470; X86-NEXT: # kill: def $ax killed $ax killed $eax2471; X86-NEXT: popl %esi2472; X86-NEXT: popl %edi2473; X86-NEXT: retl2474;2475; X64-LABEL: atomic_shl1_mask1_and_16_gpr_val:2476; X64: # %bb.0: # %entry2477; X64-NEXT: movl %esi, %ecx2478; X64-NEXT: movl $-2, %edx2479; X64-NEXT: roll %cl, %edx2480; X64-NEXT: movzwl (%rdi), %eax2481; X64-NEXT: .p2align 42482; X64-NEXT: .LBB39_1: # %atomicrmw.start2483; X64-NEXT: # =>This Inner Loop Header: Depth=12484; X64-NEXT: movl %eax, %esi2485; X64-NEXT: andl %edx, %esi2486; X64-NEXT: # kill: def $ax killed $ax killed $eax2487; X64-NEXT: lock cmpxchgw %si, (%rdi)2488; X64-NEXT: # kill: def $ax killed $ax def $eax2489; X64-NEXT: jne .LBB39_12490; X64-NEXT: # %bb.2: # %atomicrmw.end2491; X64-NEXT: andb $15, %cl2492; X64-NEXT: movl $1, %edx2493; X64-NEXT: # kill: def $cl killed $cl killed $ecx2494; X64-NEXT: shll %cl, %edx2495; X64-NEXT: andl %edx, %eax2496; X64-NEXT: # kill: def $ax killed $ax killed $eax2497; X64-NEXT: retq2498entry:2499 %conv = zext i16 %c to i322500 %shl = shl nuw i32 1, %conv2501 %0 = trunc i32 %shl to i162502 %conv1 = xor i16 %0, -12503 %1 = atomicrmw and ptr %v, i16 %conv1 monotonic, align 22504 %2 = and i16 %c, 152505 %shl4 = shl nuw i16 1, %22506 %and = and i16 %1, %shl42507 ret i16 %and2508}2509 2510define zeroext i16 @atomic_shl1_mask01_and_16_gpr_val(ptr %v, i16 zeroext %c) nounwind {2511; X86-LABEL: atomic_shl1_mask01_and_16_gpr_val:2512; X86: # %bb.0: # %entry2513; X86-NEXT: movl {{[0-9]+}}(%esp), %edx2514; X86-NEXT: movzwl {{[0-9]+}}(%esp), %ecx2515; X86-NEXT: andl $15, %ecx2516; X86-NEXT: xorl %eax, %eax2517; X86-NEXT: lock btrw %cx, (%edx)2518; X86-NEXT: setb %al2519; X86-NEXT: # kill: def $cl killed $cl killed $ecx2520; X86-NEXT: shll %cl, %eax2521; X86-NEXT: # kill: def $ax killed $ax killed $eax2522; X86-NEXT: retl2523;2524; X64-LABEL: atomic_shl1_mask01_and_16_gpr_val:2525; X64: # %bb.0: # %entry2526; X64-NEXT: movl %esi, %ecx2527; X64-NEXT: andl $15, %ecx2528; X64-NEXT: xorl %eax, %eax2529; X64-NEXT: lock btrw %cx, (%rdi)2530; X64-NEXT: setb %al2531; X64-NEXT: # kill: def $cl killed $cl killed $ecx2532; X64-NEXT: shll %cl, %eax2533; X64-NEXT: # kill: def $ax killed $ax killed $eax2534; X64-NEXT: retq2535entry:2536 %0 = and i16 %c, 152537 %shl = shl nuw i16 1, %02538 %conv1 = xor i16 %shl, -12539 %1 = atomicrmw and ptr %v, i16 %conv1 monotonic, align 22540 %conv7 = and i16 %1, %shl2541 ret i16 %conv72542}2543 2544define zeroext i16 @atomic_blsi_and_16_gpr_val(ptr %v, i16 zeroext %c) nounwind {2545; X86-LABEL: atomic_blsi_and_16_gpr_val:2546; X86: # %bb.0: # %entry2547; X86-NEXT: pushl %edi2548; X86-NEXT: pushl %esi2549; X86-NEXT: movl {{[0-9]+}}(%esp), %edx2550; X86-NEXT: movl {{[0-9]+}}(%esp), %eax2551; X86-NEXT: movl %eax, %ecx2552; X86-NEXT: negl %ecx2553; X86-NEXT: andl %eax, %ecx2554; X86-NEXT: movl %ecx, %esi2555; X86-NEXT: notl %esi2556; X86-NEXT: movzwl (%edx), %eax2557; X86-NEXT: .p2align 42558; X86-NEXT: .LBB41_1: # %atomicrmw.start2559; X86-NEXT: # =>This Inner Loop Header: Depth=12560; X86-NEXT: movl %eax, %edi2561; X86-NEXT: andl %esi, %edi2562; X86-NEXT: # kill: def $ax killed $ax killed $eax2563; X86-NEXT: lock cmpxchgw %di, (%edx)2564; X86-NEXT: # kill: def $ax killed $ax def $eax2565; X86-NEXT: jne .LBB41_12566; X86-NEXT: # %bb.2: # %atomicrmw.end2567; X86-NEXT: andl %ecx, %eax2568; X86-NEXT: # kill: def $ax killed $ax killed $eax2569; X86-NEXT: popl %esi2570; X86-NEXT: popl %edi2571; X86-NEXT: retl2572;2573; X64-LABEL: atomic_blsi_and_16_gpr_val:2574; X64: # %bb.0: # %entry2575; X64-NEXT: movl %esi, %ecx2576; X64-NEXT: negl %ecx2577; X64-NEXT: andl %esi, %ecx2578; X64-NEXT: movl %ecx, %edx2579; X64-NEXT: notl %edx2580; X64-NEXT: movzwl (%rdi), %eax2581; X64-NEXT: .p2align 42582; X64-NEXT: .LBB41_1: # %atomicrmw.start2583; X64-NEXT: # =>This Inner Loop Header: Depth=12584; X64-NEXT: movl %eax, %esi2585; X64-NEXT: andl %edx, %esi2586; X64-NEXT: # kill: def $ax killed $ax killed $eax2587; X64-NEXT: lock cmpxchgw %si, (%rdi)2588; X64-NEXT: # kill: def $ax killed $ax def $eax2589; X64-NEXT: jne .LBB41_12590; X64-NEXT: # %bb.2: # %atomicrmw.end2591; X64-NEXT: andl %ecx, %eax2592; X64-NEXT: # kill: def $ax killed $ax killed $eax2593; X64-NEXT: retq2594entry:2595 %sub = sub i16 0, %c2596 %and = and i16 %sub, %c2597 %conv2 = xor i16 %and, -12598 %0 = atomicrmw and ptr %v, i16 %conv2 monotonic, align 22599 %conv9 = and i16 %0, %and2600 ret i16 %conv92601}2602 2603define zeroext i16 @atomic_shl1_and_16_gpr_valnz(ptr %v, i16 zeroext %c) nounwind {2604; X86-LABEL: atomic_shl1_and_16_gpr_valnz:2605; X86: # %bb.0: # %entry2606; X86-NEXT: pushl %edi2607; X86-NEXT: pushl %esi2608; X86-NEXT: movl {{[0-9]+}}(%esp), %esi2609; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx2610; X86-NEXT: movl $1, %edx2611; X86-NEXT: shll %cl, %edx2612; X86-NEXT: movl $-2, %edi2613; X86-NEXT: roll %cl, %edi2614; X86-NEXT: movzwl (%esi), %eax2615; X86-NEXT: .p2align 42616; X86-NEXT: .LBB42_1: # %atomicrmw.start2617; X86-NEXT: # =>This Inner Loop Header: Depth=12618; X86-NEXT: movl %eax, %ecx2619; X86-NEXT: andl %edi, %ecx2620; X86-NEXT: # kill: def $ax killed $ax killed $eax2621; X86-NEXT: lock cmpxchgw %cx, (%esi)2622; X86-NEXT: # kill: def $ax killed $ax def $eax2623; X86-NEXT: jne .LBB42_12624; X86-NEXT: # %bb.2: # %atomicrmw.end2625; X86-NEXT: movzwl %ax, %ecx2626; X86-NEXT: xorl %eax, %eax2627; X86-NEXT: testl %ecx, %edx2628; X86-NEXT: setne %al2629; X86-NEXT: # kill: def $ax killed $ax killed $eax2630; X86-NEXT: popl %esi2631; X86-NEXT: popl %edi2632; X86-NEXT: retl2633;2634; X64-LABEL: atomic_shl1_and_16_gpr_valnz:2635; X64: # %bb.0: # %entry2636; X64-NEXT: movl %esi, %ecx2637; X64-NEXT: movl $1, %edx2638; X64-NEXT: shll %cl, %edx2639; X64-NEXT: movl $-2, %esi2640; X64-NEXT: # kill: def $cl killed $cl killed $ecx2641; X64-NEXT: roll %cl, %esi2642; X64-NEXT: movzwl (%rdi), %eax2643; X64-NEXT: .p2align 42644; X64-NEXT: .LBB42_1: # %atomicrmw.start2645; X64-NEXT: # =>This Inner Loop Header: Depth=12646; X64-NEXT: movl %eax, %ecx2647; X64-NEXT: andl %esi, %ecx2648; X64-NEXT: # kill: def $ax killed $ax killed $eax2649; X64-NEXT: lock cmpxchgw %cx, (%rdi)2650; X64-NEXT: # kill: def $ax killed $ax def $eax2651; X64-NEXT: jne .LBB42_12652; X64-NEXT: # %bb.2: # %atomicrmw.end2653; X64-NEXT: movzwl %ax, %ecx2654; X64-NEXT: xorl %eax, %eax2655; X64-NEXT: testl %ecx, %edx2656; X64-NEXT: setne %al2657; X64-NEXT: # kill: def $ax killed $ax killed $eax2658; X64-NEXT: retq2659entry:2660 %conv = zext i16 %c to i322661 %shl = shl nuw i32 1, %conv2662 %0 = trunc i32 %shl to i162663 %conv1 = xor i16 %0, -12664 %1 = atomicrmw and ptr %v, i16 %conv1 monotonic, align 22665 %conv2 = zext i16 %1 to i322666 %and = and i32 %shl, %conv22667 %tobool = icmp ne i32 %and, 02668 %conv6 = zext i1 %tobool to i162669 ret i16 %conv62670}2671 2672define zeroext i16 @atomic_shl1_small_mask_and_16_gpr_valnz(ptr %v, i16 zeroext %c) nounwind {2673; X86-LABEL: atomic_shl1_small_mask_and_16_gpr_valnz:2674; X86: # %bb.0: # %entry2675; X86-NEXT: pushl %edi2676; X86-NEXT: pushl %esi2677; X86-NEXT: movl {{[0-9]+}}(%esp), %edx2678; X86-NEXT: movzwl {{[0-9]+}}(%esp), %ecx2679; X86-NEXT: andl $7, %ecx2680; X86-NEXT: movw $-2, %si2681; X86-NEXT: rolw %cl, %si2682; X86-NEXT: movzwl (%edx), %eax2683; X86-NEXT: .p2align 42684; X86-NEXT: .LBB43_1: # %atomicrmw.start2685; X86-NEXT: # =>This Inner Loop Header: Depth=12686; X86-NEXT: movl %eax, %edi2687; X86-NEXT: andl %esi, %edi2688; X86-NEXT: # kill: def $ax killed $ax killed $eax2689; X86-NEXT: lock cmpxchgw %di, (%edx)2690; X86-NEXT: # kill: def $ax killed $ax def $eax2691; X86-NEXT: jne .LBB43_12692; X86-NEXT: # %bb.2: # %atomicrmw.end2693; X86-NEXT: movzwl %ax, %edx2694; X86-NEXT: xorl %eax, %eax2695; X86-NEXT: btl %ecx, %edx2696; X86-NEXT: setb %al2697; X86-NEXT: # kill: def $ax killed $ax killed $eax2698; X86-NEXT: popl %esi2699; X86-NEXT: popl %edi2700; X86-NEXT: retl2701;2702; X64-LABEL: atomic_shl1_small_mask_and_16_gpr_valnz:2703; X64: # %bb.0: # %entry2704; X64-NEXT: movl %esi, %ecx2705; X64-NEXT: andl $7, %ecx2706; X64-NEXT: movw $-2, %dx2707; X64-NEXT: rolw %cl, %dx2708; X64-NEXT: movzwl (%rdi), %eax2709; X64-NEXT: .p2align 42710; X64-NEXT: .LBB43_1: # %atomicrmw.start2711; X64-NEXT: # =>This Inner Loop Header: Depth=12712; X64-NEXT: movl %eax, %esi2713; X64-NEXT: andl %edx, %esi2714; X64-NEXT: # kill: def $ax killed $ax killed $eax2715; X64-NEXT: lock cmpxchgw %si, (%rdi)2716; X64-NEXT: # kill: def $ax killed $ax def $eax2717; X64-NEXT: jne .LBB43_12718; X64-NEXT: # %bb.2: # %atomicrmw.end2719; X64-NEXT: movzwl %ax, %edx2720; X64-NEXT: xorl %eax, %eax2721; X64-NEXT: btl %ecx, %edx2722; X64-NEXT: setb %al2723; X64-NEXT: # kill: def $ax killed $ax killed $eax2724; X64-NEXT: retq2725entry:2726 %0 = and i16 %c, 72727 %shl = shl nuw nsw i16 1, %02728 %not = xor i16 %shl, -12729 %1 = atomicrmw and ptr %v, i16 %not monotonic, align 22730 %conv5 = zext i16 %1 to i322731 %conv6 = zext i16 %0 to i322732 %shl7 = shl nuw nsw i32 1, %conv62733 %and = and i32 %shl7, %conv52734 %tobool = icmp ne i32 %and, 02735 %conv9 = zext i1 %tobool to i162736 ret i16 %conv92737}2738 2739define zeroext i16 @atomic_shl1_mask0_and_16_gpr_valnz(ptr %v, i16 zeroext %c) nounwind {2740; X86-LABEL: atomic_shl1_mask0_and_16_gpr_valnz:2741; X86: # %bb.0: # %entry2742; X86-NEXT: pushl %edi2743; X86-NEXT: pushl %esi2744; X86-NEXT: movzwl {{[0-9]+}}(%esp), %ecx2745; X86-NEXT: movl {{[0-9]+}}(%esp), %edx2746; X86-NEXT: movw $-2, %si2747; X86-NEXT: rolw %cl, %si2748; X86-NEXT: movzwl (%edx), %eax2749; X86-NEXT: .p2align 42750; X86-NEXT: .LBB44_1: # %atomicrmw.start2751; X86-NEXT: # =>This Inner Loop Header: Depth=12752; X86-NEXT: movl %eax, %edi2753; X86-NEXT: andl %esi, %edi2754; X86-NEXT: # kill: def $ax killed $ax killed $eax2755; X86-NEXT: lock cmpxchgw %di, (%edx)2756; X86-NEXT: # kill: def $ax killed $ax def $eax2757; X86-NEXT: jne .LBB44_12758; X86-NEXT: # %bb.2: # %atomicrmw.end2759; X86-NEXT: movzwl %ax, %edx2760; X86-NEXT: xorl %eax, %eax2761; X86-NEXT: btl %ecx, %edx2762; X86-NEXT: setb %al2763; X86-NEXT: # kill: def $ax killed $ax killed $eax2764; X86-NEXT: popl %esi2765; X86-NEXT: popl %edi2766; X86-NEXT: retl2767;2768; X64-LABEL: atomic_shl1_mask0_and_16_gpr_valnz:2769; X64: # %bb.0: # %entry2770; X64-NEXT: movl %esi, %ecx2771; X64-NEXT: movw $-2, %dx2772; X64-NEXT: rolw %cl, %dx2773; X64-NEXT: movzwl (%rdi), %eax2774; X64-NEXT: .p2align 42775; X64-NEXT: .LBB44_1: # %atomicrmw.start2776; X64-NEXT: # =>This Inner Loop Header: Depth=12777; X64-NEXT: movl %eax, %esi2778; X64-NEXT: andl %edx, %esi2779; X64-NEXT: # kill: def $ax killed $ax killed $eax2780; X64-NEXT: lock cmpxchgw %si, (%rdi)2781; X64-NEXT: # kill: def $ax killed $ax def $eax2782; X64-NEXT: jne .LBB44_12783; X64-NEXT: # %bb.2: # %atomicrmw.end2784; X64-NEXT: movzwl %ax, %edx2785; X64-NEXT: xorl %eax, %eax2786; X64-NEXT: btl %ecx, %edx2787; X64-NEXT: setb %al2788; X64-NEXT: # kill: def $ax killed $ax killed $eax2789; X64-NEXT: retq2790entry:2791 %0 = and i16 %c, 152792 %shl = shl nuw i16 1, %02793 %not = xor i16 %shl, -12794 %1 = atomicrmw and ptr %v, i16 %not monotonic, align 22795 %conv2 = zext i16 %1 to i322796 %conv3 = zext i16 %c to i322797 %shl4 = shl nuw i32 1, %conv32798 %and = and i32 %shl4, %conv22799 %tobool = icmp ne i32 %and, 02800 %conv6 = zext i1 %tobool to i162801 ret i16 %conv62802}2803 2804define zeroext i16 @atomic_shl1_mask1_and_16_gpr_valnz(ptr %v, i16 zeroext %c) nounwind {2805; X86-LABEL: atomic_shl1_mask1_and_16_gpr_valnz:2806; X86: # %bb.0: # %entry2807; X86-NEXT: pushl %edi2808; X86-NEXT: pushl %esi2809; X86-NEXT: movzwl {{[0-9]+}}(%esp), %ecx2810; X86-NEXT: movl {{[0-9]+}}(%esp), %edx2811; X86-NEXT: movl $-2, %esi2812; X86-NEXT: roll %cl, %esi2813; X86-NEXT: movzwl (%edx), %eax2814; X86-NEXT: .p2align 42815; X86-NEXT: .LBB45_1: # %atomicrmw.start2816; X86-NEXT: # =>This Inner Loop Header: Depth=12817; X86-NEXT: movl %eax, %edi2818; X86-NEXT: andl %esi, %edi2819; X86-NEXT: # kill: def $ax killed $ax killed $eax2820; X86-NEXT: lock cmpxchgw %di, (%edx)2821; X86-NEXT: # kill: def $ax killed $ax def $eax2822; X86-NEXT: jne .LBB45_12823; X86-NEXT: # %bb.2: # %atomicrmw.end2824; X86-NEXT: movzwl %ax, %edx2825; X86-NEXT: andl $15, %ecx2826; X86-NEXT: xorl %eax, %eax2827; X86-NEXT: btl %ecx, %edx2828; X86-NEXT: setb %al2829; X86-NEXT: # kill: def $ax killed $ax killed $eax2830; X86-NEXT: popl %esi2831; X86-NEXT: popl %edi2832; X86-NEXT: retl2833;2834; X64-LABEL: atomic_shl1_mask1_and_16_gpr_valnz:2835; X64: # %bb.0: # %entry2836; X64-NEXT: movl %esi, %ecx2837; X64-NEXT: movl $-2, %edx2838; X64-NEXT: roll %cl, %edx2839; X64-NEXT: movzwl (%rdi), %eax2840; X64-NEXT: .p2align 42841; X64-NEXT: .LBB45_1: # %atomicrmw.start2842; X64-NEXT: # =>This Inner Loop Header: Depth=12843; X64-NEXT: movl %eax, %esi2844; X64-NEXT: andl %edx, %esi2845; X64-NEXT: # kill: def $ax killed $ax killed $eax2846; X64-NEXT: lock cmpxchgw %si, (%rdi)2847; X64-NEXT: # kill: def $ax killed $ax def $eax2848; X64-NEXT: jne .LBB45_12849; X64-NEXT: # %bb.2: # %atomicrmw.end2850; X64-NEXT: movzwl %ax, %edx2851; X64-NEXT: andl $15, %ecx2852; X64-NEXT: xorl %eax, %eax2853; X64-NEXT: btl %ecx, %edx2854; X64-NEXT: setb %al2855; X64-NEXT: # kill: def $ax killed $ax killed $eax2856; X64-NEXT: retq2857entry:2858 %conv = zext i16 %c to i322859 %shl = shl nuw i32 1, %conv2860 %0 = trunc i32 %shl to i162861 %conv1 = xor i16 %0, -12862 %1 = atomicrmw and ptr %v, i16 %conv1 monotonic, align 22863 %conv2 = zext i16 %1 to i322864 %2 = and i16 %c, 152865 %sh_prom = zext i16 %2 to i322866 %shl4 = shl nuw nsw i32 1, %sh_prom2867 %and = and i32 %shl4, %conv22868 %tobool = icmp ne i32 %and, 02869 %conv6 = zext i1 %tobool to i162870 ret i16 %conv62871}2872 2873define zeroext i16 @atomic_shl1_mask01_and_16_gpr_valnz(ptr %v, i16 zeroext %c) nounwind {2874; X86-LABEL: atomic_shl1_mask01_and_16_gpr_valnz:2875; X86: # %bb.0: # %entry2876; X86-NEXT: pushl %edi2877; X86-NEXT: pushl %esi2878; X86-NEXT: movl {{[0-9]+}}(%esp), %edx2879; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx2880; X86-NEXT: andb $15, %cl2881; X86-NEXT: movl $1, %esi2882; X86-NEXT: shll %cl, %esi2883; X86-NEXT: movl $-2, %edi2884; X86-NEXT: roll %cl, %edi2885; X86-NEXT: movzwl (%edx), %eax2886; X86-NEXT: .p2align 42887; X86-NEXT: .LBB46_1: # %atomicrmw.start2888; X86-NEXT: # =>This Inner Loop Header: Depth=12889; X86-NEXT: movl %eax, %ecx2890; X86-NEXT: andl %edi, %ecx2891; X86-NEXT: # kill: def $ax killed $ax killed $eax2892; X86-NEXT: lock cmpxchgw %cx, (%edx)2893; X86-NEXT: # kill: def $ax killed $ax def $eax2894; X86-NEXT: jne .LBB46_12895; X86-NEXT: # %bb.2: # %atomicrmw.end2896; X86-NEXT: movzwl %ax, %ecx2897; X86-NEXT: xorl %eax, %eax2898; X86-NEXT: testl %ecx, %esi2899; X86-NEXT: setne %al2900; X86-NEXT: # kill: def $ax killed $ax killed $eax2901; X86-NEXT: popl %esi2902; X86-NEXT: popl %edi2903; X86-NEXT: retl2904;2905; X64-LABEL: atomic_shl1_mask01_and_16_gpr_valnz:2906; X64: # %bb.0: # %entry2907; X64-NEXT: movl %esi, %ecx2908; X64-NEXT: andb $15, %cl2909; X64-NEXT: movl $1, %edx2910; X64-NEXT: shll %cl, %edx2911; X64-NEXT: movl $-2, %esi2912; X64-NEXT: # kill: def $cl killed $cl killed $ecx2913; X64-NEXT: roll %cl, %esi2914; X64-NEXT: movzwl (%rdi), %eax2915; X64-NEXT: .p2align 42916; X64-NEXT: .LBB46_1: # %atomicrmw.start2917; X64-NEXT: # =>This Inner Loop Header: Depth=12918; X64-NEXT: movl %eax, %ecx2919; X64-NEXT: andl %esi, %ecx2920; X64-NEXT: # kill: def $ax killed $ax killed $eax2921; X64-NEXT: lock cmpxchgw %cx, (%rdi)2922; X64-NEXT: # kill: def $ax killed $ax def $eax2923; X64-NEXT: jne .LBB46_12924; X64-NEXT: # %bb.2: # %atomicrmw.end2925; X64-NEXT: movzwl %ax, %ecx2926; X64-NEXT: xorl %eax, %eax2927; X64-NEXT: testl %ecx, %edx2928; X64-NEXT: setne %al2929; X64-NEXT: # kill: def $ax killed $ax killed $eax2930; X64-NEXT: retq2931entry:2932 %0 = and i16 %c, 152933 %sh_prom = zext i16 %0 to i322934 %shl = shl nuw nsw i32 1, %sh_prom2935 %1 = trunc i32 %shl to i162936 %conv1 = xor i16 %1, -12937 %2 = atomicrmw and ptr %v, i16 %conv1 monotonic, align 22938 %conv2 = zext i16 %2 to i322939 %and = and i32 %shl, %conv22940 %tobool = icmp ne i32 %and, 02941 %conv8 = zext i1 %tobool to i162942 ret i16 %conv82943}2944 2945define zeroext i16 @atomic_blsi_and_16_gpr_valnz(ptr %v, i16 zeroext %c) nounwind {2946; X86-LABEL: atomic_blsi_and_16_gpr_valnz:2947; X86: # %bb.0: # %entry2948; X86-NEXT: pushl %edi2949; X86-NEXT: pushl %esi2950; X86-NEXT: movl {{[0-9]+}}(%esp), %edx2951; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax2952; X86-NEXT: movl %eax, %ecx2953; X86-NEXT: negl %ecx2954; X86-NEXT: andl %eax, %ecx2955; X86-NEXT: movl %ecx, %esi2956; X86-NEXT: notl %esi2957; X86-NEXT: movzwl (%edx), %eax2958; X86-NEXT: .p2align 42959; X86-NEXT: .LBB47_1: # %atomicrmw.start2960; X86-NEXT: # =>This Inner Loop Header: Depth=12961; X86-NEXT: movl %eax, %edi2962; X86-NEXT: andl %esi, %edi2963; X86-NEXT: # kill: def $ax killed $ax killed $eax2964; X86-NEXT: lock cmpxchgw %di, (%edx)2965; X86-NEXT: # kill: def $ax killed $ax def $eax2966; X86-NEXT: jne .LBB47_12967; X86-NEXT: # %bb.2: # %atomicrmw.end2968; X86-NEXT: movzwl %ax, %edx2969; X86-NEXT: xorl %eax, %eax2970; X86-NEXT: testl %edx, %ecx2971; X86-NEXT: setne %al2972; X86-NEXT: # kill: def $ax killed $ax killed $eax2973; X86-NEXT: popl %esi2974; X86-NEXT: popl %edi2975; X86-NEXT: retl2976;2977; X64-LABEL: atomic_blsi_and_16_gpr_valnz:2978; X64: # %bb.0: # %entry2979; X64-NEXT: movl %esi, %ecx2980; X64-NEXT: negl %ecx2981; X64-NEXT: andl %esi, %ecx2982; X64-NEXT: movl %ecx, %edx2983; X64-NEXT: notl %edx2984; X64-NEXT: movzwl (%rdi), %eax2985; X64-NEXT: .p2align 42986; X64-NEXT: .LBB47_1: # %atomicrmw.start2987; X64-NEXT: # =>This Inner Loop Header: Depth=12988; X64-NEXT: movl %eax, %esi2989; X64-NEXT: andl %edx, %esi2990; X64-NEXT: # kill: def $ax killed $ax killed $eax2991; X64-NEXT: lock cmpxchgw %si, (%rdi)2992; X64-NEXT: # kill: def $ax killed $ax def $eax2993; X64-NEXT: jne .LBB47_12994; X64-NEXT: # %bb.2: # %atomicrmw.end2995; X64-NEXT: movzwl %ax, %edx2996; X64-NEXT: xorl %eax, %eax2997; X64-NEXT: testl %edx, %ecx2998; X64-NEXT: setne %al2999; X64-NEXT: # kill: def $ax killed $ax killed $eax3000; X64-NEXT: retq3001entry:3002 %conv = zext i16 %c to i323003 %sub = sub nsw i32 0, %conv3004 %and = and i32 %conv, %sub3005 %0 = trunc i32 %and to i163006 %conv2 = xor i16 %0, -13007 %1 = atomicrmw and ptr %v, i16 %conv2 monotonic, align 23008 %conv3 = zext i16 %1 to i323009 %and8 = and i32 %and, %conv33010 %tobool = icmp ne i32 %and8, 03011 %conv10 = zext i1 %tobool to i163012 ret i16 %conv103013}3014 3015define zeroext i16 @atomic_shl1_and_16_gpr_brnz(ptr %v, i16 zeroext %c) nounwind {3016; X86-LABEL: atomic_shl1_and_16_gpr_brnz:3017; X86: # %bb.0: # %entry3018; X86-NEXT: pushl %ebx3019; X86-NEXT: pushl %edi3020; X86-NEXT: pushl %esi3021; X86-NEXT: movzwl {{[0-9]+}}(%esp), %ecx3022; X86-NEXT: movl {{[0-9]+}}(%esp), %edx3023; X86-NEXT: movl $1, %esi3024; X86-NEXT: shll %cl, %esi3025; X86-NEXT: movl $-2, %edi3026; X86-NEXT: roll %cl, %edi3027; X86-NEXT: movzwl (%edx), %eax3028; X86-NEXT: .p2align 43029; X86-NEXT: .LBB48_1: # %atomicrmw.start3030; X86-NEXT: # =>This Inner Loop Header: Depth=13031; X86-NEXT: movl %eax, %ebx3032; X86-NEXT: andl %edi, %ebx3033; X86-NEXT: # kill: def $ax killed $ax killed $eax3034; X86-NEXT: lock cmpxchgw %bx, (%edx)3035; X86-NEXT: # kill: def $ax killed $ax def $eax3036; X86-NEXT: jne .LBB48_13037; X86-NEXT: # %bb.2: # %atomicrmw.end3038; X86-NEXT: movzwl %ax, %eax3039; X86-NEXT: testl %eax, %esi3040; X86-NEXT: je .LBB48_33041; X86-NEXT: # %bb.4: # %if.then3042; X86-NEXT: movzwl %cx, %eax3043; X86-NEXT: movzwl (%edx,%eax,2), %eax3044; X86-NEXT: jmp .LBB48_53045; X86-NEXT: .LBB48_3:3046; X86-NEXT: movw $123, %ax3047; X86-NEXT: .LBB48_5: # %return3048; X86-NEXT: popl %esi3049; X86-NEXT: popl %edi3050; X86-NEXT: popl %ebx3051; X86-NEXT: retl3052;3053; X64-LABEL: atomic_shl1_and_16_gpr_brnz:3054; X64: # %bb.0: # %entry3055; X64-NEXT: movl %esi, %ecx3056; X64-NEXT: movl $1, %edx3057; X64-NEXT: shll %cl, %edx3058; X64-NEXT: movl $-2, %esi3059; X64-NEXT: roll %cl, %esi3060; X64-NEXT: movzwl (%rdi), %eax3061; X64-NEXT: .p2align 43062; X64-NEXT: .LBB48_1: # %atomicrmw.start3063; X64-NEXT: # =>This Inner Loop Header: Depth=13064; X64-NEXT: movl %eax, %r8d3065; X64-NEXT: andl %esi, %r8d3066; X64-NEXT: # kill: def $ax killed $ax killed $eax3067; X64-NEXT: lock cmpxchgw %r8w, (%rdi)3068; X64-NEXT: # kill: def $ax killed $ax def $eax3069; X64-NEXT: jne .LBB48_13070; X64-NEXT: # %bb.2: # %atomicrmw.end3071; X64-NEXT: movzwl %ax, %eax3072; X64-NEXT: testl %eax, %edx3073; X64-NEXT: je .LBB48_33074; X64-NEXT: # %bb.4: # %if.then3075; X64-NEXT: movzwl %cx, %eax3076; X64-NEXT: movzwl (%rdi,%rax,2), %eax3077; X64-NEXT: retq3078; X64-NEXT: .LBB48_3:3079; X64-NEXT: movw $123, %ax3080; X64-NEXT: retq3081entry:3082 %conv = zext i16 %c to i323083 %shl = shl nuw i32 1, %conv3084 %0 = trunc i32 %shl to i163085 %conv1 = xor i16 %0, -13086 %1 = atomicrmw and ptr %v, i16 %conv1 monotonic, align 23087 %conv2 = zext i16 %1 to i323088 %and = and i32 %shl, %conv23089 %tobool.not = icmp eq i32 %and, 03090 br i1 %tobool.not, label %return, label %if.then3091 3092if.then: ; preds = %entry3093 %idxprom = zext i16 %c to i643094 %arrayidx = getelementptr inbounds i16, ptr %v, i64 %idxprom3095 %2 = load i16, ptr %arrayidx, align 23096 br label %return3097 3098return: ; preds = %entry, %if.then3099 %retval.0 = phi i16 [ %2, %if.then ], [ 123, %entry ]3100 ret i16 %retval.03101}3102 3103define zeroext i16 @atomic_shl1_small_mask_and_16_gpr_brnz(ptr %v, i16 zeroext %c) nounwind {3104; X86-LABEL: atomic_shl1_small_mask_and_16_gpr_brnz:3105; X86: # %bb.0: # %entry3106; X86-NEXT: pushl %edi3107; X86-NEXT: pushl %esi3108; X86-NEXT: movl {{[0-9]+}}(%esp), %edx3109; X86-NEXT: movzwl {{[0-9]+}}(%esp), %ecx3110; X86-NEXT: andl $7, %ecx3111; X86-NEXT: movw $-2, %si3112; X86-NEXT: rolw %cl, %si3113; X86-NEXT: movzwl (%edx), %eax3114; X86-NEXT: .p2align 43115; X86-NEXT: .LBB49_1: # %atomicrmw.start3116; X86-NEXT: # =>This Inner Loop Header: Depth=13117; X86-NEXT: movl %eax, %edi3118; X86-NEXT: andl %esi, %edi3119; X86-NEXT: # kill: def $ax killed $ax killed $eax3120; X86-NEXT: lock cmpxchgw %di, (%edx)3121; X86-NEXT: # kill: def $ax killed $ax def $eax3122; X86-NEXT: jne .LBB49_13123; X86-NEXT: # %bb.2: # %atomicrmw.end3124; X86-NEXT: movzwl %ax, %eax3125; X86-NEXT: btl %ecx, %eax3126; X86-NEXT: jae .LBB49_33127; X86-NEXT: # %bb.4: # %if.then3128; X86-NEXT: movzwl %cx, %eax3129; X86-NEXT: movzwl (%edx,%eax,2), %eax3130; X86-NEXT: jmp .LBB49_53131; X86-NEXT: .LBB49_3:3132; X86-NEXT: movw $123, %ax3133; X86-NEXT: .LBB49_5: # %return3134; X86-NEXT: popl %esi3135; X86-NEXT: popl %edi3136; X86-NEXT: retl3137;3138; X64-LABEL: atomic_shl1_small_mask_and_16_gpr_brnz:3139; X64: # %bb.0: # %entry3140; X64-NEXT: movl %esi, %ecx3141; X64-NEXT: andl $7, %ecx3142; X64-NEXT: movw $-2, %dx3143; X64-NEXT: rolw %cl, %dx3144; X64-NEXT: movzwl (%rdi), %eax3145; X64-NEXT: .p2align 43146; X64-NEXT: .LBB49_1: # %atomicrmw.start3147; X64-NEXT: # =>This Inner Loop Header: Depth=13148; X64-NEXT: movl %eax, %esi3149; X64-NEXT: andl %edx, %esi3150; X64-NEXT: # kill: def $ax killed $ax killed $eax3151; X64-NEXT: lock cmpxchgw %si, (%rdi)3152; X64-NEXT: # kill: def $ax killed $ax def $eax3153; X64-NEXT: jne .LBB49_13154; X64-NEXT: # %bb.2: # %atomicrmw.end3155; X64-NEXT: movzwl %ax, %eax3156; X64-NEXT: btl %ecx, %eax3157; X64-NEXT: jae .LBB49_33158; X64-NEXT: # %bb.4: # %if.then3159; X64-NEXT: movzwl %cx, %eax3160; X64-NEXT: movzwl (%rdi,%rax,2), %eax3161; X64-NEXT: retq3162; X64-NEXT: .LBB49_3:3163; X64-NEXT: movw $123, %ax3164; X64-NEXT: retq3165entry:3166 %0 = and i16 %c, 73167 %shl = shl nuw nsw i16 1, %03168 %not = xor i16 %shl, -13169 %1 = atomicrmw and ptr %v, i16 %not monotonic, align 23170 %conv5 = zext i16 %1 to i323171 %conv6 = zext i16 %0 to i323172 %shl7 = shl nuw nsw i32 1, %conv63173 %and = and i32 %shl7, %conv53174 %tobool.not = icmp eq i32 %and, 03175 br i1 %tobool.not, label %return, label %if.then3176 3177if.then: ; preds = %entry3178 %conv2 = zext i16 %0 to i643179 %arrayidx = getelementptr inbounds i16, ptr %v, i64 %conv23180 %2 = load i16, ptr %arrayidx, align 23181 br label %return3182 3183return: ; preds = %entry, %if.then3184 %retval.0 = phi i16 [ %2, %if.then ], [ 123, %entry ]3185 ret i16 %retval.03186}3187 3188define zeroext i16 @atomic_shl1_mask0_and_16_gpr_brnz(ptr %v, i16 zeroext %c) nounwind {3189; X86-LABEL: atomic_shl1_mask0_and_16_gpr_brnz:3190; X86: # %bb.0: # %entry3191; X86-NEXT: pushl %edi3192; X86-NEXT: pushl %esi3193; X86-NEXT: movzwl {{[0-9]+}}(%esp), %ecx3194; X86-NEXT: movl {{[0-9]+}}(%esp), %edx3195; X86-NEXT: movw $-2, %si3196; X86-NEXT: rolw %cl, %si3197; X86-NEXT: movzwl (%edx), %eax3198; X86-NEXT: .p2align 43199; X86-NEXT: .LBB50_1: # %atomicrmw.start3200; X86-NEXT: # =>This Inner Loop Header: Depth=13201; X86-NEXT: movl %eax, %edi3202; X86-NEXT: andl %esi, %edi3203; X86-NEXT: # kill: def $ax killed $ax killed $eax3204; X86-NEXT: lock cmpxchgw %di, (%edx)3205; X86-NEXT: # kill: def $ax killed $ax def $eax3206; X86-NEXT: jne .LBB50_13207; X86-NEXT: # %bb.2: # %atomicrmw.end3208; X86-NEXT: movzwl %ax, %eax3209; X86-NEXT: btl %ecx, %eax3210; X86-NEXT: jae .LBB50_33211; X86-NEXT: # %bb.4: # %if.then3212; X86-NEXT: movzwl %cx, %eax3213; X86-NEXT: movzwl (%edx,%eax,2), %eax3214; X86-NEXT: jmp .LBB50_53215; X86-NEXT: .LBB50_3:3216; X86-NEXT: movw $123, %ax3217; X86-NEXT: .LBB50_5: # %return3218; X86-NEXT: popl %esi3219; X86-NEXT: popl %edi3220; X86-NEXT: retl3221;3222; X64-LABEL: atomic_shl1_mask0_and_16_gpr_brnz:3223; X64: # %bb.0: # %entry3224; X64-NEXT: movl %esi, %ecx3225; X64-NEXT: movw $-2, %dx3226; X64-NEXT: rolw %cl, %dx3227; X64-NEXT: movzwl (%rdi), %eax3228; X64-NEXT: .p2align 43229; X64-NEXT: .LBB50_1: # %atomicrmw.start3230; X64-NEXT: # =>This Inner Loop Header: Depth=13231; X64-NEXT: movl %eax, %esi3232; X64-NEXT: andl %edx, %esi3233; X64-NEXT: # kill: def $ax killed $ax killed $eax3234; X64-NEXT: lock cmpxchgw %si, (%rdi)3235; X64-NEXT: # kill: def $ax killed $ax def $eax3236; X64-NEXT: jne .LBB50_13237; X64-NEXT: # %bb.2: # %atomicrmw.end3238; X64-NEXT: movzwl %ax, %eax3239; X64-NEXT: btl %ecx, %eax3240; X64-NEXT: jae .LBB50_33241; X64-NEXT: # %bb.4: # %if.then3242; X64-NEXT: movzwl %cx, %eax3243; X64-NEXT: movzwl (%rdi,%rax,2), %eax3244; X64-NEXT: retq3245; X64-NEXT: .LBB50_3:3246; X64-NEXT: movw $123, %ax3247; X64-NEXT: retq3248entry:3249 %0 = and i16 %c, 153250 %shl = shl nuw i16 1, %03251 %not = xor i16 %shl, -13252 %1 = atomicrmw and ptr %v, i16 %not monotonic, align 23253 %conv2 = zext i16 %1 to i323254 %conv3 = zext i16 %c to i323255 %shl4 = shl nuw i32 1, %conv33256 %and = and i32 %shl4, %conv23257 %tobool.not = icmp eq i32 %and, 03258 br i1 %tobool.not, label %return, label %if.then3259 3260if.then: ; preds = %entry3261 %conv = zext i16 %c to i643262 %arrayidx = getelementptr inbounds i16, ptr %v, i64 %conv3263 %2 = load i16, ptr %arrayidx, align 23264 br label %return3265 3266return: ; preds = %entry, %if.then3267 %retval.0 = phi i16 [ %2, %if.then ], [ 123, %entry ]3268 ret i16 %retval.03269}3270 3271define zeroext i16 @atomic_shl1_mask1_and_16_gpr_brnz(ptr %v, i16 zeroext %c) nounwind {3272; X86-LABEL: atomic_shl1_mask1_and_16_gpr_brnz:3273; X86: # %bb.0: # %entry3274; X86-NEXT: pushl %edi3275; X86-NEXT: pushl %esi3276; X86-NEXT: movzwl {{[0-9]+}}(%esp), %ecx3277; X86-NEXT: movl {{[0-9]+}}(%esp), %edx3278; X86-NEXT: movl $-2, %esi3279; X86-NEXT: roll %cl, %esi3280; X86-NEXT: movzwl (%edx), %eax3281; X86-NEXT: .p2align 43282; X86-NEXT: .LBB51_1: # %atomicrmw.start3283; X86-NEXT: # =>This Inner Loop Header: Depth=13284; X86-NEXT: movl %eax, %edi3285; X86-NEXT: andl %esi, %edi3286; X86-NEXT: # kill: def $ax killed $ax killed $eax3287; X86-NEXT: lock cmpxchgw %di, (%edx)3288; X86-NEXT: # kill: def $ax killed $ax def $eax3289; X86-NEXT: jne .LBB51_13290; X86-NEXT: # %bb.2: # %atomicrmw.end3291; X86-NEXT: movzwl %ax, %eax3292; X86-NEXT: movl %ecx, %esi3293; X86-NEXT: andl $15, %esi3294; X86-NEXT: btl %esi, %eax3295; X86-NEXT: jae .LBB51_33296; X86-NEXT: # %bb.4: # %if.then3297; X86-NEXT: movzwl %cx, %eax3298; X86-NEXT: movzwl (%edx,%eax,2), %eax3299; X86-NEXT: jmp .LBB51_53300; X86-NEXT: .LBB51_3:3301; X86-NEXT: movw $123, %ax3302; X86-NEXT: .LBB51_5: # %return3303; X86-NEXT: popl %esi3304; X86-NEXT: popl %edi3305; X86-NEXT: retl3306;3307; X64-LABEL: atomic_shl1_mask1_and_16_gpr_brnz:3308; X64: # %bb.0: # %entry3309; X64-NEXT: movl %esi, %ecx3310; X64-NEXT: movl $-2, %edx3311; X64-NEXT: roll %cl, %edx3312; X64-NEXT: movzwl (%rdi), %eax3313; X64-NEXT: .p2align 43314; X64-NEXT: .LBB51_1: # %atomicrmw.start3315; X64-NEXT: # =>This Inner Loop Header: Depth=13316; X64-NEXT: movl %eax, %esi3317; X64-NEXT: andl %edx, %esi3318; X64-NEXT: # kill: def $ax killed $ax killed $eax3319; X64-NEXT: lock cmpxchgw %si, (%rdi)3320; X64-NEXT: # kill: def $ax killed $ax def $eax3321; X64-NEXT: jne .LBB51_13322; X64-NEXT: # %bb.2: # %atomicrmw.end3323; X64-NEXT: movzwl %ax, %eax3324; X64-NEXT: movl %ecx, %edx3325; X64-NEXT: andl $15, %edx3326; X64-NEXT: btl %edx, %eax3327; X64-NEXT: jae .LBB51_33328; X64-NEXT: # %bb.4: # %if.then3329; X64-NEXT: movzwl %cx, %eax3330; X64-NEXT: movzwl (%rdi,%rax,2), %eax3331; X64-NEXT: retq3332; X64-NEXT: .LBB51_3:3333; X64-NEXT: movw $123, %ax3334; X64-NEXT: retq3335entry:3336 %conv = zext i16 %c to i323337 %shl = shl nuw i32 1, %conv3338 %0 = trunc i32 %shl to i163339 %conv1 = xor i16 %0, -13340 %1 = atomicrmw and ptr %v, i16 %conv1 monotonic, align 23341 %conv2 = zext i16 %1 to i323342 %2 = and i16 %c, 153343 %sh_prom = zext i16 %2 to i323344 %shl4 = shl nuw nsw i32 1, %sh_prom3345 %and = and i32 %shl4, %conv23346 %tobool.not = icmp eq i32 %and, 03347 br i1 %tobool.not, label %return, label %if.then3348 3349if.then: ; preds = %entry3350 %conv3 = zext i16 %c to i643351 %arrayidx = getelementptr inbounds i16, ptr %v, i64 %conv33352 %3 = load i16, ptr %arrayidx, align 23353 br label %return3354 3355return: ; preds = %entry, %if.then3356 %retval.0 = phi i16 [ %3, %if.then ], [ 123, %entry ]3357 ret i16 %retval.03358}3359 3360define zeroext i16 @atomic_shl1_mask01_and_16_gpr_brnz(ptr %v, i16 zeroext %c) nounwind {3361; X86-LABEL: atomic_shl1_mask01_and_16_gpr_brnz:3362; X86: # %bb.0: # %entry3363; X86-NEXT: pushl %ebx3364; X86-NEXT: pushl %edi3365; X86-NEXT: pushl %esi3366; X86-NEXT: movzwl {{[0-9]+}}(%esp), %ebx3367; X86-NEXT: movl {{[0-9]+}}(%esp), %edx3368; X86-NEXT: movl %ebx, %ecx3369; X86-NEXT: andb $15, %cl3370; X86-NEXT: movl $1, %esi3371; X86-NEXT: shll %cl, %esi3372; X86-NEXT: movl $-2, %edi3373; X86-NEXT: roll %cl, %edi3374; X86-NEXT: movzwl (%edx), %eax3375; X86-NEXT: .p2align 43376; X86-NEXT: .LBB52_1: # %atomicrmw.start3377; X86-NEXT: # =>This Inner Loop Header: Depth=13378; X86-NEXT: movl %eax, %ecx3379; X86-NEXT: andl %edi, %ecx3380; X86-NEXT: # kill: def $ax killed $ax killed $eax3381; X86-NEXT: lock cmpxchgw %cx, (%edx)3382; X86-NEXT: # kill: def $ax killed $ax def $eax3383; X86-NEXT: jne .LBB52_13384; X86-NEXT: # %bb.2: # %atomicrmw.end3385; X86-NEXT: movzwl %ax, %eax3386; X86-NEXT: testl %eax, %esi3387; X86-NEXT: je .LBB52_33388; X86-NEXT: # %bb.4: # %if.then3389; X86-NEXT: movzwl %bx, %eax3390; X86-NEXT: movzwl (%edx,%eax,2), %eax3391; X86-NEXT: jmp .LBB52_53392; X86-NEXT: .LBB52_3:3393; X86-NEXT: movw $123, %ax3394; X86-NEXT: .LBB52_5: # %return3395; X86-NEXT: popl %esi3396; X86-NEXT: popl %edi3397; X86-NEXT: popl %ebx3398; X86-NEXT: retl3399;3400; X64-LABEL: atomic_shl1_mask01_and_16_gpr_brnz:3401; X64: # %bb.0: # %entry3402; X64-NEXT: movl %esi, %ecx3403; X64-NEXT: movl %ecx, %edx3404; X64-NEXT: andb $15, %cl3405; X64-NEXT: movl $1, %esi3406; X64-NEXT: shll %cl, %esi3407; X64-NEXT: movl $-2, %r8d3408; X64-NEXT: # kill: def $cl killed $cl killed $ecx3409; X64-NEXT: roll %cl, %r8d3410; X64-NEXT: movzwl (%rdi), %eax3411; X64-NEXT: .p2align 43412; X64-NEXT: .LBB52_1: # %atomicrmw.start3413; X64-NEXT: # =>This Inner Loop Header: Depth=13414; X64-NEXT: movl %eax, %ecx3415; X64-NEXT: andl %r8d, %ecx3416; X64-NEXT: # kill: def $ax killed $ax killed $eax3417; X64-NEXT: lock cmpxchgw %cx, (%rdi)3418; X64-NEXT: # kill: def $ax killed $ax def $eax3419; X64-NEXT: jne .LBB52_13420; X64-NEXT: # %bb.2: # %atomicrmw.end3421; X64-NEXT: movzwl %ax, %eax3422; X64-NEXT: testl %eax, %esi3423; X64-NEXT: je .LBB52_33424; X64-NEXT: # %bb.4: # %if.then3425; X64-NEXT: movzwl %dx, %eax3426; X64-NEXT: movzwl (%rdi,%rax,2), %eax3427; X64-NEXT: retq3428; X64-NEXT: .LBB52_3:3429; X64-NEXT: movw $123, %ax3430; X64-NEXT: retq3431entry:3432 %0 = and i16 %c, 153433 %sh_prom = zext i16 %0 to i323434 %shl = shl nuw nsw i32 1, %sh_prom3435 %1 = trunc i32 %shl to i163436 %conv1 = xor i16 %1, -13437 %2 = atomicrmw and ptr %v, i16 %conv1 monotonic, align 23438 %conv2 = zext i16 %2 to i323439 %and = and i32 %shl, %conv23440 %tobool.not = icmp eq i32 %and, 03441 br i1 %tobool.not, label %return, label %if.then3442 3443if.then: ; preds = %entry3444 %conv = zext i16 %c to i643445 %arrayidx = getelementptr inbounds i16, ptr %v, i64 %conv3446 %3 = load i16, ptr %arrayidx, align 23447 br label %return3448 3449return: ; preds = %entry, %if.then3450 %retval.0 = phi i16 [ %3, %if.then ], [ 123, %entry ]3451 ret i16 %retval.03452}3453 3454define zeroext i16 @atomic_blsi_and_16_gpr_brnz(ptr %v, i16 zeroext %c) nounwind {3455; X86-LABEL: atomic_blsi_and_16_gpr_brnz:3456; X86: # %bb.0: # %entry3457; X86-NEXT: pushl %ebx3458; X86-NEXT: pushl %edi3459; X86-NEXT: pushl %esi3460; X86-NEXT: movzwl {{[0-9]+}}(%esp), %ecx3461; X86-NEXT: movl {{[0-9]+}}(%esp), %edx3462; X86-NEXT: movl %ecx, %esi3463; X86-NEXT: negl %esi3464; X86-NEXT: andl %ecx, %esi3465; X86-NEXT: movl %esi, %edi3466; X86-NEXT: notl %edi3467; X86-NEXT: movzwl (%edx), %eax3468; X86-NEXT: .p2align 43469; X86-NEXT: .LBB53_1: # %atomicrmw.start3470; X86-NEXT: # =>This Inner Loop Header: Depth=13471; X86-NEXT: movl %eax, %ebx3472; X86-NEXT: andl %edi, %ebx3473; X86-NEXT: # kill: def $ax killed $ax killed $eax3474; X86-NEXT: lock cmpxchgw %bx, (%edx)3475; X86-NEXT: # kill: def $ax killed $ax def $eax3476; X86-NEXT: jne .LBB53_13477; X86-NEXT: # %bb.2: # %atomicrmw.end3478; X86-NEXT: movzwl %ax, %eax3479; X86-NEXT: testl %eax, %esi3480; X86-NEXT: je .LBB53_33481; X86-NEXT: # %bb.4: # %if.then3482; X86-NEXT: movzwl %cx, %eax3483; X86-NEXT: movzwl (%edx,%eax,2), %eax3484; X86-NEXT: jmp .LBB53_53485; X86-NEXT: .LBB53_3:3486; X86-NEXT: movw $123, %ax3487; X86-NEXT: .LBB53_5: # %return3488; X86-NEXT: popl %esi3489; X86-NEXT: popl %edi3490; X86-NEXT: popl %ebx3491; X86-NEXT: retl3492;3493; X64-LABEL: atomic_blsi_and_16_gpr_brnz:3494; X64: # %bb.0: # %entry3495; X64-NEXT: movl %esi, %ecx3496; X64-NEXT: negl %ecx3497; X64-NEXT: andl %esi, %ecx3498; X64-NEXT: movl %ecx, %edx3499; X64-NEXT: notl %edx3500; X64-NEXT: movzwl (%rdi), %eax3501; X64-NEXT: .p2align 43502; X64-NEXT: .LBB53_1: # %atomicrmw.start3503; X64-NEXT: # =>This Inner Loop Header: Depth=13504; X64-NEXT: movl %eax, %r8d3505; X64-NEXT: andl %edx, %r8d3506; X64-NEXT: # kill: def $ax killed $ax killed $eax3507; X64-NEXT: lock cmpxchgw %r8w, (%rdi)3508; X64-NEXT: # kill: def $ax killed $ax def $eax3509; X64-NEXT: jne .LBB53_13510; X64-NEXT: # %bb.2: # %atomicrmw.end3511; X64-NEXT: movzwl %ax, %eax3512; X64-NEXT: testl %eax, %ecx3513; X64-NEXT: je .LBB53_33514; X64-NEXT: # %bb.4: # %if.then3515; X64-NEXT: movzwl %si, %eax3516; X64-NEXT: movzwl (%rdi,%rax,2), %eax3517; X64-NEXT: retq3518; X64-NEXT: .LBB53_3:3519; X64-NEXT: movw $123, %ax3520; X64-NEXT: retq3521entry:3522 %conv = zext i16 %c to i323523 %sub = sub nsw i32 0, %conv3524 %and = and i32 %conv, %sub3525 %0 = trunc i32 %and to i163526 %conv2 = xor i16 %0, -13527 %1 = atomicrmw and ptr %v, i16 %conv2 monotonic, align 23528 %conv3 = zext i16 %1 to i323529 %and8 = and i32 %and, %conv33530 %tobool.not = icmp eq i32 %and8, 03531 br i1 %tobool.not, label %return, label %if.then3532 3533if.then: ; preds = %entry3534 %idxprom = zext i16 %c to i643535 %arrayidx = getelementptr inbounds i16, ptr %v, i64 %idxprom3536 %2 = load i16, ptr %arrayidx, align 23537 br label %return3538 3539return: ; preds = %entry, %if.then3540 %retval.0 = phi i16 [ %2, %if.then ], [ 123, %entry ]3541 ret i16 %retval.03542}3543 3544define zeroext i16 @atomic_shl1_or_16_const_val(ptr %v) nounwind {3545; X86-LABEL: atomic_shl1_or_16_const_val:3546; X86: # %bb.0: # %entry3547; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx3548; X86-NEXT: xorl %eax, %eax3549; X86-NEXT: lock btsw $4, (%ecx)3550; X86-NEXT: setb %al3551; X86-NEXT: shll $4, %eax3552; X86-NEXT: # kill: def $ax killed $ax killed $eax3553; X86-NEXT: retl3554;3555; X64-LABEL: atomic_shl1_or_16_const_val:3556; X64: # %bb.0: # %entry3557; X64-NEXT: xorl %eax, %eax3558; X64-NEXT: lock btsw $4, (%rdi)3559; X64-NEXT: setb %al3560; X64-NEXT: shll $4, %eax3561; X64-NEXT: # kill: def $ax killed $ax killed $eax3562; X64-NEXT: retq3563entry:3564 %0 = atomicrmw or ptr %v, i16 16 monotonic, align 23565 %1 = and i16 16, %03566 ret i16 %13567}3568 3569define zeroext i16 @atomic_shl1_or_16_const_valnz(ptr %v) nounwind {3570; X86-LABEL: atomic_shl1_or_16_const_valnz:3571; X86: # %bb.0: # %entry3572; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx3573; X86-NEXT: movzwl (%ecx), %eax3574; X86-NEXT: .p2align 43575; X86-NEXT: .LBB55_1: # %atomicrmw.start3576; X86-NEXT: # =>This Inner Loop Header: Depth=13577; X86-NEXT: movl %eax, %edx3578; X86-NEXT: orl $16, %edx3579; X86-NEXT: # kill: def $ax killed $ax killed $eax3580; X86-NEXT: lock cmpxchgw %dx, (%ecx)3581; X86-NEXT: # kill: def $ax killed $ax def $eax3582; X86-NEXT: jne .LBB55_13583; X86-NEXT: # %bb.2: # %atomicrmw.end3584; X86-NEXT: shrl $4, %eax3585; X86-NEXT: andl $1, %eax3586; X86-NEXT: # kill: def $ax killed $ax killed $eax3587; X86-NEXT: retl3588;3589; X64-LABEL: atomic_shl1_or_16_const_valnz:3590; X64: # %bb.0: # %entry3591; X64-NEXT: movzwl (%rdi), %eax3592; X64-NEXT: .p2align 43593; X64-NEXT: .LBB55_1: # %atomicrmw.start3594; X64-NEXT: # =>This Inner Loop Header: Depth=13595; X64-NEXT: movl %eax, %ecx3596; X64-NEXT: orl $16, %ecx3597; X64-NEXT: # kill: def $ax killed $ax killed $eax3598; X64-NEXT: lock cmpxchgw %cx, (%rdi)3599; X64-NEXT: # kill: def $ax killed $ax def $eax3600; X64-NEXT: jne .LBB55_13601; X64-NEXT: # %bb.2: # %atomicrmw.end3602; X64-NEXT: shrl $4, %eax3603; X64-NEXT: andl $1, %eax3604; X64-NEXT: # kill: def $ax killed $ax killed $eax3605; X64-NEXT: retq3606entry:3607 %0 = atomicrmw or ptr %v, i16 16 monotonic, align 23608 %1 = lshr i16 %0, 43609 %.lobit = and i16 %1, 13610 ret i16 %.lobit3611}3612 3613define zeroext i16 @atomic_shl1_or_16_const_brnz(ptr %v) nounwind {3614; X86-LABEL: atomic_shl1_or_16_const_brnz:3615; X86: # %bb.0: # %entry3616; X86-NEXT: movl {{[0-9]+}}(%esp), %eax3617; X86-NEXT: lock btsw $4, (%eax)3618; X86-NEXT: jae .LBB56_13619; X86-NEXT: # %bb.2: # %if.then3620; X86-NEXT: movzwl 8(%eax), %eax3621; X86-NEXT: retl3622; X86-NEXT: .LBB56_1:3623; X86-NEXT: movw $123, %ax3624; X86-NEXT: retl3625;3626; X64-LABEL: atomic_shl1_or_16_const_brnz:3627; X64: # %bb.0: # %entry3628; X64-NEXT: lock btsw $4, (%rdi)3629; X64-NEXT: jae .LBB56_13630; X64-NEXT: # %bb.2: # %if.then3631; X64-NEXT: movzwl 8(%rdi), %eax3632; X64-NEXT: retq3633; X64-NEXT: .LBB56_1:3634; X64-NEXT: movw $123, %ax3635; X64-NEXT: retq3636entry:3637 %0 = atomicrmw or ptr %v, i16 16 monotonic, align 23638 %1 = and i16 %0, 163639 %tobool.not = icmp eq i16 %1, 03640 br i1 %tobool.not, label %return, label %if.then3641 3642if.then: ; preds = %entry3643 %arrayidx = getelementptr inbounds i16, ptr %v, i64 43644 %2 = load i16, ptr %arrayidx, align 23645 br label %return3646 3647return: ; preds = %entry, %if.then3648 %retval.0 = phi i16 [ %2, %if.then ], [ 123, %entry ]3649 ret i16 %retval.03650}3651 3652define zeroext i16 @atomic_shl1_and_16_const_val(ptr %v) nounwind {3653; X86-LABEL: atomic_shl1_and_16_const_val:3654; X86: # %bb.0: # %entry3655; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx3656; X86-NEXT: xorl %eax, %eax3657; X86-NEXT: lock btrw $4, (%ecx)3658; X86-NEXT: setb %al3659; X86-NEXT: shll $4, %eax3660; X86-NEXT: # kill: def $ax killed $ax killed $eax3661; X86-NEXT: retl3662;3663; X64-LABEL: atomic_shl1_and_16_const_val:3664; X64: # %bb.0: # %entry3665; X64-NEXT: xorl %eax, %eax3666; X64-NEXT: lock btrw $4, (%rdi)3667; X64-NEXT: setb %al3668; X64-NEXT: shll $4, %eax3669; X64-NEXT: # kill: def $ax killed $ax killed $eax3670; X64-NEXT: retq3671entry:3672 %0 = atomicrmw and ptr %v, i16 -17 monotonic, align 23673 %1 = and i16 %0, 163674 ret i16 %13675}3676 3677define zeroext i16 @atomic_shl1_and_16_const_valz(ptr %v) nounwind {3678; X86-LABEL: atomic_shl1_and_16_const_valz:3679; X86: # %bb.0: # %entry3680; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx3681; X86-NEXT: movzwl (%ecx), %eax3682; X86-NEXT: .p2align 43683; X86-NEXT: .LBB58_1: # %atomicrmw.start3684; X86-NEXT: # =>This Inner Loop Header: Depth=13685; X86-NEXT: movl %eax, %edx3686; X86-NEXT: andl $65519, %edx # imm = 0xFFEF3687; X86-NEXT: # kill: def $ax killed $ax killed $eax3688; X86-NEXT: lock cmpxchgw %dx, (%ecx)3689; X86-NEXT: # kill: def $ax killed $ax def $eax3690; X86-NEXT: jne .LBB58_13691; X86-NEXT: # %bb.2: # %atomicrmw.end3692; X86-NEXT: xorl %ecx, %ecx3693; X86-NEXT: testb $16, %al3694; X86-NEXT: sete %cl3695; X86-NEXT: movl %ecx, %eax3696; X86-NEXT: retl3697;3698; X64-LABEL: atomic_shl1_and_16_const_valz:3699; X64: # %bb.0: # %entry3700; X64-NEXT: movzwl (%rdi), %eax3701; X64-NEXT: .p2align 43702; X64-NEXT: .LBB58_1: # %atomicrmw.start3703; X64-NEXT: # =>This Inner Loop Header: Depth=13704; X64-NEXT: movl %eax, %ecx3705; X64-NEXT: andl $65519, %ecx # imm = 0xFFEF3706; X64-NEXT: # kill: def $ax killed $ax killed $eax3707; X64-NEXT: lock cmpxchgw %cx, (%rdi)3708; X64-NEXT: # kill: def $ax killed $ax def $eax3709; X64-NEXT: jne .LBB58_13710; X64-NEXT: # %bb.2: # %atomicrmw.end3711; X64-NEXT: xorl %ecx, %ecx3712; X64-NEXT: testb $16, %al3713; X64-NEXT: sete %cl3714; X64-NEXT: movl %ecx, %eax3715; X64-NEXT: retq3716entry:3717 %0 = atomicrmw and ptr %v, i16 -17 monotonic, align 23718 %1 = lshr i16 %0, 43719 %.lobit = and i16 %1, 13720 %conv1 = xor i16 %.lobit, 13721 ret i16 %conv13722}3723 3724define zeroext i16 @atomic_shl1_and_16_const_brz(ptr %v) nounwind {3725; X86-LABEL: atomic_shl1_and_16_const_brz:3726; X86: # %bb.0: # %entry3727; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx3728; X86-NEXT: lock btrw $4, (%ecx)3729; X86-NEXT: movw $123, %ax3730; X86-NEXT: jae .LBB59_13731; X86-NEXT: # %bb.2: # %return3732; X86-NEXT: retl3733; X86-NEXT: .LBB59_1: # %if.then3734; X86-NEXT: movzwl 8(%ecx), %eax3735; X86-NEXT: retl3736;3737; X64-LABEL: atomic_shl1_and_16_const_brz:3738; X64: # %bb.0: # %entry3739; X64-NEXT: lock btrw $4, (%rdi)3740; X64-NEXT: movw $123, %ax3741; X64-NEXT: jae .LBB59_13742; X64-NEXT: # %bb.2: # %return3743; X64-NEXT: retq3744; X64-NEXT: .LBB59_1: # %if.then3745; X64-NEXT: movzwl 8(%rdi), %eax3746; X64-NEXT: retq3747entry:3748 %0 = atomicrmw and ptr %v, i16 -17 monotonic, align 23749 %1 = and i16 %0, 163750 %tobool.not = icmp eq i16 %1, 03751 br i1 %tobool.not, label %if.then, label %return3752 3753if.then: ; preds = %entry3754 %arrayidx = getelementptr inbounds i16, ptr %v, i64 43755 %2 = load i16, ptr %arrayidx, align 23756 br label %return3757 3758return: ; preds = %entry, %if.then3759 %retval.0 = phi i16 [ %2, %if.then ], [ 123, %entry ]3760 ret i16 %retval.03761}3762 3763define i32 @atomic_shl1_or_32_gpr_val(ptr %v, i32 %c) nounwind {3764; X86-LABEL: atomic_shl1_or_32_gpr_val:3765; X86: # %bb.0: # %entry3766; X86-NEXT: movl {{[0-9]+}}(%esp), %edx3767; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx3768; X86-NEXT: andl $31, %ecx3769; X86-NEXT: xorl %eax, %eax3770; X86-NEXT: lock btsl %ecx, (%edx)3771; X86-NEXT: setb %al3772; X86-NEXT: # kill: def $cl killed $cl killed $ecx3773; X86-NEXT: shll %cl, %eax3774; X86-NEXT: retl3775;3776; X64-LABEL: atomic_shl1_or_32_gpr_val:3777; X64: # %bb.0: # %entry3778; X64-NEXT: movl %esi, %ecx3779; X64-NEXT: andl $31, %ecx3780; X64-NEXT: xorl %eax, %eax3781; X64-NEXT: lock btsl %ecx, (%rdi)3782; X64-NEXT: setb %al3783; X64-NEXT: # kill: def $cl killed $cl killed $ecx3784; X64-NEXT: shll %cl, %eax3785; X64-NEXT: retq3786entry:3787 %shl = shl nuw i32 1, %c3788 %0 = atomicrmw or ptr %v, i32 %shl monotonic, align 43789 %and = and i32 %shl, %03790 ret i32 %and3791}3792 3793define i32 @atomic_shl1_small_mask_or_32_gpr_val(ptr %v, i32 %c) nounwind {3794; X86-LABEL: atomic_shl1_small_mask_or_32_gpr_val:3795; X86: # %bb.0: # %entry3796; X86-NEXT: movl {{[0-9]+}}(%esp), %edx3797; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx3798; X86-NEXT: andl $15, %ecx3799; X86-NEXT: xorl %eax, %eax3800; X86-NEXT: lock btsl %ecx, (%edx)3801; X86-NEXT: setb %al3802; X86-NEXT: # kill: def $cl killed $cl killed $ecx3803; X86-NEXT: shll %cl, %eax3804; X86-NEXT: retl3805;3806; X64-LABEL: atomic_shl1_small_mask_or_32_gpr_val:3807; X64: # %bb.0: # %entry3808; X64-NEXT: movl %esi, %ecx3809; X64-NEXT: andl $15, %ecx3810; X64-NEXT: xorl %eax, %eax3811; X64-NEXT: lock btsl %ecx, (%rdi)3812; X64-NEXT: setb %al3813; X64-NEXT: # kill: def $cl killed $cl killed $ecx3814; X64-NEXT: shll %cl, %eax3815; X64-NEXT: retq3816entry:3817 %0 = and i32 %c, 153818 %shl = shl nuw nsw i32 1, %03819 %1 = atomicrmw or ptr %v, i32 %shl monotonic, align 43820 %and = and i32 %1, %shl3821 ret i32 %and3822}3823 3824define i32 @atomic_shl1_mask0_or_32_gpr_val(ptr %v, i32 %c) nounwind {3825; X86-LABEL: atomic_shl1_mask0_or_32_gpr_val:3826; X86: # %bb.0: # %entry3827; X86-NEXT: movl {{[0-9]+}}(%esp), %edx3828; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx3829; X86-NEXT: andl $31, %ecx3830; X86-NEXT: xorl %eax, %eax3831; X86-NEXT: lock btsl %ecx, (%edx)3832; X86-NEXT: setb %al3833; X86-NEXT: # kill: def $cl killed $cl killed $ecx3834; X86-NEXT: shll %cl, %eax3835; X86-NEXT: retl3836;3837; X64-LABEL: atomic_shl1_mask0_or_32_gpr_val:3838; X64: # %bb.0: # %entry3839; X64-NEXT: movl %esi, %ecx3840; X64-NEXT: andl $31, %ecx3841; X64-NEXT: xorl %eax, %eax3842; X64-NEXT: lock btsl %ecx, (%rdi)3843; X64-NEXT: setb %al3844; X64-NEXT: # kill: def $cl killed $cl killed $ecx3845; X64-NEXT: shll %cl, %eax3846; X64-NEXT: retq3847entry:3848 %0 = and i32 %c, 313849 %shl = shl nuw i32 1, %03850 %1 = atomicrmw or ptr %v, i32 %shl monotonic, align 43851 %shl1 = shl nuw i32 1, %c3852 %and = and i32 %1, %shl13853 ret i32 %and3854}3855 3856define i32 @atomic_shl1_mask1_or_32_gpr_val(ptr %v, i32 %c) nounwind {3857; X86-LABEL: atomic_shl1_mask1_or_32_gpr_val:3858; X86: # %bb.0: # %entry3859; X86-NEXT: movl {{[0-9]+}}(%esp), %edx3860; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx3861; X86-NEXT: andl $31, %ecx3862; X86-NEXT: xorl %eax, %eax3863; X86-NEXT: lock btsl %ecx, (%edx)3864; X86-NEXT: setb %al3865; X86-NEXT: # kill: def $cl killed $cl killed $ecx3866; X86-NEXT: shll %cl, %eax3867; X86-NEXT: retl3868;3869; X64-LABEL: atomic_shl1_mask1_or_32_gpr_val:3870; X64: # %bb.0: # %entry3871; X64-NEXT: movl %esi, %ecx3872; X64-NEXT: andl $31, %ecx3873; X64-NEXT: xorl %eax, %eax3874; X64-NEXT: lock btsl %ecx, (%rdi)3875; X64-NEXT: setb %al3876; X64-NEXT: # kill: def $cl killed $cl killed $ecx3877; X64-NEXT: shll %cl, %eax3878; X64-NEXT: retq3879entry:3880 %shl = shl nuw i32 1, %c3881 %0 = atomicrmw or ptr %v, i32 %shl monotonic, align 43882 %1 = and i32 %c, 313883 %shl1 = shl nuw i32 1, %13884 %and = and i32 %shl1, %03885 ret i32 %and3886}3887 3888define i32 @atomic_shl1_mask01_or_32_gpr_val(ptr %v, i32 %c) nounwind {3889; X86-LABEL: atomic_shl1_mask01_or_32_gpr_val:3890; X86: # %bb.0: # %entry3891; X86-NEXT: movl {{[0-9]+}}(%esp), %edx3892; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx3893; X86-NEXT: andl $31, %ecx3894; X86-NEXT: xorl %eax, %eax3895; X86-NEXT: lock btsl %ecx, (%edx)3896; X86-NEXT: setb %al3897; X86-NEXT: # kill: def $cl killed $cl killed $ecx3898; X86-NEXT: shll %cl, %eax3899; X86-NEXT: retl3900;3901; X64-LABEL: atomic_shl1_mask01_or_32_gpr_val:3902; X64: # %bb.0: # %entry3903; X64-NEXT: movl %esi, %ecx3904; X64-NEXT: andl $31, %ecx3905; X64-NEXT: xorl %eax, %eax3906; X64-NEXT: lock btsl %ecx, (%rdi)3907; X64-NEXT: setb %al3908; X64-NEXT: # kill: def $cl killed $cl killed $ecx3909; X64-NEXT: shll %cl, %eax3910; X64-NEXT: retq3911entry:3912 %0 = and i32 %c, 313913 %shl = shl nuw i32 1, %03914 %1 = atomicrmw or ptr %v, i32 %shl monotonic, align 43915 %and = and i32 %1, %shl3916 ret i32 %and3917}3918 3919define i32 @atomic_blsi_or_32_gpr_val(ptr %v, i32 %c) nounwind {3920; X86-LABEL: atomic_blsi_or_32_gpr_val:3921; X86: # %bb.0: # %entry3922; X86-NEXT: pushl %esi3923; X86-NEXT: movl {{[0-9]+}}(%esp), %edx3924; X86-NEXT: movl {{[0-9]+}}(%esp), %eax3925; X86-NEXT: movl %eax, %ecx3926; X86-NEXT: negl %ecx3927; X86-NEXT: andl %eax, %ecx3928; X86-NEXT: movl (%edx), %eax3929; X86-NEXT: .p2align 43930; X86-NEXT: .LBB65_1: # %atomicrmw.start3931; X86-NEXT: # =>This Inner Loop Header: Depth=13932; X86-NEXT: movl %eax, %esi3933; X86-NEXT: orl %ecx, %esi3934; X86-NEXT: lock cmpxchgl %esi, (%edx)3935; X86-NEXT: jne .LBB65_13936; X86-NEXT: # %bb.2: # %atomicrmw.end3937; X86-NEXT: andl %ecx, %eax3938; X86-NEXT: popl %esi3939; X86-NEXT: retl3940;3941; X64-LABEL: atomic_blsi_or_32_gpr_val:3942; X64: # %bb.0: # %entry3943; X64-NEXT: movl %esi, %ecx3944; X64-NEXT: negl %ecx3945; X64-NEXT: andl %esi, %ecx3946; X64-NEXT: movl (%rdi), %eax3947; X64-NEXT: .p2align 43948; X64-NEXT: .LBB65_1: # %atomicrmw.start3949; X64-NEXT: # =>This Inner Loop Header: Depth=13950; X64-NEXT: movl %eax, %edx3951; X64-NEXT: orl %ecx, %edx3952; X64-NEXT: lock cmpxchgl %edx, (%rdi)3953; X64-NEXT: jne .LBB65_13954; X64-NEXT: # %bb.2: # %atomicrmw.end3955; X64-NEXT: andl %ecx, %eax3956; X64-NEXT: retq3957entry:3958 %sub = sub i32 0, %c3959 %and = and i32 %sub, %c3960 %0 = atomicrmw or ptr %v, i32 %and monotonic, align 43961 %and3 = and i32 %0, %and3962 ret i32 %and33963}3964 3965define i32 @atomic_shl1_or_32_gpr_valz(ptr %v, i32 %c) nounwind {3966; X86-LABEL: atomic_shl1_or_32_gpr_valz:3967; X86: # %bb.0: # %entry3968; X86-NEXT: pushl %edi3969; X86-NEXT: pushl %esi3970; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx3971; X86-NEXT: movl {{[0-9]+}}(%esp), %edx3972; X86-NEXT: movl $1, %esi3973; X86-NEXT: shll %cl, %esi3974; X86-NEXT: movl (%edx), %eax3975; X86-NEXT: .p2align 43976; X86-NEXT: .LBB66_1: # %atomicrmw.start3977; X86-NEXT: # =>This Inner Loop Header: Depth=13978; X86-NEXT: movl %eax, %edi3979; X86-NEXT: orl %esi, %edi3980; X86-NEXT: lock cmpxchgl %edi, (%edx)3981; X86-NEXT: jne .LBB66_13982; X86-NEXT: # %bb.2: # %atomicrmw.end3983; X86-NEXT: xorl %edx, %edx3984; X86-NEXT: btl %ecx, %eax3985; X86-NEXT: setae %dl3986; X86-NEXT: movl %edx, %eax3987; X86-NEXT: popl %esi3988; X86-NEXT: popl %edi3989; X86-NEXT: retl3990;3991; X64-LABEL: atomic_shl1_or_32_gpr_valz:3992; X64: # %bb.0: # %entry3993; X64-NEXT: movl %esi, %ecx3994; X64-NEXT: movl $1, %edx3995; X64-NEXT: shll %cl, %edx3996; X64-NEXT: movl (%rdi), %eax3997; X64-NEXT: .p2align 43998; X64-NEXT: .LBB66_1: # %atomicrmw.start3999; X64-NEXT: # =>This Inner Loop Header: Depth=14000; X64-NEXT: movl %eax, %esi4001; X64-NEXT: orl %edx, %esi4002; X64-NEXT: lock cmpxchgl %esi, (%rdi)4003; X64-NEXT: jne .LBB66_14004; X64-NEXT: # %bb.2: # %atomicrmw.end4005; X64-NEXT: xorl %edx, %edx4006; X64-NEXT: btl %ecx, %eax4007; X64-NEXT: setae %dl4008; X64-NEXT: movl %edx, %eax4009; X64-NEXT: retq4010entry:4011 %shl = shl nuw i32 1, %c4012 %0 = atomicrmw or ptr %v, i32 %shl monotonic, align 44013 %1 = xor i32 %0, -14014 %2 = lshr i32 %1, %c4015 %lnot.ext = and i32 %2, 14016 ret i32 %lnot.ext4017}4018 4019define i32 @atomic_shl1_small_mask_or_32_gpr_valz(ptr %v, i32 %c) nounwind {4020; X86-LABEL: atomic_shl1_small_mask_or_32_gpr_valz:4021; X86: # %bb.0: # %entry4022; X86-NEXT: pushl %edi4023; X86-NEXT: pushl %esi4024; X86-NEXT: movl {{[0-9]+}}(%esp), %edx4025; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx4026; X86-NEXT: andl $15, %ecx4027; X86-NEXT: movl $1, %esi4028; X86-NEXT: shll %cl, %esi4029; X86-NEXT: movl (%edx), %eax4030; X86-NEXT: .p2align 44031; X86-NEXT: .LBB67_1: # %atomicrmw.start4032; X86-NEXT: # =>This Inner Loop Header: Depth=14033; X86-NEXT: movl %eax, %edi4034; X86-NEXT: orl %esi, %edi4035; X86-NEXT: lock cmpxchgl %edi, (%edx)4036; X86-NEXT: jne .LBB67_14037; X86-NEXT: # %bb.2: # %atomicrmw.end4038; X86-NEXT: xorl %edx, %edx4039; X86-NEXT: btl %ecx, %eax4040; X86-NEXT: setae %dl4041; X86-NEXT: movl %edx, %eax4042; X86-NEXT: popl %esi4043; X86-NEXT: popl %edi4044; X86-NEXT: retl4045;4046; X64-LABEL: atomic_shl1_small_mask_or_32_gpr_valz:4047; X64: # %bb.0: # %entry4048; X64-NEXT: movl %esi, %ecx4049; X64-NEXT: andl $15, %ecx4050; X64-NEXT: movl $1, %edx4051; X64-NEXT: shll %cl, %edx4052; X64-NEXT: movl (%rdi), %eax4053; X64-NEXT: .p2align 44054; X64-NEXT: .LBB67_1: # %atomicrmw.start4055; X64-NEXT: # =>This Inner Loop Header: Depth=14056; X64-NEXT: movl %eax, %esi4057; X64-NEXT: orl %edx, %esi4058; X64-NEXT: lock cmpxchgl %esi, (%rdi)4059; X64-NEXT: jne .LBB67_14060; X64-NEXT: # %bb.2: # %atomicrmw.end4061; X64-NEXT: xorl %edx, %edx4062; X64-NEXT: btl %ecx, %eax4063; X64-NEXT: setae %dl4064; X64-NEXT: movl %edx, %eax4065; X64-NEXT: retq4066entry:4067 %0 = and i32 %c, 154068 %shl = shl nuw nsw i32 1, %04069 %1 = atomicrmw or ptr %v, i32 %shl monotonic, align 44070 %2 = xor i32 %1, -14071 %3 = lshr i32 %2, %04072 %lnot.ext = and i32 %3, 14073 ret i32 %lnot.ext4074}4075 4076define i32 @atomic_shl1_mask0_or_32_gpr_valz(ptr %v, i32 %c) nounwind {4077; X86-LABEL: atomic_shl1_mask0_or_32_gpr_valz:4078; X86: # %bb.0: # %entry4079; X86-NEXT: pushl %edi4080; X86-NEXT: pushl %esi4081; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx4082; X86-NEXT: movl {{[0-9]+}}(%esp), %edx4083; X86-NEXT: movl $1, %esi4084; X86-NEXT: shll %cl, %esi4085; X86-NEXT: movl (%edx), %eax4086; X86-NEXT: .p2align 44087; X86-NEXT: .LBB68_1: # %atomicrmw.start4088; X86-NEXT: # =>This Inner Loop Header: Depth=14089; X86-NEXT: movl %eax, %edi4090; X86-NEXT: orl %esi, %edi4091; X86-NEXT: lock cmpxchgl %edi, (%edx)4092; X86-NEXT: jne .LBB68_14093; X86-NEXT: # %bb.2: # %atomicrmw.end4094; X86-NEXT: xorl %edx, %edx4095; X86-NEXT: btl %ecx, %eax4096; X86-NEXT: setae %dl4097; X86-NEXT: movl %edx, %eax4098; X86-NEXT: popl %esi4099; X86-NEXT: popl %edi4100; X86-NEXT: retl4101;4102; X64-LABEL: atomic_shl1_mask0_or_32_gpr_valz:4103; X64: # %bb.0: # %entry4104; X64-NEXT: movl %esi, %ecx4105; X64-NEXT: movl $1, %edx4106; X64-NEXT: shll %cl, %edx4107; X64-NEXT: movl (%rdi), %eax4108; X64-NEXT: .p2align 44109; X64-NEXT: .LBB68_1: # %atomicrmw.start4110; X64-NEXT: # =>This Inner Loop Header: Depth=14111; X64-NEXT: movl %eax, %esi4112; X64-NEXT: orl %edx, %esi4113; X64-NEXT: lock cmpxchgl %esi, (%rdi)4114; X64-NEXT: jne .LBB68_14115; X64-NEXT: # %bb.2: # %atomicrmw.end4116; X64-NEXT: xorl %edx, %edx4117; X64-NEXT: btl %ecx, %eax4118; X64-NEXT: setae %dl4119; X64-NEXT: movl %edx, %eax4120; X64-NEXT: retq4121entry:4122 %0 = and i32 %c, 314123 %shl = shl nuw i32 1, %04124 %1 = atomicrmw or ptr %v, i32 %shl monotonic, align 44125 %2 = xor i32 %1, -14126 %3 = lshr i32 %2, %c4127 %lnot.ext = and i32 %3, 14128 ret i32 %lnot.ext4129}4130 4131define i32 @atomic_shl1_mask1_or_32_gpr_valz(ptr %v, i32 %c) nounwind {4132; X86-LABEL: atomic_shl1_mask1_or_32_gpr_valz:4133; X86: # %bb.0: # %entry4134; X86-NEXT: pushl %edi4135; X86-NEXT: pushl %esi4136; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx4137; X86-NEXT: movl {{[0-9]+}}(%esp), %edx4138; X86-NEXT: movl $1, %esi4139; X86-NEXT: shll %cl, %esi4140; X86-NEXT: movl (%edx), %eax4141; X86-NEXT: .p2align 44142; X86-NEXT: .LBB69_1: # %atomicrmw.start4143; X86-NEXT: # =>This Inner Loop Header: Depth=14144; X86-NEXT: movl %eax, %edi4145; X86-NEXT: orl %esi, %edi4146; X86-NEXT: lock cmpxchgl %edi, (%edx)4147; X86-NEXT: jne .LBB69_14148; X86-NEXT: # %bb.2: # %atomicrmw.end4149; X86-NEXT: xorl %edx, %edx4150; X86-NEXT: btl %ecx, %eax4151; X86-NEXT: setae %dl4152; X86-NEXT: movl %edx, %eax4153; X86-NEXT: popl %esi4154; X86-NEXT: popl %edi4155; X86-NEXT: retl4156;4157; X64-LABEL: atomic_shl1_mask1_or_32_gpr_valz:4158; X64: # %bb.0: # %entry4159; X64-NEXT: movl %esi, %ecx4160; X64-NEXT: movl $1, %edx4161; X64-NEXT: shll %cl, %edx4162; X64-NEXT: movl (%rdi), %eax4163; X64-NEXT: .p2align 44164; X64-NEXT: .LBB69_1: # %atomicrmw.start4165; X64-NEXT: # =>This Inner Loop Header: Depth=14166; X64-NEXT: movl %eax, %esi4167; X64-NEXT: orl %edx, %esi4168; X64-NEXT: lock cmpxchgl %esi, (%rdi)4169; X64-NEXT: jne .LBB69_14170; X64-NEXT: # %bb.2: # %atomicrmw.end4171; X64-NEXT: xorl %edx, %edx4172; X64-NEXT: btl %ecx, %eax4173; X64-NEXT: setae %dl4174; X64-NEXT: movl %edx, %eax4175; X64-NEXT: retq4176entry:4177 %shl = shl nuw i32 1, %c4178 %0 = atomicrmw or ptr %v, i32 %shl monotonic, align 44179 %1 = and i32 %c, 314180 %2 = xor i32 %0, -14181 %3 = lshr i32 %2, %14182 %lnot.ext = and i32 %3, 14183 ret i32 %lnot.ext4184}4185 4186define i32 @atomic_shl1_mask01_or_32_gpr_valz(ptr %v, i32 %c) nounwind {4187; X86-LABEL: atomic_shl1_mask01_or_32_gpr_valz:4188; X86: # %bb.0: # %entry4189; X86-NEXT: pushl %edi4190; X86-NEXT: pushl %esi4191; X86-NEXT: movl {{[0-9]+}}(%esp), %edx4192; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx4193; X86-NEXT: andl $31, %ecx4194; X86-NEXT: movl $1, %esi4195; X86-NEXT: shll %cl, %esi4196; X86-NEXT: movl (%edx), %eax4197; X86-NEXT: .p2align 44198; X86-NEXT: .LBB70_1: # %atomicrmw.start4199; X86-NEXT: # =>This Inner Loop Header: Depth=14200; X86-NEXT: movl %eax, %edi4201; X86-NEXT: orl %esi, %edi4202; X86-NEXT: lock cmpxchgl %edi, (%edx)4203; X86-NEXT: jne .LBB70_14204; X86-NEXT: # %bb.2: # %atomicrmw.end4205; X86-NEXT: xorl %edx, %edx4206; X86-NEXT: btl %ecx, %eax4207; X86-NEXT: setae %dl4208; X86-NEXT: movl %edx, %eax4209; X86-NEXT: popl %esi4210; X86-NEXT: popl %edi4211; X86-NEXT: retl4212;4213; X64-LABEL: atomic_shl1_mask01_or_32_gpr_valz:4214; X64: # %bb.0: # %entry4215; X64-NEXT: movl %esi, %ecx4216; X64-NEXT: andl $31, %ecx4217; X64-NEXT: movl $1, %edx4218; X64-NEXT: shll %cl, %edx4219; X64-NEXT: movl (%rdi), %eax4220; X64-NEXT: .p2align 44221; X64-NEXT: .LBB70_1: # %atomicrmw.start4222; X64-NEXT: # =>This Inner Loop Header: Depth=14223; X64-NEXT: movl %eax, %esi4224; X64-NEXT: orl %edx, %esi4225; X64-NEXT: lock cmpxchgl %esi, (%rdi)4226; X64-NEXT: jne .LBB70_14227; X64-NEXT: # %bb.2: # %atomicrmw.end4228; X64-NEXT: xorl %edx, %edx4229; X64-NEXT: btl %ecx, %eax4230; X64-NEXT: setae %dl4231; X64-NEXT: movl %edx, %eax4232; X64-NEXT: retq4233entry:4234 %0 = and i32 %c, 314235 %shl = shl nuw i32 1, %04236 %1 = atomicrmw or ptr %v, i32 %shl monotonic, align 44237 %2 = xor i32 %1, -14238 %3 = lshr i32 %2, %04239 %lnot.ext = and i32 %3, 14240 ret i32 %lnot.ext4241}4242 4243define i32 @atomic_blsi_or_32_gpr_valz(ptr %v, i32 %c) nounwind {4244; X86-LABEL: atomic_blsi_or_32_gpr_valz:4245; X86: # %bb.0: # %entry4246; X86-NEXT: pushl %esi4247; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx4248; X86-NEXT: movl {{[0-9]+}}(%esp), %eax4249; X86-NEXT: movl %eax, %edx4250; X86-NEXT: negl %edx4251; X86-NEXT: andl %eax, %edx4252; X86-NEXT: movl (%ecx), %eax4253; X86-NEXT: .p2align 44254; X86-NEXT: .LBB71_1: # %atomicrmw.start4255; X86-NEXT: # =>This Inner Loop Header: Depth=14256; X86-NEXT: movl %eax, %esi4257; X86-NEXT: orl %edx, %esi4258; X86-NEXT: lock cmpxchgl %esi, (%ecx)4259; X86-NEXT: jne .LBB71_14260; X86-NEXT: # %bb.2: # %atomicrmw.end4261; X86-NEXT: xorl %ecx, %ecx4262; X86-NEXT: testl %edx, %eax4263; X86-NEXT: sete %cl4264; X86-NEXT: movl %ecx, %eax4265; X86-NEXT: popl %esi4266; X86-NEXT: retl4267;4268; X64-LABEL: atomic_blsi_or_32_gpr_valz:4269; X64: # %bb.0: # %entry4270; X64-NEXT: movl %esi, %edx4271; X64-NEXT: negl %edx4272; X64-NEXT: andl %esi, %edx4273; X64-NEXT: movl (%rdi), %eax4274; X64-NEXT: .p2align 44275; X64-NEXT: .LBB71_1: # %atomicrmw.start4276; X64-NEXT: # =>This Inner Loop Header: Depth=14277; X64-NEXT: movl %eax, %ecx4278; X64-NEXT: orl %edx, %ecx4279; X64-NEXT: lock cmpxchgl %ecx, (%rdi)4280; X64-NEXT: jne .LBB71_14281; X64-NEXT: # %bb.2: # %atomicrmw.end4282; X64-NEXT: xorl %ecx, %ecx4283; X64-NEXT: testl %edx, %eax4284; X64-NEXT: sete %cl4285; X64-NEXT: movl %ecx, %eax4286; X64-NEXT: retq4287entry:4288 %sub = sub i32 0, %c4289 %and = and i32 %sub, %c4290 %0 = atomicrmw or ptr %v, i32 %and monotonic, align 44291 %and3 = and i32 %0, %and4292 %tobool.not = icmp eq i32 %and3, 04293 %lnot.ext = zext i1 %tobool.not to i324294 ret i32 %lnot.ext4295}4296 4297define i32 @atomic_shl1_or_32_gpr_valnz(ptr %v, i32 %c) nounwind {4298; X86-LABEL: atomic_shl1_or_32_gpr_valnz:4299; X86: # %bb.0: # %entry4300; X86-NEXT: pushl %edi4301; X86-NEXT: pushl %esi4302; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx4303; X86-NEXT: movl {{[0-9]+}}(%esp), %edx4304; X86-NEXT: movl $1, %esi4305; X86-NEXT: shll %cl, %esi4306; X86-NEXT: movl (%edx), %eax4307; X86-NEXT: .p2align 44308; X86-NEXT: .LBB72_1: # %atomicrmw.start4309; X86-NEXT: # =>This Inner Loop Header: Depth=14310; X86-NEXT: movl %eax, %edi4311; X86-NEXT: orl %esi, %edi4312; X86-NEXT: lock cmpxchgl %edi, (%edx)4313; X86-NEXT: jne .LBB72_14314; X86-NEXT: # %bb.2: # %atomicrmw.end4315; X86-NEXT: xorl %edx, %edx4316; X86-NEXT: btl %ecx, %eax4317; X86-NEXT: setb %dl4318; X86-NEXT: movl %edx, %eax4319; X86-NEXT: popl %esi4320; X86-NEXT: popl %edi4321; X86-NEXT: retl4322;4323; X64-LABEL: atomic_shl1_or_32_gpr_valnz:4324; X64: # %bb.0: # %entry4325; X64-NEXT: movl %esi, %ecx4326; X64-NEXT: movl $1, %edx4327; X64-NEXT: shll %cl, %edx4328; X64-NEXT: movl (%rdi), %eax4329; X64-NEXT: .p2align 44330; X64-NEXT: .LBB72_1: # %atomicrmw.start4331; X64-NEXT: # =>This Inner Loop Header: Depth=14332; X64-NEXT: movl %eax, %esi4333; X64-NEXT: orl %edx, %esi4334; X64-NEXT: lock cmpxchgl %esi, (%rdi)4335; X64-NEXT: jne .LBB72_14336; X64-NEXT: # %bb.2: # %atomicrmw.end4337; X64-NEXT: xorl %edx, %edx4338; X64-NEXT: btl %ecx, %eax4339; X64-NEXT: setb %dl4340; X64-NEXT: movl %edx, %eax4341; X64-NEXT: retq4342entry:4343 %shl = shl nuw i32 1, %c4344 %0 = atomicrmw or ptr %v, i32 %shl monotonic, align 44345 %1 = lshr i32 %0, %c4346 %lnot.ext = and i32 %1, 14347 ret i32 %lnot.ext4348}4349 4350define i32 @atomic_shl1_small_mask_or_32_gpr_valnz(ptr %v, i32 %c) nounwind {4351; X86-LABEL: atomic_shl1_small_mask_or_32_gpr_valnz:4352; X86: # %bb.0: # %entry4353; X86-NEXT: pushl %edi4354; X86-NEXT: pushl %esi4355; X86-NEXT: movl {{[0-9]+}}(%esp), %edx4356; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx4357; X86-NEXT: andl $15, %ecx4358; X86-NEXT: movl $1, %esi4359; X86-NEXT: shll %cl, %esi4360; X86-NEXT: movl (%edx), %eax4361; X86-NEXT: .p2align 44362; X86-NEXT: .LBB73_1: # %atomicrmw.start4363; X86-NEXT: # =>This Inner Loop Header: Depth=14364; X86-NEXT: movl %eax, %edi4365; X86-NEXT: orl %esi, %edi4366; X86-NEXT: lock cmpxchgl %edi, (%edx)4367; X86-NEXT: jne .LBB73_14368; X86-NEXT: # %bb.2: # %atomicrmw.end4369; X86-NEXT: xorl %edx, %edx4370; X86-NEXT: btl %ecx, %eax4371; X86-NEXT: setb %dl4372; X86-NEXT: movl %edx, %eax4373; X86-NEXT: popl %esi4374; X86-NEXT: popl %edi4375; X86-NEXT: retl4376;4377; X64-LABEL: atomic_shl1_small_mask_or_32_gpr_valnz:4378; X64: # %bb.0: # %entry4379; X64-NEXT: movl %esi, %ecx4380; X64-NEXT: andl $15, %ecx4381; X64-NEXT: movl $1, %edx4382; X64-NEXT: shll %cl, %edx4383; X64-NEXT: movl (%rdi), %eax4384; X64-NEXT: .p2align 44385; X64-NEXT: .LBB73_1: # %atomicrmw.start4386; X64-NEXT: # =>This Inner Loop Header: Depth=14387; X64-NEXT: movl %eax, %esi4388; X64-NEXT: orl %edx, %esi4389; X64-NEXT: lock cmpxchgl %esi, (%rdi)4390; X64-NEXT: jne .LBB73_14391; X64-NEXT: # %bb.2: # %atomicrmw.end4392; X64-NEXT: xorl %edx, %edx4393; X64-NEXT: btl %ecx, %eax4394; X64-NEXT: setb %dl4395; X64-NEXT: movl %edx, %eax4396; X64-NEXT: retq4397entry:4398 %0 = and i32 %c, 154399 %shl = shl nuw nsw i32 1, %04400 %1 = atomicrmw or ptr %v, i32 %shl monotonic, align 44401 %2 = lshr i32 %1, %04402 %lnot.ext = and i32 %2, 14403 ret i32 %lnot.ext4404}4405 4406define i32 @atomic_shl1_mask0_or_32_gpr_valnz(ptr %v, i32 %c) nounwind {4407; X86-LABEL: atomic_shl1_mask0_or_32_gpr_valnz:4408; X86: # %bb.0: # %entry4409; X86-NEXT: pushl %edi4410; X86-NEXT: pushl %esi4411; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx4412; X86-NEXT: movl {{[0-9]+}}(%esp), %edx4413; X86-NEXT: movl $1, %esi4414; X86-NEXT: shll %cl, %esi4415; X86-NEXT: movl (%edx), %eax4416; X86-NEXT: .p2align 44417; X86-NEXT: .LBB74_1: # %atomicrmw.start4418; X86-NEXT: # =>This Inner Loop Header: Depth=14419; X86-NEXT: movl %eax, %edi4420; X86-NEXT: orl %esi, %edi4421; X86-NEXT: lock cmpxchgl %edi, (%edx)4422; X86-NEXT: jne .LBB74_14423; X86-NEXT: # %bb.2: # %atomicrmw.end4424; X86-NEXT: xorl %edx, %edx4425; X86-NEXT: btl %ecx, %eax4426; X86-NEXT: setb %dl4427; X86-NEXT: movl %edx, %eax4428; X86-NEXT: popl %esi4429; X86-NEXT: popl %edi4430; X86-NEXT: retl4431;4432; X64-LABEL: atomic_shl1_mask0_or_32_gpr_valnz:4433; X64: # %bb.0: # %entry4434; X64-NEXT: movl %esi, %ecx4435; X64-NEXT: movl $1, %edx4436; X64-NEXT: shll %cl, %edx4437; X64-NEXT: movl (%rdi), %eax4438; X64-NEXT: .p2align 44439; X64-NEXT: .LBB74_1: # %atomicrmw.start4440; X64-NEXT: # =>This Inner Loop Header: Depth=14441; X64-NEXT: movl %eax, %esi4442; X64-NEXT: orl %edx, %esi4443; X64-NEXT: lock cmpxchgl %esi, (%rdi)4444; X64-NEXT: jne .LBB74_14445; X64-NEXT: # %bb.2: # %atomicrmw.end4446; X64-NEXT: xorl %edx, %edx4447; X64-NEXT: btl %ecx, %eax4448; X64-NEXT: setb %dl4449; X64-NEXT: movl %edx, %eax4450; X64-NEXT: retq4451entry:4452 %0 = and i32 %c, 314453 %shl = shl nuw i32 1, %04454 %1 = atomicrmw or ptr %v, i32 %shl monotonic, align 44455 %2 = lshr i32 %1, %c4456 %lnot.ext = and i32 %2, 14457 ret i32 %lnot.ext4458}4459 4460define i32 @atomic_shl1_mask1_or_32_gpr_valnz(ptr %v, i32 %c) nounwind {4461; X86-LABEL: atomic_shl1_mask1_or_32_gpr_valnz:4462; X86: # %bb.0: # %entry4463; X86-NEXT: pushl %edi4464; X86-NEXT: pushl %esi4465; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx4466; X86-NEXT: movl {{[0-9]+}}(%esp), %edx4467; X86-NEXT: movl $1, %esi4468; X86-NEXT: shll %cl, %esi4469; X86-NEXT: movl (%edx), %eax4470; X86-NEXT: .p2align 44471; X86-NEXT: .LBB75_1: # %atomicrmw.start4472; X86-NEXT: # =>This Inner Loop Header: Depth=14473; X86-NEXT: movl %eax, %edi4474; X86-NEXT: orl %esi, %edi4475; X86-NEXT: lock cmpxchgl %edi, (%edx)4476; X86-NEXT: jne .LBB75_14477; X86-NEXT: # %bb.2: # %atomicrmw.end4478; X86-NEXT: xorl %edx, %edx4479; X86-NEXT: btl %ecx, %eax4480; X86-NEXT: setb %dl4481; X86-NEXT: movl %edx, %eax4482; X86-NEXT: popl %esi4483; X86-NEXT: popl %edi4484; X86-NEXT: retl4485;4486; X64-LABEL: atomic_shl1_mask1_or_32_gpr_valnz:4487; X64: # %bb.0: # %entry4488; X64-NEXT: movl %esi, %ecx4489; X64-NEXT: movl $1, %edx4490; X64-NEXT: shll %cl, %edx4491; X64-NEXT: movl (%rdi), %eax4492; X64-NEXT: .p2align 44493; X64-NEXT: .LBB75_1: # %atomicrmw.start4494; X64-NEXT: # =>This Inner Loop Header: Depth=14495; X64-NEXT: movl %eax, %esi4496; X64-NEXT: orl %edx, %esi4497; X64-NEXT: lock cmpxchgl %esi, (%rdi)4498; X64-NEXT: jne .LBB75_14499; X64-NEXT: # %bb.2: # %atomicrmw.end4500; X64-NEXT: xorl %edx, %edx4501; X64-NEXT: btl %ecx, %eax4502; X64-NEXT: setb %dl4503; X64-NEXT: movl %edx, %eax4504; X64-NEXT: retq4505entry:4506 %shl = shl nuw i32 1, %c4507 %0 = atomicrmw or ptr %v, i32 %shl monotonic, align 44508 %1 = and i32 %c, 314509 %2 = lshr i32 %0, %14510 %lnot.ext = and i32 %2, 14511 ret i32 %lnot.ext4512}4513 4514define i32 @atomic_shl1_mask01_or_32_gpr_valnz(ptr %v, i32 %c) nounwind {4515; X86-LABEL: atomic_shl1_mask01_or_32_gpr_valnz:4516; X86: # %bb.0: # %entry4517; X86-NEXT: pushl %edi4518; X86-NEXT: pushl %esi4519; X86-NEXT: movl {{[0-9]+}}(%esp), %edx4520; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx4521; X86-NEXT: andl $31, %ecx4522; X86-NEXT: movl $1, %esi4523; X86-NEXT: shll %cl, %esi4524; X86-NEXT: movl (%edx), %eax4525; X86-NEXT: .p2align 44526; X86-NEXT: .LBB76_1: # %atomicrmw.start4527; X86-NEXT: # =>This Inner Loop Header: Depth=14528; X86-NEXT: movl %eax, %edi4529; X86-NEXT: orl %esi, %edi4530; X86-NEXT: lock cmpxchgl %edi, (%edx)4531; X86-NEXT: jne .LBB76_14532; X86-NEXT: # %bb.2: # %atomicrmw.end4533; X86-NEXT: xorl %edx, %edx4534; X86-NEXT: btl %ecx, %eax4535; X86-NEXT: setb %dl4536; X86-NEXT: movl %edx, %eax4537; X86-NEXT: popl %esi4538; X86-NEXT: popl %edi4539; X86-NEXT: retl4540;4541; X64-LABEL: atomic_shl1_mask01_or_32_gpr_valnz:4542; X64: # %bb.0: # %entry4543; X64-NEXT: movl %esi, %ecx4544; X64-NEXT: andl $31, %ecx4545; X64-NEXT: movl $1, %edx4546; X64-NEXT: shll %cl, %edx4547; X64-NEXT: movl (%rdi), %eax4548; X64-NEXT: .p2align 44549; X64-NEXT: .LBB76_1: # %atomicrmw.start4550; X64-NEXT: # =>This Inner Loop Header: Depth=14551; X64-NEXT: movl %eax, %esi4552; X64-NEXT: orl %edx, %esi4553; X64-NEXT: lock cmpxchgl %esi, (%rdi)4554; X64-NEXT: jne .LBB76_14555; X64-NEXT: # %bb.2: # %atomicrmw.end4556; X64-NEXT: xorl %edx, %edx4557; X64-NEXT: btl %ecx, %eax4558; X64-NEXT: setb %dl4559; X64-NEXT: movl %edx, %eax4560; X64-NEXT: retq4561entry:4562 %0 = and i32 %c, 314563 %shl = shl nuw i32 1, %04564 %1 = atomicrmw or ptr %v, i32 %shl monotonic, align 44565 %2 = lshr i32 %1, %04566 %lnot.ext = and i32 %2, 14567 ret i32 %lnot.ext4568}4569 4570define i32 @atomic_blsi_or_32_gpr_valnz(ptr %v, i32 %c) nounwind {4571; X86-LABEL: atomic_blsi_or_32_gpr_valnz:4572; X86: # %bb.0: # %entry4573; X86-NEXT: pushl %esi4574; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx4575; X86-NEXT: movl {{[0-9]+}}(%esp), %eax4576; X86-NEXT: movl %eax, %edx4577; X86-NEXT: negl %edx4578; X86-NEXT: andl %eax, %edx4579; X86-NEXT: movl (%ecx), %eax4580; X86-NEXT: .p2align 44581; X86-NEXT: .LBB77_1: # %atomicrmw.start4582; X86-NEXT: # =>This Inner Loop Header: Depth=14583; X86-NEXT: movl %eax, %esi4584; X86-NEXT: orl %edx, %esi4585; X86-NEXT: lock cmpxchgl %esi, (%ecx)4586; X86-NEXT: jne .LBB77_14587; X86-NEXT: # %bb.2: # %atomicrmw.end4588; X86-NEXT: xorl %ecx, %ecx4589; X86-NEXT: testl %edx, %eax4590; X86-NEXT: setne %cl4591; X86-NEXT: movl %ecx, %eax4592; X86-NEXT: popl %esi4593; X86-NEXT: retl4594;4595; X64-LABEL: atomic_blsi_or_32_gpr_valnz:4596; X64: # %bb.0: # %entry4597; X64-NEXT: movl %esi, %edx4598; X64-NEXT: negl %edx4599; X64-NEXT: andl %esi, %edx4600; X64-NEXT: movl (%rdi), %eax4601; X64-NEXT: .p2align 44602; X64-NEXT: .LBB77_1: # %atomicrmw.start4603; X64-NEXT: # =>This Inner Loop Header: Depth=14604; X64-NEXT: movl %eax, %ecx4605; X64-NEXT: orl %edx, %ecx4606; X64-NEXT: lock cmpxchgl %ecx, (%rdi)4607; X64-NEXT: jne .LBB77_14608; X64-NEXT: # %bb.2: # %atomicrmw.end4609; X64-NEXT: xorl %ecx, %ecx4610; X64-NEXT: testl %edx, %eax4611; X64-NEXT: setne %cl4612; X64-NEXT: movl %ecx, %eax4613; X64-NEXT: retq4614entry:4615 %sub = sub i32 0, %c4616 %and = and i32 %sub, %c4617 %0 = atomicrmw or ptr %v, i32 %and monotonic, align 44618 %and3 = and i32 %0, %and4619 %tobool = icmp ne i32 %and3, 04620 %lnot.ext = zext i1 %tobool to i324621 ret i32 %lnot.ext4622}4623 4624define i32 @atomic_shl1_or_32_gpr_br(ptr %v, i32 %c) nounwind {4625; X86-LABEL: atomic_shl1_or_32_gpr_br:4626; X86: # %bb.0: # %entry4627; X86-NEXT: movl {{[0-9]+}}(%esp), %eax4628; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx4629; X86-NEXT: movl %eax, %edx4630; X86-NEXT: andl $31, %edx4631; X86-NEXT: lock btsl %edx, (%ecx)4632; X86-NEXT: jae .LBB78_14633; X86-NEXT: # %bb.2: # %if.then4634; X86-NEXT: movl (%ecx,%eax,4), %eax4635; X86-NEXT: retl4636; X86-NEXT: .LBB78_1:4637; X86-NEXT: movl $123, %eax4638; X86-NEXT: retl4639;4640; X64-LABEL: atomic_shl1_or_32_gpr_br:4641; X64: # %bb.0: # %entry4642; X64-NEXT: movl %esi, %eax4643; X64-NEXT: andl $31, %eax4644; X64-NEXT: lock btsl %eax, (%rdi)4645; X64-NEXT: jae .LBB78_14646; X64-NEXT: # %bb.2: # %if.then4647; X64-NEXT: movl %esi, %eax4648; X64-NEXT: movl (%rdi,%rax,4), %eax4649; X64-NEXT: retq4650; X64-NEXT: .LBB78_1:4651; X64-NEXT: movl $123, %eax4652; X64-NEXT: retq4653entry:4654 %shl = shl nuw i32 1, %c4655 %0 = atomicrmw or ptr %v, i32 %shl monotonic, align 44656 %and = and i32 %0, %shl4657 %tobool.not = icmp eq i32 %and, 04658 br i1 %tobool.not, label %return, label %if.then4659 4660if.then: ; preds = %entry4661 %idxprom = zext i32 %c to i644662 %arrayidx = getelementptr inbounds i32, ptr %v, i64 %idxprom4663 %1 = load i32, ptr %arrayidx, align 44664 br label %return4665 4666return: ; preds = %entry, %if.then4667 %retval.0 = phi i32 [ %1, %if.then ], [ 123, %entry ]4668 ret i32 %retval.04669}4670 4671define i32 @atomic_shl1_small_mask_or_32_gpr_br(ptr %v, i32 %c) nounwind {4672; X86-LABEL: atomic_shl1_small_mask_or_32_gpr_br:4673; X86: # %bb.0: # %entry4674; X86-NEXT: movl {{[0-9]+}}(%esp), %eax4675; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx4676; X86-NEXT: andl $15, %ecx4677; X86-NEXT: lock btsl %ecx, (%eax)4678; X86-NEXT: jae .LBB79_14679; X86-NEXT: # %bb.2: # %if.then4680; X86-NEXT: movl (%eax,%ecx,4), %eax4681; X86-NEXT: retl4682; X86-NEXT: .LBB79_1:4683; X86-NEXT: movl $123, %eax4684; X86-NEXT: retl4685;4686; X64-LABEL: atomic_shl1_small_mask_or_32_gpr_br:4687; X64: # %bb.0: # %entry4688; X64-NEXT: andl $15, %esi4689; X64-NEXT: lock btsl %esi, (%rdi)4690; X64-NEXT: jae .LBB79_14691; X64-NEXT: # %bb.2: # %if.then4692; X64-NEXT: movl %esi, %eax4693; X64-NEXT: movl (%rdi,%rax,4), %eax4694; X64-NEXT: retq4695; X64-NEXT: .LBB79_1:4696; X64-NEXT: movl $123, %eax4697; X64-NEXT: retq4698entry:4699 %0 = and i32 %c, 154700 %shl = shl nuw nsw i32 1, %04701 %1 = atomicrmw or ptr %v, i32 %shl monotonic, align 44702 %and = and i32 %shl, %14703 %tobool.not = icmp eq i32 %and, 04704 br i1 %tobool.not, label %return, label %if.then4705 4706if.then: ; preds = %entry4707 %conv2 = zext i32 %0 to i644708 %arrayidx = getelementptr inbounds i32, ptr %v, i64 %conv24709 %2 = load i32, ptr %arrayidx, align 44710 br label %return4711 4712return: ; preds = %entry, %if.then4713 %retval.0 = phi i32 [ %2, %if.then ], [ 123, %entry ]4714 ret i32 %retval.04715}4716 4717define i32 @atomic_shl1_mask0_or_32_gpr_br(ptr %v, i32 %c) nounwind {4718; X86-LABEL: atomic_shl1_mask0_or_32_gpr_br:4719; X86: # %bb.0: # %entry4720; X86-NEXT: movl {{[0-9]+}}(%esp), %eax4721; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx4722; X86-NEXT: movl %eax, %edx4723; X86-NEXT: andl $31, %edx4724; X86-NEXT: lock btsl %edx, (%ecx)4725; X86-NEXT: jae .LBB80_14726; X86-NEXT: # %bb.2: # %if.then4727; X86-NEXT: movl (%ecx,%eax,4), %eax4728; X86-NEXT: retl4729; X86-NEXT: .LBB80_1:4730; X86-NEXT: movl $123, %eax4731; X86-NEXT: retl4732;4733; X64-LABEL: atomic_shl1_mask0_or_32_gpr_br:4734; X64: # %bb.0: # %entry4735; X64-NEXT: movl %esi, %eax4736; X64-NEXT: andl $31, %eax4737; X64-NEXT: lock btsl %eax, (%rdi)4738; X64-NEXT: jae .LBB80_14739; X64-NEXT: # %bb.2: # %if.then4740; X64-NEXT: movl %esi, %eax4741; X64-NEXT: movl (%rdi,%rax,4), %eax4742; X64-NEXT: retq4743; X64-NEXT: .LBB80_1:4744; X64-NEXT: movl $123, %eax4745; X64-NEXT: retq4746entry:4747 %rem = and i32 %c, 314748 %shl = shl nuw i32 1, %rem4749 %0 = atomicrmw or ptr %v, i32 %shl monotonic, align 44750 %shl1 = shl nuw i32 1, %c4751 %and = and i32 %0, %shl14752 %tobool.not = icmp eq i32 %and, 04753 br i1 %tobool.not, label %return, label %if.then4754 4755if.then: ; preds = %entry4756 %conv = zext i32 %c to i644757 %arrayidx = getelementptr inbounds i32, ptr %v, i64 %conv4758 %1 = load i32, ptr %arrayidx, align 44759 br label %return4760 4761return: ; preds = %entry, %if.then4762 %retval.0 = phi i32 [ %1, %if.then ], [ 123, %entry ]4763 ret i32 %retval.04764}4765 4766define i32 @atomic_shl1_mask1_or_32_gpr_br(ptr %v, i32 %c) nounwind {4767; X86-LABEL: atomic_shl1_mask1_or_32_gpr_br:4768; X86: # %bb.0: # %entry4769; X86-NEXT: movl {{[0-9]+}}(%esp), %eax4770; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx4771; X86-NEXT: movl %eax, %edx4772; X86-NEXT: andl $31, %edx4773; X86-NEXT: lock btsl %edx, (%ecx)4774; X86-NEXT: jae .LBB81_14775; X86-NEXT: # %bb.2: # %if.then4776; X86-NEXT: movl (%ecx,%eax,4), %eax4777; X86-NEXT: retl4778; X86-NEXT: .LBB81_1:4779; X86-NEXT: movl $123, %eax4780; X86-NEXT: retl4781;4782; X64-LABEL: atomic_shl1_mask1_or_32_gpr_br:4783; X64: # %bb.0: # %entry4784; X64-NEXT: movl %esi, %eax4785; X64-NEXT: andl $31, %eax4786; X64-NEXT: lock btsl %eax, (%rdi)4787; X64-NEXT: jae .LBB81_14788; X64-NEXT: # %bb.2: # %if.then4789; X64-NEXT: movl %esi, %eax4790; X64-NEXT: movl (%rdi,%rax,4), %eax4791; X64-NEXT: retq4792; X64-NEXT: .LBB81_1:4793; X64-NEXT: movl $123, %eax4794; X64-NEXT: retq4795entry:4796 %shl = shl nuw i32 1, %c4797 %0 = atomicrmw or ptr %v, i32 %shl monotonic, align 44798 %rem = and i32 %c, 314799 %shl1 = shl nuw i32 1, %rem4800 %and = and i32 %0, %shl14801 %tobool.not = icmp eq i32 %and, 04802 br i1 %tobool.not, label %return, label %if.then4803 4804if.then: ; preds = %entry4805 %conv = zext i32 %c to i644806 %arrayidx = getelementptr inbounds i32, ptr %v, i64 %conv4807 %1 = load i32, ptr %arrayidx, align 44808 br label %return4809 4810return: ; preds = %entry, %if.then4811 %retval.0 = phi i32 [ %1, %if.then ], [ 123, %entry ]4812 ret i32 %retval.04813}4814 4815define i32 @atomic_shl1_mask01_or_32_gpr_br(ptr %v, i32 %c) nounwind {4816; X86-LABEL: atomic_shl1_mask01_or_32_gpr_br:4817; X86: # %bb.0: # %entry4818; X86-NEXT: movl {{[0-9]+}}(%esp), %eax4819; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx4820; X86-NEXT: movl %eax, %edx4821; X86-NEXT: andl $31, %edx4822; X86-NEXT: lock btsl %edx, (%ecx)4823; X86-NEXT: jae .LBB82_14824; X86-NEXT: # %bb.2: # %if.then4825; X86-NEXT: movl (%ecx,%eax,4), %eax4826; X86-NEXT: retl4827; X86-NEXT: .LBB82_1:4828; X86-NEXT: movl $123, %eax4829; X86-NEXT: retl4830;4831; X64-LABEL: atomic_shl1_mask01_or_32_gpr_br:4832; X64: # %bb.0: # %entry4833; X64-NEXT: movl %esi, %eax4834; X64-NEXT: andl $31, %eax4835; X64-NEXT: lock btsl %eax, (%rdi)4836; X64-NEXT: jae .LBB82_14837; X64-NEXT: # %bb.2: # %if.then4838; X64-NEXT: movl %esi, %eax4839; X64-NEXT: movl (%rdi,%rax,4), %eax4840; X64-NEXT: retq4841; X64-NEXT: .LBB82_1:4842; X64-NEXT: movl $123, %eax4843; X64-NEXT: retq4844entry:4845 %rem = and i32 %c, 314846 %shl = shl nuw i32 1, %rem4847 %0 = atomicrmw or ptr %v, i32 %shl monotonic, align 44848 %and = and i32 %shl, %04849 %tobool.not = icmp eq i32 %and, 04850 br i1 %tobool.not, label %return, label %if.then4851 4852if.then: ; preds = %entry4853 %conv = zext i32 %c to i644854 %arrayidx = getelementptr inbounds i32, ptr %v, i64 %conv4855 %1 = load i32, ptr %arrayidx, align 44856 br label %return4857 4858return: ; preds = %entry, %if.then4859 %retval.0 = phi i32 [ %1, %if.then ], [ 123, %entry ]4860 ret i32 %retval.04861}4862 4863define i32 @atomic_blsi_or_32_gpr_br(ptr %v, i32 %c) nounwind {4864; X86-LABEL: atomic_blsi_or_32_gpr_br:4865; X86: # %bb.0: # %entry4866; X86-NEXT: pushl %edi4867; X86-NEXT: pushl %esi4868; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx4869; X86-NEXT: movl {{[0-9]+}}(%esp), %edx4870; X86-NEXT: movl %ecx, %esi4871; X86-NEXT: negl %esi4872; X86-NEXT: andl %ecx, %esi4873; X86-NEXT: movl (%edx), %eax4874; X86-NEXT: .p2align 44875; X86-NEXT: .LBB83_1: # %atomicrmw.start4876; X86-NEXT: # =>This Inner Loop Header: Depth=14877; X86-NEXT: movl %eax, %edi4878; X86-NEXT: orl %esi, %edi4879; X86-NEXT: lock cmpxchgl %edi, (%edx)4880; X86-NEXT: jne .LBB83_14881; X86-NEXT: # %bb.2: # %atomicrmw.end4882; X86-NEXT: testl %esi, %eax4883; X86-NEXT: je .LBB83_34884; X86-NEXT: # %bb.4: # %if.then4885; X86-NEXT: movl (%edx,%ecx,4), %eax4886; X86-NEXT: jmp .LBB83_54887; X86-NEXT: .LBB83_3:4888; X86-NEXT: movl $123, %eax4889; X86-NEXT: .LBB83_5: # %return4890; X86-NEXT: popl %esi4891; X86-NEXT: popl %edi4892; X86-NEXT: retl4893;4894; X64-LABEL: atomic_blsi_or_32_gpr_br:4895; X64: # %bb.0: # %entry4896; X64-NEXT: movl %esi, %ecx4897; X64-NEXT: negl %ecx4898; X64-NEXT: andl %esi, %ecx4899; X64-NEXT: movl (%rdi), %eax4900; X64-NEXT: .p2align 44901; X64-NEXT: .LBB83_1: # %atomicrmw.start4902; X64-NEXT: # =>This Inner Loop Header: Depth=14903; X64-NEXT: movl %eax, %edx4904; X64-NEXT: orl %ecx, %edx4905; X64-NEXT: lock cmpxchgl %edx, (%rdi)4906; X64-NEXT: jne .LBB83_14907; X64-NEXT: # %bb.2: # %atomicrmw.end4908; X64-NEXT: testl %ecx, %eax4909; X64-NEXT: je .LBB83_34910; X64-NEXT: # %bb.4: # %if.then4911; X64-NEXT: movl %esi, %eax4912; X64-NEXT: movl (%rdi,%rax,4), %eax4913; X64-NEXT: retq4914; X64-NEXT: .LBB83_3:4915; X64-NEXT: movl $123, %eax4916; X64-NEXT: retq4917entry:4918 %sub = sub i32 0, %c4919 %and = and i32 %sub, %c4920 %0 = atomicrmw or ptr %v, i32 %and monotonic, align 44921 %and3 = and i32 %0, %and4922 %tobool.not = icmp eq i32 %and3, 04923 br i1 %tobool.not, label %return, label %if.then4924 4925if.then: ; preds = %entry4926 %idxprom = zext i32 %c to i644927 %arrayidx = getelementptr inbounds i32, ptr %v, i64 %idxprom4928 %1 = load i32, ptr %arrayidx, align 44929 br label %return4930 4931return: ; preds = %entry, %if.then4932 %retval.0 = phi i32 [ %1, %if.then ], [ 123, %entry ]4933 ret i32 %retval.04934}4935 4936define i32 @atomic_shl1_or_32_gpr_brz(ptr %v, i32 %c) nounwind {4937; X86-LABEL: atomic_shl1_or_32_gpr_brz:4938; X86: # %bb.0: # %entry4939; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx4940; X86-NEXT: movl {{[0-9]+}}(%esp), %edx4941; X86-NEXT: movl %ecx, %eax4942; X86-NEXT: andl $31, %eax4943; X86-NEXT: lock btsl %eax, (%edx)4944; X86-NEXT: movl $123, %eax4945; X86-NEXT: jae .LBB84_14946; X86-NEXT: # %bb.2: # %return4947; X86-NEXT: retl4948; X86-NEXT: .LBB84_1: # %if.then4949; X86-NEXT: movl (%edx,%ecx,4), %eax4950; X86-NEXT: retl4951;4952; X64-LABEL: atomic_shl1_or_32_gpr_brz:4953; X64: # %bb.0: # %entry4954; X64-NEXT: movl %esi, %eax4955; X64-NEXT: andl $31, %eax4956; X64-NEXT: lock btsl %eax, (%rdi)4957; X64-NEXT: movl $123, %eax4958; X64-NEXT: jae .LBB84_14959; X64-NEXT: # %bb.2: # %return4960; X64-NEXT: retq4961; X64-NEXT: .LBB84_1: # %if.then4962; X64-NEXT: movl %esi, %eax4963; X64-NEXT: movl (%rdi,%rax,4), %eax4964; X64-NEXT: retq4965entry:4966 %shl = shl nuw i32 1, %c4967 %0 = atomicrmw or ptr %v, i32 %shl monotonic, align 44968 %and = and i32 %0, %shl4969 %tobool.not = icmp eq i32 %and, 04970 br i1 %tobool.not, label %if.then, label %return4971 4972if.then: ; preds = %entry4973 %idxprom = zext i32 %c to i644974 %arrayidx = getelementptr inbounds i32, ptr %v, i64 %idxprom4975 %1 = load i32, ptr %arrayidx, align 44976 br label %return4977 4978return: ; preds = %entry, %if.then4979 %retval.0 = phi i32 [ %1, %if.then ], [ 123, %entry ]4980 ret i32 %retval.04981}4982 4983define i32 @atomic_shl1_small_mask_or_32_gpr_brz(ptr %v, i32 %c) nounwind {4984; X86-LABEL: atomic_shl1_small_mask_or_32_gpr_brz:4985; X86: # %bb.0: # %entry4986; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx4987; X86-NEXT: movl {{[0-9]+}}(%esp), %edx4988; X86-NEXT: andl $15, %edx4989; X86-NEXT: lock btsl %edx, (%ecx)4990; X86-NEXT: movl $123, %eax4991; X86-NEXT: jae .LBB85_14992; X86-NEXT: # %bb.2: # %return4993; X86-NEXT: retl4994; X86-NEXT: .LBB85_1: # %if.then4995; X86-NEXT: movl (%ecx,%edx,4), %eax4996; X86-NEXT: retl4997;4998; X64-LABEL: atomic_shl1_small_mask_or_32_gpr_brz:4999; X64: # %bb.0: # %entry5000; X64-NEXT: andl $15, %esi5001; X64-NEXT: lock btsl %esi, (%rdi)5002; X64-NEXT: movl $123, %eax5003; X64-NEXT: jae .LBB85_15004; X64-NEXT: # %bb.2: # %return5005; X64-NEXT: retq5006; X64-NEXT: .LBB85_1: # %if.then5007; X64-NEXT: movl %esi, %eax5008; X64-NEXT: movl (%rdi,%rax,4), %eax5009; X64-NEXT: retq5010entry:5011 %0 = and i32 %c, 155012 %shl = shl nuw nsw i32 1, %05013 %1 = atomicrmw or ptr %v, i32 %shl monotonic, align 45014 %and = and i32 %shl, %15015 %tobool.not = icmp eq i32 %and, 05016 br i1 %tobool.not, label %if.then, label %return5017 5018if.then: ; preds = %entry5019 %conv2 = zext i32 %0 to i645020 %arrayidx = getelementptr inbounds i32, ptr %v, i64 %conv25021 %2 = load i32, ptr %arrayidx, align 45022 br label %return5023 5024return: ; preds = %entry, %if.then5025 %retval.0 = phi i32 [ %2, %if.then ], [ 123, %entry ]5026 ret i32 %retval.05027}5028 5029define i32 @atomic_shl1_mask0_or_32_gpr_brz(ptr %v, i32 %c) nounwind {5030; X86-LABEL: atomic_shl1_mask0_or_32_gpr_brz:5031; X86: # %bb.0: # %entry5032; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx5033; X86-NEXT: movl {{[0-9]+}}(%esp), %edx5034; X86-NEXT: movl %ecx, %eax5035; X86-NEXT: andl $31, %eax5036; X86-NEXT: lock btsl %eax, (%edx)5037; X86-NEXT: movl $123, %eax5038; X86-NEXT: jae .LBB86_15039; X86-NEXT: # %bb.2: # %return5040; X86-NEXT: retl5041; X86-NEXT: .LBB86_1: # %if.then5042; X86-NEXT: movl (%edx,%ecx,4), %eax5043; X86-NEXT: retl5044;5045; X64-LABEL: atomic_shl1_mask0_or_32_gpr_brz:5046; X64: # %bb.0: # %entry5047; X64-NEXT: movl %esi, %eax5048; X64-NEXT: andl $31, %eax5049; X64-NEXT: lock btsl %eax, (%rdi)5050; X64-NEXT: movl $123, %eax5051; X64-NEXT: jae .LBB86_15052; X64-NEXT: # %bb.2: # %return5053; X64-NEXT: retq5054; X64-NEXT: .LBB86_1: # %if.then5055; X64-NEXT: movl %esi, %eax5056; X64-NEXT: movl (%rdi,%rax,4), %eax5057; X64-NEXT: retq5058entry:5059 %rem = and i32 %c, 315060 %shl = shl nuw i32 1, %rem5061 %0 = atomicrmw or ptr %v, i32 %shl monotonic, align 45062 %shl1 = shl nuw i32 1, %c5063 %and = and i32 %0, %shl15064 %tobool.not = icmp eq i32 %and, 05065 br i1 %tobool.not, label %if.then, label %return5066 5067if.then: ; preds = %entry5068 %conv = zext i32 %c to i645069 %arrayidx = getelementptr inbounds i32, ptr %v, i64 %conv5070 %1 = load i32, ptr %arrayidx, align 45071 br label %return5072 5073return: ; preds = %entry, %if.then5074 %retval.0 = phi i32 [ %1, %if.then ], [ 123, %entry ]5075 ret i32 %retval.05076}5077 5078define i32 @atomic_shl1_mask1_or_32_gpr_brz(ptr %v, i32 %c) nounwind {5079; X86-LABEL: atomic_shl1_mask1_or_32_gpr_brz:5080; X86: # %bb.0: # %entry5081; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx5082; X86-NEXT: movl {{[0-9]+}}(%esp), %edx5083; X86-NEXT: movl %ecx, %eax5084; X86-NEXT: andl $31, %eax5085; X86-NEXT: lock btsl %eax, (%edx)5086; X86-NEXT: movl $123, %eax5087; X86-NEXT: jae .LBB87_15088; X86-NEXT: # %bb.2: # %return5089; X86-NEXT: retl5090; X86-NEXT: .LBB87_1: # %if.then5091; X86-NEXT: movl (%edx,%ecx,4), %eax5092; X86-NEXT: retl5093;5094; X64-LABEL: atomic_shl1_mask1_or_32_gpr_brz:5095; X64: # %bb.0: # %entry5096; X64-NEXT: movl %esi, %eax5097; X64-NEXT: andl $31, %eax5098; X64-NEXT: lock btsl %eax, (%rdi)5099; X64-NEXT: movl $123, %eax5100; X64-NEXT: jae .LBB87_15101; X64-NEXT: # %bb.2: # %return5102; X64-NEXT: retq5103; X64-NEXT: .LBB87_1: # %if.then5104; X64-NEXT: movl %esi, %eax5105; X64-NEXT: movl (%rdi,%rax,4), %eax5106; X64-NEXT: retq5107entry:5108 %shl = shl nuw i32 1, %c5109 %0 = atomicrmw or ptr %v, i32 %shl monotonic, align 45110 %rem = and i32 %c, 315111 %shl1 = shl nuw i32 1, %rem5112 %and = and i32 %shl1, %05113 %tobool.not = icmp eq i32 %and, 05114 br i1 %tobool.not, label %if.then, label %return5115 5116if.then: ; preds = %entry5117 %conv = zext i32 %c to i645118 %arrayidx = getelementptr inbounds i32, ptr %v, i64 %conv5119 %1 = load i32, ptr %arrayidx, align 45120 br label %return5121 5122return: ; preds = %entry, %if.then5123 %retval.0 = phi i32 [ %1, %if.then ], [ 123, %entry ]5124 ret i32 %retval.05125}5126 5127define i32 @atomic_shl1_mask01_or_32_gpr_brz(ptr %v, i32 %c) nounwind {5128; X86-LABEL: atomic_shl1_mask01_or_32_gpr_brz:5129; X86: # %bb.0: # %entry5130; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx5131; X86-NEXT: movl {{[0-9]+}}(%esp), %edx5132; X86-NEXT: movl %ecx, %eax5133; X86-NEXT: andl $31, %eax5134; X86-NEXT: lock btsl %eax, (%edx)5135; X86-NEXT: movl $123, %eax5136; X86-NEXT: jae .LBB88_15137; X86-NEXT: # %bb.2: # %return5138; X86-NEXT: retl5139; X86-NEXT: .LBB88_1: # %if.then5140; X86-NEXT: movl (%edx,%ecx,4), %eax5141; X86-NEXT: retl5142;5143; X64-LABEL: atomic_shl1_mask01_or_32_gpr_brz:5144; X64: # %bb.0: # %entry5145; X64-NEXT: movl %esi, %eax5146; X64-NEXT: andl $31, %eax5147; X64-NEXT: lock btsl %eax, (%rdi)5148; X64-NEXT: movl $123, %eax5149; X64-NEXT: jae .LBB88_15150; X64-NEXT: # %bb.2: # %return5151; X64-NEXT: retq5152; X64-NEXT: .LBB88_1: # %if.then5153; X64-NEXT: movl %esi, %eax5154; X64-NEXT: movl (%rdi,%rax,4), %eax5155; X64-NEXT: retq5156entry:5157 %rem = and i32 %c, 315158 %shl = shl nuw i32 1, %rem5159 %0 = atomicrmw or ptr %v, i32 %shl monotonic, align 45160 %and = and i32 %0, %shl5161 %tobool.not = icmp eq i32 %and, 05162 br i1 %tobool.not, label %if.then, label %return5163 5164if.then: ; preds = %entry5165 %conv = zext i32 %c to i645166 %arrayidx = getelementptr inbounds i32, ptr %v, i64 %conv5167 %1 = load i32, ptr %arrayidx, align 45168 br label %return5169 5170return: ; preds = %entry, %if.then5171 %retval.0 = phi i32 [ %1, %if.then ], [ 123, %entry ]5172 ret i32 %retval.05173}5174 5175define i32 @atomic_blsi_or_32_gpr_brz(ptr %v, i32 %c) nounwind {5176; X86-LABEL: atomic_blsi_or_32_gpr_brz:5177; X86: # %bb.0: # %entry5178; X86-NEXT: pushl %edi5179; X86-NEXT: pushl %esi5180; X86-NEXT: movl {{[0-9]+}}(%esp), %edx5181; X86-NEXT: movl {{[0-9]+}}(%esp), %esi5182; X86-NEXT: movl %edx, %edi5183; X86-NEXT: negl %edi5184; X86-NEXT: andl %edx, %edi5185; X86-NEXT: movl (%esi), %eax5186; X86-NEXT: .p2align 45187; X86-NEXT: .LBB89_1: # %atomicrmw.start5188; X86-NEXT: # =>This Inner Loop Header: Depth=15189; X86-NEXT: movl %eax, %ecx5190; X86-NEXT: orl %edi, %ecx5191; X86-NEXT: lock cmpxchgl %ecx, (%esi)5192; X86-NEXT: jne .LBB89_15193; X86-NEXT: # %bb.2: # %atomicrmw.end5194; X86-NEXT: movl $123, %ecx5195; X86-NEXT: testl %edi, %eax5196; X86-NEXT: jne .LBB89_45197; X86-NEXT: # %bb.3: # %if.then5198; X86-NEXT: movl (%esi,%edx,4), %ecx5199; X86-NEXT: .LBB89_4: # %return5200; X86-NEXT: movl %ecx, %eax5201; X86-NEXT: popl %esi5202; X86-NEXT: popl %edi5203; X86-NEXT: retl5204;5205; X64-LABEL: atomic_blsi_or_32_gpr_brz:5206; X64: # %bb.0: # %entry5207; X64-NEXT: movl %esi, %edx5208; X64-NEXT: negl %edx5209; X64-NEXT: andl %esi, %edx5210; X64-NEXT: movl (%rdi), %eax5211; X64-NEXT: .p2align 45212; X64-NEXT: .LBB89_1: # %atomicrmw.start5213; X64-NEXT: # =>This Inner Loop Header: Depth=15214; X64-NEXT: movl %eax, %ecx5215; X64-NEXT: orl %edx, %ecx5216; X64-NEXT: lock cmpxchgl %ecx, (%rdi)5217; X64-NEXT: jne .LBB89_15218; X64-NEXT: # %bb.2: # %atomicrmw.end5219; X64-NEXT: movl $123, %ecx5220; X64-NEXT: testl %edx, %eax5221; X64-NEXT: je .LBB89_35222; X64-NEXT: # %bb.4: # %return5223; X64-NEXT: movl %ecx, %eax5224; X64-NEXT: retq5225; X64-NEXT: .LBB89_3: # %if.then5226; X64-NEXT: movl %esi, %eax5227; X64-NEXT: movl (%rdi,%rax,4), %ecx5228; X64-NEXT: movl %ecx, %eax5229; X64-NEXT: retq5230entry:5231 %sub = sub i32 0, %c5232 %and = and i32 %sub, %c5233 %0 = atomicrmw or ptr %v, i32 %and monotonic, align 45234 %and3 = and i32 %0, %and5235 %tobool.not = icmp eq i32 %and3, 05236 br i1 %tobool.not, label %if.then, label %return5237 5238if.then: ; preds = %entry5239 %idxprom = zext i32 %c to i645240 %arrayidx = getelementptr inbounds i32, ptr %v, i64 %idxprom5241 %1 = load i32, ptr %arrayidx, align 45242 br label %return5243 5244return: ; preds = %entry, %if.then5245 %retval.0 = phi i32 [ %1, %if.then ], [ 123, %entry ]5246 ret i32 %retval.05247}5248 5249define i32 @atomic_shl1_or_32_gpr_brnz(ptr %v, i32 %c) nounwind {5250; X86-LABEL: atomic_shl1_or_32_gpr_brnz:5251; X86: # %bb.0: # %entry5252; X86-NEXT: movl {{[0-9]+}}(%esp), %eax5253; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx5254; X86-NEXT: movl %eax, %edx5255; X86-NEXT: andl $31, %edx5256; X86-NEXT: lock btsl %edx, (%ecx)5257; X86-NEXT: jae .LBB90_15258; X86-NEXT: # %bb.2: # %if.then5259; X86-NEXT: movl (%ecx,%eax,4), %eax5260; X86-NEXT: retl5261; X86-NEXT: .LBB90_1:5262; X86-NEXT: movl $123, %eax5263; X86-NEXT: retl5264;5265; X64-LABEL: atomic_shl1_or_32_gpr_brnz:5266; X64: # %bb.0: # %entry5267; X64-NEXT: movl %esi, %eax5268; X64-NEXT: andl $31, %eax5269; X64-NEXT: lock btsl %eax, (%rdi)5270; X64-NEXT: jae .LBB90_15271; X64-NEXT: # %bb.2: # %if.then5272; X64-NEXT: movl %esi, %eax5273; X64-NEXT: movl (%rdi,%rax,4), %eax5274; X64-NEXT: retq5275; X64-NEXT: .LBB90_1:5276; X64-NEXT: movl $123, %eax5277; X64-NEXT: retq5278entry:5279 %shl = shl nuw i32 1, %c5280 %0 = atomicrmw or ptr %v, i32 %shl monotonic, align 45281 %and = and i32 %shl, %05282 %tobool.not = icmp eq i32 %and, 05283 br i1 %tobool.not, label %return, label %if.then5284 5285if.then: ; preds = %entry5286 %idxprom = zext i32 %c to i645287 %arrayidx = getelementptr inbounds i32, ptr %v, i64 %idxprom5288 %1 = load i32, ptr %arrayidx, align 45289 br label %return5290 5291return: ; preds = %entry, %if.then5292 %retval.0 = phi i32 [ %1, %if.then ], [ 123, %entry ]5293 ret i32 %retval.05294}5295 5296define i32 @atomic_shl1_small_mask_or_32_gpr_brnz(ptr %v, i32 %c) nounwind {5297; X86-LABEL: atomic_shl1_small_mask_or_32_gpr_brnz:5298; X86: # %bb.0: # %entry5299; X86-NEXT: movl {{[0-9]+}}(%esp), %eax5300; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx5301; X86-NEXT: andl $15, %ecx5302; X86-NEXT: lock btsl %ecx, (%eax)5303; X86-NEXT: jae .LBB91_15304; X86-NEXT: # %bb.2: # %if.then5305; X86-NEXT: movl (%eax,%ecx,4), %eax5306; X86-NEXT: retl5307; X86-NEXT: .LBB91_1:5308; X86-NEXT: movl $123, %eax5309; X86-NEXT: retl5310;5311; X64-LABEL: atomic_shl1_small_mask_or_32_gpr_brnz:5312; X64: # %bb.0: # %entry5313; X64-NEXT: andl $15, %esi5314; X64-NEXT: lock btsl %esi, (%rdi)5315; X64-NEXT: jae .LBB91_15316; X64-NEXT: # %bb.2: # %if.then5317; X64-NEXT: movl %esi, %eax5318; X64-NEXT: movl (%rdi,%rax,4), %eax5319; X64-NEXT: retq5320; X64-NEXT: .LBB91_1:5321; X64-NEXT: movl $123, %eax5322; X64-NEXT: retq5323entry:5324 %0 = and i32 %c, 155325 %shl = shl nuw nsw i32 1, %05326 %1 = atomicrmw or ptr %v, i32 %shl monotonic, align 45327 %and = and i32 %1, %shl5328 %tobool.not = icmp eq i32 %and, 05329 br i1 %tobool.not, label %return, label %if.then5330 5331if.then: ; preds = %entry5332 %conv2 = zext i32 %0 to i645333 %arrayidx = getelementptr inbounds i32, ptr %v, i64 %conv25334 %2 = load i32, ptr %arrayidx, align 45335 br label %return5336 5337return: ; preds = %entry, %if.then5338 %retval.0 = phi i32 [ %2, %if.then ], [ 123, %entry ]5339 ret i32 %retval.05340}5341 5342define i32 @atomic_shl1_mask0_or_32_gpr_brnz(ptr %v, i32 %c) nounwind {5343; X86-LABEL: atomic_shl1_mask0_or_32_gpr_brnz:5344; X86: # %bb.0: # %entry5345; X86-NEXT: movl {{[0-9]+}}(%esp), %eax5346; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx5347; X86-NEXT: movl %eax, %edx5348; X86-NEXT: andl $31, %edx5349; X86-NEXT: lock btsl %edx, (%ecx)5350; X86-NEXT: jae .LBB92_15351; X86-NEXT: # %bb.2: # %if.then5352; X86-NEXT: movl (%ecx,%eax,4), %eax5353; X86-NEXT: retl5354; X86-NEXT: .LBB92_1:5355; X86-NEXT: movl $123, %eax5356; X86-NEXT: retl5357;5358; X64-LABEL: atomic_shl1_mask0_or_32_gpr_brnz:5359; X64: # %bb.0: # %entry5360; X64-NEXT: movl %esi, %eax5361; X64-NEXT: andl $31, %eax5362; X64-NEXT: lock btsl %eax, (%rdi)5363; X64-NEXT: jae .LBB92_15364; X64-NEXT: # %bb.2: # %if.then5365; X64-NEXT: movl %esi, %eax5366; X64-NEXT: movl (%rdi,%rax,4), %eax5367; X64-NEXT: retq5368; X64-NEXT: .LBB92_1:5369; X64-NEXT: movl $123, %eax5370; X64-NEXT: retq5371entry:5372 %rem = and i32 %c, 315373 %shl = shl nuw i32 1, %rem5374 %0 = atomicrmw or ptr %v, i32 %shl monotonic, align 45375 %shl1 = shl nuw i32 1, %c5376 %and = and i32 %0, %shl15377 %tobool.not = icmp eq i32 %and, 05378 br i1 %tobool.not, label %return, label %if.then5379 5380if.then: ; preds = %entry5381 %conv = zext i32 %c to i645382 %arrayidx = getelementptr inbounds i32, ptr %v, i64 %conv5383 %1 = load i32, ptr %arrayidx, align 45384 br label %return5385 5386return: ; preds = %entry, %if.then5387 %retval.0 = phi i32 [ %1, %if.then ], [ 123, %entry ]5388 ret i32 %retval.05389}5390 5391define i32 @atomic_shl1_mask1_or_32_gpr_brnz(ptr %v, i32 %c) nounwind {5392; X86-LABEL: atomic_shl1_mask1_or_32_gpr_brnz:5393; X86: # %bb.0: # %entry5394; X86-NEXT: movl {{[0-9]+}}(%esp), %eax5395; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx5396; X86-NEXT: movl %eax, %edx5397; X86-NEXT: andl $31, %edx5398; X86-NEXT: lock btsl %edx, (%ecx)5399; X86-NEXT: jae .LBB93_15400; X86-NEXT: # %bb.2: # %if.then5401; X86-NEXT: movl (%ecx,%eax,4), %eax5402; X86-NEXT: retl5403; X86-NEXT: .LBB93_1:5404; X86-NEXT: movl $123, %eax5405; X86-NEXT: retl5406;5407; X64-LABEL: atomic_shl1_mask1_or_32_gpr_brnz:5408; X64: # %bb.0: # %entry5409; X64-NEXT: movl %esi, %eax5410; X64-NEXT: andl $31, %eax5411; X64-NEXT: lock btsl %eax, (%rdi)5412; X64-NEXT: jae .LBB93_15413; X64-NEXT: # %bb.2: # %if.then5414; X64-NEXT: movl %esi, %eax5415; X64-NEXT: movl (%rdi,%rax,4), %eax5416; X64-NEXT: retq5417; X64-NEXT: .LBB93_1:5418; X64-NEXT: movl $123, %eax5419; X64-NEXT: retq5420entry:5421 %shl = shl nuw i32 1, %c5422 %0 = atomicrmw or ptr %v, i32 %shl monotonic, align 45423 %rem = and i32 %c, 315424 %shl1 = shl nuw i32 1, %rem5425 %and = and i32 %0, %shl15426 %tobool.not = icmp eq i32 %and, 05427 br i1 %tobool.not, label %return, label %if.then5428 5429if.then: ; preds = %entry5430 %conv = zext i32 %c to i645431 %arrayidx = getelementptr inbounds i32, ptr %v, i64 %conv5432 %1 = load i32, ptr %arrayidx, align 45433 br label %return5434 5435return: ; preds = %entry, %if.then5436 %retval.0 = phi i32 [ %1, %if.then ], [ 123, %entry ]5437 ret i32 %retval.05438}5439 5440define i32 @atomic_shl1_mask01_or_32_gpr_brnz(ptr %v, i32 %c) nounwind {5441; X86-LABEL: atomic_shl1_mask01_or_32_gpr_brnz:5442; X86: # %bb.0: # %entry5443; X86-NEXT: movl {{[0-9]+}}(%esp), %eax5444; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx5445; X86-NEXT: movl %eax, %edx5446; X86-NEXT: andl $31, %edx5447; X86-NEXT: lock btsl %edx, (%ecx)5448; X86-NEXT: jae .LBB94_15449; X86-NEXT: # %bb.2: # %if.then5450; X86-NEXT: movl (%ecx,%eax,4), %eax5451; X86-NEXT: retl5452; X86-NEXT: .LBB94_1:5453; X86-NEXT: movl $123, %eax5454; X86-NEXT: retl5455;5456; X64-LABEL: atomic_shl1_mask01_or_32_gpr_brnz:5457; X64: # %bb.0: # %entry5458; X64-NEXT: movl %esi, %eax5459; X64-NEXT: andl $31, %eax5460; X64-NEXT: lock btsl %eax, (%rdi)5461; X64-NEXT: jae .LBB94_15462; X64-NEXT: # %bb.2: # %if.then5463; X64-NEXT: movl %esi, %eax5464; X64-NEXT: movl (%rdi,%rax,4), %eax5465; X64-NEXT: retq5466; X64-NEXT: .LBB94_1:5467; X64-NEXT: movl $123, %eax5468; X64-NEXT: retq5469entry:5470 %rem = and i32 %c, 315471 %shl = shl nuw i32 1, %rem5472 %0 = atomicrmw or ptr %v, i32 %shl monotonic, align 45473 %and = and i32 %shl, %05474 %tobool.not = icmp eq i32 %and, 05475 br i1 %tobool.not, label %return, label %if.then5476 5477if.then: ; preds = %entry5478 %conv = zext i32 %c to i645479 %arrayidx = getelementptr inbounds i32, ptr %v, i64 %conv5480 %1 = load i32, ptr %arrayidx, align 45481 br label %return5482 5483return: ; preds = %entry, %if.then5484 %retval.0 = phi i32 [ %1, %if.then ], [ 123, %entry ]5485 ret i32 %retval.05486}5487 5488define i32 @atomic_blsi_or_32_gpr_brnz(ptr %v, i32 %c) nounwind {5489; X86-LABEL: atomic_blsi_or_32_gpr_brnz:5490; X86: # %bb.0: # %entry5491; X86-NEXT: pushl %edi5492; X86-NEXT: pushl %esi5493; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx5494; X86-NEXT: movl {{[0-9]+}}(%esp), %edx5495; X86-NEXT: movl %ecx, %esi5496; X86-NEXT: negl %esi5497; X86-NEXT: andl %ecx, %esi5498; X86-NEXT: movl (%edx), %eax5499; X86-NEXT: .p2align 45500; X86-NEXT: .LBB95_1: # %atomicrmw.start5501; X86-NEXT: # =>This Inner Loop Header: Depth=15502; X86-NEXT: movl %eax, %edi5503; X86-NEXT: orl %esi, %edi5504; X86-NEXT: lock cmpxchgl %edi, (%edx)5505; X86-NEXT: jne .LBB95_15506; X86-NEXT: # %bb.2: # %atomicrmw.end5507; X86-NEXT: testl %esi, %eax5508; X86-NEXT: je .LBB95_35509; X86-NEXT: # %bb.4: # %if.then5510; X86-NEXT: movl (%edx,%ecx,4), %eax5511; X86-NEXT: jmp .LBB95_55512; X86-NEXT: .LBB95_3:5513; X86-NEXT: movl $123, %eax5514; X86-NEXT: .LBB95_5: # %return5515; X86-NEXT: popl %esi5516; X86-NEXT: popl %edi5517; X86-NEXT: retl5518;5519; X64-LABEL: atomic_blsi_or_32_gpr_brnz:5520; X64: # %bb.0: # %entry5521; X64-NEXT: movl %esi, %ecx5522; X64-NEXT: negl %ecx5523; X64-NEXT: andl %esi, %ecx5524; X64-NEXT: movl (%rdi), %eax5525; X64-NEXT: .p2align 45526; X64-NEXT: .LBB95_1: # %atomicrmw.start5527; X64-NEXT: # =>This Inner Loop Header: Depth=15528; X64-NEXT: movl %eax, %edx5529; X64-NEXT: orl %ecx, %edx5530; X64-NEXT: lock cmpxchgl %edx, (%rdi)5531; X64-NEXT: jne .LBB95_15532; X64-NEXT: # %bb.2: # %atomicrmw.end5533; X64-NEXT: testl %ecx, %eax5534; X64-NEXT: je .LBB95_35535; X64-NEXT: # %bb.4: # %if.then5536; X64-NEXT: movl %esi, %eax5537; X64-NEXT: movl (%rdi,%rax,4), %eax5538; X64-NEXT: retq5539; X64-NEXT: .LBB95_3:5540; X64-NEXT: movl $123, %eax5541; X64-NEXT: retq5542entry:5543 %sub = sub i32 0, %c5544 %and = and i32 %sub, %c5545 %0 = atomicrmw or ptr %v, i32 %and monotonic, align 45546 %and3 = and i32 %0, %and5547 %tobool.not = icmp eq i32 %and3, 05548 br i1 %tobool.not, label %return, label %if.then5549 5550if.then: ; preds = %entry5551 %idxprom = zext i32 %c to i645552 %arrayidx = getelementptr inbounds i32, ptr %v, i64 %idxprom5553 %1 = load i32, ptr %arrayidx, align 45554 br label %return5555 5556return: ; preds = %entry, %if.then5557 %retval.0 = phi i32 [ %1, %if.then ], [ 123, %entry ]5558 ret i32 %retval.05559}5560 5561define i32 @atomic_shl1_and_32_gpr_valz(ptr %v, i32 %c) nounwind {5562; X86-LABEL: atomic_shl1_and_32_gpr_valz:5563; X86: # %bb.0: # %entry5564; X86-NEXT: pushl %edi5565; X86-NEXT: pushl %esi5566; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx5567; X86-NEXT: movl {{[0-9]+}}(%esp), %edx5568; X86-NEXT: movl $1, %esi5569; X86-NEXT: shll %cl, %esi5570; X86-NEXT: movl (%edx), %eax5571; X86-NEXT: .p2align 45572; X86-NEXT: .LBB96_1: # %atomicrmw.start5573; X86-NEXT: # =>This Inner Loop Header: Depth=15574; X86-NEXT: movl %eax, %edi5575; X86-NEXT: andl %esi, %edi5576; X86-NEXT: lock cmpxchgl %edi, (%edx)5577; X86-NEXT: jne .LBB96_15578; X86-NEXT: # %bb.2: # %atomicrmw.end5579; X86-NEXT: xorl %edx, %edx5580; X86-NEXT: btl %ecx, %eax5581; X86-NEXT: setae %dl5582; X86-NEXT: movl %edx, %eax5583; X86-NEXT: popl %esi5584; X86-NEXT: popl %edi5585; X86-NEXT: retl5586;5587; X64-LABEL: atomic_shl1_and_32_gpr_valz:5588; X64: # %bb.0: # %entry5589; X64-NEXT: movl %esi, %ecx5590; X64-NEXT: movl $1, %edx5591; X64-NEXT: shll %cl, %edx5592; X64-NEXT: movl (%rdi), %eax5593; X64-NEXT: .p2align 45594; X64-NEXT: .LBB96_1: # %atomicrmw.start5595; X64-NEXT: # =>This Inner Loop Header: Depth=15596; X64-NEXT: movl %eax, %esi5597; X64-NEXT: andl %edx, %esi5598; X64-NEXT: lock cmpxchgl %esi, (%rdi)5599; X64-NEXT: jne .LBB96_15600; X64-NEXT: # %bb.2: # %atomicrmw.end5601; X64-NEXT: xorl %edx, %edx5602; X64-NEXT: btl %ecx, %eax5603; X64-NEXT: setae %dl5604; X64-NEXT: movl %edx, %eax5605; X64-NEXT: retq5606entry:5607 %shl = shl nuw i32 1, %c5608 %0 = atomicrmw and ptr %v, i32 %shl monotonic, align 45609 %1 = xor i32 %0, -15610 %2 = lshr i32 %1, %c5611 %lnot.ext = and i32 %2, 15612 ret i32 %lnot.ext5613}5614 5615define i32 @atomic_shl1_small_mask_and_32_gpr_valz(ptr %v, i32 %c) nounwind {5616; X86-LABEL: atomic_shl1_small_mask_and_32_gpr_valz:5617; X86: # %bb.0: # %entry5618; X86-NEXT: pushl %edi5619; X86-NEXT: pushl %esi5620; X86-NEXT: movl {{[0-9]+}}(%esp), %edx5621; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx5622; X86-NEXT: andl $15, %ecx5623; X86-NEXT: movl $1, %esi5624; X86-NEXT: shll %cl, %esi5625; X86-NEXT: movl (%edx), %eax5626; X86-NEXT: .p2align 45627; X86-NEXT: .LBB97_1: # %atomicrmw.start5628; X86-NEXT: # =>This Inner Loop Header: Depth=15629; X86-NEXT: movl %eax, %edi5630; X86-NEXT: andl %esi, %edi5631; X86-NEXT: lock cmpxchgl %edi, (%edx)5632; X86-NEXT: jne .LBB97_15633; X86-NEXT: # %bb.2: # %atomicrmw.end5634; X86-NEXT: xorl %edx, %edx5635; X86-NEXT: btl %ecx, %eax5636; X86-NEXT: setae %dl5637; X86-NEXT: movl %edx, %eax5638; X86-NEXT: popl %esi5639; X86-NEXT: popl %edi5640; X86-NEXT: retl5641;5642; X64-LABEL: atomic_shl1_small_mask_and_32_gpr_valz:5643; X64: # %bb.0: # %entry5644; X64-NEXT: movl %esi, %ecx5645; X64-NEXT: andl $15, %ecx5646; X64-NEXT: movl $1, %edx5647; X64-NEXT: shll %cl, %edx5648; X64-NEXT: movl (%rdi), %eax5649; X64-NEXT: .p2align 45650; X64-NEXT: .LBB97_1: # %atomicrmw.start5651; X64-NEXT: # =>This Inner Loop Header: Depth=15652; X64-NEXT: movl %eax, %esi5653; X64-NEXT: andl %edx, %esi5654; X64-NEXT: lock cmpxchgl %esi, (%rdi)5655; X64-NEXT: jne .LBB97_15656; X64-NEXT: # %bb.2: # %atomicrmw.end5657; X64-NEXT: xorl %edx, %edx5658; X64-NEXT: btl %ecx, %eax5659; X64-NEXT: setae %dl5660; X64-NEXT: movl %edx, %eax5661; X64-NEXT: retq5662entry:5663 %0 = and i32 %c, 155664 %shl = shl nuw nsw i32 1, %05665 %1 = atomicrmw and ptr %v, i32 %shl monotonic, align 45666 %2 = xor i32 %1, -15667 %3 = lshr i32 %2, %05668 %lnot.ext = and i32 %3, 15669 ret i32 %lnot.ext5670}5671 5672define i32 @atomic_shl1_mask0_and_32_gpr_valz(ptr %v, i32 %c) nounwind {5673; X86-LABEL: atomic_shl1_mask0_and_32_gpr_valz:5674; X86: # %bb.0: # %entry5675; X86-NEXT: pushl %edi5676; X86-NEXT: pushl %esi5677; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx5678; X86-NEXT: movl {{[0-9]+}}(%esp), %edx5679; X86-NEXT: movl $1, %esi5680; X86-NEXT: shll %cl, %esi5681; X86-NEXT: movl (%edx), %eax5682; X86-NEXT: .p2align 45683; X86-NEXT: .LBB98_1: # %atomicrmw.start5684; X86-NEXT: # =>This Inner Loop Header: Depth=15685; X86-NEXT: movl %eax, %edi5686; X86-NEXT: andl %esi, %edi5687; X86-NEXT: lock cmpxchgl %edi, (%edx)5688; X86-NEXT: jne .LBB98_15689; X86-NEXT: # %bb.2: # %atomicrmw.end5690; X86-NEXT: xorl %edx, %edx5691; X86-NEXT: btl %ecx, %eax5692; X86-NEXT: setae %dl5693; X86-NEXT: movl %edx, %eax5694; X86-NEXT: popl %esi5695; X86-NEXT: popl %edi5696; X86-NEXT: retl5697;5698; X64-LABEL: atomic_shl1_mask0_and_32_gpr_valz:5699; X64: # %bb.0: # %entry5700; X64-NEXT: movl %esi, %ecx5701; X64-NEXT: movl $1, %edx5702; X64-NEXT: shll %cl, %edx5703; X64-NEXT: movl (%rdi), %eax5704; X64-NEXT: .p2align 45705; X64-NEXT: .LBB98_1: # %atomicrmw.start5706; X64-NEXT: # =>This Inner Loop Header: Depth=15707; X64-NEXT: movl %eax, %esi5708; X64-NEXT: andl %edx, %esi5709; X64-NEXT: lock cmpxchgl %esi, (%rdi)5710; X64-NEXT: jne .LBB98_15711; X64-NEXT: # %bb.2: # %atomicrmw.end5712; X64-NEXT: xorl %edx, %edx5713; X64-NEXT: btl %ecx, %eax5714; X64-NEXT: setae %dl5715; X64-NEXT: movl %edx, %eax5716; X64-NEXT: retq5717entry:5718 %0 = and i32 %c, 315719 %shl = shl nuw i32 1, %05720 %1 = atomicrmw and ptr %v, i32 %shl monotonic, align 45721 %2 = xor i32 %1, -15722 %3 = lshr i32 %2, %c5723 %lnot.ext = and i32 %3, 15724 ret i32 %lnot.ext5725}5726 5727define i32 @atomic_shl1_mask1_and_32_gpr_valz(ptr %v, i32 %c) nounwind {5728; X86-LABEL: atomic_shl1_mask1_and_32_gpr_valz:5729; X86: # %bb.0: # %entry5730; X86-NEXT: pushl %edi5731; X86-NEXT: pushl %esi5732; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx5733; X86-NEXT: movl {{[0-9]+}}(%esp), %edx5734; X86-NEXT: movl $1, %esi5735; X86-NEXT: shll %cl, %esi5736; X86-NEXT: movl (%edx), %eax5737; X86-NEXT: .p2align 45738; X86-NEXT: .LBB99_1: # %atomicrmw.start5739; X86-NEXT: # =>This Inner Loop Header: Depth=15740; X86-NEXT: movl %eax, %edi5741; X86-NEXT: andl %esi, %edi5742; X86-NEXT: lock cmpxchgl %edi, (%edx)5743; X86-NEXT: jne .LBB99_15744; X86-NEXT: # %bb.2: # %atomicrmw.end5745; X86-NEXT: xorl %edx, %edx5746; X86-NEXT: btl %ecx, %eax5747; X86-NEXT: setae %dl5748; X86-NEXT: movl %edx, %eax5749; X86-NEXT: popl %esi5750; X86-NEXT: popl %edi5751; X86-NEXT: retl5752;5753; X64-LABEL: atomic_shl1_mask1_and_32_gpr_valz:5754; X64: # %bb.0: # %entry5755; X64-NEXT: movl %esi, %ecx5756; X64-NEXT: movl $1, %edx5757; X64-NEXT: shll %cl, %edx5758; X64-NEXT: movl (%rdi), %eax5759; X64-NEXT: .p2align 45760; X64-NEXT: .LBB99_1: # %atomicrmw.start5761; X64-NEXT: # =>This Inner Loop Header: Depth=15762; X64-NEXT: movl %eax, %esi5763; X64-NEXT: andl %edx, %esi5764; X64-NEXT: lock cmpxchgl %esi, (%rdi)5765; X64-NEXT: jne .LBB99_15766; X64-NEXT: # %bb.2: # %atomicrmw.end5767; X64-NEXT: xorl %edx, %edx5768; X64-NEXT: btl %ecx, %eax5769; X64-NEXT: setae %dl5770; X64-NEXT: movl %edx, %eax5771; X64-NEXT: retq5772entry:5773 %shl = shl nuw i32 1, %c5774 %0 = atomicrmw and ptr %v, i32 %shl monotonic, align 45775 %1 = and i32 %c, 315776 %2 = xor i32 -1, %05777 %3 = lshr i32 %2, %15778 %lnot.ext = and i32 %3, 15779 ret i32 %lnot.ext5780}5781 5782define i32 @atomic_shl1_mask01_and_32_gpr_valz(ptr %v, i32 %c) nounwind {5783; X86-LABEL: atomic_shl1_mask01_and_32_gpr_valz:5784; X86: # %bb.0: # %entry5785; X86-NEXT: pushl %edi5786; X86-NEXT: pushl %esi5787; X86-NEXT: movl {{[0-9]+}}(%esp), %edx5788; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx5789; X86-NEXT: andl $31, %ecx5790; X86-NEXT: movl $1, %esi5791; X86-NEXT: shll %cl, %esi5792; X86-NEXT: movl (%edx), %eax5793; X86-NEXT: .p2align 45794; X86-NEXT: .LBB100_1: # %atomicrmw.start5795; X86-NEXT: # =>This Inner Loop Header: Depth=15796; X86-NEXT: movl %eax, %edi5797; X86-NEXT: andl %esi, %edi5798; X86-NEXT: lock cmpxchgl %edi, (%edx)5799; X86-NEXT: jne .LBB100_15800; X86-NEXT: # %bb.2: # %atomicrmw.end5801; X86-NEXT: xorl %edx, %edx5802; X86-NEXT: btl %ecx, %eax5803; X86-NEXT: setae %dl5804; X86-NEXT: movl %edx, %eax5805; X86-NEXT: popl %esi5806; X86-NEXT: popl %edi5807; X86-NEXT: retl5808;5809; X64-LABEL: atomic_shl1_mask01_and_32_gpr_valz:5810; X64: # %bb.0: # %entry5811; X64-NEXT: movl %esi, %ecx5812; X64-NEXT: andl $31, %ecx5813; X64-NEXT: movl $1, %edx5814; X64-NEXT: shll %cl, %edx5815; X64-NEXT: movl (%rdi), %eax5816; X64-NEXT: .p2align 45817; X64-NEXT: .LBB100_1: # %atomicrmw.start5818; X64-NEXT: # =>This Inner Loop Header: Depth=15819; X64-NEXT: movl %eax, %esi5820; X64-NEXT: andl %edx, %esi5821; X64-NEXT: lock cmpxchgl %esi, (%rdi)5822; X64-NEXT: jne .LBB100_15823; X64-NEXT: # %bb.2: # %atomicrmw.end5824; X64-NEXT: xorl %edx, %edx5825; X64-NEXT: btl %ecx, %eax5826; X64-NEXT: setae %dl5827; X64-NEXT: movl %edx, %eax5828; X64-NEXT: retq5829entry:5830 %0 = and i32 %c, 315831 %shl = shl nuw i32 1, %05832 %1 = atomicrmw and ptr %v, i32 %shl monotonic, align 45833 %2 = xor i32 %1, -15834 %3 = lshr i32 %2, %05835 %lnot.ext = and i32 %3, 15836 ret i32 %lnot.ext5837}5838 5839define i32 @atomic_blsi_and_32_gpr_valz(ptr %v, i32 %c) nounwind {5840; X86-LABEL: atomic_blsi_and_32_gpr_valz:5841; X86: # %bb.0: # %entry5842; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx5843; X86-NEXT: movl {{[0-9]+}}(%esp), %eax5844; X86-NEXT: movl %eax, %edx5845; X86-NEXT: negl %edx5846; X86-NEXT: andl %eax, %edx5847; X86-NEXT: xorl %eax, %eax5848; X86-NEXT: lock andl %edx, (%ecx)5849; X86-NEXT: sete %al5850; X86-NEXT: retl5851;5852; X64-LABEL: atomic_blsi_and_32_gpr_valz:5853; X64: # %bb.0: # %entry5854; X64-NEXT: movl %esi, %ecx5855; X64-NEXT: negl %ecx5856; X64-NEXT: andl %esi, %ecx5857; X64-NEXT: xorl %eax, %eax5858; X64-NEXT: lock andl %ecx, (%rdi)5859; X64-NEXT: sete %al5860; X64-NEXT: retq5861entry:5862 %sub = sub i32 0, %c5863 %and = and i32 %sub, %c5864 %0 = atomicrmw and ptr %v, i32 %and monotonic, align 45865 %and3 = and i32 %0, %and5866 %tobool.not = icmp eq i32 %and3, 05867 %lnot.ext = zext i1 %tobool.not to i325868 ret i32 %lnot.ext5869}5870 5871define i32 @atomic_shl1_and_32_gpr_br(ptr %v, i32 %c) nounwind {5872; X86-LABEL: atomic_shl1_and_32_gpr_br:5873; X86: # %bb.0: # %entry5874; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx5875; X86-NEXT: movl {{[0-9]+}}(%esp), %edx5876; X86-NEXT: movl $1, %eax5877; X86-NEXT: shll %cl, %eax5878; X86-NEXT: lock andl %eax, (%edx)5879; X86-NEXT: movl $123, %eax5880; X86-NEXT: je .LBB102_25881; X86-NEXT: # %bb.1: # %if.then5882; X86-NEXT: movl (%edx,%ecx,4), %eax5883; X86-NEXT: .LBB102_2: # %return5884; X86-NEXT: retl5885;5886; X64-LABEL: atomic_shl1_and_32_gpr_br:5887; X64: # %bb.0: # %entry5888; X64-NEXT: movl %esi, %ecx5889; X64-NEXT: movl $1, %eax5890; X64-NEXT: shll %cl, %eax5891; X64-NEXT: lock andl %eax, (%rdi)5892; X64-NEXT: movl $123, %eax5893; X64-NEXT: je .LBB102_25894; X64-NEXT: # %bb.1: # %if.then5895; X64-NEXT: movl %ecx, %eax5896; X64-NEXT: movl (%rdi,%rax,4), %eax5897; X64-NEXT: .LBB102_2: # %return5898; X64-NEXT: retq5899entry:5900 %shl = shl nuw i32 1, %c5901 %0 = atomicrmw and ptr %v, i32 %shl monotonic, align 45902 %and = and i32 %0, %shl5903 %tobool.not = icmp eq i32 %and, 05904 br i1 %tobool.not, label %return, label %if.then5905 5906if.then: ; preds = %entry5907 %idxprom = zext i32 %c to i645908 %arrayidx = getelementptr inbounds i32, ptr %v, i64 %idxprom5909 %1 = load i32, ptr %arrayidx, align 45910 br label %return5911 5912return: ; preds = %entry, %if.then5913 %retval.0 = phi i32 [ %1, %if.then ], [ 123, %entry ]5914 ret i32 %retval.05915}5916 5917define i32 @atomic_shl1_small_mask_and_32_gpr_br(ptr %v, i32 %c) nounwind {5918; X86-LABEL: atomic_shl1_small_mask_and_32_gpr_br:5919; X86: # %bb.0: # %entry5920; X86-NEXT: movl {{[0-9]+}}(%esp), %edx5921; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx5922; X86-NEXT: andl $15, %ecx5923; X86-NEXT: movl $1, %eax5924; X86-NEXT: shll %cl, %eax5925; X86-NEXT: lock andl %eax, (%edx)5926; X86-NEXT: movl $123, %eax5927; X86-NEXT: je .LBB103_25928; X86-NEXT: # %bb.1: # %if.then5929; X86-NEXT: movl (%edx,%ecx,4), %eax5930; X86-NEXT: .LBB103_2: # %return5931; X86-NEXT: retl5932;5933; X64-LABEL: atomic_shl1_small_mask_and_32_gpr_br:5934; X64: # %bb.0: # %entry5935; X64-NEXT: movl %esi, %ecx5936; X64-NEXT: andl $15, %ecx5937; X64-NEXT: movl $1, %eax5938; X64-NEXT: shll %cl, %eax5939; X64-NEXT: lock andl %eax, (%rdi)5940; X64-NEXT: movl $123, %eax5941; X64-NEXT: je .LBB103_25942; X64-NEXT: # %bb.1: # %if.then5943; X64-NEXT: movl %ecx, %eax5944; X64-NEXT: movl (%rdi,%rax,4), %eax5945; X64-NEXT: .LBB103_2: # %return5946; X64-NEXT: retq5947entry:5948 %0 = and i32 %c, 155949 %shl = shl nuw nsw i32 1, %05950 %1 = atomicrmw and ptr %v, i32 %shl monotonic, align 45951 %and = and i32 %1, %shl5952 %tobool.not = icmp eq i32 %and, 05953 br i1 %tobool.not, label %return, label %if.then5954 5955if.then: ; preds = %entry5956 %conv2 = zext i32 %0 to i645957 %arrayidx = getelementptr inbounds i32, ptr %v, i64 %conv25958 %2 = load i32, ptr %arrayidx, align 45959 br label %return5960 5961return: ; preds = %entry, %if.then5962 %retval.0 = phi i32 [ %2, %if.then ], [ 123, %entry ]5963 ret i32 %retval.05964}5965 5966define i32 @atomic_shl1_mask0_and_32_gpr_br(ptr %v, i32 %c) nounwind {5967; X86-LABEL: atomic_shl1_mask0_and_32_gpr_br:5968; X86: # %bb.0: # %entry5969; X86-NEXT: pushl %edi5970; X86-NEXT: pushl %esi5971; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx5972; X86-NEXT: movl {{[0-9]+}}(%esp), %edx5973; X86-NEXT: movl $1, %esi5974; X86-NEXT: shll %cl, %esi5975; X86-NEXT: movl (%edx), %eax5976; X86-NEXT: .p2align 45977; X86-NEXT: .LBB104_1: # %atomicrmw.start5978; X86-NEXT: # =>This Inner Loop Header: Depth=15979; X86-NEXT: movl %eax, %edi5980; X86-NEXT: andl %esi, %edi5981; X86-NEXT: lock cmpxchgl %edi, (%edx)5982; X86-NEXT: jne .LBB104_15983; X86-NEXT: # %bb.2: # %atomicrmw.end5984; X86-NEXT: btl %ecx, %eax5985; X86-NEXT: jae .LBB104_35986; X86-NEXT: # %bb.4: # %if.then5987; X86-NEXT: movl (%edx,%ecx,4), %eax5988; X86-NEXT: jmp .LBB104_55989; X86-NEXT: .LBB104_3:5990; X86-NEXT: movl $123, %eax5991; X86-NEXT: .LBB104_5: # %return5992; X86-NEXT: popl %esi5993; X86-NEXT: popl %edi5994; X86-NEXT: retl5995;5996; X64-LABEL: atomic_shl1_mask0_and_32_gpr_br:5997; X64: # %bb.0: # %entry5998; X64-NEXT: movl %esi, %ecx5999; X64-NEXT: movl $1, %edx6000; X64-NEXT: shll %cl, %edx6001; X64-NEXT: movl (%rdi), %eax6002; X64-NEXT: .p2align 46003; X64-NEXT: .LBB104_1: # %atomicrmw.start6004; X64-NEXT: # =>This Inner Loop Header: Depth=16005; X64-NEXT: movl %eax, %esi6006; X64-NEXT: andl %edx, %esi6007; X64-NEXT: lock cmpxchgl %esi, (%rdi)6008; X64-NEXT: jne .LBB104_16009; X64-NEXT: # %bb.2: # %atomicrmw.end6010; X64-NEXT: btl %ecx, %eax6011; X64-NEXT: jae .LBB104_36012; X64-NEXT: # %bb.4: # %if.then6013; X64-NEXT: movl %ecx, %eax6014; X64-NEXT: movl (%rdi,%rax,4), %eax6015; X64-NEXT: retq6016; X64-NEXT: .LBB104_3:6017; X64-NEXT: movl $123, %eax6018; X64-NEXT: retq6019entry:6020 %rem = and i32 %c, 316021 %shl = shl nuw i32 1, %rem6022 %0 = atomicrmw and ptr %v, i32 %shl monotonic, align 46023 %shl1 = shl nuw i32 1, %c6024 %and = and i32 %shl1, %06025 %tobool.not = icmp eq i32 %and, 06026 br i1 %tobool.not, label %return, label %if.then6027 6028if.then: ; preds = %entry6029 %conv = zext i32 %c to i646030 %arrayidx = getelementptr inbounds i32, ptr %v, i64 %conv6031 %1 = load i32, ptr %arrayidx, align 46032 br label %return6033 6034return: ; preds = %entry, %if.then6035 %retval.0 = phi i32 [ %1, %if.then ], [ 123, %entry ]6036 ret i32 %retval.06037}6038 6039define i32 @atomic_shl1_mask1_and_32_gpr_br(ptr %v, i32 %c) nounwind {6040; X86-LABEL: atomic_shl1_mask1_and_32_gpr_br:6041; X86: # %bb.0: # %entry6042; X86-NEXT: pushl %edi6043; X86-NEXT: pushl %esi6044; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx6045; X86-NEXT: movl {{[0-9]+}}(%esp), %edx6046; X86-NEXT: movl $1, %esi6047; X86-NEXT: shll %cl, %esi6048; X86-NEXT: movl (%edx), %eax6049; X86-NEXT: .p2align 46050; X86-NEXT: .LBB105_1: # %atomicrmw.start6051; X86-NEXT: # =>This Inner Loop Header: Depth=16052; X86-NEXT: movl %eax, %edi6053; X86-NEXT: andl %esi, %edi6054; X86-NEXT: lock cmpxchgl %edi, (%edx)6055; X86-NEXT: jne .LBB105_16056; X86-NEXT: # %bb.2: # %atomicrmw.end6057; X86-NEXT: btl %ecx, %eax6058; X86-NEXT: jae .LBB105_36059; X86-NEXT: # %bb.4: # %if.then6060; X86-NEXT: movl (%edx,%ecx,4), %eax6061; X86-NEXT: jmp .LBB105_56062; X86-NEXT: .LBB105_3:6063; X86-NEXT: movl $123, %eax6064; X86-NEXT: .LBB105_5: # %return6065; X86-NEXT: popl %esi6066; X86-NEXT: popl %edi6067; X86-NEXT: retl6068;6069; X64-LABEL: atomic_shl1_mask1_and_32_gpr_br:6070; X64: # %bb.0: # %entry6071; X64-NEXT: movl %esi, %ecx6072; X64-NEXT: movl $1, %edx6073; X64-NEXT: shll %cl, %edx6074; X64-NEXT: movl (%rdi), %eax6075; X64-NEXT: .p2align 46076; X64-NEXT: .LBB105_1: # %atomicrmw.start6077; X64-NEXT: # =>This Inner Loop Header: Depth=16078; X64-NEXT: movl %eax, %esi6079; X64-NEXT: andl %edx, %esi6080; X64-NEXT: lock cmpxchgl %esi, (%rdi)6081; X64-NEXT: jne .LBB105_16082; X64-NEXT: # %bb.2: # %atomicrmw.end6083; X64-NEXT: btl %ecx, %eax6084; X64-NEXT: jae .LBB105_36085; X64-NEXT: # %bb.4: # %if.then6086; X64-NEXT: movl %ecx, %eax6087; X64-NEXT: movl (%rdi,%rax,4), %eax6088; X64-NEXT: retq6089; X64-NEXT: .LBB105_3:6090; X64-NEXT: movl $123, %eax6091; X64-NEXT: retq6092entry:6093 %shl = shl nuw i32 1, %c6094 %0 = atomicrmw and ptr %v, i32 %shl monotonic, align 46095 %rem = and i32 %c, 316096 %shl1 = shl nuw i32 1, %rem6097 %and = and i32 %0, %shl16098 %tobool.not = icmp eq i32 %and, 06099 br i1 %tobool.not, label %return, label %if.then6100 6101if.then: ; preds = %entry6102 %conv = zext i32 %c to i646103 %arrayidx = getelementptr inbounds i32, ptr %v, i64 %conv6104 %1 = load i32, ptr %arrayidx, align 46105 br label %return6106 6107return: ; preds = %entry, %if.then6108 %retval.0 = phi i32 [ %1, %if.then ], [ 123, %entry ]6109 ret i32 %retval.06110}6111 6112define i32 @atomic_shl1_mask01_and_32_gpr_br(ptr %v, i32 %c) nounwind {6113; X86-LABEL: atomic_shl1_mask01_and_32_gpr_br:6114; X86: # %bb.0: # %entry6115; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx6116; X86-NEXT: movl {{[0-9]+}}(%esp), %edx6117; X86-NEXT: movl $1, %eax6118; X86-NEXT: shll %cl, %eax6119; X86-NEXT: lock andl %eax, (%edx)6120; X86-NEXT: movl $123, %eax6121; X86-NEXT: je .LBB106_26122; X86-NEXT: # %bb.1: # %if.then6123; X86-NEXT: movl (%edx,%ecx,4), %eax6124; X86-NEXT: .LBB106_2: # %return6125; X86-NEXT: retl6126;6127; X64-LABEL: atomic_shl1_mask01_and_32_gpr_br:6128; X64: # %bb.0: # %entry6129; X64-NEXT: movl %esi, %ecx6130; X64-NEXT: movl $1, %eax6131; X64-NEXT: shll %cl, %eax6132; X64-NEXT: lock andl %eax, (%rdi)6133; X64-NEXT: movl $123, %eax6134; X64-NEXT: je .LBB106_26135; X64-NEXT: # %bb.1: # %if.then6136; X64-NEXT: movl %ecx, %eax6137; X64-NEXT: movl (%rdi,%rax,4), %eax6138; X64-NEXT: .LBB106_2: # %return6139; X64-NEXT: retq6140entry:6141 %rem = and i32 %c, 316142 %shl = shl nuw i32 1, %rem6143 %0 = atomicrmw and ptr %v, i32 %shl monotonic, align 46144 %and = and i32 %0, %shl6145 %tobool.not = icmp eq i32 %and, 06146 br i1 %tobool.not, label %return, label %if.then6147 6148if.then: ; preds = %entry6149 %conv = zext i32 %c to i646150 %arrayidx = getelementptr inbounds i32, ptr %v, i64 %conv6151 %1 = load i32, ptr %arrayidx, align 46152 br label %return6153 6154return: ; preds = %entry, %if.then6155 %retval.0 = phi i32 [ %1, %if.then ], [ 123, %entry ]6156 ret i32 %retval.06157}6158 6159define i32 @atomic_blsi_and_32_gpr_br(ptr %v, i32 %c) nounwind {6160; X86-LABEL: atomic_blsi_and_32_gpr_br:6161; X86: # %bb.0: # %entry6162; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx6163; X86-NEXT: movl {{[0-9]+}}(%esp), %edx6164; X86-NEXT: movl %ecx, %eax6165; X86-NEXT: negl %eax6166; X86-NEXT: andl %ecx, %eax6167; X86-NEXT: lock andl %eax, (%edx)6168; X86-NEXT: movl $123, %eax6169; X86-NEXT: je .LBB107_26170; X86-NEXT: # %bb.1: # %if.then6171; X86-NEXT: movl (%edx,%ecx,4), %eax6172; X86-NEXT: .LBB107_2: # %return6173; X86-NEXT: retl6174;6175; X64-LABEL: atomic_blsi_and_32_gpr_br:6176; X64: # %bb.0: # %entry6177; X64-NEXT: movl %esi, %eax6178; X64-NEXT: negl %eax6179; X64-NEXT: andl %esi, %eax6180; X64-NEXT: lock andl %eax, (%rdi)6181; X64-NEXT: movl $123, %eax6182; X64-NEXT: je .LBB107_26183; X64-NEXT: # %bb.1: # %if.then6184; X64-NEXT: movl %esi, %eax6185; X64-NEXT: movl (%rdi,%rax,4), %eax6186; X64-NEXT: .LBB107_2: # %return6187; X64-NEXT: retq6188entry:6189 %sub = sub i32 0, %c6190 %and = and i32 %sub, %c6191 %0 = atomicrmw and ptr %v, i32 %and monotonic, align 46192 %and3 = and i32 %and, %06193 %tobool.not = icmp eq i32 %and3, 06194 br i1 %tobool.not, label %return, label %if.then6195 6196if.then: ; preds = %entry6197 %idxprom = zext i32 %c to i646198 %arrayidx = getelementptr inbounds i32, ptr %v, i64 %idxprom6199 %1 = load i32, ptr %arrayidx, align 46200 br label %return6201 6202return: ; preds = %entry, %if.then6203 %retval.0 = phi i32 [ %1, %if.then ], [ 123, %entry ]6204 ret i32 %retval.06205}6206 6207define i32 @atomic_shl1_and_32_gpr_brz(ptr %v, i32 %c) nounwind {6208; X86-LABEL: atomic_shl1_and_32_gpr_brz:6209; X86: # %bb.0: # %entry6210; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx6211; X86-NEXT: movl {{[0-9]+}}(%esp), %edx6212; X86-NEXT: movl $1, %eax6213; X86-NEXT: shll %cl, %eax6214; X86-NEXT: lock andl %eax, (%edx)6215; X86-NEXT: movl $123, %eax6216; X86-NEXT: jne .LBB108_26217; X86-NEXT: # %bb.1: # %if.then6218; X86-NEXT: movl (%edx,%ecx,4), %eax6219; X86-NEXT: .LBB108_2: # %return6220; X86-NEXT: retl6221;6222; X64-LABEL: atomic_shl1_and_32_gpr_brz:6223; X64: # %bb.0: # %entry6224; X64-NEXT: movl %esi, %ecx6225; X64-NEXT: movl $1, %eax6226; X64-NEXT: shll %cl, %eax6227; X64-NEXT: lock andl %eax, (%rdi)6228; X64-NEXT: movl $123, %eax6229; X64-NEXT: jne .LBB108_26230; X64-NEXT: # %bb.1: # %if.then6231; X64-NEXT: movl %ecx, %eax6232; X64-NEXT: movl (%rdi,%rax,4), %eax6233; X64-NEXT: .LBB108_2: # %return6234; X64-NEXT: retq6235entry:6236 %shl = shl nuw i32 1, %c6237 %0 = atomicrmw and ptr %v, i32 %shl monotonic, align 46238 %and = and i32 %0, %shl6239 %tobool.not = icmp eq i32 %and, 06240 br i1 %tobool.not, label %if.then, label %return6241 6242if.then: ; preds = %entry6243 %idxprom = zext i32 %c to i646244 %arrayidx = getelementptr inbounds i32, ptr %v, i64 %idxprom6245 %1 = load i32, ptr %arrayidx, align 46246 br label %return6247 6248return: ; preds = %entry, %if.then6249 %retval.0 = phi i32 [ %1, %if.then ], [ 123, %entry ]6250 ret i32 %retval.06251}6252 6253define i32 @atomic_shl1_small_mask_and_32_gpr_brz(ptr %v, i32 %c) nounwind {6254; X86-LABEL: atomic_shl1_small_mask_and_32_gpr_brz:6255; X86: # %bb.0: # %entry6256; X86-NEXT: movl {{[0-9]+}}(%esp), %edx6257; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx6258; X86-NEXT: andl $15, %ecx6259; X86-NEXT: movl $1, %eax6260; X86-NEXT: shll %cl, %eax6261; X86-NEXT: lock andl %eax, (%edx)6262; X86-NEXT: movl $123, %eax6263; X86-NEXT: jne .LBB109_26264; X86-NEXT: # %bb.1: # %if.then6265; X86-NEXT: movl (%edx,%ecx,4), %eax6266; X86-NEXT: .LBB109_2: # %return6267; X86-NEXT: retl6268;6269; X64-LABEL: atomic_shl1_small_mask_and_32_gpr_brz:6270; X64: # %bb.0: # %entry6271; X64-NEXT: movl %esi, %ecx6272; X64-NEXT: andl $15, %ecx6273; X64-NEXT: movl $1, %eax6274; X64-NEXT: shll %cl, %eax6275; X64-NEXT: lock andl %eax, (%rdi)6276; X64-NEXT: movl $123, %eax6277; X64-NEXT: jne .LBB109_26278; X64-NEXT: # %bb.1: # %if.then6279; X64-NEXT: movl %ecx, %eax6280; X64-NEXT: movl (%rdi,%rax,4), %eax6281; X64-NEXT: .LBB109_2: # %return6282; X64-NEXT: retq6283entry:6284 %0 = and i32 %c, 156285 %shl = shl nuw nsw i32 1, %06286 %1 = atomicrmw and ptr %v, i32 %shl monotonic, align 46287 %and = and i32 %shl, %16288 %tobool.not = icmp eq i32 %and, 06289 br i1 %tobool.not, label %if.then, label %return6290 6291if.then: ; preds = %entry6292 %conv2 = zext i32 %0 to i646293 %arrayidx = getelementptr inbounds i32, ptr %v, i64 %conv26294 %2 = load i32, ptr %arrayidx, align 46295 br label %return6296 6297return: ; preds = %entry, %if.then6298 %retval.0 = phi i32 [ %2, %if.then ], [ 123, %entry ]6299 ret i32 %retval.06300}6301 6302define i32 @atomic_shl1_mask0_and_32_gpr_brz(ptr %v, i32 %c) nounwind {6303; X86-LABEL: atomic_shl1_mask0_and_32_gpr_brz:6304; X86: # %bb.0: # %entry6305; X86-NEXT: pushl %edi6306; X86-NEXT: pushl %esi6307; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx6308; X86-NEXT: movl {{[0-9]+}}(%esp), %esi6309; X86-NEXT: movl $1, %edx6310; X86-NEXT: shll %cl, %edx6311; X86-NEXT: movl (%esi), %eax6312; X86-NEXT: .p2align 46313; X86-NEXT: .LBB110_1: # %atomicrmw.start6314; X86-NEXT: # =>This Inner Loop Header: Depth=16315; X86-NEXT: movl %eax, %edi6316; X86-NEXT: andl %edx, %edi6317; X86-NEXT: lock cmpxchgl %edi, (%esi)6318; X86-NEXT: jne .LBB110_16319; X86-NEXT: # %bb.2: # %atomicrmw.end6320; X86-NEXT: movl $123, %edx6321; X86-NEXT: btl %ecx, %eax6322; X86-NEXT: jb .LBB110_46323; X86-NEXT: # %bb.3: # %if.then6324; X86-NEXT: movl (%esi,%ecx,4), %edx6325; X86-NEXT: .LBB110_4: # %return6326; X86-NEXT: movl %edx, %eax6327; X86-NEXT: popl %esi6328; X86-NEXT: popl %edi6329; X86-NEXT: retl6330;6331; X64-LABEL: atomic_shl1_mask0_and_32_gpr_brz:6332; X64: # %bb.0: # %entry6333; X64-NEXT: movl %esi, %ecx6334; X64-NEXT: movl $1, %edx6335; X64-NEXT: shll %cl, %edx6336; X64-NEXT: movl (%rdi), %eax6337; X64-NEXT: .p2align 46338; X64-NEXT: .LBB110_1: # %atomicrmw.start6339; X64-NEXT: # =>This Inner Loop Header: Depth=16340; X64-NEXT: movl %eax, %esi6341; X64-NEXT: andl %edx, %esi6342; X64-NEXT: lock cmpxchgl %esi, (%rdi)6343; X64-NEXT: jne .LBB110_16344; X64-NEXT: # %bb.2: # %atomicrmw.end6345; X64-NEXT: movl $123, %edx6346; X64-NEXT: btl %ecx, %eax6347; X64-NEXT: jae .LBB110_36348; X64-NEXT: # %bb.4: # %return6349; X64-NEXT: movl %edx, %eax6350; X64-NEXT: retq6351; X64-NEXT: .LBB110_3: # %if.then6352; X64-NEXT: movl %ecx, %eax6353; X64-NEXT: movl (%rdi,%rax,4), %edx6354; X64-NEXT: movl %edx, %eax6355; X64-NEXT: retq6356entry:6357 %rem = and i32 %c, 316358 %shl = shl nuw i32 1, %rem6359 %0 = atomicrmw and ptr %v, i32 %shl monotonic, align 46360 %shl1 = shl nuw i32 1, %c6361 %and = and i32 %0, %shl16362 %tobool.not = icmp eq i32 %and, 06363 br i1 %tobool.not, label %if.then, label %return6364 6365if.then: ; preds = %entry6366 %conv = zext i32 %c to i646367 %arrayidx = getelementptr inbounds i32, ptr %v, i64 %conv6368 %1 = load i32, ptr %arrayidx, align 46369 br label %return6370 6371return: ; preds = %entry, %if.then6372 %retval.0 = phi i32 [ %1, %if.then ], [ 123, %entry ]6373 ret i32 %retval.06374}6375 6376define i32 @atomic_shl1_mask1_and_32_gpr_brz(ptr %v, i32 %c) nounwind {6377; X86-LABEL: atomic_shl1_mask1_and_32_gpr_brz:6378; X86: # %bb.0: # %entry6379; X86-NEXT: pushl %edi6380; X86-NEXT: pushl %esi6381; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx6382; X86-NEXT: movl {{[0-9]+}}(%esp), %esi6383; X86-NEXT: movl $1, %edx6384; X86-NEXT: shll %cl, %edx6385; X86-NEXT: movl (%esi), %eax6386; X86-NEXT: .p2align 46387; X86-NEXT: .LBB111_1: # %atomicrmw.start6388; X86-NEXT: # =>This Inner Loop Header: Depth=16389; X86-NEXT: movl %eax, %edi6390; X86-NEXT: andl %edx, %edi6391; X86-NEXT: lock cmpxchgl %edi, (%esi)6392; X86-NEXT: jne .LBB111_16393; X86-NEXT: # %bb.2: # %atomicrmw.end6394; X86-NEXT: movl $123, %edx6395; X86-NEXT: btl %ecx, %eax6396; X86-NEXT: jb .LBB111_46397; X86-NEXT: # %bb.3: # %if.then6398; X86-NEXT: movl (%esi,%ecx,4), %edx6399; X86-NEXT: .LBB111_4: # %return6400; X86-NEXT: movl %edx, %eax6401; X86-NEXT: popl %esi6402; X86-NEXT: popl %edi6403; X86-NEXT: retl6404;6405; X64-LABEL: atomic_shl1_mask1_and_32_gpr_brz:6406; X64: # %bb.0: # %entry6407; X64-NEXT: movl %esi, %ecx6408; X64-NEXT: movl $1, %edx6409; X64-NEXT: shll %cl, %edx6410; X64-NEXT: movl (%rdi), %eax6411; X64-NEXT: .p2align 46412; X64-NEXT: .LBB111_1: # %atomicrmw.start6413; X64-NEXT: # =>This Inner Loop Header: Depth=16414; X64-NEXT: movl %eax, %esi6415; X64-NEXT: andl %edx, %esi6416; X64-NEXT: lock cmpxchgl %esi, (%rdi)6417; X64-NEXT: jne .LBB111_16418; X64-NEXT: # %bb.2: # %atomicrmw.end6419; X64-NEXT: movl $123, %edx6420; X64-NEXT: btl %ecx, %eax6421; X64-NEXT: jae .LBB111_36422; X64-NEXT: # %bb.4: # %return6423; X64-NEXT: movl %edx, %eax6424; X64-NEXT: retq6425; X64-NEXT: .LBB111_3: # %if.then6426; X64-NEXT: movl %ecx, %eax6427; X64-NEXT: movl (%rdi,%rax,4), %edx6428; X64-NEXT: movl %edx, %eax6429; X64-NEXT: retq6430entry:6431 %shl = shl nuw i32 1, %c6432 %0 = atomicrmw and ptr %v, i32 %shl monotonic, align 46433 %rem = and i32 %c, 316434 %shl1 = shl nuw i32 1, %rem6435 %and = and i32 %0, %shl16436 %tobool.not = icmp eq i32 %and, 06437 br i1 %tobool.not, label %if.then, label %return6438 6439if.then: ; preds = %entry6440 %conv = zext i32 %c to i646441 %arrayidx = getelementptr inbounds i32, ptr %v, i64 %conv6442 %1 = load i32, ptr %arrayidx, align 46443 br label %return6444 6445return: ; preds = %entry, %if.then6446 %retval.0 = phi i32 [ %1, %if.then ], [ 123, %entry ]6447 ret i32 %retval.06448}6449 6450define i32 @atomic_shl1_mask01_and_32_gpr_brz(ptr %v, i32 %c) nounwind {6451; X86-LABEL: atomic_shl1_mask01_and_32_gpr_brz:6452; X86: # %bb.0: # %entry6453; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx6454; X86-NEXT: movl {{[0-9]+}}(%esp), %edx6455; X86-NEXT: movl $1, %eax6456; X86-NEXT: shll %cl, %eax6457; X86-NEXT: lock andl %eax, (%edx)6458; X86-NEXT: movl $123, %eax6459; X86-NEXT: jne .LBB112_26460; X86-NEXT: # %bb.1: # %if.then6461; X86-NEXT: movl (%edx,%ecx,4), %eax6462; X86-NEXT: .LBB112_2: # %return6463; X86-NEXT: retl6464;6465; X64-LABEL: atomic_shl1_mask01_and_32_gpr_brz:6466; X64: # %bb.0: # %entry6467; X64-NEXT: movl %esi, %ecx6468; X64-NEXT: movl $1, %eax6469; X64-NEXT: shll %cl, %eax6470; X64-NEXT: lock andl %eax, (%rdi)6471; X64-NEXT: movl $123, %eax6472; X64-NEXT: jne .LBB112_26473; X64-NEXT: # %bb.1: # %if.then6474; X64-NEXT: movl %ecx, %eax6475; X64-NEXT: movl (%rdi,%rax,4), %eax6476; X64-NEXT: .LBB112_2: # %return6477; X64-NEXT: retq6478entry:6479 %rem = and i32 %c, 316480 %shl = shl nuw i32 1, %rem6481 %0 = atomicrmw and ptr %v, i32 %shl monotonic, align 46482 %and = and i32 %0, %shl6483 %tobool.not = icmp eq i32 %and, 06484 br i1 %tobool.not, label %if.then, label %return6485 6486if.then: ; preds = %entry6487 %conv = zext i32 %c to i646488 %arrayidx = getelementptr inbounds i32, ptr %v, i64 %conv6489 %1 = load i32, ptr %arrayidx, align 46490 br label %return6491 6492return: ; preds = %entry, %if.then6493 %retval.0 = phi i32 [ %1, %if.then ], [ 123, %entry ]6494 ret i32 %retval.06495}6496 6497define i32 @atomic_blsi_and_32_gpr_brz(ptr %v, i32 %c) nounwind {6498; X86-LABEL: atomic_blsi_and_32_gpr_brz:6499; X86: # %bb.0: # %entry6500; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx6501; X86-NEXT: movl {{[0-9]+}}(%esp), %edx6502; X86-NEXT: movl %ecx, %eax6503; X86-NEXT: negl %eax6504; X86-NEXT: andl %ecx, %eax6505; X86-NEXT: lock andl %eax, (%edx)6506; X86-NEXT: movl $123, %eax6507; X86-NEXT: jne .LBB113_26508; X86-NEXT: # %bb.1: # %if.then6509; X86-NEXT: movl (%edx,%ecx,4), %eax6510; X86-NEXT: .LBB113_2: # %return6511; X86-NEXT: retl6512;6513; X64-LABEL: atomic_blsi_and_32_gpr_brz:6514; X64: # %bb.0: # %entry6515; X64-NEXT: movl %esi, %eax6516; X64-NEXT: negl %eax6517; X64-NEXT: andl %esi, %eax6518; X64-NEXT: lock andl %eax, (%rdi)6519; X64-NEXT: movl $123, %eax6520; X64-NEXT: jne .LBB113_26521; X64-NEXT: # %bb.1: # %if.then6522; X64-NEXT: movl %esi, %eax6523; X64-NEXT: movl (%rdi,%rax,4), %eax6524; X64-NEXT: .LBB113_2: # %return6525; X64-NEXT: retq6526entry:6527 %sub = sub i32 0, %c6528 %and = and i32 %sub, %c6529 %0 = atomicrmw and ptr %v, i32 %and monotonic, align 46530 %and3 = and i32 %0, %and6531 %tobool.not = icmp eq i32 %and3, 06532 br i1 %tobool.not, label %if.then, label %return6533 6534if.then: ; preds = %entry6535 %idxprom = zext i32 %c to i646536 %arrayidx = getelementptr inbounds i32, ptr %v, i64 %idxprom6537 %1 = load i32, ptr %arrayidx, align 46538 br label %return6539 6540return: ; preds = %entry, %if.then6541 %retval.0 = phi i32 [ %1, %if.then ], [ 123, %entry ]6542 ret i32 %retval.06543}6544 6545define i32 @atomic_shl1_xor_32_const_val(ptr %v) nounwind {6546; X86-LABEL: atomic_shl1_xor_32_const_val:6547; X86: # %bb.0: # %entry6548; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx6549; X86-NEXT: xorl %eax, %eax6550; X86-NEXT: lock btcl $4, (%ecx)6551; X86-NEXT: setb %al6552; X86-NEXT: shll $4, %eax6553; X86-NEXT: retl6554;6555; X64-LABEL: atomic_shl1_xor_32_const_val:6556; X64: # %bb.0: # %entry6557; X64-NEXT: xorl %eax, %eax6558; X64-NEXT: lock btcl $4, (%rdi)6559; X64-NEXT: setb %al6560; X64-NEXT: shll $4, %eax6561; X64-NEXT: retq6562entry:6563 %0 = atomicrmw xor ptr %v, i32 16 monotonic, align 46564 %and = and i32 16, %06565 ret i32 %and6566}6567 6568define i32 @atomic_shl1_xor_32_const_valz(ptr %v) nounwind {6569; X86-LABEL: atomic_shl1_xor_32_const_valz:6570; X86: # %bb.0: # %entry6571; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx6572; X86-NEXT: movl (%ecx), %eax6573; X86-NEXT: .p2align 46574; X86-NEXT: .LBB115_1: # %atomicrmw.start6575; X86-NEXT: # =>This Inner Loop Header: Depth=16576; X86-NEXT: movl %eax, %edx6577; X86-NEXT: xorl $16, %edx6578; X86-NEXT: lock cmpxchgl %edx, (%ecx)6579; X86-NEXT: jne .LBB115_16580; X86-NEXT: # %bb.2: # %atomicrmw.end6581; X86-NEXT: xorl %ecx, %ecx6582; X86-NEXT: testb $16, %al6583; X86-NEXT: sete %cl6584; X86-NEXT: movl %ecx, %eax6585; X86-NEXT: retl6586;6587; X64-LABEL: atomic_shl1_xor_32_const_valz:6588; X64: # %bb.0: # %entry6589; X64-NEXT: movl (%rdi), %eax6590; X64-NEXT: .p2align 46591; X64-NEXT: .LBB115_1: # %atomicrmw.start6592; X64-NEXT: # =>This Inner Loop Header: Depth=16593; X64-NEXT: movl %eax, %ecx6594; X64-NEXT: xorl $16, %ecx6595; X64-NEXT: lock cmpxchgl %ecx, (%rdi)6596; X64-NEXT: jne .LBB115_16597; X64-NEXT: # %bb.2: # %atomicrmw.end6598; X64-NEXT: xorl %ecx, %ecx6599; X64-NEXT: testb $16, %al6600; X64-NEXT: sete %cl6601; X64-NEXT: movl %ecx, %eax6602; X64-NEXT: retq6603entry:6604 %0 = atomicrmw xor ptr %v, i32 16 monotonic, align 46605 %and = lshr i32 %0, 46606 %and.lobit = and i32 %and, 16607 %lnot.ext = xor i32 %and.lobit, 16608 ret i32 %lnot.ext6609}6610 6611define i32 @atomic_shl1_xor_32_const_valnz(ptr %v) nounwind {6612; X86-LABEL: atomic_shl1_xor_32_const_valnz:6613; X86: # %bb.0: # %entry6614; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx6615; X86-NEXT: movl (%ecx), %eax6616; X86-NEXT: .p2align 46617; X86-NEXT: .LBB116_1: # %atomicrmw.start6618; X86-NEXT: # =>This Inner Loop Header: Depth=16619; X86-NEXT: movl %eax, %edx6620; X86-NEXT: xorl $16, %edx6621; X86-NEXT: lock cmpxchgl %edx, (%ecx)6622; X86-NEXT: jne .LBB116_16623; X86-NEXT: # %bb.2: # %atomicrmw.end6624; X86-NEXT: shrl $4, %eax6625; X86-NEXT: andl $1, %eax6626; X86-NEXT: retl6627;6628; X64-LABEL: atomic_shl1_xor_32_const_valnz:6629; X64: # %bb.0: # %entry6630; X64-NEXT: movl (%rdi), %eax6631; X64-NEXT: .p2align 46632; X64-NEXT: .LBB116_1: # %atomicrmw.start6633; X64-NEXT: # =>This Inner Loop Header: Depth=16634; X64-NEXT: movl %eax, %ecx6635; X64-NEXT: xorl $16, %ecx6636; X64-NEXT: lock cmpxchgl %ecx, (%rdi)6637; X64-NEXT: jne .LBB116_16638; X64-NEXT: # %bb.2: # %atomicrmw.end6639; X64-NEXT: shrl $4, %eax6640; X64-NEXT: andl $1, %eax6641; X64-NEXT: retq6642entry:6643 %0 = atomicrmw xor ptr %v, i32 16 monotonic, align 46644 %and = lshr i32 %0, 46645 %and.lobit = and i32 %and, 16646 ret i32 %and.lobit6647}6648 6649define i32 @atomic_shl1_and_32_const_val(ptr %v) nounwind {6650; X86-LABEL: atomic_shl1_and_32_const_val:6651; X86: # %bb.0: # %entry6652; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx6653; X86-NEXT: xorl %eax, %eax6654; X86-NEXT: lock btrl $4, (%ecx)6655; X86-NEXT: setb %al6656; X86-NEXT: shll $4, %eax6657; X86-NEXT: retl6658;6659; X64-LABEL: atomic_shl1_and_32_const_val:6660; X64: # %bb.0: # %entry6661; X64-NEXT: xorl %eax, %eax6662; X64-NEXT: lock btrl $4, (%rdi)6663; X64-NEXT: setb %al6664; X64-NEXT: shll $4, %eax6665; X64-NEXT: retq6666entry:6667 %0 = atomicrmw and ptr %v, i32 -17 monotonic, align 46668 %and = and i32 %0, 166669 ret i32 %and6670}6671 6672define i32 @atomic_shl1_and_32_const_valz(ptr %v) nounwind {6673; X86-LABEL: atomic_shl1_and_32_const_valz:6674; X86: # %bb.0: # %entry6675; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx6676; X86-NEXT: movl (%ecx), %eax6677; X86-NEXT: .p2align 46678; X86-NEXT: .LBB118_1: # %atomicrmw.start6679; X86-NEXT: # =>This Inner Loop Header: Depth=16680; X86-NEXT: movl %eax, %edx6681; X86-NEXT: andl $-17, %edx6682; X86-NEXT: lock cmpxchgl %edx, (%ecx)6683; X86-NEXT: jne .LBB118_16684; X86-NEXT: # %bb.2: # %atomicrmw.end6685; X86-NEXT: xorl %ecx, %ecx6686; X86-NEXT: testb $16, %al6687; X86-NEXT: sete %cl6688; X86-NEXT: movl %ecx, %eax6689; X86-NEXT: retl6690;6691; X64-LABEL: atomic_shl1_and_32_const_valz:6692; X64: # %bb.0: # %entry6693; X64-NEXT: movl (%rdi), %eax6694; X64-NEXT: .p2align 46695; X64-NEXT: .LBB118_1: # %atomicrmw.start6696; X64-NEXT: # =>This Inner Loop Header: Depth=16697; X64-NEXT: movl %eax, %ecx6698; X64-NEXT: andl $-17, %ecx6699; X64-NEXT: lock cmpxchgl %ecx, (%rdi)6700; X64-NEXT: jne .LBB118_16701; X64-NEXT: # %bb.2: # %atomicrmw.end6702; X64-NEXT: xorl %ecx, %ecx6703; X64-NEXT: testb $16, %al6704; X64-NEXT: sete %cl6705; X64-NEXT: movl %ecx, %eax6706; X64-NEXT: retq6707entry:6708 %0 = atomicrmw and ptr %v, i32 -17 monotonic, align 46709 %and = lshr i32 %0, 46710 %and.lobit = and i32 %and, 16711 %lnot.ext = xor i32 %and.lobit, 16712 ret i32 %lnot.ext6713}6714 6715define i32 @atomic_shl1_and_32_const_valnz(ptr %v) nounwind {6716; X86-LABEL: atomic_shl1_and_32_const_valnz:6717; X86: # %bb.0: # %entry6718; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx6719; X86-NEXT: movl (%ecx), %eax6720; X86-NEXT: .p2align 46721; X86-NEXT: .LBB119_1: # %atomicrmw.start6722; X86-NEXT: # =>This Inner Loop Header: Depth=16723; X86-NEXT: movl %eax, %edx6724; X86-NEXT: andl $-17, %edx6725; X86-NEXT: lock cmpxchgl %edx, (%ecx)6726; X86-NEXT: jne .LBB119_16727; X86-NEXT: # %bb.2: # %atomicrmw.end6728; X86-NEXT: shrl $4, %eax6729; X86-NEXT: andl $1, %eax6730; X86-NEXT: retl6731;6732; X64-LABEL: atomic_shl1_and_32_const_valnz:6733; X64: # %bb.0: # %entry6734; X64-NEXT: movl (%rdi), %eax6735; X64-NEXT: .p2align 46736; X64-NEXT: .LBB119_1: # %atomicrmw.start6737; X64-NEXT: # =>This Inner Loop Header: Depth=16738; X64-NEXT: movl %eax, %ecx6739; X64-NEXT: andl $-17, %ecx6740; X64-NEXT: lock cmpxchgl %ecx, (%rdi)6741; X64-NEXT: jne .LBB119_16742; X64-NEXT: # %bb.2: # %atomicrmw.end6743; X64-NEXT: shrl $4, %eax6744; X64-NEXT: andl $1, %eax6745; X64-NEXT: retq6746entry:6747 %0 = atomicrmw and ptr %v, i32 -17 monotonic, align 46748 %and = lshr i32 %0, 46749 %and.lobit = and i32 %and, 16750 ret i32 %and.lobit6751}6752 6753define i32 @atomic_shl1_and_32_const_br(ptr %v) nounwind {6754; X86-LABEL: atomic_shl1_and_32_const_br:6755; X86: # %bb.0: # %entry6756; X86-NEXT: movl {{[0-9]+}}(%esp), %eax6757; X86-NEXT: lock btrl $4, (%eax)6758; X86-NEXT: jae .LBB120_16759; X86-NEXT: # %bb.2: # %if.then6760; X86-NEXT: movl 16(%eax), %eax6761; X86-NEXT: retl6762; X86-NEXT: .LBB120_1:6763; X86-NEXT: movl $123, %eax6764; X86-NEXT: retl6765;6766; X64-LABEL: atomic_shl1_and_32_const_br:6767; X64: # %bb.0: # %entry6768; X64-NEXT: lock btrl $4, (%rdi)6769; X64-NEXT: jae .LBB120_16770; X64-NEXT: # %bb.2: # %if.then6771; X64-NEXT: movl 16(%rdi), %eax6772; X64-NEXT: retq6773; X64-NEXT: .LBB120_1:6774; X64-NEXT: movl $123, %eax6775; X64-NEXT: retq6776entry:6777 %0 = atomicrmw and ptr %v, i32 -17 monotonic, align 46778 %and = and i32 16, %06779 %tobool.not = icmp eq i32 %and, 06780 br i1 %tobool.not, label %return, label %if.then6781 6782if.then: ; preds = %entry6783 %arrayidx = getelementptr inbounds i32, ptr %v, i64 46784 %1 = load i32, ptr %arrayidx, align 46785 br label %return6786 6787return: ; preds = %entry, %if.then6788 %retval.0 = phi i32 [ %1, %if.then ], [ 123, %entry ]6789 ret i32 %retval.06790}6791 6792define i32 @atomic_shl1_and_32_const_brz(ptr %v) nounwind {6793; X86-LABEL: atomic_shl1_and_32_const_brz:6794; X86: # %bb.0: # %entry6795; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx6796; X86-NEXT: lock btrl $4, (%ecx)6797; X86-NEXT: movl $123, %eax6798; X86-NEXT: jae .LBB121_16799; X86-NEXT: # %bb.2: # %return6800; X86-NEXT: retl6801; X86-NEXT: .LBB121_1: # %if.then6802; X86-NEXT: movl 16(%ecx), %eax6803; X86-NEXT: retl6804;6805; X64-LABEL: atomic_shl1_and_32_const_brz:6806; X64: # %bb.0: # %entry6807; X64-NEXT: lock btrl $4, (%rdi)6808; X64-NEXT: movl $123, %eax6809; X64-NEXT: jae .LBB121_16810; X64-NEXT: # %bb.2: # %return6811; X64-NEXT: retq6812; X64-NEXT: .LBB121_1: # %if.then6813; X64-NEXT: movl 16(%rdi), %eax6814; X64-NEXT: retq6815entry:6816 %0 = atomicrmw and ptr %v, i32 -17 monotonic, align 46817 %and = and i32 %0, 166818 %tobool.not = icmp eq i32 %and, 06819 br i1 %tobool.not, label %if.then, label %return6820 6821if.then: ; preds = %entry6822 %arrayidx = getelementptr inbounds i32, ptr %v, i64 46823 %1 = load i32, ptr %arrayidx, align 46824 br label %return6825 6826return: ; preds = %entry, %if.then6827 %retval.0 = phi i32 [ %1, %if.then ], [ 123, %entry ]6828 ret i32 %retval.06829}6830 6831; This IR isn't really ever expected. This test is just make sure we don't crash.6832define i32 @atomic_xor_dead_and(ptr %v, i32 %c) nounwind {6833; X86-LABEL: atomic_xor_dead_and:6834; X86: # %bb.0: # %entry6835; X86-NEXT: pushl %esi6836; X86-NEXT: movl {{[0-9]+}}(%esp), %edx6837; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx6838; X86-NEXT: andb $7, %cl6839; X86-NEXT: movl $1, %esi6840; X86-NEXT: shll %cl, %esi6841; X86-NEXT: movl (%edx), %eax6842; X86-NEXT: .p2align 46843; X86-NEXT: .LBB122_1: # %atomicrmw.start6844; X86-NEXT: # =>This Inner Loop Header: Depth=16845; X86-NEXT: movl %eax, %ecx6846; X86-NEXT: xorl %esi, %ecx6847; X86-NEXT: lock cmpxchgl %ecx, (%edx)6848; X86-NEXT: jne .LBB122_16849; X86-NEXT: # %bb.2: # %atomicrmw.end6850; X86-NEXT: andl %esi, %eax6851; X86-NEXT: popl %esi6852; X86-NEXT: retl6853;6854; X64-LABEL: atomic_xor_dead_and:6855; X64: # %bb.0: # %entry6856; X64-NEXT: movl %esi, %ecx6857; X64-NEXT: andb $7, %cl6858; X64-NEXT: movl $1, %edx6859; X64-NEXT: # kill: def $cl killed $cl killed $ecx6860; X64-NEXT: shll %cl, %edx6861; X64-NEXT: movl (%rdi), %eax6862; X64-NEXT: .p2align 46863; X64-NEXT: .LBB122_1: # %atomicrmw.start6864; X64-NEXT: # =>This Inner Loop Header: Depth=16865; X64-NEXT: movl %eax, %ecx6866; X64-NEXT: xorl %edx, %ecx6867; X64-NEXT: lock cmpxchgl %ecx, (%rdi)6868; X64-NEXT: jne .LBB122_16869; X64-NEXT: # %bb.2: # %atomicrmw.end6870; X64-NEXT: andl %edx, %eax6871; X64-NEXT: retq6872entry:6873 %0 = and i32 %c, 76874 %shl = shl nuw nsw i32 1, %06875 %1 = atomicrmw xor ptr %v, i32 %shl monotonic, align 46876 %and = and i32 %1, %16877 %and1 = and i32 %and, %shl6878 ret i32 %and16879}6880 6881define i32 @atomic_xor_with_not_arg(ptr %v, i32 %c) nounwind {6882; X86-LABEL: atomic_xor_with_not_arg:6883; X86: # %bb.0: # %entry6884; X86-NEXT: pushl %esi6885; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx6886; X86-NEXT: movl {{[0-9]+}}(%esp), %edx6887; X86-NEXT: notl %edx6888; X86-NEXT: movl (%ecx), %eax6889; X86-NEXT: .p2align 46890; X86-NEXT: .LBB123_1: # %atomicrmw.start6891; X86-NEXT: # =>This Inner Loop Header: Depth=16892; X86-NEXT: movl %eax, %esi6893; X86-NEXT: xorl %edx, %esi6894; X86-NEXT: lock cmpxchgl %esi, (%ecx)6895; X86-NEXT: jne .LBB123_16896; X86-NEXT: # %bb.2: # %atomicrmw.end6897; X86-NEXT: popl %esi6898; X86-NEXT: retl6899;6900; X64-LABEL: atomic_xor_with_not_arg:6901; X64: # %bb.0: # %entry6902; X64-NEXT: notl %esi6903; X64-NEXT: movl (%rdi), %eax6904; X64-NEXT: .p2align 46905; X64-NEXT: .LBB123_1: # %atomicrmw.start6906; X64-NEXT: # =>This Inner Loop Header: Depth=16907; X64-NEXT: movl %eax, %ecx6908; X64-NEXT: xorl %esi, %ecx6909; X64-NEXT: lock cmpxchgl %ecx, (%rdi)6910; X64-NEXT: jne .LBB123_16911; X64-NEXT: # %bb.2: # %atomicrmw.end6912; X64-NEXT: retq6913entry:6914 %0 = xor i32 %c, -16915 %1 = atomicrmw xor ptr %v, i32 %0 monotonic, align 46916 ret i32 %16917}6918 6919define i16 @atomic_or_with_not_arg(ptr %v, i16 %c) nounwind {6920; X86-LABEL: atomic_or_with_not_arg:6921; X86: # %bb.0: # %entry6922; X86-NEXT: pushl %esi6923; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx6924; X86-NEXT: movl {{[0-9]+}}(%esp), %edx6925; X86-NEXT: notl %edx6926; X86-NEXT: movzwl (%ecx), %eax6927; X86-NEXT: .p2align 46928; X86-NEXT: .LBB124_1: # %atomicrmw.start6929; X86-NEXT: # =>This Inner Loop Header: Depth=16930; X86-NEXT: movl %eax, %esi6931; X86-NEXT: orl %edx, %esi6932; X86-NEXT: # kill: def $ax killed $ax killed $eax6933; X86-NEXT: lock cmpxchgw %si, (%ecx)6934; X86-NEXT: # kill: def $ax killed $ax def $eax6935; X86-NEXT: jne .LBB124_16936; X86-NEXT: # %bb.2: # %atomicrmw.end6937; X86-NEXT: # kill: def $ax killed $ax killed $eax6938; X86-NEXT: popl %esi6939; X86-NEXT: retl6940;6941; X64-LABEL: atomic_or_with_not_arg:6942; X64: # %bb.0: # %entry6943; X64-NEXT: notl %esi6944; X64-NEXT: movzwl (%rdi), %eax6945; X64-NEXT: .p2align 46946; X64-NEXT: .LBB124_1: # %atomicrmw.start6947; X64-NEXT: # =>This Inner Loop Header: Depth=16948; X64-NEXT: movl %eax, %ecx6949; X64-NEXT: orl %esi, %ecx6950; X64-NEXT: # kill: def $ax killed $ax killed $eax6951; X64-NEXT: lock cmpxchgw %cx, (%rdi)6952; X64-NEXT: # kill: def $ax killed $ax def $eax6953; X64-NEXT: jne .LBB124_16954; X64-NEXT: # %bb.2: # %atomicrmw.end6955; X64-NEXT: # kill: def $ax killed $ax killed $eax6956; X64-NEXT: retq6957entry:6958 %0 = xor i16 %c, -16959 %1 = atomicrmw or ptr %v, i16 %0 monotonic, align 26960 ret i16 %16961}6962 6963define i8 @atomic_and_with_not_arg(ptr %v, i8 %c) nounwind {6964; X86-LABEL: atomic_and_with_not_arg:6965; X86: # %bb.0: # %entry6966; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx6967; X86-NEXT: movzbl {{[0-9]+}}(%esp), %edx6968; X86-NEXT: notb %dl6969; X86-NEXT: movzbl (%ecx), %eax6970; X86-NEXT: .p2align 46971; X86-NEXT: .LBB125_1: # %atomicrmw.start6972; X86-NEXT: # =>This Inner Loop Header: Depth=16973; X86-NEXT: movb %al, %ah6974; X86-NEXT: orb %dl, %ah6975; X86-NEXT: lock cmpxchgb %ah, (%ecx)6976; X86-NEXT: jne .LBB125_16977; X86-NEXT: # %bb.2: # %atomicrmw.end6978; X86-NEXT: retl6979;6980; X64-LABEL: atomic_and_with_not_arg:6981; X64: # %bb.0: # %entry6982; X64-NEXT: notb %sil6983; X64-NEXT: movzbl (%rdi), %eax6984; X64-NEXT: .p2align 46985; X64-NEXT: .LBB125_1: # %atomicrmw.start6986; X64-NEXT: # =>This Inner Loop Header: Depth=16987; X64-NEXT: movl %eax, %ecx6988; X64-NEXT: orb %sil, %cl6989; X64-NEXT: lock cmpxchgb %cl, (%rdi)6990; X64-NEXT: jne .LBB125_16991; X64-NEXT: # %bb.2: # %atomicrmw.end6992; X64-NEXT: retq6993entry:6994 %0 = xor i8 %c, -16995 %1 = atomicrmw or ptr %v, i8 %0 monotonic, align 16996 ret i8 %16997}6998 6999define weak_odr void @atomic_and_with_not_const() nounwind {7000; X86-LABEL: atomic_and_with_not_const:7001; X86: # %bb.0: # %entry7002; X86-NEXT: retl7003;7004; X64-LABEL: atomic_and_with_not_const:7005; X64: # %bb.0: # %entry7006; X64-NEXT: retq7007 entry:7008 br label %if.end197009cont11: ; No predecessors!7010 %not = xor i32 0, -17011 %0 = atomicrmw and ptr null, i32 %not monotonic, align 47012 %and13 = and i32 %0, 07013 br label %if.end197014if.end19: ; preds = %cont11, %entry7015 ret void7016}7017