brintos

brintos / llvm-project-archived public Read only

0
0
Text · 16.9 KiB · bb02138 Raw
578 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc -mtriple=i386-unknown-unknown -mcpu=core-avx2 < %s | FileCheck --check-prefix=BMI2 %s3; RUN: llc -mtriple=x86_64-unknown-unknown -mcpu=core-avx2 < %s | FileCheck --check-prefix=BMI264 %s4; RUN: llc -mtriple=x86_64-unknown-unknown -mcpu=core-avx2 -mattr=+egpr --show-mc-encoding < %s | FileCheck --check-prefix=EGPR %s5 6define i32 @shl32(i32 %x, i32 %shamt) nounwind uwtable readnone {7; BMI2-LABEL: shl32:8; BMI2:       # %bb.0:9; BMI2-NEXT:    movzbl {{[0-9]+}}(%esp), %eax10; BMI2-NEXT:    shlxl %eax, {{[0-9]+}}(%esp), %eax11; BMI2-NEXT:    retl12;13; BMI264-LABEL: shl32:14; BMI264:       # %bb.0:15; BMI264-NEXT:    shlxl %esi, %edi, %eax16; BMI264-NEXT:    retq17;18; EGPR-LABEL: shl32:19; EGPR:       # %bb.0:20; EGPR-NEXT:    shlxl %esi, %edi, %eax # EVEX TO VEX Compression encoding: [0xc4,0xe2,0x49,0xf7,0xc7]21; EGPR-NEXT:    retq # encoding: [0xc3]22  %shl = shl i32 %x, %shamt23  ret i32 %shl24}25 26define i32 @shl32i(i32 %x) nounwind uwtable readnone {27; BMI2-LABEL: shl32i:28; BMI2:       # %bb.0:29; BMI2-NEXT:    movl {{[0-9]+}}(%esp), %eax30; BMI2-NEXT:    shll $5, %eax31; BMI2-NEXT:    retl32;33; BMI264-LABEL: shl32i:34; BMI264:       # %bb.0:35; BMI264-NEXT:    movl %edi, %eax36; BMI264-NEXT:    shll $5, %eax37; BMI264-NEXT:    retq38;39; EGPR-LABEL: shl32i:40; EGPR:       # %bb.0:41; EGPR-NEXT:    movl %edi, %eax # encoding: [0x89,0xf8]42; EGPR-NEXT:    shll $5, %eax # encoding: [0xc1,0xe0,0x05]43; EGPR-NEXT:    retq # encoding: [0xc3]44  %shl = shl i32 %x, 545  ret i32 %shl46}47 48define i32 @shl32p(ptr %p, i32 %shamt) nounwind uwtable readnone {49; BMI2-LABEL: shl32p:50; BMI2:       # %bb.0:51; BMI2-NEXT:    movl {{[0-9]+}}(%esp), %eax52; BMI2-NEXT:    movzbl {{[0-9]+}}(%esp), %ecx53; BMI2-NEXT:    shlxl %ecx, (%eax), %eax54; BMI2-NEXT:    retl55;56; BMI264-LABEL: shl32p:57; BMI264:       # %bb.0:58; BMI264-NEXT:    shlxl %esi, (%rdi), %eax59; BMI264-NEXT:    retq60;61; EGPR-LABEL: shl32p:62; EGPR:       # %bb.0:63; EGPR-NEXT:    shlxl %esi, (%rdi), %eax # EVEX TO VEX Compression encoding: [0xc4,0xe2,0x49,0xf7,0x07]64; EGPR-NEXT:    retq # encoding: [0xc3]65  %x = load i32, ptr %p66  %shl = shl i32 %x, %shamt67  ret i32 %shl68}69 70define i32 @shl32pi(ptr %p) nounwind uwtable readnone {71; BMI2-LABEL: shl32pi:72; BMI2:       # %bb.0:73; BMI2-NEXT:    movl {{[0-9]+}}(%esp), %eax74; BMI2-NEXT:    movl (%eax), %eax75; BMI2-NEXT:    shll $5, %eax76; BMI2-NEXT:    retl77;78; BMI264-LABEL: shl32pi:79; BMI264:       # %bb.0:80; BMI264-NEXT:    movl (%rdi), %eax81; BMI264-NEXT:    shll $5, %eax82; BMI264-NEXT:    retq83;84; EGPR-LABEL: shl32pi:85; EGPR:       # %bb.0:86; EGPR-NEXT:    movl (%rdi), %eax # encoding: [0x8b,0x07]87; EGPR-NEXT:    shll $5, %eax # encoding: [0xc1,0xe0,0x05]88; EGPR-NEXT:    retq # encoding: [0xc3]89  %x = load i32, ptr %p90  %shl = shl i32 %x, 591  ret i32 %shl92}93 94define i64 @shl64(i64 %x, i64 %shamt) nounwind uwtable readnone {95; BMI2-LABEL: shl64:96; BMI2:       # %bb.0:97; BMI2-NEXT:    pushl %esi98; BMI2-NEXT:    .cfi_def_cfa_offset 899; BMI2-NEXT:    .cfi_offset %esi, -8100; BMI2-NEXT:    movzbl {{[0-9]+}}(%esp), %ecx101; BMI2-NEXT:    movl {{[0-9]+}}(%esp), %eax102; BMI2-NEXT:    movl {{[0-9]+}}(%esp), %edx103; BMI2-NEXT:    shldl %cl, %eax, %edx104; BMI2-NEXT:    shlxl %ecx, %eax, %esi105; BMI2-NEXT:    xorl %eax, %eax106; BMI2-NEXT:    testb $32, %cl107; BMI2-NEXT:    cmovnel %esi, %edx108; BMI2-NEXT:    cmovel %esi, %eax109; BMI2-NEXT:    popl %esi110; BMI2-NEXT:    .cfi_def_cfa_offset 4111; BMI2-NEXT:    retl112;113; BMI264-LABEL: shl64:114; BMI264:       # %bb.0:115; BMI264-NEXT:    shlxq %rsi, %rdi, %rax116; BMI264-NEXT:    retq117;118; EGPR-LABEL: shl64:119; EGPR:       # %bb.0:120; EGPR-NEXT:    shlxq %rsi, %rdi, %rax # EVEX TO VEX Compression encoding: [0xc4,0xe2,0xc9,0xf7,0xc7]121; EGPR-NEXT:    retq # encoding: [0xc3]122  %shl = shl i64 %x, %shamt123  ret i64 %shl124}125 126define i64 @shl64i(i64 %x) nounwind uwtable readnone {127; BMI2-LABEL: shl64i:128; BMI2:       # %bb.0:129; BMI2-NEXT:    movl {{[0-9]+}}(%esp), %eax130; BMI2-NEXT:    movl {{[0-9]+}}(%esp), %edx131; BMI2-NEXT:    shldl $7, %eax, %edx132; BMI2-NEXT:    shll $7, %eax133; BMI2-NEXT:    retl134;135; BMI264-LABEL: shl64i:136; BMI264:       # %bb.0:137; BMI264-NEXT:    movq %rdi, %rax138; BMI264-NEXT:    shlq $7, %rax139; BMI264-NEXT:    retq140;141; EGPR-LABEL: shl64i:142; EGPR:       # %bb.0:143; EGPR-NEXT:    movq %rdi, %rax # encoding: [0x48,0x89,0xf8]144; EGPR-NEXT:    shlq $7, %rax # encoding: [0x48,0xc1,0xe0,0x07]145; EGPR-NEXT:    retq # encoding: [0xc3]146  %shl = shl i64 %x, 7147  ret i64 %shl148}149 150define i64 @shl64p(ptr %p, i64 %shamt) nounwind uwtable readnone {151; BMI2-LABEL: shl64p:152; BMI2:       # %bb.0:153; BMI2-NEXT:    pushl %esi154; BMI2-NEXT:    .cfi_def_cfa_offset 8155; BMI2-NEXT:    .cfi_offset %esi, -8156; BMI2-NEXT:    movzbl {{[0-9]+}}(%esp), %ecx157; BMI2-NEXT:    movl {{[0-9]+}}(%esp), %eax158; BMI2-NEXT:    movl (%eax), %esi159; BMI2-NEXT:    movl 4(%eax), %edx160; BMI2-NEXT:    shldl %cl, %esi, %edx161; BMI2-NEXT:    shlxl %ecx, %esi, %esi162; BMI2-NEXT:    xorl %eax, %eax163; BMI2-NEXT:    testb $32, %cl164; BMI2-NEXT:    cmovnel %esi, %edx165; BMI2-NEXT:    cmovel %esi, %eax166; BMI2-NEXT:    popl %esi167; BMI2-NEXT:    .cfi_def_cfa_offset 4168; BMI2-NEXT:    retl169;170; BMI264-LABEL: shl64p:171; BMI264:       # %bb.0:172; BMI264-NEXT:    shlxq %rsi, (%rdi), %rax173; BMI264-NEXT:    retq174;175; EGPR-LABEL: shl64p:176; EGPR:       # %bb.0:177; EGPR-NEXT:    shlxq %rsi, (%rdi), %rax # EVEX TO VEX Compression encoding: [0xc4,0xe2,0xc9,0xf7,0x07]178; EGPR-NEXT:    retq # encoding: [0xc3]179  %x = load i64, ptr %p180  %shl = shl i64 %x, %shamt181  ret i64 %shl182}183 184define i64 @shl64pi(ptr %p) nounwind uwtable readnone {185; BMI2-LABEL: shl64pi:186; BMI2:       # %bb.0:187; BMI2-NEXT:    movl {{[0-9]+}}(%esp), %ecx188; BMI2-NEXT:    movl (%ecx), %eax189; BMI2-NEXT:    movl 4(%ecx), %edx190; BMI2-NEXT:    shldl $7, %eax, %edx191; BMI2-NEXT:    shll $7, %eax192; BMI2-NEXT:    retl193;194; BMI264-LABEL: shl64pi:195; BMI264:       # %bb.0:196; BMI264-NEXT:    movq (%rdi), %rax197; BMI264-NEXT:    shlq $7, %rax198; BMI264-NEXT:    retq199;200; EGPR-LABEL: shl64pi:201; EGPR:       # %bb.0:202; EGPR-NEXT:    movq (%rdi), %rax # encoding: [0x48,0x8b,0x07]203; EGPR-NEXT:    shlq $7, %rax # encoding: [0x48,0xc1,0xe0,0x07]204; EGPR-NEXT:    retq # encoding: [0xc3]205  %x = load i64, ptr %p206  %shl = shl i64 %x, 7207  ret i64 %shl208}209 210define i32 @lshr32(i32 %x, i32 %shamt) nounwind uwtable readnone {211; BMI2-LABEL: lshr32:212; BMI2:       # %bb.0:213; BMI2-NEXT:    movzbl {{[0-9]+}}(%esp), %eax214; BMI2-NEXT:    shrxl %eax, {{[0-9]+}}(%esp), %eax215; BMI2-NEXT:    retl216;217; BMI264-LABEL: lshr32:218; BMI264:       # %bb.0:219; BMI264-NEXT:    shrxl %esi, %edi, %eax220; BMI264-NEXT:    retq221;222; EGPR-LABEL: lshr32:223; EGPR:       # %bb.0:224; EGPR-NEXT:    shrxl %esi, %edi, %eax # EVEX TO VEX Compression encoding: [0xc4,0xe2,0x4b,0xf7,0xc7]225; EGPR-NEXT:    retq # encoding: [0xc3]226  %shl = lshr i32 %x, %shamt227  ret i32 %shl228}229 230define i32 @lshr32p(ptr %p, i32 %shamt) nounwind uwtable readnone {231; BMI2-LABEL: lshr32p:232; BMI2:       # %bb.0:233; BMI2-NEXT:    movl {{[0-9]+}}(%esp), %eax234; BMI2-NEXT:    movzbl {{[0-9]+}}(%esp), %ecx235; BMI2-NEXT:    shrxl %ecx, (%eax), %eax236; BMI2-NEXT:    retl237;238; BMI264-LABEL: lshr32p:239; BMI264:       # %bb.0:240; BMI264-NEXT:    shrxl %esi, (%rdi), %eax241; BMI264-NEXT:    retq242;243; EGPR-LABEL: lshr32p:244; EGPR:       # %bb.0:245; EGPR-NEXT:    shrxl %esi, (%rdi), %eax # EVEX TO VEX Compression encoding: [0xc4,0xe2,0x4b,0xf7,0x07]246; EGPR-NEXT:    retq # encoding: [0xc3]247  %x = load i32, ptr %p248  %shl = lshr i32 %x, %shamt249  ret i32 %shl250}251 252define i64 @lshr64(i64 %x, i64 %shamt) nounwind uwtable readnone {253; BMI2-LABEL: lshr64:254; BMI2:       # %bb.0:255; BMI2-NEXT:    pushl %esi256; BMI2-NEXT:    .cfi_def_cfa_offset 8257; BMI2-NEXT:    .cfi_offset %esi, -8258; BMI2-NEXT:    movzbl {{[0-9]+}}(%esp), %ecx259; BMI2-NEXT:    movl {{[0-9]+}}(%esp), %eax260; BMI2-NEXT:    movl {{[0-9]+}}(%esp), %edx261; BMI2-NEXT:    shrdl %cl, %edx, %eax262; BMI2-NEXT:    shrxl %ecx, %edx, %esi263; BMI2-NEXT:    xorl %edx, %edx264; BMI2-NEXT:    testb $32, %cl265; BMI2-NEXT:    cmovnel %esi, %eax266; BMI2-NEXT:    cmovel %esi, %edx267; BMI2-NEXT:    popl %esi268; BMI2-NEXT:    .cfi_def_cfa_offset 4269; BMI2-NEXT:    retl270;271; BMI264-LABEL: lshr64:272; BMI264:       # %bb.0:273; BMI264-NEXT:    shrxq %rsi, %rdi, %rax274; BMI264-NEXT:    retq275;276; EGPR-LABEL: lshr64:277; EGPR:       # %bb.0:278; EGPR-NEXT:    shrxq %rsi, %rdi, %rax # EVEX TO VEX Compression encoding: [0xc4,0xe2,0xcb,0xf7,0xc7]279; EGPR-NEXT:    retq # encoding: [0xc3]280  %shl = lshr i64 %x, %shamt281  ret i64 %shl282}283 284define i64 @lshr64p(ptr %p, i64 %shamt) nounwind uwtable readnone {285; BMI2-LABEL: lshr64p:286; BMI2:       # %bb.0:287; BMI2-NEXT:    pushl %esi288; BMI2-NEXT:    .cfi_def_cfa_offset 8289; BMI2-NEXT:    .cfi_offset %esi, -8290; BMI2-NEXT:    movzbl {{[0-9]+}}(%esp), %ecx291; BMI2-NEXT:    movl {{[0-9]+}}(%esp), %edx292; BMI2-NEXT:    movl (%edx), %eax293; BMI2-NEXT:    movl 4(%edx), %edx294; BMI2-NEXT:    shrdl %cl, %edx, %eax295; BMI2-NEXT:    shrxl %ecx, %edx, %esi296; BMI2-NEXT:    xorl %edx, %edx297; BMI2-NEXT:    testb $32, %cl298; BMI2-NEXT:    cmovnel %esi, %eax299; BMI2-NEXT:    cmovel %esi, %edx300; BMI2-NEXT:    popl %esi301; BMI2-NEXT:    .cfi_def_cfa_offset 4302; BMI2-NEXT:    retl303;304; BMI264-LABEL: lshr64p:305; BMI264:       # %bb.0:306; BMI264-NEXT:    shrxq %rsi, (%rdi), %rax307; BMI264-NEXT:    retq308;309; EGPR-LABEL: lshr64p:310; EGPR:       # %bb.0:311; EGPR-NEXT:    shrxq %rsi, (%rdi), %rax # EVEX TO VEX Compression encoding: [0xc4,0xe2,0xcb,0xf7,0x07]312; EGPR-NEXT:    retq # encoding: [0xc3]313  %x = load i64, ptr %p314  %shl = lshr i64 %x, %shamt315  ret i64 %shl316}317 318define i32 @ashr32(i32 %x, i32 %shamt) nounwind uwtable readnone {319; BMI2-LABEL: ashr32:320; BMI2:       # %bb.0:321; BMI2-NEXT:    movzbl {{[0-9]+}}(%esp), %eax322; BMI2-NEXT:    sarxl %eax, {{[0-9]+}}(%esp), %eax323; BMI2-NEXT:    retl324;325; BMI264-LABEL: ashr32:326; BMI264:       # %bb.0:327; BMI264-NEXT:    sarxl %esi, %edi, %eax328; BMI264-NEXT:    retq329;330; EGPR-LABEL: ashr32:331; EGPR:       # %bb.0:332; EGPR-NEXT:    sarxl %esi, %edi, %eax # EVEX TO VEX Compression encoding: [0xc4,0xe2,0x4a,0xf7,0xc7]333; EGPR-NEXT:    retq # encoding: [0xc3]334  %shl = ashr i32 %x, %shamt335  ret i32 %shl336}337 338define i32 @ashr32p(ptr %p, i32 %shamt) nounwind uwtable readnone {339; BMI2-LABEL: ashr32p:340; BMI2:       # %bb.0:341; BMI2-NEXT:    movl {{[0-9]+}}(%esp), %eax342; BMI2-NEXT:    movzbl {{[0-9]+}}(%esp), %ecx343; BMI2-NEXT:    sarxl %ecx, (%eax), %eax344; BMI2-NEXT:    retl345;346; BMI264-LABEL: ashr32p:347; BMI264:       # %bb.0:348; BMI264-NEXT:    sarxl %esi, (%rdi), %eax349; BMI264-NEXT:    retq350;351; EGPR-LABEL: ashr32p:352; EGPR:       # %bb.0:353; EGPR-NEXT:    sarxl %esi, (%rdi), %eax # EVEX TO VEX Compression encoding: [0xc4,0xe2,0x4a,0xf7,0x07]354; EGPR-NEXT:    retq # encoding: [0xc3]355  %x = load i32, ptr %p356  %shl = ashr i32 %x, %shamt357  ret i32 %shl358}359 360define i64 @ashr64(i64 %x, i64 %shamt) nounwind uwtable readnone {361; BMI2-LABEL: ashr64:362; BMI2:       # %bb.0:363; BMI2-NEXT:    pushl %esi364; BMI2-NEXT:    .cfi_def_cfa_offset 8365; BMI2-NEXT:    .cfi_offset %esi, -8366; BMI2-NEXT:    movzbl {{[0-9]+}}(%esp), %ecx367; BMI2-NEXT:    movl {{[0-9]+}}(%esp), %eax368; BMI2-NEXT:    movl {{[0-9]+}}(%esp), %edx369; BMI2-NEXT:    shrdl %cl, %edx, %eax370; BMI2-NEXT:    sarxl %ecx, %edx, %esi371; BMI2-NEXT:    sarl $31, %edx372; BMI2-NEXT:    testb $32, %cl373; BMI2-NEXT:    cmovnel %esi, %eax374; BMI2-NEXT:    cmovel %esi, %edx375; BMI2-NEXT:    popl %esi376; BMI2-NEXT:    .cfi_def_cfa_offset 4377; BMI2-NEXT:    retl378;379; BMI264-LABEL: ashr64:380; BMI264:       # %bb.0:381; BMI264-NEXT:    sarxq %rsi, %rdi, %rax382; BMI264-NEXT:    retq383;384; EGPR-LABEL: ashr64:385; EGPR:       # %bb.0:386; EGPR-NEXT:    sarxq %rsi, %rdi, %rax # EVEX TO VEX Compression encoding: [0xc4,0xe2,0xca,0xf7,0xc7]387; EGPR-NEXT:    retq # encoding: [0xc3]388  %shl = ashr i64 %x, %shamt389  ret i64 %shl390}391 392define i64 @ashr64p(ptr %p, i64 %shamt) nounwind uwtable readnone {393; BMI2-LABEL: ashr64p:394; BMI2:       # %bb.0:395; BMI2-NEXT:    pushl %esi396; BMI2-NEXT:    .cfi_def_cfa_offset 8397; BMI2-NEXT:    .cfi_offset %esi, -8398; BMI2-NEXT:    movzbl {{[0-9]+}}(%esp), %ecx399; BMI2-NEXT:    movl {{[0-9]+}}(%esp), %edx400; BMI2-NEXT:    movl (%edx), %eax401; BMI2-NEXT:    movl 4(%edx), %edx402; BMI2-NEXT:    shrdl %cl, %edx, %eax403; BMI2-NEXT:    sarxl %ecx, %edx, %esi404; BMI2-NEXT:    sarl $31, %edx405; BMI2-NEXT:    testb $32, %cl406; BMI2-NEXT:    cmovnel %esi, %eax407; BMI2-NEXT:    cmovel %esi, %edx408; BMI2-NEXT:    popl %esi409; BMI2-NEXT:    .cfi_def_cfa_offset 4410; BMI2-NEXT:    retl411;412; BMI264-LABEL: ashr64p:413; BMI264:       # %bb.0:414; BMI264-NEXT:    sarxq %rsi, (%rdi), %rax415; BMI264-NEXT:    retq416;417; EGPR-LABEL: ashr64p:418; EGPR:       # %bb.0:419; EGPR-NEXT:    sarxq %rsi, (%rdi), %rax # EVEX TO VEX Compression encoding: [0xc4,0xe2,0xca,0xf7,0x07]420; EGPR-NEXT:    retq # encoding: [0xc3]421  %x = load i64, ptr %p422  %shl = ashr i64 %x, %shamt423  ret i64 %shl424}425 426define i32 @shl32and(i32 %t, i32 %val) nounwind {427; BMI2-LABEL: shl32and:428; BMI2:       # %bb.0:429; BMI2-NEXT:    movzbl {{[0-9]+}}(%esp), %eax430; BMI2-NEXT:    shlxl %eax, {{[0-9]+}}(%esp), %eax431; BMI2-NEXT:    retl432;433; BMI264-LABEL: shl32and:434; BMI264:       # %bb.0:435; BMI264-NEXT:    shlxl %edi, %esi, %eax436; BMI264-NEXT:    retq437;438; EGPR-LABEL: shl32and:439; EGPR:       # %bb.0:440; EGPR-NEXT:    shlxl %edi, %esi, %eax # EVEX TO VEX Compression encoding: [0xc4,0xe2,0x41,0xf7,0xc6]441; EGPR-NEXT:    retq # encoding: [0xc3]442  %shamt = and i32 %t, 31443  %res = shl i32 %val, %shamt444  ret i32 %res445}446 447define i64 @shl64and(i64 %t, i64 %val) nounwind {448; BMI2-LABEL: shl64and:449; BMI2:       # %bb.0:450; BMI2-NEXT:    pushl %esi451; BMI2-NEXT:    movzbl {{[0-9]+}}(%esp), %ecx452; BMI2-NEXT:    movl {{[0-9]+}}(%esp), %eax453; BMI2-NEXT:    movl {{[0-9]+}}(%esp), %edx454; BMI2-NEXT:    shldl %cl, %eax, %edx455; BMI2-NEXT:    shlxl %ecx, %eax, %esi456; BMI2-NEXT:    xorl %eax, %eax457; BMI2-NEXT:    testb $32, %cl458; BMI2-NEXT:    cmovnel %esi, %edx459; BMI2-NEXT:    cmovel %esi, %eax460; BMI2-NEXT:    popl %esi461; BMI2-NEXT:    retl462;463; BMI264-LABEL: shl64and:464; BMI264:       # %bb.0:465; BMI264-NEXT:    shlxq %rdi, %rsi, %rax466; BMI264-NEXT:    retq467;468; EGPR-LABEL: shl64and:469; EGPR:       # %bb.0:470; EGPR-NEXT:    shlxq %rdi, %rsi, %rax # EVEX TO VEX Compression encoding: [0xc4,0xe2,0xc1,0xf7,0xc6]471; EGPR-NEXT:    retq # encoding: [0xc3]472  %shamt = and i64 %t, 63473  %res = shl i64 %val, %shamt474  ret i64 %res475}476 477define i32 @lshr32and(i32 %t, i32 %val) nounwind {478; BMI2-LABEL: lshr32and:479; BMI2:       # %bb.0:480; BMI2-NEXT:    movzbl {{[0-9]+}}(%esp), %eax481; BMI2-NEXT:    shrxl %eax, {{[0-9]+}}(%esp), %eax482; BMI2-NEXT:    retl483;484; BMI264-LABEL: lshr32and:485; BMI264:       # %bb.0:486; BMI264-NEXT:    shrxl %edi, %esi, %eax487; BMI264-NEXT:    retq488;489; EGPR-LABEL: lshr32and:490; EGPR:       # %bb.0:491; EGPR-NEXT:    shrxl %edi, %esi, %eax # EVEX TO VEX Compression encoding: [0xc4,0xe2,0x43,0xf7,0xc6]492; EGPR-NEXT:    retq # encoding: [0xc3]493  %shamt = and i32 %t, 31494  %res = lshr i32 %val, %shamt495  ret i32 %res496}497 498define i64 @lshr64and(i64 %t, i64 %val) nounwind {499; BMI2-LABEL: lshr64and:500; BMI2:       # %bb.0:501; BMI2-NEXT:    pushl %esi502; BMI2-NEXT:    movzbl {{[0-9]+}}(%esp), %ecx503; BMI2-NEXT:    movl {{[0-9]+}}(%esp), %eax504; BMI2-NEXT:    movl {{[0-9]+}}(%esp), %edx505; BMI2-NEXT:    shrdl %cl, %edx, %eax506; BMI2-NEXT:    shrxl %ecx, %edx, %esi507; BMI2-NEXT:    xorl %edx, %edx508; BMI2-NEXT:    testb $32, %cl509; BMI2-NEXT:    cmovnel %esi, %eax510; BMI2-NEXT:    cmovel %esi, %edx511; BMI2-NEXT:    popl %esi512; BMI2-NEXT:    retl513;514; BMI264-LABEL: lshr64and:515; BMI264:       # %bb.0:516; BMI264-NEXT:    shrxq %rdi, %rsi, %rax517; BMI264-NEXT:    retq518;519; EGPR-LABEL: lshr64and:520; EGPR:       # %bb.0:521; EGPR-NEXT:    shrxq %rdi, %rsi, %rax # EVEX TO VEX Compression encoding: [0xc4,0xe2,0xc3,0xf7,0xc6]522; EGPR-NEXT:    retq # encoding: [0xc3]523  %shamt = and i64 %t, 63524  %res = lshr i64 %val, %shamt525  ret i64 %res526}527 528define i32 @ashr32and(i32 %t, i32 %val) nounwind {529; BMI2-LABEL: ashr32and:530; BMI2:       # %bb.0:531; BMI2-NEXT:    movzbl {{[0-9]+}}(%esp), %eax532; BMI2-NEXT:    sarxl %eax, {{[0-9]+}}(%esp), %eax533; BMI2-NEXT:    retl534;535; BMI264-LABEL: ashr32and:536; BMI264:       # %bb.0:537; BMI264-NEXT:    sarxl %edi, %esi, %eax538; BMI264-NEXT:    retq539;540; EGPR-LABEL: ashr32and:541; EGPR:       # %bb.0:542; EGPR-NEXT:    sarxl %edi, %esi, %eax # EVEX TO VEX Compression encoding: [0xc4,0xe2,0x42,0xf7,0xc6]543; EGPR-NEXT:    retq # encoding: [0xc3]544  %shamt = and i32 %t, 31545  %res = ashr i32 %val, %shamt546  ret i32 %res547}548 549define i64 @ashr64and(i64 %t, i64 %val) nounwind {550; BMI2-LABEL: ashr64and:551; BMI2:       # %bb.0:552; BMI2-NEXT:    pushl %esi553; BMI2-NEXT:    movzbl {{[0-9]+}}(%esp), %ecx554; BMI2-NEXT:    movl {{[0-9]+}}(%esp), %eax555; BMI2-NEXT:    movl {{[0-9]+}}(%esp), %edx556; BMI2-NEXT:    shrdl %cl, %edx, %eax557; BMI2-NEXT:    sarxl %ecx, %edx, %esi558; BMI2-NEXT:    sarl $31, %edx559; BMI2-NEXT:    testb $32, %cl560; BMI2-NEXT:    cmovnel %esi, %eax561; BMI2-NEXT:    cmovel %esi, %edx562; BMI2-NEXT:    popl %esi563; BMI2-NEXT:    retl564;565; BMI264-LABEL: ashr64and:566; BMI264:       # %bb.0:567; BMI264-NEXT:    sarxq %rdi, %rsi, %rax568; BMI264-NEXT:    retq569;570; EGPR-LABEL: ashr64and:571; EGPR:       # %bb.0:572; EGPR-NEXT:    sarxq %rdi, %rsi, %rax # EVEX TO VEX Compression encoding: [0xc4,0xe2,0xc2,0xf7,0xc6]573; EGPR-NEXT:    retq # encoding: [0xc3]574  %shamt = and i64 %t, 63575  %res = ashr i64 %val, %shamt576  ret i64 %res577}578