2096 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc < %s -mtriple=i686-unknown-unknown | FileCheck %s --check-prefix=X863; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s --check-prefix=X644 5; The mask is all-ones, potentially shifted.6 7;------------------------------------------------------------------------------;8; 8-bit9;------------------------------------------------------------------------------;10 11; lshr12 13define i8 @test_i8_7_mask_lshr_1(i8 %a0) {14; X86-LABEL: test_i8_7_mask_lshr_1:15; X86: # %bb.0:16; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax17; X86-NEXT: andb $6, %al18; X86-NEXT: shrb %al19; X86-NEXT: retl20;21; X64-LABEL: test_i8_7_mask_lshr_1:22; X64: # %bb.0:23; X64-NEXT: movl %edi, %eax24; X64-NEXT: andb $6, %al25; X64-NEXT: shrb %al26; X64-NEXT: # kill: def $al killed $al killed $eax27; X64-NEXT: retq28 %t0 = and i8 %a0, 729 %t1 = lshr i8 %t0, 130 ret i8 %t131}32 33define i8 @test_i8_28_mask_lshr_1(i8 %a0) {34; X86-LABEL: test_i8_28_mask_lshr_1:35; X86: # %bb.0:36; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax37; X86-NEXT: andb $28, %al38; X86-NEXT: shrb %al39; X86-NEXT: retl40;41; X64-LABEL: test_i8_28_mask_lshr_1:42; X64: # %bb.0:43; X64-NEXT: movl %edi, %eax44; X64-NEXT: andb $28, %al45; X64-NEXT: shrb %al46; X64-NEXT: # kill: def $al killed $al killed $eax47; X64-NEXT: retq48 %t0 = and i8 %a0, 2849 %t1 = lshr i8 %t0, 150 ret i8 %t151}52define i8 @test_i8_28_mask_lshr_2(i8 %a0) {53; X86-LABEL: test_i8_28_mask_lshr_2:54; X86: # %bb.0:55; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax56; X86-NEXT: andb $28, %al57; X86-NEXT: shrb $2, %al58; X86-NEXT: retl59;60; X64-LABEL: test_i8_28_mask_lshr_2:61; X64: # %bb.0:62; X64-NEXT: movl %edi, %eax63; X64-NEXT: andb $28, %al64; X64-NEXT: shrb $2, %al65; X64-NEXT: # kill: def $al killed $al killed $eax66; X64-NEXT: retq67 %t0 = and i8 %a0, 2868 %t1 = lshr i8 %t0, 269 ret i8 %t170}71define i8 @test_i8_28_mask_lshr_3(i8 %a0) {72; X86-LABEL: test_i8_28_mask_lshr_3:73; X86: # %bb.0:74; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax75; X86-NEXT: andb $24, %al76; X86-NEXT: shrb $3, %al77; X86-NEXT: retl78;79; X64-LABEL: test_i8_28_mask_lshr_3:80; X64: # %bb.0:81; X64-NEXT: movl %edi, %eax82; X64-NEXT: andb $24, %al83; X64-NEXT: shrb $3, %al84; X64-NEXT: # kill: def $al killed $al killed $eax85; X64-NEXT: retq86 %t0 = and i8 %a0, 2887 %t1 = lshr i8 %t0, 388 ret i8 %t189}90define i8 @test_i8_28_mask_lshr_4(i8 %a0) {91; X86-LABEL: test_i8_28_mask_lshr_4:92; X86: # %bb.0:93; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax94; X86-NEXT: andb $16, %al95; X86-NEXT: shrb $4, %al96; X86-NEXT: retl97;98; X64-LABEL: test_i8_28_mask_lshr_4:99; X64: # %bb.0:100; X64-NEXT: movl %edi, %eax101; X64-NEXT: andb $16, %al102; X64-NEXT: shrb $4, %al103; X64-NEXT: # kill: def $al killed $al killed $eax104; X64-NEXT: retq105 %t0 = and i8 %a0, 28106 %t1 = lshr i8 %t0, 4107 ret i8 %t1108}109 110define i8 @test_i8_224_mask_lshr_1(i8 %a0) {111; X86-LABEL: test_i8_224_mask_lshr_1:112; X86: # %bb.0:113; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax114; X86-NEXT: andb $-32, %al115; X86-NEXT: shrb %al116; X86-NEXT: retl117;118; X64-LABEL: test_i8_224_mask_lshr_1:119; X64: # %bb.0:120; X64-NEXT: movl %edi, %eax121; X64-NEXT: andb $-32, %al122; X64-NEXT: shrb %al123; X64-NEXT: # kill: def $al killed $al killed $eax124; X64-NEXT: retq125 %t0 = and i8 %a0, 224126 %t1 = lshr i8 %t0, 1127 ret i8 %t1128}129define i8 @test_i8_224_mask_lshr_4(i8 %a0) {130; X86-LABEL: test_i8_224_mask_lshr_4:131; X86: # %bb.0:132; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax133; X86-NEXT: andb $-32, %al134; X86-NEXT: shrb $4, %al135; X86-NEXT: retl136;137; X64-LABEL: test_i8_224_mask_lshr_4:138; X64: # %bb.0:139; X64-NEXT: movl %edi, %eax140; X64-NEXT: andb $-32, %al141; X64-NEXT: shrb $4, %al142; X64-NEXT: # kill: def $al killed $al killed $eax143; X64-NEXT: retq144 %t0 = and i8 %a0, 224145 %t1 = lshr i8 %t0, 4146 ret i8 %t1147}148define i8 @test_i8_224_mask_lshr_5(i8 %a0) {149; X86-LABEL: test_i8_224_mask_lshr_5:150; X86: # %bb.0:151; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax152; X86-NEXT: shrb $5, %al153; X86-NEXT: retl154;155; X64-LABEL: test_i8_224_mask_lshr_5:156; X64: # %bb.0:157; X64-NEXT: movl %edi, %eax158; X64-NEXT: shrb $5, %al159; X64-NEXT: # kill: def $al killed $al killed $eax160; X64-NEXT: retq161 %t0 = and i8 %a0, 224162 %t1 = lshr i8 %t0, 5163 ret i8 %t1164}165define i8 @test_i8_224_mask_lshr_6(i8 %a0) {166; X86-LABEL: test_i8_224_mask_lshr_6:167; X86: # %bb.0:168; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax169; X86-NEXT: shrb $6, %al170; X86-NEXT: retl171;172; X64-LABEL: test_i8_224_mask_lshr_6:173; X64: # %bb.0:174; X64-NEXT: movl %edi, %eax175; X64-NEXT: shrb $6, %al176; X64-NEXT: # kill: def $al killed $al killed $eax177; X64-NEXT: retq178 %t0 = and i8 %a0, 224179 %t1 = lshr i8 %t0, 6180 ret i8 %t1181}182 183; ashr184 185define i8 @test_i8_7_mask_ashr_1(i8 %a0) {186; X86-LABEL: test_i8_7_mask_ashr_1:187; X86: # %bb.0:188; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax189; X86-NEXT: andb $6, %al190; X86-NEXT: shrb %al191; X86-NEXT: retl192;193; X64-LABEL: test_i8_7_mask_ashr_1:194; X64: # %bb.0:195; X64-NEXT: movl %edi, %eax196; X64-NEXT: andb $6, %al197; X64-NEXT: shrb %al198; X64-NEXT: # kill: def $al killed $al killed $eax199; X64-NEXT: retq200 %t0 = and i8 %a0, 7201 %t1 = ashr i8 %t0, 1202 ret i8 %t1203}204 205define i8 @test_i8_28_mask_ashr_1(i8 %a0) {206; X86-LABEL: test_i8_28_mask_ashr_1:207; X86: # %bb.0:208; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax209; X86-NEXT: andb $28, %al210; X86-NEXT: shrb %al211; X86-NEXT: retl212;213; X64-LABEL: test_i8_28_mask_ashr_1:214; X64: # %bb.0:215; X64-NEXT: movl %edi, %eax216; X64-NEXT: andb $28, %al217; X64-NEXT: shrb %al218; X64-NEXT: # kill: def $al killed $al killed $eax219; X64-NEXT: retq220 %t0 = and i8 %a0, 28221 %t1 = ashr i8 %t0, 1222 ret i8 %t1223}224define i8 @test_i8_28_mask_ashr_2(i8 %a0) {225; X86-LABEL: test_i8_28_mask_ashr_2:226; X86: # %bb.0:227; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax228; X86-NEXT: andb $28, %al229; X86-NEXT: shrb $2, %al230; X86-NEXT: retl231;232; X64-LABEL: test_i8_28_mask_ashr_2:233; X64: # %bb.0:234; X64-NEXT: movl %edi, %eax235; X64-NEXT: andb $28, %al236; X64-NEXT: shrb $2, %al237; X64-NEXT: # kill: def $al killed $al killed $eax238; X64-NEXT: retq239 %t0 = and i8 %a0, 28240 %t1 = ashr i8 %t0, 2241 ret i8 %t1242}243define i8 @test_i8_28_mask_ashr_3(i8 %a0) {244; X86-LABEL: test_i8_28_mask_ashr_3:245; X86: # %bb.0:246; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax247; X86-NEXT: andb $24, %al248; X86-NEXT: shrb $3, %al249; X86-NEXT: retl250;251; X64-LABEL: test_i8_28_mask_ashr_3:252; X64: # %bb.0:253; X64-NEXT: movl %edi, %eax254; X64-NEXT: andb $24, %al255; X64-NEXT: shrb $3, %al256; X64-NEXT: # kill: def $al killed $al killed $eax257; X64-NEXT: retq258 %t0 = and i8 %a0, 28259 %t1 = ashr i8 %t0, 3260 ret i8 %t1261}262define i8 @test_i8_28_mask_ashr_4(i8 %a0) {263; X86-LABEL: test_i8_28_mask_ashr_4:264; X86: # %bb.0:265; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax266; X86-NEXT: andb $16, %al267; X86-NEXT: shrb $4, %al268; X86-NEXT: retl269;270; X64-LABEL: test_i8_28_mask_ashr_4:271; X64: # %bb.0:272; X64-NEXT: movl %edi, %eax273; X64-NEXT: andb $16, %al274; X64-NEXT: shrb $4, %al275; X64-NEXT: # kill: def $al killed $al killed $eax276; X64-NEXT: retq277 %t0 = and i8 %a0, 28278 %t1 = ashr i8 %t0, 4279 ret i8 %t1280}281 282define i8 @test_i8_224_mask_ashr_1(i8 %a0) {283; X86-LABEL: test_i8_224_mask_ashr_1:284; X86: # %bb.0:285; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax286; X86-NEXT: andb $-32, %al287; X86-NEXT: sarb %al288; X86-NEXT: retl289;290; X64-LABEL: test_i8_224_mask_ashr_1:291; X64: # %bb.0:292; X64-NEXT: movl %edi, %eax293; X64-NEXT: andb $-32, %al294; X64-NEXT: sarb %al295; X64-NEXT: # kill: def $al killed $al killed $eax296; X64-NEXT: retq297 %t0 = and i8 %a0, 224298 %t1 = ashr i8 %t0, 1299 ret i8 %t1300}301define i8 @test_i8_224_mask_ashr_4(i8 %a0) {302; X86-LABEL: test_i8_224_mask_ashr_4:303; X86: # %bb.0:304; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax305; X86-NEXT: andb $-32, %al306; X86-NEXT: sarb $4, %al307; X86-NEXT: retl308;309; X64-LABEL: test_i8_224_mask_ashr_4:310; X64: # %bb.0:311; X64-NEXT: movl %edi, %eax312; X64-NEXT: andb $-32, %al313; X64-NEXT: sarb $4, %al314; X64-NEXT: # kill: def $al killed $al killed $eax315; X64-NEXT: retq316 %t0 = and i8 %a0, 224317 %t1 = ashr i8 %t0, 4318 ret i8 %t1319}320define i8 @test_i8_224_mask_ashr_5(i8 %a0) {321; X86-LABEL: test_i8_224_mask_ashr_5:322; X86: # %bb.0:323; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax324; X86-NEXT: sarb $5, %al325; X86-NEXT: retl326;327; X64-LABEL: test_i8_224_mask_ashr_5:328; X64: # %bb.0:329; X64-NEXT: movl %edi, %eax330; X64-NEXT: sarb $5, %al331; X64-NEXT: # kill: def $al killed $al killed $eax332; X64-NEXT: retq333 %t0 = and i8 %a0, 224334 %t1 = ashr i8 %t0, 5335 ret i8 %t1336}337define i8 @test_i8_224_mask_ashr_6(i8 %a0) {338; X86-LABEL: test_i8_224_mask_ashr_6:339; X86: # %bb.0:340; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax341; X86-NEXT: sarb $6, %al342; X86-NEXT: retl343;344; X64-LABEL: test_i8_224_mask_ashr_6:345; X64: # %bb.0:346; X64-NEXT: movl %edi, %eax347; X64-NEXT: sarb $6, %al348; X64-NEXT: # kill: def $al killed $al killed $eax349; X64-NEXT: retq350 %t0 = and i8 %a0, 224351 %t1 = ashr i8 %t0, 6352 ret i8 %t1353}354 355; shl356 357define i8 @test_i8_7_mask_shl_1(i8 %a0) {358; X86-LABEL: test_i8_7_mask_shl_1:359; X86: # %bb.0:360; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax361; X86-NEXT: andb $7, %al362; X86-NEXT: addb %al, %al363; X86-NEXT: retl364;365; X64-LABEL: test_i8_7_mask_shl_1:366; X64: # %bb.0:367; X64-NEXT: # kill: def $edi killed $edi def $rdi368; X64-NEXT: andb $7, %dil369; X64-NEXT: leal (%rdi,%rdi), %eax370; X64-NEXT: # kill: def $al killed $al killed $eax371; X64-NEXT: retq372 %t0 = and i8 %a0, 7373 %t1 = shl i8 %t0, 1374 ret i8 %t1375}376define i8 @test_i8_7_mask_shl_4(i8 %a0) {377; X86-LABEL: test_i8_7_mask_shl_4:378; X86: # %bb.0:379; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax380; X86-NEXT: andb $7, %al381; X86-NEXT: shlb $4, %al382; X86-NEXT: retl383;384; X64-LABEL: test_i8_7_mask_shl_4:385; X64: # %bb.0:386; X64-NEXT: movl %edi, %eax387; X64-NEXT: andb $7, %al388; X64-NEXT: shlb $4, %al389; X64-NEXT: # kill: def $al killed $al killed $eax390; X64-NEXT: retq391 %t0 = and i8 %a0, 7392 %t1 = shl i8 %t0, 4393 ret i8 %t1394}395define i8 @test_i8_7_mask_shl_5(i8 %a0) {396; X86-LABEL: test_i8_7_mask_shl_5:397; X86: # %bb.0:398; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax399; X86-NEXT: shlb $5, %al400; X86-NEXT: retl401;402; X64-LABEL: test_i8_7_mask_shl_5:403; X64: # %bb.0:404; X64-NEXT: movl %edi, %eax405; X64-NEXT: shlb $5, %al406; X64-NEXT: # kill: def $al killed $al killed $eax407; X64-NEXT: retq408 %t0 = and i8 %a0, 7409 %t1 = shl i8 %t0, 5410 ret i8 %t1411}412define i8 @test_i8_7_mask_shl_6(i8 %a0) {413; X86-LABEL: test_i8_7_mask_shl_6:414; X86: # %bb.0:415; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax416; X86-NEXT: shlb $6, %al417; X86-NEXT: retl418;419; X64-LABEL: test_i8_7_mask_shl_6:420; X64: # %bb.0:421; X64-NEXT: movl %edi, %eax422; X64-NEXT: shlb $6, %al423; X64-NEXT: # kill: def $al killed $al killed $eax424; X64-NEXT: retq425 %t0 = and i8 %a0, 7426 %t1 = shl i8 %t0, 6427 ret i8 %t1428}429 430define i8 @test_i8_28_mask_shl_1(i8 %a0) {431; X86-LABEL: test_i8_28_mask_shl_1:432; X86: # %bb.0:433; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax434; X86-NEXT: andb $28, %al435; X86-NEXT: addb %al, %al436; X86-NEXT: retl437;438; X64-LABEL: test_i8_28_mask_shl_1:439; X64: # %bb.0:440; X64-NEXT: # kill: def $edi killed $edi def $rdi441; X64-NEXT: andb $28, %dil442; X64-NEXT: leal (%rdi,%rdi), %eax443; X64-NEXT: # kill: def $al killed $al killed $eax444; X64-NEXT: retq445 %t0 = and i8 %a0, 28446 %t1 = shl i8 %t0, 1447 ret i8 %t1448}449define i8 @test_i8_28_mask_shl_2(i8 %a0) {450; X86-LABEL: test_i8_28_mask_shl_2:451; X86: # %bb.0:452; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax453; X86-NEXT: andb $28, %al454; X86-NEXT: shlb $2, %al455; X86-NEXT: retl456;457; X64-LABEL: test_i8_28_mask_shl_2:458; X64: # %bb.0:459; X64-NEXT: # kill: def $edi killed $edi def $rdi460; X64-NEXT: andb $28, %dil461; X64-NEXT: leal (,%rdi,4), %eax462; X64-NEXT: # kill: def $al killed $al killed $eax463; X64-NEXT: retq464 %t0 = and i8 %a0, 28465 %t1 = shl i8 %t0, 2466 ret i8 %t1467}468define i8 @test_i8_28_mask_shl_3(i8 %a0) {469; X86-LABEL: test_i8_28_mask_shl_3:470; X86: # %bb.0:471; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax472; X86-NEXT: andb $28, %al473; X86-NEXT: shlb $3, %al474; X86-NEXT: retl475;476; X64-LABEL: test_i8_28_mask_shl_3:477; X64: # %bb.0:478; X64-NEXT: # kill: def $edi killed $edi def $rdi479; X64-NEXT: andb $28, %dil480; X64-NEXT: leal (,%rdi,8), %eax481; X64-NEXT: # kill: def $al killed $al killed $eax482; X64-NEXT: retq483 %t0 = and i8 %a0, 28484 %t1 = shl i8 %t0, 3485 ret i8 %t1486}487define i8 @test_i8_28_mask_shl_4(i8 %a0) {488; X86-LABEL: test_i8_28_mask_shl_4:489; X86: # %bb.0:490; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax491; X86-NEXT: andb $12, %al492; X86-NEXT: shlb $4, %al493; X86-NEXT: retl494;495; X64-LABEL: test_i8_28_mask_shl_4:496; X64: # %bb.0:497; X64-NEXT: movl %edi, %eax498; X64-NEXT: andb $12, %al499; X64-NEXT: shlb $4, %al500; X64-NEXT: # kill: def $al killed $al killed $eax501; X64-NEXT: retq502 %t0 = and i8 %a0, 28503 %t1 = shl i8 %t0, 4504 ret i8 %t1505}506 507define i8 @test_i8_224_mask_shl_1(i8 %a0) {508; X86-LABEL: test_i8_224_mask_shl_1:509; X86: # %bb.0:510; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax511; X86-NEXT: andb $96, %al512; X86-NEXT: addb %al, %al513; X86-NEXT: retl514;515; X64-LABEL: test_i8_224_mask_shl_1:516; X64: # %bb.0:517; X64-NEXT: # kill: def $edi killed $edi def $rdi518; X64-NEXT: andb $96, %dil519; X64-NEXT: leal (%rdi,%rdi), %eax520; X64-NEXT: # kill: def $al killed $al killed $eax521; X64-NEXT: retq522 %t0 = and i8 %a0, 224523 %t1 = shl i8 %t0, 1524 ret i8 %t1525}526 527;------------------------------------------------------------------------------;528; 16-bit529;------------------------------------------------------------------------------;530 531; lshr532 533define i16 @test_i16_127_mask_lshr_1(i16 %a0) {534; X86-LABEL: test_i16_127_mask_lshr_1:535; X86: # %bb.0:536; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax537; X86-NEXT: andl $126, %eax538; X86-NEXT: shrl %eax539; X86-NEXT: # kill: def $ax killed $ax killed $eax540; X86-NEXT: retl541;542; X64-LABEL: test_i16_127_mask_lshr_1:543; X64: # %bb.0:544; X64-NEXT: movl %edi, %eax545; X64-NEXT: andl $126, %eax546; X64-NEXT: shrl %eax547; X64-NEXT: # kill: def $ax killed $ax killed $eax548; X64-NEXT: retq549 %t0 = and i16 %a0, 127550 %t1 = lshr i16 %t0, 1551 ret i16 %t1552}553 554define i16 @test_i16_2032_mask_lshr_3(i16 %a0) {555; X86-LABEL: test_i16_2032_mask_lshr_3:556; X86: # %bb.0:557; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax558; X86-NEXT: andl $2032, %eax # imm = 0x7F0559; X86-NEXT: shrl $3, %eax560; X86-NEXT: # kill: def $ax killed $ax killed $eax561; X86-NEXT: retl562;563; X64-LABEL: test_i16_2032_mask_lshr_3:564; X64: # %bb.0:565; X64-NEXT: movl %edi, %eax566; X64-NEXT: andl $2032, %eax # imm = 0x7F0567; X64-NEXT: shrl $3, %eax568; X64-NEXT: # kill: def $ax killed $ax killed $eax569; X64-NEXT: retq570 %t0 = and i16 %a0, 2032571 %t1 = lshr i16 %t0, 3572 ret i16 %t1573}574define i16 @test_i16_2032_mask_lshr_4(i16 %a0) {575; X86-LABEL: test_i16_2032_mask_lshr_4:576; X86: # %bb.0:577; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax578; X86-NEXT: shrl $4, %eax579; X86-NEXT: andl $127, %eax580; X86-NEXT: # kill: def $ax killed $ax killed $eax581; X86-NEXT: retl582;583; X64-LABEL: test_i16_2032_mask_lshr_4:584; X64: # %bb.0:585; X64-NEXT: movl %edi, %eax586; X64-NEXT: shrl $4, %eax587; X64-NEXT: andl $127, %eax588; X64-NEXT: # kill: def $ax killed $ax killed $eax589; X64-NEXT: retq590 %t0 = and i16 %a0, 2032591 %t1 = lshr i16 %t0, 4592 ret i16 %t1593}594define i16 @test_i16_2032_mask_lshr_5(i16 %a0) {595; X86-LABEL: test_i16_2032_mask_lshr_5:596; X86: # %bb.0:597; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax598; X86-NEXT: shrl $5, %eax599; X86-NEXT: andl $63, %eax600; X86-NEXT: # kill: def $ax killed $ax killed $eax601; X86-NEXT: retl602;603; X64-LABEL: test_i16_2032_mask_lshr_5:604; X64: # %bb.0:605; X64-NEXT: movl %edi, %eax606; X64-NEXT: shrl $5, %eax607; X64-NEXT: andl $63, %eax608; X64-NEXT: # kill: def $ax killed $ax killed $eax609; X64-NEXT: retq610 %t0 = and i16 %a0, 2032611 %t1 = lshr i16 %t0, 5612 ret i16 %t1613}614define i16 @test_i16_2032_mask_lshr_6(i16 %a0) {615; X86-LABEL: test_i16_2032_mask_lshr_6:616; X86: # %bb.0:617; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax618; X86-NEXT: shrl $6, %eax619; X86-NEXT: andl $31, %eax620; X86-NEXT: # kill: def $ax killed $ax killed $eax621; X86-NEXT: retl622;623; X64-LABEL: test_i16_2032_mask_lshr_6:624; X64: # %bb.0:625; X64-NEXT: movl %edi, %eax626; X64-NEXT: shrl $6, %eax627; X64-NEXT: andl $31, %eax628; X64-NEXT: # kill: def $ax killed $ax killed $eax629; X64-NEXT: retq630 %t0 = and i16 %a0, 2032631 %t1 = lshr i16 %t0, 6632 ret i16 %t1633}634 635define i16 @test_i16_65024_mask_lshr_1(i16 %a0) {636; X86-LABEL: test_i16_65024_mask_lshr_1:637; X86: # %bb.0:638; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax639; X86-NEXT: andl $65024, %eax # imm = 0xFE00640; X86-NEXT: shrl %eax641; X86-NEXT: # kill: def $ax killed $ax killed $eax642; X86-NEXT: retl643;644; X64-LABEL: test_i16_65024_mask_lshr_1:645; X64: # %bb.0:646; X64-NEXT: movl %edi, %eax647; X64-NEXT: andl $65024, %eax # imm = 0xFE00648; X64-NEXT: shrl %eax649; X64-NEXT: # kill: def $ax killed $ax killed $eax650; X64-NEXT: retq651 %t0 = and i16 %a0, 65024652 %t1 = lshr i16 %t0, 1653 ret i16 %t1654}655define i16 @test_i16_65024_mask_lshr_8(i16 %a0) {656; X86-LABEL: test_i16_65024_mask_lshr_8:657; X86: # %bb.0:658; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax659; X86-NEXT: andl $65024, %eax # imm = 0xFE00660; X86-NEXT: shrl $8, %eax661; X86-NEXT: # kill: def $ax killed $ax killed $eax662; X86-NEXT: retl663;664; X64-LABEL: test_i16_65024_mask_lshr_8:665; X64: # %bb.0:666; X64-NEXT: movl %edi, %eax667; X64-NEXT: andl $65024, %eax # imm = 0xFE00668; X64-NEXT: shrl $8, %eax669; X64-NEXT: # kill: def $ax killed $ax killed $eax670; X64-NEXT: retq671 %t0 = and i16 %a0, 65024672 %t1 = lshr i16 %t0, 8673 ret i16 %t1674}675define i16 @test_i16_65024_mask_lshr_9(i16 %a0) {676; X86-LABEL: test_i16_65024_mask_lshr_9:677; X86: # %bb.0:678; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax679; X86-NEXT: shrl $9, %eax680; X86-NEXT: # kill: def $ax killed $ax killed $eax681; X86-NEXT: retl682;683; X64-LABEL: test_i16_65024_mask_lshr_9:684; X64: # %bb.0:685; X64-NEXT: movzwl %di, %eax686; X64-NEXT: shrl $9, %eax687; X64-NEXT: # kill: def $ax killed $ax killed $eax688; X64-NEXT: retq689 %t0 = and i16 %a0, 65024690 %t1 = lshr i16 %t0, 9691 ret i16 %t1692}693define i16 @test_i16_65024_mask_lshr_10(i16 %a0) {694; X86-LABEL: test_i16_65024_mask_lshr_10:695; X86: # %bb.0:696; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax697; X86-NEXT: shrl $10, %eax698; X86-NEXT: # kill: def $ax killed $ax killed $eax699; X86-NEXT: retl700;701; X64-LABEL: test_i16_65024_mask_lshr_10:702; X64: # %bb.0:703; X64-NEXT: movzwl %di, %eax704; X64-NEXT: shrl $10, %eax705; X64-NEXT: # kill: def $ax killed $ax killed $eax706; X64-NEXT: retq707 %t0 = and i16 %a0, 65024708 %t1 = lshr i16 %t0, 10709 ret i16 %t1710}711 712; ashr713 714define i16 @test_i16_127_mask_ashr_1(i16 %a0) {715; X86-LABEL: test_i16_127_mask_ashr_1:716; X86: # %bb.0:717; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax718; X86-NEXT: andl $126, %eax719; X86-NEXT: shrl %eax720; X86-NEXT: # kill: def $ax killed $ax killed $eax721; X86-NEXT: retl722;723; X64-LABEL: test_i16_127_mask_ashr_1:724; X64: # %bb.0:725; X64-NEXT: movl %edi, %eax726; X64-NEXT: andl $126, %eax727; X64-NEXT: shrl %eax728; X64-NEXT: # kill: def $ax killed $ax killed $eax729; X64-NEXT: retq730 %t0 = and i16 %a0, 127731 %t1 = ashr i16 %t0, 1732 ret i16 %t1733}734 735define i16 @test_i16_2032_mask_ashr_3(i16 %a0) {736; X86-LABEL: test_i16_2032_mask_ashr_3:737; X86: # %bb.0:738; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax739; X86-NEXT: andl $2032, %eax # imm = 0x7F0740; X86-NEXT: shrl $3, %eax741; X86-NEXT: # kill: def $ax killed $ax killed $eax742; X86-NEXT: retl743;744; X64-LABEL: test_i16_2032_mask_ashr_3:745; X64: # %bb.0:746; X64-NEXT: movl %edi, %eax747; X64-NEXT: andl $2032, %eax # imm = 0x7F0748; X64-NEXT: shrl $3, %eax749; X64-NEXT: # kill: def $ax killed $ax killed $eax750; X64-NEXT: retq751 %t0 = and i16 %a0, 2032752 %t1 = ashr i16 %t0, 3753 ret i16 %t1754}755define i16 @test_i16_2032_mask_ashr_4(i16 %a0) {756; X86-LABEL: test_i16_2032_mask_ashr_4:757; X86: # %bb.0:758; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax759; X86-NEXT: shrl $4, %eax760; X86-NEXT: andl $127, %eax761; X86-NEXT: # kill: def $ax killed $ax killed $eax762; X86-NEXT: retl763;764; X64-LABEL: test_i16_2032_mask_ashr_4:765; X64: # %bb.0:766; X64-NEXT: movl %edi, %eax767; X64-NEXT: shrl $4, %eax768; X64-NEXT: andl $127, %eax769; X64-NEXT: # kill: def $ax killed $ax killed $eax770; X64-NEXT: retq771 %t0 = and i16 %a0, 2032772 %t1 = ashr i16 %t0, 4773 ret i16 %t1774}775define i16 @test_i16_2032_mask_ashr_5(i16 %a0) {776; X86-LABEL: test_i16_2032_mask_ashr_5:777; X86: # %bb.0:778; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax779; X86-NEXT: shrl $5, %eax780; X86-NEXT: andl $63, %eax781; X86-NEXT: # kill: def $ax killed $ax killed $eax782; X86-NEXT: retl783;784; X64-LABEL: test_i16_2032_mask_ashr_5:785; X64: # %bb.0:786; X64-NEXT: movl %edi, %eax787; X64-NEXT: shrl $5, %eax788; X64-NEXT: andl $63, %eax789; X64-NEXT: # kill: def $ax killed $ax killed $eax790; X64-NEXT: retq791 %t0 = and i16 %a0, 2032792 %t1 = ashr i16 %t0, 5793 ret i16 %t1794}795define i16 @test_i16_2032_mask_ashr_6(i16 %a0) {796; X86-LABEL: test_i16_2032_mask_ashr_6:797; X86: # %bb.0:798; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax799; X86-NEXT: shrl $6, %eax800; X86-NEXT: andl $31, %eax801; X86-NEXT: # kill: def $ax killed $ax killed $eax802; X86-NEXT: retl803;804; X64-LABEL: test_i16_2032_mask_ashr_6:805; X64: # %bb.0:806; X64-NEXT: movl %edi, %eax807; X64-NEXT: shrl $6, %eax808; X64-NEXT: andl $31, %eax809; X64-NEXT: # kill: def $ax killed $ax killed $eax810; X64-NEXT: retq811 %t0 = and i16 %a0, 2032812 %t1 = ashr i16 %t0, 6813 ret i16 %t1814}815 816define i16 @test_i16_65024_mask_ashr_1(i16 %a0) {817; X86-LABEL: test_i16_65024_mask_ashr_1:818; X86: # %bb.0:819; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax820; X86-NEXT: andl $65024, %eax # imm = 0xFE00821; X86-NEXT: cwtl822; X86-NEXT: shrl %eax823; X86-NEXT: # kill: def $ax killed $ax killed $eax824; X86-NEXT: retl825;826; X64-LABEL: test_i16_65024_mask_ashr_1:827; X64: # %bb.0:828; X64-NEXT: andl $65024, %edi # imm = 0xFE00829; X64-NEXT: movswl %di, %eax830; X64-NEXT: shrl %eax831; X64-NEXT: # kill: def $ax killed $ax killed $eax832; X64-NEXT: retq833 %t0 = and i16 %a0, 65024834 %t1 = ashr i16 %t0, 1835 ret i16 %t1836}837define i16 @test_i16_65024_mask_ashr_8(i16 %a0) {838; X86-LABEL: test_i16_65024_mask_ashr_8:839; X86: # %bb.0:840; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax841; X86-NEXT: andl $65024, %eax # imm = 0xFE00842; X86-NEXT: cwtl843; X86-NEXT: shrl $8, %eax844; X86-NEXT: # kill: def $ax killed $ax killed $eax845; X86-NEXT: retl846;847; X64-LABEL: test_i16_65024_mask_ashr_8:848; X64: # %bb.0:849; X64-NEXT: andl $65024, %edi # imm = 0xFE00850; X64-NEXT: movswl %di, %eax851; X64-NEXT: shrl $8, %eax852; X64-NEXT: # kill: def $ax killed $ax killed $eax853; X64-NEXT: retq854 %t0 = and i16 %a0, 65024855 %t1 = ashr i16 %t0, 8856 ret i16 %t1857}858define i16 @test_i16_65024_mask_ashr_9(i16 %a0) {859; X86-LABEL: test_i16_65024_mask_ashr_9:860; X86: # %bb.0:861; X86-NEXT: movswl {{[0-9]+}}(%esp), %eax862; X86-NEXT: shrl $9, %eax863; X86-NEXT: # kill: def $ax killed $ax killed $eax864; X86-NEXT: retl865;866; X64-LABEL: test_i16_65024_mask_ashr_9:867; X64: # %bb.0:868; X64-NEXT: movswl %di, %eax869; X64-NEXT: shrl $9, %eax870; X64-NEXT: # kill: def $ax killed $ax killed $eax871; X64-NEXT: retq872 %t0 = and i16 %a0, 65024873 %t1 = ashr i16 %t0, 9874 ret i16 %t1875}876define i16 @test_i16_65024_mask_ashr_10(i16 %a0) {877; X86-LABEL: test_i16_65024_mask_ashr_10:878; X86: # %bb.0:879; X86-NEXT: movswl {{[0-9]+}}(%esp), %eax880; X86-NEXT: shrl $10, %eax881; X86-NEXT: # kill: def $ax killed $ax killed $eax882; X86-NEXT: retl883;884; X64-LABEL: test_i16_65024_mask_ashr_10:885; X64: # %bb.0:886; X64-NEXT: movswl %di, %eax887; X64-NEXT: shrl $10, %eax888; X64-NEXT: # kill: def $ax killed $ax killed $eax889; X64-NEXT: retq890 %t0 = and i16 %a0, 65024891 %t1 = ashr i16 %t0, 10892 ret i16 %t1893}894 895; shl896 897define i16 @test_i16_127_mask_shl_1(i16 %a0) {898; X86-LABEL: test_i16_127_mask_shl_1:899; X86: # %bb.0:900; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax901; X86-NEXT: andl $127, %eax902; X86-NEXT: addl %eax, %eax903; X86-NEXT: # kill: def $ax killed $ax killed $eax904; X86-NEXT: retl905;906; X64-LABEL: test_i16_127_mask_shl_1:907; X64: # %bb.0:908; X64-NEXT: # kill: def $edi killed $edi def $rdi909; X64-NEXT: andl $127, %edi910; X64-NEXT: leal (%rdi,%rdi), %eax911; X64-NEXT: # kill: def $ax killed $ax killed $eax912; X64-NEXT: retq913 %t0 = and i16 %a0, 127914 %t1 = shl i16 %t0, 1915 ret i16 %t1916}917define i16 @test_i16_127_mask_shl_8(i16 %a0) {918; X86-LABEL: test_i16_127_mask_shl_8:919; X86: # %bb.0:920; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax921; X86-NEXT: andl $127, %eax922; X86-NEXT: shll $8, %eax923; X86-NEXT: # kill: def $ax killed $ax killed $eax924; X86-NEXT: retl925;926; X64-LABEL: test_i16_127_mask_shl_8:927; X64: # %bb.0:928; X64-NEXT: movl %edi, %eax929; X64-NEXT: andl $127, %eax930; X64-NEXT: shll $8, %eax931; X64-NEXT: # kill: def $ax killed $ax killed $eax932; X64-NEXT: retq933 %t0 = and i16 %a0, 127934 %t1 = shl i16 %t0, 8935 ret i16 %t1936}937define i16 @test_i16_127_mask_shl_9(i16 %a0) {938; X86-LABEL: test_i16_127_mask_shl_9:939; X86: # %bb.0:940; X86-NEXT: movl {{[0-9]+}}(%esp), %eax941; X86-NEXT: shll $9, %eax942; X86-NEXT: # kill: def $ax killed $ax killed $eax943; X86-NEXT: retl944;945; X64-LABEL: test_i16_127_mask_shl_9:946; X64: # %bb.0:947; X64-NEXT: movl %edi, %eax948; X64-NEXT: shll $9, %eax949; X64-NEXT: # kill: def $ax killed $ax killed $eax950; X64-NEXT: retq951 %t0 = and i16 %a0, 127952 %t1 = shl i16 %t0, 9953 ret i16 %t1954}955define i16 @test_i16_127_mask_shl_10(i16 %a0) {956; X86-LABEL: test_i16_127_mask_shl_10:957; X86: # %bb.0:958; X86-NEXT: movl {{[0-9]+}}(%esp), %eax959; X86-NEXT: shll $10, %eax960; X86-NEXT: # kill: def $ax killed $ax killed $eax961; X86-NEXT: retl962;963; X64-LABEL: test_i16_127_mask_shl_10:964; X64: # %bb.0:965; X64-NEXT: movl %edi, %eax966; X64-NEXT: shll $10, %eax967; X64-NEXT: # kill: def $ax killed $ax killed $eax968; X64-NEXT: retq969 %t0 = and i16 %a0, 127970 %t1 = shl i16 %t0, 10971 ret i16 %t1972}973 974define i16 @test_i16_2032_mask_shl_3(i16 %a0) {975; X86-LABEL: test_i16_2032_mask_shl_3:976; X86: # %bb.0:977; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax978; X86-NEXT: andl $2032, %eax # imm = 0x7F0979; X86-NEXT: shll $3, %eax980; X86-NEXT: # kill: def $ax killed $ax killed $eax981; X86-NEXT: retl982;983; X64-LABEL: test_i16_2032_mask_shl_3:984; X64: # %bb.0:985; X64-NEXT: # kill: def $edi killed $edi def $rdi986; X64-NEXT: andl $2032, %edi # imm = 0x7F0987; X64-NEXT: leal (,%rdi,8), %eax988; X64-NEXT: # kill: def $ax killed $ax killed $eax989; X64-NEXT: retq990 %t0 = and i16 %a0, 2032991 %t1 = shl i16 %t0, 3992 ret i16 %t1993}994define i16 @test_i16_2032_mask_shl_4(i16 %a0) {995; X86-LABEL: test_i16_2032_mask_shl_4:996; X86: # %bb.0:997; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax998; X86-NEXT: andl $2032, %eax # imm = 0x7F0999; X86-NEXT: shll $4, %eax1000; X86-NEXT: # kill: def $ax killed $ax killed $eax1001; X86-NEXT: retl1002;1003; X64-LABEL: test_i16_2032_mask_shl_4:1004; X64: # %bb.0:1005; X64-NEXT: movl %edi, %eax1006; X64-NEXT: andl $2032, %eax # imm = 0x7F01007; X64-NEXT: shll $4, %eax1008; X64-NEXT: # kill: def $ax killed $ax killed $eax1009; X64-NEXT: retq1010 %t0 = and i16 %a0, 20321011 %t1 = shl i16 %t0, 41012 ret i16 %t11013}1014define i16 @test_i16_2032_mask_shl_5(i16 %a0) {1015; X86-LABEL: test_i16_2032_mask_shl_5:1016; X86: # %bb.0:1017; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax1018; X86-NEXT: andl $2032, %eax # imm = 0x7F01019; X86-NEXT: shll $5, %eax1020; X86-NEXT: # kill: def $ax killed $ax killed $eax1021; X86-NEXT: retl1022;1023; X64-LABEL: test_i16_2032_mask_shl_5:1024; X64: # %bb.0:1025; X64-NEXT: movl %edi, %eax1026; X64-NEXT: andl $2032, %eax # imm = 0x7F01027; X64-NEXT: shll $5, %eax1028; X64-NEXT: # kill: def $ax killed $ax killed $eax1029; X64-NEXT: retq1030 %t0 = and i16 %a0, 20321031 %t1 = shl i16 %t0, 51032 ret i16 %t11033}1034define i16 @test_i16_2032_mask_shl_6(i16 %a0) {1035; X86-LABEL: test_i16_2032_mask_shl_6:1036; X86: # %bb.0:1037; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax1038; X86-NEXT: andl $1008, %eax # imm = 0x3F01039; X86-NEXT: shll $6, %eax1040; X86-NEXT: # kill: def $ax killed $ax killed $eax1041; X86-NEXT: retl1042;1043; X64-LABEL: test_i16_2032_mask_shl_6:1044; X64: # %bb.0:1045; X64-NEXT: movl %edi, %eax1046; X64-NEXT: andl $1008, %eax # imm = 0x3F01047; X64-NEXT: shll $6, %eax1048; X64-NEXT: # kill: def $ax killed $ax killed $eax1049; X64-NEXT: retq1050 %t0 = and i16 %a0, 20321051 %t1 = shl i16 %t0, 61052 ret i16 %t11053}1054 1055define i16 @test_i16_65024_mask_shl_1(i16 %a0) {1056; X86-LABEL: test_i16_65024_mask_shl_1:1057; X86: # %bb.0:1058; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax1059; X86-NEXT: andl $32256, %eax # imm = 0x7E001060; X86-NEXT: addl %eax, %eax1061; X86-NEXT: # kill: def $ax killed $ax killed $eax1062; X86-NEXT: retl1063;1064; X64-LABEL: test_i16_65024_mask_shl_1:1065; X64: # %bb.0:1066; X64-NEXT: # kill: def $edi killed $edi def $rdi1067; X64-NEXT: andl $32256, %edi # imm = 0x7E001068; X64-NEXT: leal (%rdi,%rdi), %eax1069; X64-NEXT: # kill: def $ax killed $ax killed $eax1070; X64-NEXT: retq1071 %t0 = and i16 %a0, 650241072 %t1 = shl i16 %t0, 11073 ret i16 %t11074}1075 1076;------------------------------------------------------------------------------;1077; 32-bit1078;------------------------------------------------------------------------------;1079 1080; lshr1081 1082define i32 @test_i32_32767_mask_lshr_1(i32 %a0) {1083; X86-LABEL: test_i32_32767_mask_lshr_1:1084; X86: # %bb.0:1085; X86-NEXT: movl $32766, %eax # imm = 0x7FFE1086; X86-NEXT: andl {{[0-9]+}}(%esp), %eax1087; X86-NEXT: shrl %eax1088; X86-NEXT: retl1089;1090; X64-LABEL: test_i32_32767_mask_lshr_1:1091; X64: # %bb.0:1092; X64-NEXT: movl %edi, %eax1093; X64-NEXT: andl $32766, %eax # imm = 0x7FFE1094; X64-NEXT: shrl %eax1095; X64-NEXT: retq1096 %t0 = and i32 %a0, 327671097 %t1 = lshr i32 %t0, 11098 ret i32 %t11099}1100 1101define i32 @test_i32_8388352_mask_lshr_7(i32 %a0) {1102; X86-LABEL: test_i32_8388352_mask_lshr_7:1103; X86: # %bb.0:1104; X86-NEXT: movl $8388352, %eax # imm = 0x7FFF001105; X86-NEXT: andl {{[0-9]+}}(%esp), %eax1106; X86-NEXT: shrl $7, %eax1107; X86-NEXT: retl1108;1109; X64-LABEL: test_i32_8388352_mask_lshr_7:1110; X64: # %bb.0:1111; X64-NEXT: movl %edi, %eax1112; X64-NEXT: andl $8388352, %eax # imm = 0x7FFF001113; X64-NEXT: shrl $7, %eax1114; X64-NEXT: retq1115 %t0 = and i32 %a0, 83883521116 %t1 = lshr i32 %t0, 71117 ret i32 %t11118}1119define i32 @test_i32_8388352_mask_lshr_8(i32 %a0) {1120; X86-LABEL: test_i32_8388352_mask_lshr_8:1121; X86: # %bb.0:1122; X86-NEXT: movl $8388352, %eax # imm = 0x7FFF001123; X86-NEXT: andl {{[0-9]+}}(%esp), %eax1124; X86-NEXT: shrl $8, %eax1125; X86-NEXT: retl1126;1127; X64-LABEL: test_i32_8388352_mask_lshr_8:1128; X64: # %bb.0:1129; X64-NEXT: movl %edi, %eax1130; X64-NEXT: andl $8388352, %eax # imm = 0x7FFF001131; X64-NEXT: shrl $8, %eax1132; X64-NEXT: retq1133 %t0 = and i32 %a0, 83883521134 %t1 = lshr i32 %t0, 81135 ret i32 %t11136}1137define i32 @test_i32_8388352_mask_lshr_9(i32 %a0) {1138; X86-LABEL: test_i32_8388352_mask_lshr_9:1139; X86: # %bb.0:1140; X86-NEXT: movl $8388096, %eax # imm = 0x7FFE001141; X86-NEXT: andl {{[0-9]+}}(%esp), %eax1142; X86-NEXT: shrl $9, %eax1143; X86-NEXT: retl1144;1145; X64-LABEL: test_i32_8388352_mask_lshr_9:1146; X64: # %bb.0:1147; X64-NEXT: movl %edi, %eax1148; X64-NEXT: andl $8388096, %eax # imm = 0x7FFE001149; X64-NEXT: shrl $9, %eax1150; X64-NEXT: retq1151 %t0 = and i32 %a0, 83883521152 %t1 = lshr i32 %t0, 91153 ret i32 %t11154}1155define i32 @test_i32_8388352_mask_lshr_10(i32 %a0) {1156; X86-LABEL: test_i32_8388352_mask_lshr_10:1157; X86: # %bb.0:1158; X86-NEXT: movl $8387584, %eax # imm = 0x7FFC001159; X86-NEXT: andl {{[0-9]+}}(%esp), %eax1160; X86-NEXT: shrl $10, %eax1161; X86-NEXT: retl1162;1163; X64-LABEL: test_i32_8388352_mask_lshr_10:1164; X64: # %bb.0:1165; X64-NEXT: movl %edi, %eax1166; X64-NEXT: andl $8387584, %eax # imm = 0x7FFC001167; X64-NEXT: shrl $10, %eax1168; X64-NEXT: retq1169 %t0 = and i32 %a0, 83883521170 %t1 = lshr i32 %t0, 101171 ret i32 %t11172}1173 1174define i32 @test_i32_4294836224_mask_lshr_1(i32 %a0) {1175; X86-LABEL: test_i32_4294836224_mask_lshr_1:1176; X86: # %bb.0:1177; X86-NEXT: movl $-131072, %eax # imm = 0xFFFE00001178; X86-NEXT: andl {{[0-9]+}}(%esp), %eax1179; X86-NEXT: shrl %eax1180; X86-NEXT: retl1181;1182; X64-LABEL: test_i32_4294836224_mask_lshr_1:1183; X64: # %bb.0:1184; X64-NEXT: movl %edi, %eax1185; X64-NEXT: andl $-131072, %eax # imm = 0xFFFE00001186; X64-NEXT: shrl %eax1187; X64-NEXT: retq1188 %t0 = and i32 %a0, 42948362241189 %t1 = lshr i32 %t0, 11190 ret i32 %t11191}1192define i32 @test_i32_4294836224_mask_lshr_16(i32 %a0) {1193; X86-LABEL: test_i32_4294836224_mask_lshr_16:1194; X86: # %bb.0:1195; X86-NEXT: movl $-131072, %eax # imm = 0xFFFE00001196; X86-NEXT: andl {{[0-9]+}}(%esp), %eax1197; X86-NEXT: shrl $16, %eax1198; X86-NEXT: retl1199;1200; X64-LABEL: test_i32_4294836224_mask_lshr_16:1201; X64: # %bb.0:1202; X64-NEXT: movl %edi, %eax1203; X64-NEXT: andl $-131072, %eax # imm = 0xFFFE00001204; X64-NEXT: shrl $16, %eax1205; X64-NEXT: retq1206 %t0 = and i32 %a0, 42948362241207 %t1 = lshr i32 %t0, 161208 ret i32 %t11209}1210define i32 @test_i32_4294836224_mask_lshr_17(i32 %a0) {1211; X86-LABEL: test_i32_4294836224_mask_lshr_17:1212; X86: # %bb.0:1213; X86-NEXT: movl {{[0-9]+}}(%esp), %eax1214; X86-NEXT: shrl $17, %eax1215; X86-NEXT: retl1216;1217; X64-LABEL: test_i32_4294836224_mask_lshr_17:1218; X64: # %bb.0:1219; X64-NEXT: movl %edi, %eax1220; X64-NEXT: shrl $17, %eax1221; X64-NEXT: retq1222 %t0 = and i32 %a0, 42948362241223 %t1 = lshr i32 %t0, 171224 ret i32 %t11225}1226define i32 @test_i32_4294836224_mask_lshr_18(i32 %a0) {1227; X86-LABEL: test_i32_4294836224_mask_lshr_18:1228; X86: # %bb.0:1229; X86-NEXT: movl {{[0-9]+}}(%esp), %eax1230; X86-NEXT: shrl $18, %eax1231; X86-NEXT: retl1232;1233; X64-LABEL: test_i32_4294836224_mask_lshr_18:1234; X64: # %bb.0:1235; X64-NEXT: movl %edi, %eax1236; X64-NEXT: shrl $18, %eax1237; X64-NEXT: retq1238 %t0 = and i32 %a0, 42948362241239 %t1 = lshr i32 %t0, 181240 ret i32 %t11241}1242 1243; ashr1244 1245define i32 @test_i32_32767_mask_ashr_1(i32 %a0) {1246; X86-LABEL: test_i32_32767_mask_ashr_1:1247; X86: # %bb.0:1248; X86-NEXT: movl $32766, %eax # imm = 0x7FFE1249; X86-NEXT: andl {{[0-9]+}}(%esp), %eax1250; X86-NEXT: shrl %eax1251; X86-NEXT: retl1252;1253; X64-LABEL: test_i32_32767_mask_ashr_1:1254; X64: # %bb.0:1255; X64-NEXT: movl %edi, %eax1256; X64-NEXT: andl $32766, %eax # imm = 0x7FFE1257; X64-NEXT: shrl %eax1258; X64-NEXT: retq1259 %t0 = and i32 %a0, 327671260 %t1 = ashr i32 %t0, 11261 ret i32 %t11262}1263 1264define i32 @test_i32_8388352_mask_ashr_7(i32 %a0) {1265; X86-LABEL: test_i32_8388352_mask_ashr_7:1266; X86: # %bb.0:1267; X86-NEXT: movl $8388352, %eax # imm = 0x7FFF001268; X86-NEXT: andl {{[0-9]+}}(%esp), %eax1269; X86-NEXT: shrl $7, %eax1270; X86-NEXT: retl1271;1272; X64-LABEL: test_i32_8388352_mask_ashr_7:1273; X64: # %bb.0:1274; X64-NEXT: movl %edi, %eax1275; X64-NEXT: andl $8388352, %eax # imm = 0x7FFF001276; X64-NEXT: shrl $7, %eax1277; X64-NEXT: retq1278 %t0 = and i32 %a0, 83883521279 %t1 = ashr i32 %t0, 71280 ret i32 %t11281}1282define i32 @test_i32_8388352_mask_ashr_8(i32 %a0) {1283; X86-LABEL: test_i32_8388352_mask_ashr_8:1284; X86: # %bb.0:1285; X86-NEXT: movl $8388352, %eax # imm = 0x7FFF001286; X86-NEXT: andl {{[0-9]+}}(%esp), %eax1287; X86-NEXT: shrl $8, %eax1288; X86-NEXT: retl1289;1290; X64-LABEL: test_i32_8388352_mask_ashr_8:1291; X64: # %bb.0:1292; X64-NEXT: movl %edi, %eax1293; X64-NEXT: andl $8388352, %eax # imm = 0x7FFF001294; X64-NEXT: shrl $8, %eax1295; X64-NEXT: retq1296 %t0 = and i32 %a0, 83883521297 %t1 = ashr i32 %t0, 81298 ret i32 %t11299}1300define i32 @test_i32_8388352_mask_ashr_9(i32 %a0) {1301; X86-LABEL: test_i32_8388352_mask_ashr_9:1302; X86: # %bb.0:1303; X86-NEXT: movl $8388096, %eax # imm = 0x7FFE001304; X86-NEXT: andl {{[0-9]+}}(%esp), %eax1305; X86-NEXT: shrl $9, %eax1306; X86-NEXT: retl1307;1308; X64-LABEL: test_i32_8388352_mask_ashr_9:1309; X64: # %bb.0:1310; X64-NEXT: movl %edi, %eax1311; X64-NEXT: andl $8388096, %eax # imm = 0x7FFE001312; X64-NEXT: shrl $9, %eax1313; X64-NEXT: retq1314 %t0 = and i32 %a0, 83883521315 %t1 = ashr i32 %t0, 91316 ret i32 %t11317}1318define i32 @test_i32_8388352_mask_ashr_10(i32 %a0) {1319; X86-LABEL: test_i32_8388352_mask_ashr_10:1320; X86: # %bb.0:1321; X86-NEXT: movl $8387584, %eax # imm = 0x7FFC001322; X86-NEXT: andl {{[0-9]+}}(%esp), %eax1323; X86-NEXT: shrl $10, %eax1324; X86-NEXT: retl1325;1326; X64-LABEL: test_i32_8388352_mask_ashr_10:1327; X64: # %bb.0:1328; X64-NEXT: movl %edi, %eax1329; X64-NEXT: andl $8387584, %eax # imm = 0x7FFC001330; X64-NEXT: shrl $10, %eax1331; X64-NEXT: retq1332 %t0 = and i32 %a0, 83883521333 %t1 = ashr i32 %t0, 101334 ret i32 %t11335}1336 1337define i32 @test_i32_4294836224_mask_ashr_1(i32 %a0) {1338; X86-LABEL: test_i32_4294836224_mask_ashr_1:1339; X86: # %bb.0:1340; X86-NEXT: movl $-131072, %eax # imm = 0xFFFE00001341; X86-NEXT: andl {{[0-9]+}}(%esp), %eax1342; X86-NEXT: sarl %eax1343; X86-NEXT: retl1344;1345; X64-LABEL: test_i32_4294836224_mask_ashr_1:1346; X64: # %bb.0:1347; X64-NEXT: movl %edi, %eax1348; X64-NEXT: andl $-131072, %eax # imm = 0xFFFE00001349; X64-NEXT: sarl %eax1350; X64-NEXT: retq1351 %t0 = and i32 %a0, 42948362241352 %t1 = ashr i32 %t0, 11353 ret i32 %t11354}1355define i32 @test_i32_4294836224_mask_ashr_16(i32 %a0) {1356; X86-LABEL: test_i32_4294836224_mask_ashr_16:1357; X86: # %bb.0:1358; X86-NEXT: movl $-131072, %eax # imm = 0xFFFE00001359; X86-NEXT: andl {{[0-9]+}}(%esp), %eax1360; X86-NEXT: sarl $16, %eax1361; X86-NEXT: retl1362;1363; X64-LABEL: test_i32_4294836224_mask_ashr_16:1364; X64: # %bb.0:1365; X64-NEXT: movl %edi, %eax1366; X64-NEXT: andl $-131072, %eax # imm = 0xFFFE00001367; X64-NEXT: sarl $16, %eax1368; X64-NEXT: retq1369 %t0 = and i32 %a0, 42948362241370 %t1 = ashr i32 %t0, 161371 ret i32 %t11372}1373define i32 @test_i32_4294836224_mask_ashr_17(i32 %a0) {1374; X86-LABEL: test_i32_4294836224_mask_ashr_17:1375; X86: # %bb.0:1376; X86-NEXT: movl {{[0-9]+}}(%esp), %eax1377; X86-NEXT: sarl $17, %eax1378; X86-NEXT: retl1379;1380; X64-LABEL: test_i32_4294836224_mask_ashr_17:1381; X64: # %bb.0:1382; X64-NEXT: movl %edi, %eax1383; X64-NEXT: sarl $17, %eax1384; X64-NEXT: retq1385 %t0 = and i32 %a0, 42948362241386 %t1 = ashr i32 %t0, 171387 ret i32 %t11388}1389define i32 @test_i32_4294836224_mask_ashr_18(i32 %a0) {1390; X86-LABEL: test_i32_4294836224_mask_ashr_18:1391; X86: # %bb.0:1392; X86-NEXT: movl {{[0-9]+}}(%esp), %eax1393; X86-NEXT: sarl $18, %eax1394; X86-NEXT: retl1395;1396; X64-LABEL: test_i32_4294836224_mask_ashr_18:1397; X64: # %bb.0:1398; X64-NEXT: movl %edi, %eax1399; X64-NEXT: sarl $18, %eax1400; X64-NEXT: retq1401 %t0 = and i32 %a0, 42948362241402 %t1 = ashr i32 %t0, 181403 ret i32 %t11404}1405 1406; shl1407 1408define i32 @test_i32_32767_mask_shl_1(i32 %a0) {1409; X86-LABEL: test_i32_32767_mask_shl_1:1410; X86: # %bb.0:1411; X86-NEXT: movl $32767, %eax # imm = 0x7FFF1412; X86-NEXT: andl {{[0-9]+}}(%esp), %eax1413; X86-NEXT: addl %eax, %eax1414; X86-NEXT: retl1415;1416; X64-LABEL: test_i32_32767_mask_shl_1:1417; X64: # %bb.0:1418; X64-NEXT: # kill: def $edi killed $edi def $rdi1419; X64-NEXT: andl $32767, %edi # imm = 0x7FFF1420; X64-NEXT: leal (%rdi,%rdi), %eax1421; X64-NEXT: retq1422 %t0 = and i32 %a0, 327671423 %t1 = shl i32 %t0, 11424 ret i32 %t11425}1426define i32 @test_i32_32767_mask_shl_16(i32 %a0) {1427; X86-LABEL: test_i32_32767_mask_shl_16:1428; X86: # %bb.0:1429; X86-NEXT: movl $32767, %eax # imm = 0x7FFF1430; X86-NEXT: andl {{[0-9]+}}(%esp), %eax1431; X86-NEXT: shll $16, %eax1432; X86-NEXT: retl1433;1434; X64-LABEL: test_i32_32767_mask_shl_16:1435; X64: # %bb.0:1436; X64-NEXT: movl %edi, %eax1437; X64-NEXT: andl $32767, %eax # imm = 0x7FFF1438; X64-NEXT: shll $16, %eax1439; X64-NEXT: retq1440 %t0 = and i32 %a0, 327671441 %t1 = shl i32 %t0, 161442 ret i32 %t11443}1444define i32 @test_i32_32767_mask_shl_17(i32 %a0) {1445; X86-LABEL: test_i32_32767_mask_shl_17:1446; X86: # %bb.0:1447; X86-NEXT: movl {{[0-9]+}}(%esp), %eax1448; X86-NEXT: shll $17, %eax1449; X86-NEXT: retl1450;1451; X64-LABEL: test_i32_32767_mask_shl_17:1452; X64: # %bb.0:1453; X64-NEXT: movl %edi, %eax1454; X64-NEXT: shll $17, %eax1455; X64-NEXT: retq1456 %t0 = and i32 %a0, 327671457 %t1 = shl i32 %t0, 171458 ret i32 %t11459}1460define i32 @test_i32_32767_mask_shl_18(i32 %a0) {1461; X86-LABEL: test_i32_32767_mask_shl_18:1462; X86: # %bb.0:1463; X86-NEXT: movl {{[0-9]+}}(%esp), %eax1464; X86-NEXT: shll $18, %eax1465; X86-NEXT: retl1466;1467; X64-LABEL: test_i32_32767_mask_shl_18:1468; X64: # %bb.0:1469; X64-NEXT: movl %edi, %eax1470; X64-NEXT: shll $18, %eax1471; X64-NEXT: retq1472 %t0 = and i32 %a0, 327671473 %t1 = shl i32 %t0, 181474 ret i32 %t11475}1476 1477define i32 @test_i32_8388352_mask_shl_7(i32 %a0) {1478; X86-LABEL: test_i32_8388352_mask_shl_7:1479; X86: # %bb.0:1480; X86-NEXT: movl $8388352, %eax # imm = 0x7FFF001481; X86-NEXT: andl {{[0-9]+}}(%esp), %eax1482; X86-NEXT: shll $7, %eax1483; X86-NEXT: retl1484;1485; X64-LABEL: test_i32_8388352_mask_shl_7:1486; X64: # %bb.0:1487; X64-NEXT: movl %edi, %eax1488; X64-NEXT: andl $8388352, %eax # imm = 0x7FFF001489; X64-NEXT: shll $7, %eax1490; X64-NEXT: retq1491 %t0 = and i32 %a0, 83883521492 %t1 = shl i32 %t0, 71493 ret i32 %t11494}1495define i32 @test_i32_8388352_mask_shl_8(i32 %a0) {1496; X86-LABEL: test_i32_8388352_mask_shl_8:1497; X86: # %bb.0:1498; X86-NEXT: movl $8388352, %eax # imm = 0x7FFF001499; X86-NEXT: andl {{[0-9]+}}(%esp), %eax1500; X86-NEXT: shll $8, %eax1501; X86-NEXT: retl1502;1503; X64-LABEL: test_i32_8388352_mask_shl_8:1504; X64: # %bb.0:1505; X64-NEXT: movl %edi, %eax1506; X64-NEXT: andl $8388352, %eax # imm = 0x7FFF001507; X64-NEXT: shll $8, %eax1508; X64-NEXT: retq1509 %t0 = and i32 %a0, 83883521510 %t1 = shl i32 %t0, 81511 ret i32 %t11512}1513define i32 @test_i32_8388352_mask_shl_9(i32 %a0) {1514; X86-LABEL: test_i32_8388352_mask_shl_9:1515; X86: # %bb.0:1516; X86-NEXT: movl $8388352, %eax # imm = 0x7FFF001517; X86-NEXT: andl {{[0-9]+}}(%esp), %eax1518; X86-NEXT: shll $9, %eax1519; X86-NEXT: retl1520;1521; X64-LABEL: test_i32_8388352_mask_shl_9:1522; X64: # %bb.0:1523; X64-NEXT: movl %edi, %eax1524; X64-NEXT: andl $8388352, %eax # imm = 0x7FFF001525; X64-NEXT: shll $9, %eax1526; X64-NEXT: retq1527 %t0 = and i32 %a0, 83883521528 %t1 = shl i32 %t0, 91529 ret i32 %t11530}1531define i32 @test_i32_8388352_mask_shl_10(i32 %a0) {1532; X86-LABEL: test_i32_8388352_mask_shl_10:1533; X86: # %bb.0:1534; X86-NEXT: movl $4194048, %eax # imm = 0x3FFF001535; X86-NEXT: andl {{[0-9]+}}(%esp), %eax1536; X86-NEXT: shll $10, %eax1537; X86-NEXT: retl1538;1539; X64-LABEL: test_i32_8388352_mask_shl_10:1540; X64: # %bb.0:1541; X64-NEXT: movl %edi, %eax1542; X64-NEXT: andl $4194048, %eax # imm = 0x3FFF001543; X64-NEXT: shll $10, %eax1544; X64-NEXT: retq1545 %t0 = and i32 %a0, 83883521546 %t1 = shl i32 %t0, 101547 ret i32 %t11548}1549 1550define i32 @test_i32_4294836224_mask_shl_1(i32 %a0) {1551; X86-LABEL: test_i32_4294836224_mask_shl_1:1552; X86: # %bb.0:1553; X86-NEXT: movl $2147352576, %eax # imm = 0x7FFE00001554; X86-NEXT: andl {{[0-9]+}}(%esp), %eax1555; X86-NEXT: addl %eax, %eax1556; X86-NEXT: retl1557;1558; X64-LABEL: test_i32_4294836224_mask_shl_1:1559; X64: # %bb.0:1560; X64-NEXT: # kill: def $edi killed $edi def $rdi1561; X64-NEXT: andl $2147352576, %edi # imm = 0x7FFE00001562; X64-NEXT: leal (%rdi,%rdi), %eax1563; X64-NEXT: retq1564 %t0 = and i32 %a0, 42948362241565 %t1 = shl i32 %t0, 11566 ret i32 %t11567}1568 1569;------------------------------------------------------------------------------;1570; 64-bit1571;------------------------------------------------------------------------------;1572 1573; lshr1574 1575define i64 @test_i64_2147483647_mask_lshr_1(i64 %a0) {1576; X86-LABEL: test_i64_2147483647_mask_lshr_1:1577; X86: # %bb.0:1578; X86-NEXT: movl $2147483646, %eax # imm = 0x7FFFFFFE1579; X86-NEXT: andl {{[0-9]+}}(%esp), %eax1580; X86-NEXT: shrl %eax1581; X86-NEXT: xorl %edx, %edx1582; X86-NEXT: retl1583;1584; X64-LABEL: test_i64_2147483647_mask_lshr_1:1585; X64: # %bb.0:1586; X64-NEXT: movq %rdi, %rax1587; X64-NEXT: andl $2147483646, %eax # imm = 0x7FFFFFFE1588; X64-NEXT: shrl %eax1589; X64-NEXT: retq1590 %t0 = and i64 %a0, 21474836471591 %t1 = lshr i64 %t0, 11592 ret i64 %t11593}1594 1595define i64 @test_i64_140737488289792_mask_lshr_15(i64 %a0) {1596; X86-LABEL: test_i64_140737488289792_mask_lshr_15:1597; X86: # %bb.0:1598; X86-NEXT: movzwl {{[0-9]+}}(%esp), %ecx1599; X86-NEXT: shll $16, %ecx1600; X86-NEXT: movl {{[0-9]+}}(%esp), %eax1601; X86-NEXT: shldl $17, %ecx, %eax1602; X86-NEXT: xorl %edx, %edx1603; X86-NEXT: retl1604;1605; X64-LABEL: test_i64_140737488289792_mask_lshr_15:1606; X64: # %bb.0:1607; X64-NEXT: movabsq $140737488289792, %rax # imm = 0x7FFFFFFF00001608; X64-NEXT: andq %rdi, %rax1609; X64-NEXT: shrq $15, %rax1610; X64-NEXT: retq1611 %t0 = and i64 %a0, 1407374882897921612 %t1 = lshr i64 %t0, 151613 ret i64 %t11614}1615define i64 @test_i64_140737488289792_mask_lshr_16(i64 %a0) {1616; X86-LABEL: test_i64_140737488289792_mask_lshr_16:1617; X86: # %bb.0:1618; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx1619; X86-NEXT: movl $32767, %eax # imm = 0x7FFF1620; X86-NEXT: andl {{[0-9]+}}(%esp), %eax1621; X86-NEXT: shldl $16, %ecx, %eax1622; X86-NEXT: xorl %edx, %edx1623; X86-NEXT: retl1624;1625; X64-LABEL: test_i64_140737488289792_mask_lshr_16:1626; X64: # %bb.0:1627; X64-NEXT: movq %rdi, %rax1628; X64-NEXT: shrq $16, %rax1629; X64-NEXT: andl $2147483647, %eax # imm = 0x7FFFFFFF1630; X64-NEXT: retq1631 %t0 = and i64 %a0, 1407374882897921632 %t1 = lshr i64 %t0, 161633 ret i64 %t11634}1635define i64 @test_i64_140737488289792_mask_lshr_17(i64 %a0) {1636; X86-LABEL: test_i64_140737488289792_mask_lshr_17:1637; X86: # %bb.0:1638; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx1639; X86-NEXT: movl $32767, %eax # imm = 0x7FFF1640; X86-NEXT: andl {{[0-9]+}}(%esp), %eax1641; X86-NEXT: shldl $15, %ecx, %eax1642; X86-NEXT: xorl %edx, %edx1643; X86-NEXT: retl1644;1645; X64-LABEL: test_i64_140737488289792_mask_lshr_17:1646; X64: # %bb.0:1647; X64-NEXT: movq %rdi, %rax1648; X64-NEXT: shrq $17, %rax1649; X64-NEXT: andl $1073741823, %eax # imm = 0x3FFFFFFF1650; X64-NEXT: retq1651 %t0 = and i64 %a0, 1407374882897921652 %t1 = lshr i64 %t0, 171653 ret i64 %t11654}1655define i64 @test_i64_140737488289792_mask_lshr_18(i64 %a0) {1656; X86-LABEL: test_i64_140737488289792_mask_lshr_18:1657; X86: # %bb.0:1658; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx1659; X86-NEXT: movl $32767, %eax # imm = 0x7FFF1660; X86-NEXT: andl {{[0-9]+}}(%esp), %eax1661; X86-NEXT: shldl $14, %ecx, %eax1662; X86-NEXT: xorl %edx, %edx1663; X86-NEXT: retl1664;1665; X64-LABEL: test_i64_140737488289792_mask_lshr_18:1666; X64: # %bb.0:1667; X64-NEXT: movq %rdi, %rax1668; X64-NEXT: shrq $18, %rax1669; X64-NEXT: andl $536870911, %eax # imm = 0x1FFFFFFF1670; X64-NEXT: retq1671 %t0 = and i64 %a0, 1407374882897921672 %t1 = lshr i64 %t0, 181673 ret i64 %t11674}1675 1676define i64 @test_i64_18446744065119617024_mask_lshr_1(i64 %a0) {1677; X86-LABEL: test_i64_18446744065119617024_mask_lshr_1:1678; X86: # %bb.0:1679; X86-NEXT: movl {{[0-9]+}}(%esp), %edx1680; X86-NEXT: shrl %edx1681; X86-NEXT: xorl %eax, %eax1682; X86-NEXT: retl1683;1684; X64-LABEL: test_i64_18446744065119617024_mask_lshr_1:1685; X64: # %bb.0:1686; X64-NEXT: movabsq $-8589934592, %rax # imm = 0xFFFFFFFE000000001687; X64-NEXT: andq %rdi, %rax1688; X64-NEXT: shrq %rax1689; X64-NEXT: retq1690 %t0 = and i64 %a0, 184467440651196170241691 %t1 = lshr i64 %t0, 11692 ret i64 %t11693}1694define i64 @test_i64_18446744065119617024_mask_lshr_32(i64 %a0) {1695; X86-LABEL: test_i64_18446744065119617024_mask_lshr_32:1696; X86: # %bb.0:1697; X86-NEXT: movl {{[0-9]+}}(%esp), %eax1698; X86-NEXT: andl $-2, %eax1699; X86-NEXT: xorl %edx, %edx1700; X86-NEXT: retl1701;1702; X64-LABEL: test_i64_18446744065119617024_mask_lshr_32:1703; X64: # %bb.0:1704; X64-NEXT: movabsq $-8589934592, %rax # imm = 0xFFFFFFFE000000001705; X64-NEXT: andq %rdi, %rax1706; X64-NEXT: shrq $32, %rax1707; X64-NEXT: retq1708 %t0 = and i64 %a0, 184467440651196170241709 %t1 = lshr i64 %t0, 321710 ret i64 %t11711}1712define i64 @test_i64_18446744065119617024_mask_lshr_33(i64 %a0) {1713; X86-LABEL: test_i64_18446744065119617024_mask_lshr_33:1714; X86: # %bb.0:1715; X86-NEXT: movl {{[0-9]+}}(%esp), %eax1716; X86-NEXT: shrl %eax1717; X86-NEXT: xorl %edx, %edx1718; X86-NEXT: retl1719;1720; X64-LABEL: test_i64_18446744065119617024_mask_lshr_33:1721; X64: # %bb.0:1722; X64-NEXT: movq %rdi, %rax1723; X64-NEXT: shrq $33, %rax1724; X64-NEXT: retq1725 %t0 = and i64 %a0, 184467440651196170241726 %t1 = lshr i64 %t0, 331727 ret i64 %t11728}1729define i64 @test_i64_18446744065119617024_mask_lshr_34(i64 %a0) {1730; X86-LABEL: test_i64_18446744065119617024_mask_lshr_34:1731; X86: # %bb.0:1732; X86-NEXT: movl {{[0-9]+}}(%esp), %eax1733; X86-NEXT: shrl $2, %eax1734; X86-NEXT: xorl %edx, %edx1735; X86-NEXT: retl1736;1737; X64-LABEL: test_i64_18446744065119617024_mask_lshr_34:1738; X64: # %bb.0:1739; X64-NEXT: movq %rdi, %rax1740; X64-NEXT: shrq $34, %rax1741; X64-NEXT: retq1742 %t0 = and i64 %a0, 184467440651196170241743 %t1 = lshr i64 %t0, 341744 ret i64 %t11745}1746 1747; ashr1748 1749define i64 @test_i64_2147483647_mask_ashr_1(i64 %a0) {1750; X86-LABEL: test_i64_2147483647_mask_ashr_1:1751; X86: # %bb.0:1752; X86-NEXT: movl $2147483646, %eax # imm = 0x7FFFFFFE1753; X86-NEXT: andl {{[0-9]+}}(%esp), %eax1754; X86-NEXT: shrl %eax1755; X86-NEXT: xorl %edx, %edx1756; X86-NEXT: retl1757;1758; X64-LABEL: test_i64_2147483647_mask_ashr_1:1759; X64: # %bb.0:1760; X64-NEXT: movq %rdi, %rax1761; X64-NEXT: andl $2147483646, %eax # imm = 0x7FFFFFFE1762; X64-NEXT: shrl %eax1763; X64-NEXT: retq1764 %t0 = and i64 %a0, 21474836471765 %t1 = ashr i64 %t0, 11766 ret i64 %t11767}1768 1769define i64 @test_i64_140737488289792_mask_ashr_15(i64 %a0) {1770; X86-LABEL: test_i64_140737488289792_mask_ashr_15:1771; X86: # %bb.0:1772; X86-NEXT: movzwl {{[0-9]+}}(%esp), %ecx1773; X86-NEXT: shll $16, %ecx1774; X86-NEXT: movl {{[0-9]+}}(%esp), %eax1775; X86-NEXT: shldl $17, %ecx, %eax1776; X86-NEXT: xorl %edx, %edx1777; X86-NEXT: retl1778;1779; X64-LABEL: test_i64_140737488289792_mask_ashr_15:1780; X64: # %bb.0:1781; X64-NEXT: movabsq $140737488289792, %rax # imm = 0x7FFFFFFF00001782; X64-NEXT: andq %rdi, %rax1783; X64-NEXT: shrq $15, %rax1784; X64-NEXT: retq1785 %t0 = and i64 %a0, 1407374882897921786 %t1 = ashr i64 %t0, 151787 ret i64 %t11788}1789define i64 @test_i64_140737488289792_mask_ashr_16(i64 %a0) {1790; X86-LABEL: test_i64_140737488289792_mask_ashr_16:1791; X86: # %bb.0:1792; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx1793; X86-NEXT: movl $32767, %eax # imm = 0x7FFF1794; X86-NEXT: andl {{[0-9]+}}(%esp), %eax1795; X86-NEXT: shldl $16, %ecx, %eax1796; X86-NEXT: xorl %edx, %edx1797; X86-NEXT: retl1798;1799; X64-LABEL: test_i64_140737488289792_mask_ashr_16:1800; X64: # %bb.0:1801; X64-NEXT: movq %rdi, %rax1802; X64-NEXT: shrq $16, %rax1803; X64-NEXT: andl $2147483647, %eax # imm = 0x7FFFFFFF1804; X64-NEXT: retq1805 %t0 = and i64 %a0, 1407374882897921806 %t1 = ashr i64 %t0, 161807 ret i64 %t11808}1809define i64 @test_i64_140737488289792_mask_ashr_17(i64 %a0) {1810; X86-LABEL: test_i64_140737488289792_mask_ashr_17:1811; X86: # %bb.0:1812; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx1813; X86-NEXT: movl $32767, %eax # imm = 0x7FFF1814; X86-NEXT: andl {{[0-9]+}}(%esp), %eax1815; X86-NEXT: shldl $15, %ecx, %eax1816; X86-NEXT: xorl %edx, %edx1817; X86-NEXT: retl1818;1819; X64-LABEL: test_i64_140737488289792_mask_ashr_17:1820; X64: # %bb.0:1821; X64-NEXT: movq %rdi, %rax1822; X64-NEXT: shrq $17, %rax1823; X64-NEXT: andl $1073741823, %eax # imm = 0x3FFFFFFF1824; X64-NEXT: retq1825 %t0 = and i64 %a0, 1407374882897921826 %t1 = ashr i64 %t0, 171827 ret i64 %t11828}1829define i64 @test_i64_140737488289792_mask_ashr_18(i64 %a0) {1830; X86-LABEL: test_i64_140737488289792_mask_ashr_18:1831; X86: # %bb.0:1832; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx1833; X86-NEXT: movl $32767, %eax # imm = 0x7FFF1834; X86-NEXT: andl {{[0-9]+}}(%esp), %eax1835; X86-NEXT: shldl $14, %ecx, %eax1836; X86-NEXT: xorl %edx, %edx1837; X86-NEXT: retl1838;1839; X64-LABEL: test_i64_140737488289792_mask_ashr_18:1840; X64: # %bb.0:1841; X64-NEXT: movq %rdi, %rax1842; X64-NEXT: shrq $18, %rax1843; X64-NEXT: andl $536870911, %eax # imm = 0x1FFFFFFF1844; X64-NEXT: retq1845 %t0 = and i64 %a0, 1407374882897921846 %t1 = ashr i64 %t0, 181847 ret i64 %t11848}1849 1850define i64 @test_i64_18446744065119617024_mask_ashr_1(i64 %a0) {1851; X86-LABEL: test_i64_18446744065119617024_mask_ashr_1:1852; X86: # %bb.0:1853; X86-NEXT: movl {{[0-9]+}}(%esp), %edx1854; X86-NEXT: sarl %edx1855; X86-NEXT: xorl %eax, %eax1856; X86-NEXT: retl1857;1858; X64-LABEL: test_i64_18446744065119617024_mask_ashr_1:1859; X64: # %bb.0:1860; X64-NEXT: movabsq $-8589934592, %rax # imm = 0xFFFFFFFE000000001861; X64-NEXT: andq %rdi, %rax1862; X64-NEXT: sarq %rax1863; X64-NEXT: retq1864 %t0 = and i64 %a0, 184467440651196170241865 %t1 = ashr i64 %t0, 11866 ret i64 %t11867}1868define i64 @test_i64_18446744065119617024_mask_ashr_32(i64 %a0) {1869; X86-LABEL: test_i64_18446744065119617024_mask_ashr_32:1870; X86: # %bb.0:1871; X86-NEXT: movl {{[0-9]+}}(%esp), %edx1872; X86-NEXT: movl %edx, %eax1873; X86-NEXT: andl $-2, %eax1874; X86-NEXT: sarl $31, %edx1875; X86-NEXT: retl1876;1877; X64-LABEL: test_i64_18446744065119617024_mask_ashr_32:1878; X64: # %bb.0:1879; X64-NEXT: movabsq $-8589934592, %rax # imm = 0xFFFFFFFE000000001880; X64-NEXT: andq %rdi, %rax1881; X64-NEXT: sarq $32, %rax1882; X64-NEXT: retq1883 %t0 = and i64 %a0, 184467440651196170241884 %t1 = ashr i64 %t0, 321885 ret i64 %t11886}1887define i64 @test_i64_18446744065119617024_mask_ashr_33(i64 %a0) {1888; X86-LABEL: test_i64_18446744065119617024_mask_ashr_33:1889; X86: # %bb.0:1890; X86-NEXT: movl {{[0-9]+}}(%esp), %edx1891; X86-NEXT: movl %edx, %eax1892; X86-NEXT: sarl %eax1893; X86-NEXT: sarl $31, %edx1894; X86-NEXT: retl1895;1896; X64-LABEL: test_i64_18446744065119617024_mask_ashr_33:1897; X64: # %bb.0:1898; X64-NEXT: movq %rdi, %rax1899; X64-NEXT: sarq $33, %rax1900; X64-NEXT: retq1901 %t0 = and i64 %a0, 184467440651196170241902 %t1 = ashr i64 %t0, 331903 ret i64 %t11904}1905define i64 @test_i64_18446744065119617024_mask_ashr_34(i64 %a0) {1906; X86-LABEL: test_i64_18446744065119617024_mask_ashr_34:1907; X86: # %bb.0:1908; X86-NEXT: movl {{[0-9]+}}(%esp), %edx1909; X86-NEXT: movl %edx, %eax1910; X86-NEXT: sarl $2, %eax1911; X86-NEXT: sarl $31, %edx1912; X86-NEXT: retl1913;1914; X64-LABEL: test_i64_18446744065119617024_mask_ashr_34:1915; X64: # %bb.0:1916; X64-NEXT: movq %rdi, %rax1917; X64-NEXT: sarq $34, %rax1918; X64-NEXT: retq1919 %t0 = and i64 %a0, 184467440651196170241920 %t1 = ashr i64 %t0, 341921 ret i64 %t11922}1923 1924; shl1925 1926define i64 @test_i64_2147483647_mask_shl_1(i64 %a0) {1927; X86-LABEL: test_i64_2147483647_mask_shl_1:1928; X86: # %bb.0:1929; X86-NEXT: movl {{[0-9]+}}(%esp), %eax1930; X86-NEXT: addl %eax, %eax1931; X86-NEXT: xorl %edx, %edx1932; X86-NEXT: retl1933;1934; X64-LABEL: test_i64_2147483647_mask_shl_1:1935; X64: # %bb.0:1936; X64-NEXT: leal (%rdi,%rdi), %eax1937; X64-NEXT: retq1938 %t0 = and i64 %a0, 21474836471939 %t1 = shl i64 %t0, 11940 ret i64 %t11941}1942define i64 @test_i64_2147483647_mask_shl_32(i64 %a0) {1943; X86-LABEL: test_i64_2147483647_mask_shl_32:1944; X86: # %bb.0:1945; X86-NEXT: movl $2147483647, %edx # imm = 0x7FFFFFFF1946; X86-NEXT: andl {{[0-9]+}}(%esp), %edx1947; X86-NEXT: xorl %eax, %eax1948; X86-NEXT: retl1949;1950; X64-LABEL: test_i64_2147483647_mask_shl_32:1951; X64: # %bb.0:1952; X64-NEXT: movq %rdi, %rax1953; X64-NEXT: andl $2147483647, %eax # imm = 0x7FFFFFFF1954; X64-NEXT: shlq $32, %rax1955; X64-NEXT: retq1956 %t0 = and i64 %a0, 21474836471957 %t1 = shl i64 %t0, 321958 ret i64 %t11959}1960define i64 @test_i64_2147483647_mask_shl_33(i64 %a0) {1961; X86-LABEL: test_i64_2147483647_mask_shl_33:1962; X86: # %bb.0:1963; X86-NEXT: movl {{[0-9]+}}(%esp), %edx1964; X86-NEXT: addl %edx, %edx1965; X86-NEXT: xorl %eax, %eax1966; X86-NEXT: retl1967;1968; X64-LABEL: test_i64_2147483647_mask_shl_33:1969; X64: # %bb.0:1970; X64-NEXT: movq %rdi, %rax1971; X64-NEXT: shlq $33, %rax1972; X64-NEXT: retq1973 %t0 = and i64 %a0, 21474836471974 %t1 = shl i64 %t0, 331975 ret i64 %t11976}1977define i64 @test_i64_2147483647_mask_shl_34(i64 %a0) {1978; X86-LABEL: test_i64_2147483647_mask_shl_34:1979; X86: # %bb.0:1980; X86-NEXT: movl {{[0-9]+}}(%esp), %edx1981; X86-NEXT: shll $2, %edx1982; X86-NEXT: xorl %eax, %eax1983; X86-NEXT: retl1984;1985; X64-LABEL: test_i64_2147483647_mask_shl_34:1986; X64: # %bb.0:1987; X64-NEXT: movq %rdi, %rax1988; X64-NEXT: shlq $34, %rax1989; X64-NEXT: retq1990 %t0 = and i64 %a0, 21474836471991 %t1 = shl i64 %t0, 341992 ret i64 %t11993}1994 1995define i64 @test_i64_140737488289792_mask_shl_15(i64 %a0) {1996; X86-LABEL: test_i64_140737488289792_mask_shl_15:1997; X86: # %bb.0:1998; X86-NEXT: movl {{[0-9]+}}(%esp), %eax1999; X86-NEXT: movl $32767, %edx # imm = 0x7FFF2000; X86-NEXT: andl {{[0-9]+}}(%esp), %edx2001; X86-NEXT: shldl $15, %eax, %edx2002; X86-NEXT: andl $65536, %eax # imm = 0x100002003; X86-NEXT: shll $15, %eax2004; X86-NEXT: retl2005;2006; X64-LABEL: test_i64_140737488289792_mask_shl_15:2007; X64: # %bb.0:2008; X64-NEXT: movabsq $140737488289792, %rax # imm = 0x7FFFFFFF00002009; X64-NEXT: andq %rdi, %rax2010; X64-NEXT: shlq $15, %rax2011; X64-NEXT: retq2012 %t0 = and i64 %a0, 1407374882897922013 %t1 = shl i64 %t0, 152014 ret i64 %t12015}2016define i64 @test_i64_140737488289792_mask_shl_16(i64 %a0) {2017; X86-LABEL: test_i64_140737488289792_mask_shl_16:2018; X86: # %bb.0:2019; X86-NEXT: movl {{[0-9]+}}(%esp), %eax2020; X86-NEXT: movl $32767, %edx # imm = 0x7FFF2021; X86-NEXT: andl {{[0-9]+}}(%esp), %edx2022; X86-NEXT: shldl $16, %eax, %edx2023; X86-NEXT: xorl %eax, %eax2024; X86-NEXT: retl2025;2026; X64-LABEL: test_i64_140737488289792_mask_shl_16:2027; X64: # %bb.0:2028; X64-NEXT: movabsq $140737488289792, %rax # imm = 0x7FFFFFFF00002029; X64-NEXT: andq %rdi, %rax2030; X64-NEXT: shlq $16, %rax2031; X64-NEXT: retq2032 %t0 = and i64 %a0, 1407374882897922033 %t1 = shl i64 %t0, 162034 ret i64 %t12035}2036define i64 @test_i64_140737488289792_mask_shl_17(i64 %a0) {2037; X86-LABEL: test_i64_140737488289792_mask_shl_17:2038; X86: # %bb.0:2039; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax2040; X86-NEXT: shll $16, %eax2041; X86-NEXT: movl {{[0-9]+}}(%esp), %edx2042; X86-NEXT: shldl $17, %eax, %edx2043; X86-NEXT: xorl %eax, %eax2044; X86-NEXT: retl2045;2046; X64-LABEL: test_i64_140737488289792_mask_shl_17:2047; X64: # %bb.0:2048; X64-NEXT: movabsq $140737488289792, %rax # imm = 0x7FFFFFFF00002049; X64-NEXT: andq %rdi, %rax2050; X64-NEXT: shlq $17, %rax2051; X64-NEXT: retq2052 %t0 = and i64 %a0, 1407374882897922053 %t1 = shl i64 %t0, 172054 ret i64 %t12055}2056define i64 @test_i64_140737488289792_mask_shl_18(i64 %a0) {2057; X86-LABEL: test_i64_140737488289792_mask_shl_18:2058; X86: # %bb.0:2059; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax2060; X86-NEXT: shll $16, %eax2061; X86-NEXT: movl {{[0-9]+}}(%esp), %edx2062; X86-NEXT: shldl $18, %eax, %edx2063; X86-NEXT: xorl %eax, %eax2064; X86-NEXT: retl2065;2066; X64-LABEL: test_i64_140737488289792_mask_shl_18:2067; X64: # %bb.0:2068; X64-NEXT: movabsq $70368744112128, %rax # imm = 0x3FFFFFFF00002069; X64-NEXT: andq %rdi, %rax2070; X64-NEXT: shlq $18, %rax2071; X64-NEXT: retq2072 %t0 = and i64 %a0, 1407374882897922073 %t1 = shl i64 %t0, 182074 ret i64 %t12075}2076 2077define i64 @test_i64_18446744065119617024_mask_shl_1(i64 %a0) {2078; X86-LABEL: test_i64_18446744065119617024_mask_shl_1:2079; X86: # %bb.0:2080; X86-NEXT: movl $2147483646, %edx # imm = 0x7FFFFFFE2081; X86-NEXT: andl {{[0-9]+}}(%esp), %edx2082; X86-NEXT: addl %edx, %edx2083; X86-NEXT: xorl %eax, %eax2084; X86-NEXT: retl2085;2086; X64-LABEL: test_i64_18446744065119617024_mask_shl_1:2087; X64: # %bb.0:2088; X64-NEXT: movabsq $9223372028264841216, %rax # imm = 0x7FFFFFFE000000002089; X64-NEXT: andq %rdi, %rax2090; X64-NEXT: addq %rax, %rax2091; X64-NEXT: retq2092 %t0 = and i64 %a0, 184467440651196170242093 %t1 = shl i64 %t0, 12094 ret i64 %t12095}2096