brintos

brintos / llvm-project-archived public Read only

0
0
Text · 61.6 KiB · bf027a7 Raw
1656 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+sse2   | FileCheck %s --check-prefixes=SSE,SSE23; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+sse4.2 | FileCheck %s --check-prefixes=SSE,SSE424; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+avx    | FileCheck %s --check-prefixes=AVX,AVX1OR2,AVX15; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+avx2   | FileCheck %s --check-prefixes=AVX,AVX1OR2,AVX26; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+avx512f,+avx512bw,+avx512vl | FileCheck %s --check-prefixes=AVX,AVX5127 8define i64 @test_v2f64_sext(<2 x double> %a0, <2 x double> %a1) {9; SSE-LABEL: test_v2f64_sext:10; SSE:       # %bb.0:11; SSE-NEXT:    cmpltpd %xmm0, %xmm112; SSE-NEXT:    movmskpd %xmm1, %ecx13; SSE-NEXT:    xorl %eax, %eax14; SSE-NEXT:    cmpl $3, %ecx15; SSE-NEXT:    sete %al16; SSE-NEXT:    negq %rax17; SSE-NEXT:    retq18;19; AVX-LABEL: test_v2f64_sext:20; AVX:       # %bb.0:21; AVX-NEXT:    vcmpltpd %xmm0, %xmm1, %xmm022; AVX-NEXT:    xorl %eax, %eax23; AVX-NEXT:    vpcmpeqd %xmm1, %xmm1, %xmm124; AVX-NEXT:    vtestpd %xmm1, %xmm025; AVX-NEXT:    sbbq %rax, %rax26; AVX-NEXT:    retq27  %c = fcmp ogt <2 x double> %a0, %a128  %s = sext <2 x i1> %c to <2 x i64>29  %1 = shufflevector <2 x i64> %s, <2 x i64> undef, <2 x i32> <i32 1, i32 undef>30  %2 = and <2 x i64> %s, %131  %3 = extractelement <2 x i64> %2, i32 032  ret i64 %333}34 35define i64 @test_v4f64_sext(<4 x double> %a0, <4 x double> %a1) {36; SSE-LABEL: test_v4f64_sext:37; SSE:       # %bb.0:38; SSE-NEXT:    cmpltpd %xmm1, %xmm339; SSE-NEXT:    cmpltpd %xmm0, %xmm240; SSE-NEXT:    andpd %xmm3, %xmm241; SSE-NEXT:    movmskpd %xmm2, %ecx42; SSE-NEXT:    xorl %eax, %eax43; SSE-NEXT:    cmpl $3, %ecx44; SSE-NEXT:    sete %al45; SSE-NEXT:    negq %rax46; SSE-NEXT:    retq47;48; AVX1-LABEL: test_v4f64_sext:49; AVX1:       # %bb.0:50; AVX1-NEXT:    vcmpltpd %ymm0, %ymm1, %ymm051; AVX1-NEXT:    xorl %eax, %eax52; AVX1-NEXT:    vxorpd %xmm1, %xmm1, %xmm153; AVX1-NEXT:    vcmptrueps %ymm1, %ymm1, %ymm154; AVX1-NEXT:    vtestpd %ymm1, %ymm055; AVX1-NEXT:    sbbq %rax, %rax56; AVX1-NEXT:    vzeroupper57; AVX1-NEXT:    retq58;59; AVX2-LABEL: test_v4f64_sext:60; AVX2:       # %bb.0:61; AVX2-NEXT:    vcmpltpd %ymm0, %ymm1, %ymm062; AVX2-NEXT:    xorl %eax, %eax63; AVX2-NEXT:    vpcmpeqd %ymm1, %ymm1, %ymm164; AVX2-NEXT:    vtestpd %ymm1, %ymm065; AVX2-NEXT:    sbbq %rax, %rax66; AVX2-NEXT:    vzeroupper67; AVX2-NEXT:    retq68;69; AVX512-LABEL: test_v4f64_sext:70; AVX512:       # %bb.0:71; AVX512-NEXT:    vcmpltpd %ymm0, %ymm1, %ymm072; AVX512-NEXT:    xorl %eax, %eax73; AVX512-NEXT:    vpcmpeqd %ymm1, %ymm1, %ymm174; AVX512-NEXT:    vtestpd %ymm1, %ymm075; AVX512-NEXT:    sbbq %rax, %rax76; AVX512-NEXT:    vzeroupper77; AVX512-NEXT:    retq78  %c = fcmp ogt <4 x double> %a0, %a179  %s = sext <4 x i1> %c to <4 x i64>80  %1 = shufflevector <4 x i64> %s, <4 x i64> undef, <4 x i32> <i32 2, i32 3, i32 undef, i32 undef>81  %2 = and <4 x i64> %s, %182  %3 = shufflevector <4 x i64> %2, <4 x i64> undef, <4 x i32> <i32 1, i32 undef, i32 undef, i32 undef>83  %4 = and <4 x i64> %2, %384  %5 = extractelement <4 x i64> %4, i64 085  ret i64 %586}87 88define i64 @test_v4f64_legal_sext(<4 x double> %a0, <4 x double> %a1) {89; SSE-LABEL: test_v4f64_legal_sext:90; SSE:       # %bb.0:91; SSE-NEXT:    cmpltpd %xmm1, %xmm392; SSE-NEXT:    cmpltpd %xmm0, %xmm293; SSE-NEXT:    shufps {{.*#+}} xmm2 = xmm2[0,2],xmm3[0,2]94; SSE-NEXT:    movmskps %xmm2, %ecx95; SSE-NEXT:    xorl %eax, %eax96; SSE-NEXT:    cmpl $15, %ecx97; SSE-NEXT:    sete %al98; SSE-NEXT:    negq %rax99; SSE-NEXT:    retq100;101; AVX1OR2-LABEL: test_v4f64_legal_sext:102; AVX1OR2:       # %bb.0:103; AVX1OR2-NEXT:    vcmpltpd %ymm0, %ymm1, %ymm0104; AVX1OR2-NEXT:    vextractf128 $1, %ymm0, %xmm1105; AVX1OR2-NEXT:    vpackssdw %xmm1, %xmm0, %xmm0106; AVX1OR2-NEXT:    vpcmpeqd %xmm1, %xmm1, %xmm1107; AVX1OR2-NEXT:    xorl %eax, %eax108; AVX1OR2-NEXT:    vtestps %xmm1, %xmm0109; AVX1OR2-NEXT:    sbbq %rax, %rax110; AVX1OR2-NEXT:    vzeroupper111; AVX1OR2-NEXT:    retq112;113; AVX512-LABEL: test_v4f64_legal_sext:114; AVX512:       # %bb.0:115; AVX512-NEXT:    vcmpltpd %ymm0, %ymm1, %k1116; AVX512-NEXT:    vpcmpeqd %xmm0, %xmm0, %xmm0117; AVX512-NEXT:    vmovdqa32 %xmm0, %xmm1 {%k1} {z}118; AVX512-NEXT:    xorl %eax, %eax119; AVX512-NEXT:    vtestps %xmm0, %xmm1120; AVX512-NEXT:    sbbq %rax, %rax121; AVX512-NEXT:    vzeroupper122; AVX512-NEXT:    retq123  %c = fcmp ogt <4 x double> %a0, %a1124  %s = sext <4 x i1> %c to <4 x i32>125  %1 = shufflevector <4 x i32> %s, <4 x i32> undef, <4 x i32> <i32 2, i32 3, i32 undef, i32 undef>126  %2 = and <4 x i32> %s, %1127  %3 = shufflevector <4 x i32> %2, <4 x i32> undef, <4 x i32> <i32 1, i32 undef, i32 undef, i32 undef>128  %4 = and <4 x i32> %2, %3129  %5 = extractelement <4 x i32> %4, i64 0130  %6 = sext i32 %5 to i64131  ret i64 %6132}133 134define i32 @test_v4f32_sext(<4 x float> %a0, <4 x float> %a1) {135; SSE-LABEL: test_v4f32_sext:136; SSE:       # %bb.0:137; SSE-NEXT:    cmpltps %xmm0, %xmm1138; SSE-NEXT:    movmskps %xmm1, %ecx139; SSE-NEXT:    xorl %eax, %eax140; SSE-NEXT:    cmpl $15, %ecx141; SSE-NEXT:    sete %al142; SSE-NEXT:    negl %eax143; SSE-NEXT:    retq144;145; AVX-LABEL: test_v4f32_sext:146; AVX:       # %bb.0:147; AVX-NEXT:    vcmpltps %xmm0, %xmm1, %xmm0148; AVX-NEXT:    xorl %eax, %eax149; AVX-NEXT:    vpcmpeqd %xmm1, %xmm1, %xmm1150; AVX-NEXT:    vtestps %xmm1, %xmm0151; AVX-NEXT:    sbbl %eax, %eax152; AVX-NEXT:    retq153  %c = fcmp ogt <4 x float> %a0, %a1154  %s = sext <4 x i1> %c to <4 x i32>155  %1 = shufflevector <4 x i32> %s, <4 x i32> undef, <4 x i32> <i32 2, i32 3, i32 undef, i32 undef>156  %2 = and <4 x i32> %s, %1157  %3 = shufflevector <4 x i32> %2, <4 x i32> undef, <4 x i32> <i32 1, i32 undef, i32 undef, i32 undef>158  %4 = and <4 x i32> %2, %3159  %5 = extractelement <4 x i32> %4, i32 0160  ret i32 %5161}162 163define i32 @test_v8f32_sext(<8 x float> %a0, <8 x float> %a1) {164; SSE-LABEL: test_v8f32_sext:165; SSE:       # %bb.0:166; SSE-NEXT:    cmpltps %xmm1, %xmm3167; SSE-NEXT:    cmpltps %xmm0, %xmm2168; SSE-NEXT:    andps %xmm3, %xmm2169; SSE-NEXT:    movmskps %xmm2, %ecx170; SSE-NEXT:    xorl %eax, %eax171; SSE-NEXT:    cmpl $15, %ecx172; SSE-NEXT:    sete %al173; SSE-NEXT:    negl %eax174; SSE-NEXT:    retq175;176; AVX1-LABEL: test_v8f32_sext:177; AVX1:       # %bb.0:178; AVX1-NEXT:    vcmpltps %ymm0, %ymm1, %ymm0179; AVX1-NEXT:    vxorps %xmm1, %xmm1, %xmm1180; AVX1-NEXT:    vcmptrueps %ymm1, %ymm1, %ymm1181; AVX1-NEXT:    xorl %eax, %eax182; AVX1-NEXT:    vtestps %ymm1, %ymm0183; AVX1-NEXT:    sbbl %eax, %eax184; AVX1-NEXT:    vzeroupper185; AVX1-NEXT:    retq186;187; AVX2-LABEL: test_v8f32_sext:188; AVX2:       # %bb.0:189; AVX2-NEXT:    vcmpltps %ymm0, %ymm1, %ymm0190; AVX2-NEXT:    xorl %eax, %eax191; AVX2-NEXT:    vpcmpeqd %ymm1, %ymm1, %ymm1192; AVX2-NEXT:    vtestps %ymm1, %ymm0193; AVX2-NEXT:    sbbl %eax, %eax194; AVX2-NEXT:    vzeroupper195; AVX2-NEXT:    retq196;197; AVX512-LABEL: test_v8f32_sext:198; AVX512:       # %bb.0:199; AVX512-NEXT:    vcmpltps %ymm0, %ymm1, %ymm0200; AVX512-NEXT:    xorl %eax, %eax201; AVX512-NEXT:    vpcmpeqd %ymm1, %ymm1, %ymm1202; AVX512-NEXT:    vtestps %ymm1, %ymm0203; AVX512-NEXT:    sbbl %eax, %eax204; AVX512-NEXT:    vzeroupper205; AVX512-NEXT:    retq206  %c = fcmp ogt <8 x float> %a0, %a1207  %s = sext <8 x i1> %c to <8 x i32>208  %1 = shufflevector <8 x i32> %s, <8 x i32> undef, <8 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef>209  %2 = and <8 x i32> %s, %1210  %3 = shufflevector <8 x i32> %2, <8 x i32> undef, <8 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>211  %4 = and <8 x i32> %2, %3212  %5 = shufflevector <8 x i32> %4, <8 x i32> undef, <8 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>213  %6 = and <8 x i32> %4, %5214  %7 = extractelement <8 x i32> %6, i32 0215  ret i32 %7216}217 218define i32 @test_v8f32_legal_sext(<8 x float> %a0, <8 x float> %a1) {219; SSE-LABEL: test_v8f32_legal_sext:220; SSE:       # %bb.0:221; SSE-NEXT:    cmpltps %xmm1, %xmm3222; SSE-NEXT:    cmpltps %xmm0, %xmm2223; SSE-NEXT:    packssdw %xmm3, %xmm2224; SSE-NEXT:    pmovmskb %xmm2, %ecx225; SSE-NEXT:    xorl %eax, %eax226; SSE-NEXT:    cmpl $65535, %ecx # imm = 0xFFFF227; SSE-NEXT:    sete %al228; SSE-NEXT:    negl %eax229; SSE-NEXT:    retq230;231; AVX1OR2-LABEL: test_v8f32_legal_sext:232; AVX1OR2:       # %bb.0:233; AVX1OR2-NEXT:    vcmpltps %ymm0, %ymm1, %ymm0234; AVX1OR2-NEXT:    vextractf128 $1, %ymm0, %xmm1235; AVX1OR2-NEXT:    vpackssdw %xmm1, %xmm0, %xmm0236; AVX1OR2-NEXT:    vpmovmskb %xmm0, %ecx237; AVX1OR2-NEXT:    xorl %eax, %eax238; AVX1OR2-NEXT:    cmpl $65535, %ecx # imm = 0xFFFF239; AVX1OR2-NEXT:    sete %al240; AVX1OR2-NEXT:    negl %eax241; AVX1OR2-NEXT:    vzeroupper242; AVX1OR2-NEXT:    retq243;244; AVX512-LABEL: test_v8f32_legal_sext:245; AVX512:       # %bb.0:246; AVX512-NEXT:    vcmpltps %ymm0, %ymm1, %k0247; AVX512-NEXT:    vpmovm2w %k0, %xmm0248; AVX512-NEXT:    vpmovmskb %xmm0, %ecx249; AVX512-NEXT:    xorl %eax, %eax250; AVX512-NEXT:    cmpl $65535, %ecx # imm = 0xFFFF251; AVX512-NEXT:    sete %al252; AVX512-NEXT:    negl %eax253; AVX512-NEXT:    vzeroupper254; AVX512-NEXT:    retq255  %c = fcmp ogt <8 x float> %a0, %a1256  %s = sext <8 x i1> %c to <8 x i16>257  %1 = shufflevector <8 x i16> %s, <8 x i16> undef, <8 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef>258  %2 = and <8 x i16> %s, %1259  %3 = shufflevector <8 x i16> %2, <8 x i16> undef, <8 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>260  %4 = and <8 x i16> %2, %3261  %5 = shufflevector <8 x i16> %4, <8 x i16> undef, <8 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>262  %6 = and <8 x i16> %4, %5263  %7 = extractelement <8 x i16> %6, i32 0264  %8 = sext i16 %7 to i32265  ret i32 %8266}267 268define i64 @test_v2i64_sext(<2 x i64> %a0, <2 x i64> %a1) {269; SSE2-LABEL: test_v2i64_sext:270; SSE2:       # %bb.0:271; SSE2-NEXT:    movdqa {{.*#+}} xmm2 = [2147483648,2147483648]272; SSE2-NEXT:    pxor %xmm2, %xmm1273; SSE2-NEXT:    pxor %xmm2, %xmm0274; SSE2-NEXT:    movdqa %xmm0, %xmm2275; SSE2-NEXT:    pcmpeqd %xmm1, %xmm2276; SSE2-NEXT:    pcmpgtd %xmm1, %xmm0277; SSE2-NEXT:    pshufd {{.*#+}} xmm1 = xmm0[0,0,2,2]278; SSE2-NEXT:    pand %xmm2, %xmm1279; SSE2-NEXT:    por %xmm0, %xmm1280; SSE2-NEXT:    movmskpd %xmm1, %ecx281; SSE2-NEXT:    xorl %eax, %eax282; SSE2-NEXT:    cmpl $3, %ecx283; SSE2-NEXT:    sete %al284; SSE2-NEXT:    negq %rax285; SSE2-NEXT:    retq286;287; SSE42-LABEL: test_v2i64_sext:288; SSE42:       # %bb.0:289; SSE42-NEXT:    pcmpgtq %xmm1, %xmm0290; SSE42-NEXT:    movmskpd %xmm0, %ecx291; SSE42-NEXT:    xorl %eax, %eax292; SSE42-NEXT:    cmpl $3, %ecx293; SSE42-NEXT:    sete %al294; SSE42-NEXT:    negq %rax295; SSE42-NEXT:    retq296;297; AVX-LABEL: test_v2i64_sext:298; AVX:       # %bb.0:299; AVX-NEXT:    vpcmpgtq %xmm1, %xmm0, %xmm0300; AVX-NEXT:    xorl %eax, %eax301; AVX-NEXT:    vpcmpeqd %xmm1, %xmm1, %xmm1302; AVX-NEXT:    vtestpd %xmm1, %xmm0303; AVX-NEXT:    sbbq %rax, %rax304; AVX-NEXT:    retq305  %c = icmp sgt <2 x i64> %a0, %a1306  %s = sext <2 x i1> %c to <2 x i64>307  %1 = shufflevector <2 x i64> %s, <2 x i64> undef, <2 x i32> <i32 1, i32 undef>308  %2 = and <2 x i64> %s, %1309  %3 = extractelement <2 x i64> %2, i32 0310  ret i64 %3311}312 313define i64 @test_v4i64_sext(<4 x i64> %a0, <4 x i64> %a1) {314; SSE2-LABEL: test_v4i64_sext:315; SSE2:       # %bb.0:316; SSE2-NEXT:    movdqa {{.*#+}} xmm4 = [2147483648,2147483648]317; SSE2-NEXT:    pxor %xmm4, %xmm3318; SSE2-NEXT:    pxor %xmm4, %xmm1319; SSE2-NEXT:    movdqa %xmm1, %xmm5320; SSE2-NEXT:    pcmpeqd %xmm3, %xmm5321; SSE2-NEXT:    pcmpgtd %xmm3, %xmm1322; SSE2-NEXT:    pshufd {{.*#+}} xmm3 = xmm1[0,0,2,2]323; SSE2-NEXT:    pand %xmm5, %xmm3324; SSE2-NEXT:    por %xmm1, %xmm3325; SSE2-NEXT:    pxor %xmm4, %xmm2326; SSE2-NEXT:    pxor %xmm4, %xmm0327; SSE2-NEXT:    movdqa %xmm0, %xmm1328; SSE2-NEXT:    pcmpeqd %xmm2, %xmm1329; SSE2-NEXT:    pcmpgtd %xmm2, %xmm0330; SSE2-NEXT:    pshufd {{.*#+}} xmm2 = xmm0[0,0,2,2]331; SSE2-NEXT:    pand %xmm1, %xmm2332; SSE2-NEXT:    por %xmm0, %xmm2333; SSE2-NEXT:    pand %xmm3, %xmm2334; SSE2-NEXT:    movmskpd %xmm2, %ecx335; SSE2-NEXT:    xorl %eax, %eax336; SSE2-NEXT:    cmpl $3, %ecx337; SSE2-NEXT:    sete %al338; SSE2-NEXT:    negq %rax339; SSE2-NEXT:    retq340;341; SSE42-LABEL: test_v4i64_sext:342; SSE42:       # %bb.0:343; SSE42-NEXT:    pcmpgtq %xmm3, %xmm1344; SSE42-NEXT:    pcmpgtq %xmm2, %xmm0345; SSE42-NEXT:    pand %xmm1, %xmm0346; SSE42-NEXT:    movmskpd %xmm0, %ecx347; SSE42-NEXT:    xorl %eax, %eax348; SSE42-NEXT:    cmpl $3, %ecx349; SSE42-NEXT:    sete %al350; SSE42-NEXT:    negq %rax351; SSE42-NEXT:    retq352;353; AVX1-LABEL: test_v4i64_sext:354; AVX1:       # %bb.0:355; AVX1-NEXT:    vextractf128 $1, %ymm1, %xmm2356; AVX1-NEXT:    vextractf128 $1, %ymm0, %xmm3357; AVX1-NEXT:    vpcmpgtq %xmm2, %xmm3, %xmm2358; AVX1-NEXT:    vpcmpgtq %xmm1, %xmm0, %xmm0359; AVX1-NEXT:    vpand %xmm2, %xmm0, %xmm0360; AVX1-NEXT:    xorl %eax, %eax361; AVX1-NEXT:    vpcmpeqd %xmm1, %xmm1, %xmm1362; AVX1-NEXT:    vtestpd %xmm1, %xmm0363; AVX1-NEXT:    sbbq %rax, %rax364; AVX1-NEXT:    vzeroupper365; AVX1-NEXT:    retq366;367; AVX2-LABEL: test_v4i64_sext:368; AVX2:       # %bb.0:369; AVX2-NEXT:    vpcmpgtq %ymm1, %ymm0, %ymm0370; AVX2-NEXT:    xorl %eax, %eax371; AVX2-NEXT:    vpcmpeqd %ymm1, %ymm1, %ymm1372; AVX2-NEXT:    vtestpd %ymm1, %ymm0373; AVX2-NEXT:    sbbq %rax, %rax374; AVX2-NEXT:    vzeroupper375; AVX2-NEXT:    retq376;377; AVX512-LABEL: test_v4i64_sext:378; AVX512:       # %bb.0:379; AVX512-NEXT:    vpcmpgtq %ymm1, %ymm0, %ymm0380; AVX512-NEXT:    xorl %eax, %eax381; AVX512-NEXT:    vpcmpeqd %ymm1, %ymm1, %ymm1382; AVX512-NEXT:    vtestpd %ymm1, %ymm0383; AVX512-NEXT:    sbbq %rax, %rax384; AVX512-NEXT:    vzeroupper385; AVX512-NEXT:    retq386  %c = icmp sgt <4 x i64> %a0, %a1387  %s = sext <4 x i1> %c to <4 x i64>388  %1 = shufflevector <4 x i64> %s, <4 x i64> undef, <4 x i32> <i32 2, i32 3, i32 undef, i32 undef>389  %2 = and <4 x i64> %s, %1390  %3 = shufflevector <4 x i64> %2, <4 x i64> undef, <4 x i32> <i32 1, i32 undef, i32 undef, i32 undef>391  %4 = and <4 x i64> %2, %3392  %5 = extractelement <4 x i64> %4, i64 0393  ret i64 %5394}395 396define i64 @test_v4i64_legal_sext(<4 x i64> %a0, <4 x i64> %a1) {397; SSE2-LABEL: test_v4i64_legal_sext:398; SSE2:       # %bb.0:399; SSE2-NEXT:    movdqa {{.*#+}} xmm4 = [2147483648,2147483648]400; SSE2-NEXT:    pxor %xmm4, %xmm3401; SSE2-NEXT:    pxor %xmm4, %xmm1402; SSE2-NEXT:    movdqa %xmm1, %xmm5403; SSE2-NEXT:    pcmpgtd %xmm3, %xmm5404; SSE2-NEXT:    pxor %xmm4, %xmm2405; SSE2-NEXT:    pxor %xmm4, %xmm0406; SSE2-NEXT:    movdqa %xmm0, %xmm4407; SSE2-NEXT:    pcmpgtd %xmm2, %xmm4408; SSE2-NEXT:    movdqa %xmm4, %xmm6409; SSE2-NEXT:    shufps {{.*#+}} xmm6 = xmm6[0,2],xmm5[0,2]410; SSE2-NEXT:    pcmpeqd %xmm3, %xmm1411; SSE2-NEXT:    pcmpeqd %xmm2, %xmm0412; SSE2-NEXT:    shufps {{.*#+}} xmm0 = xmm0[1,3],xmm1[1,3]413; SSE2-NEXT:    andps %xmm6, %xmm0414; SSE2-NEXT:    shufps {{.*#+}} xmm4 = xmm4[1,3],xmm5[1,3]415; SSE2-NEXT:    orps %xmm0, %xmm4416; SSE2-NEXT:    movmskps %xmm4, %ecx417; SSE2-NEXT:    xorl %eax, %eax418; SSE2-NEXT:    cmpl $15, %ecx419; SSE2-NEXT:    sete %al420; SSE2-NEXT:    negq %rax421; SSE2-NEXT:    retq422;423; SSE42-LABEL: test_v4i64_legal_sext:424; SSE42:       # %bb.0:425; SSE42-NEXT:    pcmpgtq %xmm3, %xmm1426; SSE42-NEXT:    pcmpgtq %xmm2, %xmm0427; SSE42-NEXT:    packssdw %xmm1, %xmm0428; SSE42-NEXT:    movmskps %xmm0, %ecx429; SSE42-NEXT:    xorl %eax, %eax430; SSE42-NEXT:    cmpl $15, %ecx431; SSE42-NEXT:    sete %al432; SSE42-NEXT:    negq %rax433; SSE42-NEXT:    retq434;435; AVX1-LABEL: test_v4i64_legal_sext:436; AVX1:       # %bb.0:437; AVX1-NEXT:    vextractf128 $1, %ymm1, %xmm2438; AVX1-NEXT:    vextractf128 $1, %ymm0, %xmm3439; AVX1-NEXT:    vpcmpgtq %xmm2, %xmm3, %xmm2440; AVX1-NEXT:    vpcmpgtq %xmm1, %xmm0, %xmm0441; AVX1-NEXT:    vpackssdw %xmm2, %xmm0, %xmm0442; AVX1-NEXT:    vpcmpeqd %xmm1, %xmm1, %xmm1443; AVX1-NEXT:    xorl %eax, %eax444; AVX1-NEXT:    vtestps %xmm1, %xmm0445; AVX1-NEXT:    sbbq %rax, %rax446; AVX1-NEXT:    vzeroupper447; AVX1-NEXT:    retq448;449; AVX2-LABEL: test_v4i64_legal_sext:450; AVX2:       # %bb.0:451; AVX2-NEXT:    vpcmpgtq %ymm1, %ymm0, %ymm0452; AVX2-NEXT:    vextracti128 $1, %ymm0, %xmm1453; AVX2-NEXT:    vpackssdw %xmm1, %xmm0, %xmm0454; AVX2-NEXT:    vpcmpeqd %xmm1, %xmm1, %xmm1455; AVX2-NEXT:    xorl %eax, %eax456; AVX2-NEXT:    vtestps %xmm1, %xmm0457; AVX2-NEXT:    sbbq %rax, %rax458; AVX2-NEXT:    vzeroupper459; AVX2-NEXT:    retq460;461; AVX512-LABEL: test_v4i64_legal_sext:462; AVX512:       # %bb.0:463; AVX512-NEXT:    vpcmpgtq %ymm1, %ymm0, %k1464; AVX512-NEXT:    vpcmpeqd %xmm0, %xmm0, %xmm0465; AVX512-NEXT:    vmovdqa32 %xmm0, %xmm1 {%k1} {z}466; AVX512-NEXT:    xorl %eax, %eax467; AVX512-NEXT:    vtestps %xmm0, %xmm1468; AVX512-NEXT:    sbbq %rax, %rax469; AVX512-NEXT:    vzeroupper470; AVX512-NEXT:    retq471  %c = icmp sgt <4 x i64> %a0, %a1472  %s = sext <4 x i1> %c to <4 x i32>473  %1 = shufflevector <4 x i32> %s, <4 x i32> undef, <4 x i32> <i32 2, i32 3, i32 undef, i32 undef>474  %2 = and <4 x i32> %s, %1475  %3 = shufflevector <4 x i32> %2, <4 x i32> undef, <4 x i32> <i32 1, i32 undef, i32 undef, i32 undef>476  %4 = and <4 x i32> %2, %3477  %5 = extractelement <4 x i32> %4, i64 0478  %6 = sext i32 %5 to i64479  ret i64 %6480}481 482define i32 @test_v4i32_sext(<4 x i32> %a0, <4 x i32> %a1) {483; SSE-LABEL: test_v4i32_sext:484; SSE:       # %bb.0:485; SSE-NEXT:    pcmpgtd %xmm1, %xmm0486; SSE-NEXT:    movmskps %xmm0, %ecx487; SSE-NEXT:    xorl %eax, %eax488; SSE-NEXT:    cmpl $15, %ecx489; SSE-NEXT:    sete %al490; SSE-NEXT:    negl %eax491; SSE-NEXT:    retq492;493; AVX-LABEL: test_v4i32_sext:494; AVX:       # %bb.0:495; AVX-NEXT:    vpcmpgtd %xmm1, %xmm0, %xmm0496; AVX-NEXT:    xorl %eax, %eax497; AVX-NEXT:    vpcmpeqd %xmm1, %xmm1, %xmm1498; AVX-NEXT:    vtestps %xmm1, %xmm0499; AVX-NEXT:    sbbl %eax, %eax500; AVX-NEXT:    retq501  %c = icmp sgt <4 x i32> %a0, %a1502  %s = sext <4 x i1> %c to <4 x i32>503  %1 = shufflevector <4 x i32> %s, <4 x i32> undef, <4 x i32> <i32 2, i32 3, i32 undef, i32 undef>504  %2 = and <4 x i32> %s, %1505  %3 = shufflevector <4 x i32> %2, <4 x i32> undef, <4 x i32> <i32 1, i32 undef, i32 undef, i32 undef>506  %4 = and <4 x i32> %2, %3507  %5 = extractelement <4 x i32> %4, i32 0508  ret i32 %5509}510 511define i32 @test_v8i32_sext(<8 x i32> %a0, <8 x i32> %a1) {512; SSE-LABEL: test_v8i32_sext:513; SSE:       # %bb.0:514; SSE-NEXT:    pcmpgtd %xmm3, %xmm1515; SSE-NEXT:    pcmpgtd %xmm2, %xmm0516; SSE-NEXT:    pand %xmm1, %xmm0517; SSE-NEXT:    movmskps %xmm0, %ecx518; SSE-NEXT:    xorl %eax, %eax519; SSE-NEXT:    cmpl $15, %ecx520; SSE-NEXT:    sete %al521; SSE-NEXT:    negl %eax522; SSE-NEXT:    retq523;524; AVX1-LABEL: test_v8i32_sext:525; AVX1:       # %bb.0:526; AVX1-NEXT:    vextractf128 $1, %ymm1, %xmm2527; AVX1-NEXT:    vextractf128 $1, %ymm0, %xmm3528; AVX1-NEXT:    vpcmpgtd %xmm2, %xmm3, %xmm2529; AVX1-NEXT:    vpcmpgtd %xmm1, %xmm0, %xmm0530; AVX1-NEXT:    vpand %xmm2, %xmm0, %xmm0531; AVX1-NEXT:    xorl %eax, %eax532; AVX1-NEXT:    vpcmpeqd %xmm1, %xmm1, %xmm1533; AVX1-NEXT:    vtestps %xmm1, %xmm0534; AVX1-NEXT:    sbbl %eax, %eax535; AVX1-NEXT:    vzeroupper536; AVX1-NEXT:    retq537;538; AVX2-LABEL: test_v8i32_sext:539; AVX2:       # %bb.0:540; AVX2-NEXT:    vpcmpgtd %ymm1, %ymm0, %ymm0541; AVX2-NEXT:    xorl %eax, %eax542; AVX2-NEXT:    vpcmpeqd %ymm1, %ymm1, %ymm1543; AVX2-NEXT:    vtestps %ymm1, %ymm0544; AVX2-NEXT:    sbbl %eax, %eax545; AVX2-NEXT:    vzeroupper546; AVX2-NEXT:    retq547;548; AVX512-LABEL: test_v8i32_sext:549; AVX512:       # %bb.0:550; AVX512-NEXT:    vpcmpgtd %ymm1, %ymm0, %ymm0551; AVX512-NEXT:    xorl %eax, %eax552; AVX512-NEXT:    vpcmpeqd %ymm1, %ymm1, %ymm1553; AVX512-NEXT:    vtestps %ymm1, %ymm0554; AVX512-NEXT:    sbbl %eax, %eax555; AVX512-NEXT:    vzeroupper556; AVX512-NEXT:    retq557  %c = icmp sgt <8 x i32> %a0, %a1558  %s = sext <8 x i1> %c to <8 x i32>559  %1 = shufflevector <8 x i32> %s, <8 x i32> undef, <8 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef>560  %2 = and <8 x i32> %s, %1561  %3 = shufflevector <8 x i32> %2, <8 x i32> undef, <8 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>562  %4 = and <8 x i32> %2, %3563  %5 = shufflevector <8 x i32> %4, <8 x i32> undef, <8 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>564  %6 = and <8 x i32> %4, %5565  %7 = extractelement <8 x i32> %6, i32 0566  ret i32 %7567}568 569define i32 @test_v8i32_legal_sext(<8 x i32> %a0, <8 x i32> %a1) {570; SSE-LABEL: test_v8i32_legal_sext:571; SSE:       # %bb.0:572; SSE-NEXT:    pcmpgtd %xmm3, %xmm1573; SSE-NEXT:    pcmpgtd %xmm2, %xmm0574; SSE-NEXT:    packssdw %xmm1, %xmm0575; SSE-NEXT:    pmovmskb %xmm0, %ecx576; SSE-NEXT:    xorl %eax, %eax577; SSE-NEXT:    cmpl $65535, %ecx # imm = 0xFFFF578; SSE-NEXT:    sete %al579; SSE-NEXT:    negl %eax580; SSE-NEXT:    retq581;582; AVX1-LABEL: test_v8i32_legal_sext:583; AVX1:       # %bb.0:584; AVX1-NEXT:    vextractf128 $1, %ymm1, %xmm2585; AVX1-NEXT:    vextractf128 $1, %ymm0, %xmm3586; AVX1-NEXT:    vpcmpgtd %xmm2, %xmm3, %xmm2587; AVX1-NEXT:    vpcmpgtd %xmm1, %xmm0, %xmm0588; AVX1-NEXT:    vpackssdw %xmm2, %xmm0, %xmm0589; AVX1-NEXT:    vpmovmskb %xmm0, %ecx590; AVX1-NEXT:    xorl %eax, %eax591; AVX1-NEXT:    cmpl $65535, %ecx # imm = 0xFFFF592; AVX1-NEXT:    sete %al593; AVX1-NEXT:    negl %eax594; AVX1-NEXT:    vzeroupper595; AVX1-NEXT:    retq596;597; AVX2-LABEL: test_v8i32_legal_sext:598; AVX2:       # %bb.0:599; AVX2-NEXT:    vpcmpgtd %ymm1, %ymm0, %ymm0600; AVX2-NEXT:    vextracti128 $1, %ymm0, %xmm1601; AVX2-NEXT:    vpackssdw %xmm1, %xmm0, %xmm0602; AVX2-NEXT:    vpmovmskb %xmm0, %ecx603; AVX2-NEXT:    xorl %eax, %eax604; AVX2-NEXT:    cmpl $65535, %ecx # imm = 0xFFFF605; AVX2-NEXT:    sete %al606; AVX2-NEXT:    negl %eax607; AVX2-NEXT:    vzeroupper608; AVX2-NEXT:    retq609;610; AVX512-LABEL: test_v8i32_legal_sext:611; AVX512:       # %bb.0:612; AVX512-NEXT:    vpcmpgtd %ymm1, %ymm0, %k0613; AVX512-NEXT:    vpmovm2w %k0, %xmm0614; AVX512-NEXT:    vpmovmskb %xmm0, %ecx615; AVX512-NEXT:    xorl %eax, %eax616; AVX512-NEXT:    cmpl $65535, %ecx # imm = 0xFFFF617; AVX512-NEXT:    sete %al618; AVX512-NEXT:    negl %eax619; AVX512-NEXT:    vzeroupper620; AVX512-NEXT:    retq621  %c = icmp sgt <8 x i32> %a0, %a1622  %s = sext <8 x i1> %c to <8 x i16>623  %1 = shufflevector <8 x i16> %s, <8 x i16> undef, <8 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef>624  %2 = and <8 x i16> %s, %1625  %3 = shufflevector <8 x i16> %2, <8 x i16> undef, <8 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>626  %4 = and <8 x i16> %2, %3627  %5 = shufflevector <8 x i16> %4, <8 x i16> undef, <8 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>628  %6 = and <8 x i16> %4, %5629  %7 = extractelement <8 x i16> %6, i32 0630  %8 = sext i16 %7 to i32631  ret i32 %8632}633 634define i16 @test_v8i16_sext(<8 x i16> %a0, <8 x i16> %a1) {635; SSE-LABEL: test_v8i16_sext:636; SSE:       # %bb.0:637; SSE-NEXT:    pcmpgtw %xmm1, %xmm0638; SSE-NEXT:    pmovmskb %xmm0, %ecx639; SSE-NEXT:    xorl %eax, %eax640; SSE-NEXT:    cmpl $65535, %ecx # imm = 0xFFFF641; SSE-NEXT:    sete %al642; SSE-NEXT:    negl %eax643; SSE-NEXT:    # kill: def $ax killed $ax killed $eax644; SSE-NEXT:    retq645;646; AVX-LABEL: test_v8i16_sext:647; AVX:       # %bb.0:648; AVX-NEXT:    vpcmpgtw %xmm1, %xmm0, %xmm0649; AVX-NEXT:    vpmovmskb %xmm0, %ecx650; AVX-NEXT:    xorl %eax, %eax651; AVX-NEXT:    cmpl $65535, %ecx # imm = 0xFFFF652; AVX-NEXT:    sete %al653; AVX-NEXT:    negl %eax654; AVX-NEXT:    # kill: def $ax killed $ax killed $eax655; AVX-NEXT:    retq656  %c = icmp sgt <8 x i16> %a0, %a1657  %s = sext <8 x i1> %c to <8 x i16>658  %1 = shufflevector <8 x i16> %s, <8 x i16> undef, <8 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef>659  %2 = and <8 x i16> %s, %1660  %3 = shufflevector <8 x i16> %2, <8 x i16> undef, <8 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>661  %4 = and <8 x i16> %2, %3662  %5 = shufflevector <8 x i16> %4, <8 x i16> undef, <8 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>663  %6 = and <8 x i16> %4, %5664  %7 = extractelement <8 x i16> %6, i32 0665  ret i16 %7666}667 668define i16 @test_v16i16_sext(<16 x i16> %a0, <16 x i16> %a1) {669; SSE-LABEL: test_v16i16_sext:670; SSE:       # %bb.0:671; SSE-NEXT:    pcmpgtw %xmm3, %xmm1672; SSE-NEXT:    pcmpgtw %xmm2, %xmm0673; SSE-NEXT:    pand %xmm1, %xmm0674; SSE-NEXT:    pmovmskb %xmm0, %ecx675; SSE-NEXT:    xorl %eax, %eax676; SSE-NEXT:    cmpl $65535, %ecx # imm = 0xFFFF677; SSE-NEXT:    sete %al678; SSE-NEXT:    negl %eax679; SSE-NEXT:    # kill: def $ax killed $ax killed $eax680; SSE-NEXT:    retq681;682; AVX1-LABEL: test_v16i16_sext:683; AVX1:       # %bb.0:684; AVX1-NEXT:    vextractf128 $1, %ymm1, %xmm2685; AVX1-NEXT:    vextractf128 $1, %ymm0, %xmm3686; AVX1-NEXT:    vpcmpgtw %xmm2, %xmm3, %xmm2687; AVX1-NEXT:    vpcmpgtw %xmm1, %xmm0, %xmm0688; AVX1-NEXT:    vpand %xmm2, %xmm0, %xmm0689; AVX1-NEXT:    vpmovmskb %xmm0, %ecx690; AVX1-NEXT:    xorl %eax, %eax691; AVX1-NEXT:    cmpl $65535, %ecx # imm = 0xFFFF692; AVX1-NEXT:    sete %al693; AVX1-NEXT:    negl %eax694; AVX1-NEXT:    # kill: def $ax killed $ax killed $eax695; AVX1-NEXT:    vzeroupper696; AVX1-NEXT:    retq697;698; AVX2-LABEL: test_v16i16_sext:699; AVX2:       # %bb.0:700; AVX2-NEXT:    vpcmpgtw %ymm1, %ymm0, %ymm0701; AVX2-NEXT:    vpmovmskb %ymm0, %ecx702; AVX2-NEXT:    xorl %eax, %eax703; AVX2-NEXT:    cmpl $-1, %ecx704; AVX2-NEXT:    sete %al705; AVX2-NEXT:    negl %eax706; AVX2-NEXT:    # kill: def $ax killed $ax killed $eax707; AVX2-NEXT:    vzeroupper708; AVX2-NEXT:    retq709;710; AVX512-LABEL: test_v16i16_sext:711; AVX512:       # %bb.0:712; AVX512-NEXT:    vpcmpgtw %ymm1, %ymm0, %ymm0713; AVX512-NEXT:    vpmovmskb %ymm0, %ecx714; AVX512-NEXT:    xorl %eax, %eax715; AVX512-NEXT:    cmpl $-1, %ecx716; AVX512-NEXT:    sete %al717; AVX512-NEXT:    negl %eax718; AVX512-NEXT:    # kill: def $ax killed $ax killed $eax719; AVX512-NEXT:    vzeroupper720; AVX512-NEXT:    retq721  %c = icmp sgt <16 x i16> %a0, %a1722  %s = sext <16 x i1> %c to <16 x i16>723  %1 = shufflevector <16 x i16> %s, <16 x i16> undef, <16 x i32> <i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>724  %2 = and <16 x i16> %s, %1725  %3 = shufflevector <16 x i16> %2, <16 x i16> undef, <16 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>726  %4 = and <16 x i16> %2, %3727  %5 = shufflevector <16 x i16> %4, <16 x i16> undef, <16 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>728  %6 = and <16 x i16> %4, %5729  %7 = shufflevector <16 x i16> %6, <16 x i16> undef, <16 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>730  %8 = and <16 x i16> %6, %7731  %9 = extractelement <16 x i16> %8, i32 0732  ret i16 %9733}734 735define i16 @test_v16i16_legal_sext(<16 x i16> %a0, <16 x i16> %a1) {736; SSE-LABEL: test_v16i16_legal_sext:737; SSE:       # %bb.0:738; SSE-NEXT:    pcmpgtw %xmm3, %xmm1739; SSE-NEXT:    pcmpgtw %xmm2, %xmm0740; SSE-NEXT:    packsswb %xmm1, %xmm0741; SSE-NEXT:    pmovmskb %xmm0, %eax742; SSE-NEXT:    cmpl $65535, %eax # imm = 0xFFFF743; SSE-NEXT:    sete %al744; SSE-NEXT:    negb %al745; SSE-NEXT:    movsbl %al, %eax746; SSE-NEXT:    # kill: def $ax killed $ax killed $eax747; SSE-NEXT:    retq748;749; AVX1-LABEL: test_v16i16_legal_sext:750; AVX1:       # %bb.0:751; AVX1-NEXT:    vextractf128 $1, %ymm1, %xmm2752; AVX1-NEXT:    vextractf128 $1, %ymm0, %xmm3753; AVX1-NEXT:    vpcmpgtw %xmm2, %xmm3, %xmm2754; AVX1-NEXT:    vpcmpgtw %xmm1, %xmm0, %xmm0755; AVX1-NEXT:    vpacksswb %xmm2, %xmm0, %xmm0756; AVX1-NEXT:    vpmovmskb %xmm0, %eax757; AVX1-NEXT:    cmpl $65535, %eax # imm = 0xFFFF758; AVX1-NEXT:    sete %al759; AVX1-NEXT:    negb %al760; AVX1-NEXT:    movsbl %al, %eax761; AVX1-NEXT:    # kill: def $ax killed $ax killed $eax762; AVX1-NEXT:    vzeroupper763; AVX1-NEXT:    retq764;765; AVX2-LABEL: test_v16i16_legal_sext:766; AVX2:       # %bb.0:767; AVX2-NEXT:    vpcmpgtw %ymm1, %ymm0, %ymm0768; AVX2-NEXT:    vpmovmskb %ymm0, %eax769; AVX2-NEXT:    cmpl $-1, %eax770; AVX2-NEXT:    sete %al771; AVX2-NEXT:    negb %al772; AVX2-NEXT:    movsbl %al, %eax773; AVX2-NEXT:    # kill: def $ax killed $ax killed $eax774; AVX2-NEXT:    vzeroupper775; AVX2-NEXT:    retq776;777; AVX512-LABEL: test_v16i16_legal_sext:778; AVX512:       # %bb.0:779; AVX512-NEXT:    vpcmpgtw %ymm1, %ymm0, %k0780; AVX512-NEXT:    vpmovm2b %k0, %xmm0781; AVX512-NEXT:    vpmovmskb %xmm0, %eax782; AVX512-NEXT:    cmpl $65535, %eax # imm = 0xFFFF783; AVX512-NEXT:    sete %al784; AVX512-NEXT:    negb %al785; AVX512-NEXT:    movsbl %al, %eax786; AVX512-NEXT:    # kill: def $ax killed $ax killed $eax787; AVX512-NEXT:    vzeroupper788; AVX512-NEXT:    retq789  %c  = icmp sgt <16 x i16> %a0, %a1790  %s  = sext <16 x i1> %c to <16 x i8>791  %1  = shufflevector <16 x i8> %s, <16 x i8> undef, <16 x i32> <i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>792  %2  = and <16 x i8> %s, %1793  %3  = shufflevector <16 x i8> %2, <16 x i8> undef, <16 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>794  %4  = and <16 x i8> %2, %3795  %5  = shufflevector <16 x i8> %4, <16 x i8> undef, <16 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>796  %6  = and <16 x i8> %4, %5797  %7  = shufflevector <16 x i8> %6, <16 x i8> undef, <16 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>798  %8  = and <16 x i8> %6, %7799  %9  = extractelement <16 x i8> %8, i32 0800  %10 = sext i8 %9 to i16801  ret i16 %10802}803 804define i8 @test_v16i8_sext(<16 x i8> %a0, <16 x i8> %a1) {805; SSE-LABEL: test_v16i8_sext:806; SSE:       # %bb.0:807; SSE-NEXT:    pcmpgtb %xmm1, %xmm0808; SSE-NEXT:    pmovmskb %xmm0, %eax809; SSE-NEXT:    cmpl $65535, %eax # imm = 0xFFFF810; SSE-NEXT:    sete %al811; SSE-NEXT:    negb %al812; SSE-NEXT:    retq813;814; AVX-LABEL: test_v16i8_sext:815; AVX:       # %bb.0:816; AVX-NEXT:    vpcmpgtb %xmm1, %xmm0, %xmm0817; AVX-NEXT:    vpmovmskb %xmm0, %eax818; AVX-NEXT:    cmpl $65535, %eax # imm = 0xFFFF819; AVX-NEXT:    sete %al820; AVX-NEXT:    negb %al821; AVX-NEXT:    retq822  %c = icmp sgt <16 x i8> %a0, %a1823  %s = sext <16 x i1> %c to <16 x i8>824  %1 = shufflevector <16 x i8> %s, <16 x i8> undef, <16 x i32> <i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>825  %2 = and <16 x i8> %s, %1826  %3 = shufflevector <16 x i8> %2, <16 x i8> undef, <16 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>827  %4 = and <16 x i8> %2, %3828  %5 = shufflevector <16 x i8> %4, <16 x i8> undef, <16 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>829  %6 = and <16 x i8> %4, %5830  %7 = shufflevector <16 x i8> %6, <16 x i8> undef, <16 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>831  %8 = and <16 x i8> %6, %7832  %9 = extractelement <16 x i8> %8, i32 0833  ret i8 %9834}835 836define i8 @test_v32i8_sext(<32 x i8> %a0, <32 x i8> %a1) {837; SSE-LABEL: test_v32i8_sext:838; SSE:       # %bb.0:839; SSE-NEXT:    pcmpgtb %xmm3, %xmm1840; SSE-NEXT:    pcmpgtb %xmm2, %xmm0841; SSE-NEXT:    pand %xmm1, %xmm0842; SSE-NEXT:    pmovmskb %xmm0, %eax843; SSE-NEXT:    cmpl $65535, %eax # imm = 0xFFFF844; SSE-NEXT:    sete %al845; SSE-NEXT:    negb %al846; SSE-NEXT:    retq847;848; AVX1-LABEL: test_v32i8_sext:849; AVX1:       # %bb.0:850; AVX1-NEXT:    vextractf128 $1, %ymm1, %xmm2851; AVX1-NEXT:    vextractf128 $1, %ymm0, %xmm3852; AVX1-NEXT:    vpcmpgtb %xmm2, %xmm3, %xmm2853; AVX1-NEXT:    vpcmpgtb %xmm1, %xmm0, %xmm0854; AVX1-NEXT:    vpand %xmm2, %xmm0, %xmm0855; AVX1-NEXT:    vpmovmskb %xmm0, %eax856; AVX1-NEXT:    cmpl $65535, %eax # imm = 0xFFFF857; AVX1-NEXT:    sete %al858; AVX1-NEXT:    negb %al859; AVX1-NEXT:    vzeroupper860; AVX1-NEXT:    retq861;862; AVX2-LABEL: test_v32i8_sext:863; AVX2:       # %bb.0:864; AVX2-NEXT:    vpcmpgtb %ymm1, %ymm0, %ymm0865; AVX2-NEXT:    vpmovmskb %ymm0, %eax866; AVX2-NEXT:    cmpl $-1, %eax867; AVX2-NEXT:    sete %al868; AVX2-NEXT:    negb %al869; AVX2-NEXT:    vzeroupper870; AVX2-NEXT:    retq871;872; AVX512-LABEL: test_v32i8_sext:873; AVX512:       # %bb.0:874; AVX512-NEXT:    vpcmpgtb %ymm1, %ymm0, %ymm0875; AVX512-NEXT:    vpmovmskb %ymm0, %eax876; AVX512-NEXT:    cmpl $-1, %eax877; AVX512-NEXT:    sete %al878; AVX512-NEXT:    negb %al879; AVX512-NEXT:    vzeroupper880; AVX512-NEXT:    retq881  %c  = icmp sgt <32 x i8> %a0, %a1882  %s  = sext <32 x i1> %c to <32 x i8>883  %1  = shufflevector <32 x i8> %s, <32 x i8> undef, <32 x i32> <i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>884  %2  = and <32 x i8> %s, %1885  %3  = shufflevector <32 x i8> %2, <32 x i8> undef, <32 x i32> <i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>886  %4  = and <32 x i8> %2, %3887  %5  = shufflevector <32 x i8> %4, <32 x i8> undef, <32 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>888  %6  = and <32 x i8> %4, %5889  %7  = shufflevector <32 x i8> %6, <32 x i8> undef, <32 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>890  %8  = and <32 x i8> %6, %7891  %9  = shufflevector <32 x i8> %8, <32 x i8> undef, <32 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>892  %10 = and <32 x i8> %8, %9893  %11 = extractelement <32 x i8> %10, i32 0894  ret i8 %11895}896 897; Should not "MOVMSK(PCMPEQ(..)) -> PTESTZ(..)" when cmp result has muti-uses.898define i32 @test_v32i8_muti_uses(<32 x i8> %x, <32 x i8>%y, i32 %z) {899; SSE-LABEL: test_v32i8_muti_uses:900; SSE:       # %bb.0:901; SSE-NEXT:    pcmpeqb %xmm2, %xmm0902; SSE-NEXT:    pmovmskb %xmm0, %eax903; SSE-NEXT:    pcmpeqb %xmm3, %xmm1904; SSE-NEXT:    pmovmskb %xmm1, %ecx905; SSE-NEXT:    shll $16, %ecx906; SSE-NEXT:    orl %eax, %ecx907; SSE-NEXT:    cmpl $-1, %ecx908; SSE-NEXT:    movl $16, %eax909; SSE-NEXT:    cmovnel %ecx, %eax910; SSE-NEXT:    retq911;912; AVX1-LABEL: test_v32i8_muti_uses:913; AVX1:       # %bb.0:914; AVX1-NEXT:    vpcmpeqb %xmm1, %xmm0, %xmm2915; AVX1-NEXT:    vpmovmskb %xmm2, %eax916; AVX1-NEXT:    vextractf128 $1, %ymm1, %xmm1917; AVX1-NEXT:    vextractf128 $1, %ymm0, %xmm0918; AVX1-NEXT:    vpcmpeqb %xmm1, %xmm0, %xmm0919; AVX1-NEXT:    vpmovmskb %xmm0, %ecx920; AVX1-NEXT:    shll $16, %ecx921; AVX1-NEXT:    orl %eax, %ecx922; AVX1-NEXT:    cmpl $-1, %ecx923; AVX1-NEXT:    movl $16, %eax924; AVX1-NEXT:    cmovnel %ecx, %eax925; AVX1-NEXT:    vzeroupper926; AVX1-NEXT:    retq927;928; AVX2-LABEL: test_v32i8_muti_uses:929; AVX2:       # %bb.0:930; AVX2-NEXT:    vpcmpeqb %ymm1, %ymm0, %ymm0931; AVX2-NEXT:    vpmovmskb %ymm0, %ecx932; AVX2-NEXT:    cmpl $-1, %ecx933; AVX2-NEXT:    movl $16, %eax934; AVX2-NEXT:    cmovnel %ecx, %eax935; AVX2-NEXT:    vzeroupper936; AVX2-NEXT:    retq937;938; AVX512-LABEL: test_v32i8_muti_uses:939; AVX512:       # %bb.0:940; AVX512-NEXT:    vpcmpeqb %ymm1, %ymm0, %k0941; AVX512-NEXT:    kortestd %k0, %k0942; AVX512-NEXT:    kmovd %k0, %ecx943; AVX512-NEXT:    movl $16, %eax944; AVX512-NEXT:    cmovael %ecx, %eax945; AVX512-NEXT:    vzeroupper946; AVX512-NEXT:    retq947  %a = icmp eq <32 x i8> %x, %y948  %b = bitcast <32 x i1> %a to i32949  %c = icmp eq i32 %b, -1950  %res = select i1 %c, i32 16, i32 %b951  ret i32 %res952}953 954define i1 @bool_reduction_v2f64(<2 x double> %x, <2 x double> %y) {955; SSE-LABEL: bool_reduction_v2f64:956; SSE:       # %bb.0:957; SSE-NEXT:    cmpltpd %xmm0, %xmm1958; SSE-NEXT:    movmskpd %xmm1, %eax959; SSE-NEXT:    cmpl $3, %eax960; SSE-NEXT:    sete %al961; SSE-NEXT:    retq962;963; AVX1OR2-LABEL: bool_reduction_v2f64:964; AVX1OR2:       # %bb.0:965; AVX1OR2-NEXT:    vcmpltpd %xmm0, %xmm1, %xmm0966; AVX1OR2-NEXT:    vpcmpeqd %xmm1, %xmm1, %xmm1967; AVX1OR2-NEXT:    vtestpd %xmm1, %xmm0968; AVX1OR2-NEXT:    setb %al969; AVX1OR2-NEXT:    retq970;971; AVX512-LABEL: bool_reduction_v2f64:972; AVX512:       # %bb.0:973; AVX512-NEXT:    vcmpltpd %xmm0, %xmm1, %k0974; AVX512-NEXT:    kmovd %k0, %eax975; AVX512-NEXT:    cmpb $3, %al976; AVX512-NEXT:    sete %al977; AVX512-NEXT:    retq978  %a = fcmp ogt <2 x double> %x, %y979  %b = shufflevector <2 x i1> %a, <2 x i1> undef, <2 x i32> <i32 1, i32 undef>980  %c = and <2 x i1> %a, %b981  %d = extractelement <2 x i1> %c, i32 0982  ret i1 %d983}984 985define i1 @bool_reduction_v4f32(<4 x float> %x, <4 x float> %y) {986; SSE-LABEL: bool_reduction_v4f32:987; SSE:       # %bb.0:988; SSE-NEXT:    cmpeqps %xmm1, %xmm0989; SSE-NEXT:    movmskps %xmm0, %eax990; SSE-NEXT:    cmpl $15, %eax991; SSE-NEXT:    sete %al992; SSE-NEXT:    retq993;994; AVX1OR2-LABEL: bool_reduction_v4f32:995; AVX1OR2:       # %bb.0:996; AVX1OR2-NEXT:    vcmpeqps %xmm1, %xmm0, %xmm0997; AVX1OR2-NEXT:    vpcmpeqd %xmm1, %xmm1, %xmm1998; AVX1OR2-NEXT:    vtestps %xmm1, %xmm0999; AVX1OR2-NEXT:    setb %al1000; AVX1OR2-NEXT:    retq1001;1002; AVX512-LABEL: bool_reduction_v4f32:1003; AVX512:       # %bb.0:1004; AVX512-NEXT:    vcmpeqps %xmm1, %xmm0, %k01005; AVX512-NEXT:    kmovd %k0, %eax1006; AVX512-NEXT:    cmpb $15, %al1007; AVX512-NEXT:    sete %al1008; AVX512-NEXT:    retq1009  %a = fcmp oeq <4 x float> %x, %y1010  %s1 = shufflevector <4 x i1> %a, <4 x i1> undef, <4 x i32> <i32 2, i32 3, i32 undef, i32 undef>1011  %b = and <4 x i1> %s1, %a1012  %s2 = shufflevector <4 x i1> %b, <4 x i1> undef, <4 x i32> <i32 1, i32 undef, i32 undef, i32 undef>1013  %c = and <4 x i1> %s2, %b1014  %d = extractelement <4 x i1> %c, i32 01015  ret i1 %d1016}1017 1018define i1 @bool_reduction_v4f64(<4 x double> %x, <4 x double> %y) {1019; SSE-LABEL: bool_reduction_v4f64:1020; SSE:       # %bb.0:1021; SSE-NEXT:    cmplepd %xmm1, %xmm31022; SSE-NEXT:    cmplepd %xmm0, %xmm21023; SSE-NEXT:    shufps {{.*#+}} xmm2 = xmm2[0,2],xmm3[0,2]1024; SSE-NEXT:    movmskps %xmm2, %eax1025; SSE-NEXT:    cmpl $15, %eax1026; SSE-NEXT:    sete %al1027; SSE-NEXT:    retq1028;1029; AVX1-LABEL: bool_reduction_v4f64:1030; AVX1:       # %bb.0:1031; AVX1-NEXT:    vcmplepd %ymm0, %ymm1, %ymm01032; AVX1-NEXT:    vxorpd %xmm1, %xmm1, %xmm11033; AVX1-NEXT:    vcmptrueps %ymm1, %ymm1, %ymm11034; AVX1-NEXT:    vtestpd %ymm1, %ymm01035; AVX1-NEXT:    setb %al1036; AVX1-NEXT:    vzeroupper1037; AVX1-NEXT:    retq1038;1039; AVX2-LABEL: bool_reduction_v4f64:1040; AVX2:       # %bb.0:1041; AVX2-NEXT:    vcmplepd %ymm0, %ymm1, %ymm01042; AVX2-NEXT:    vpcmpeqd %ymm1, %ymm1, %ymm11043; AVX2-NEXT:    vtestpd %ymm1, %ymm01044; AVX2-NEXT:    setb %al1045; AVX2-NEXT:    vzeroupper1046; AVX2-NEXT:    retq1047;1048; AVX512-LABEL: bool_reduction_v4f64:1049; AVX512:       # %bb.0:1050; AVX512-NEXT:    vcmplepd %ymm0, %ymm1, %k01051; AVX512-NEXT:    kmovd %k0, %eax1052; AVX512-NEXT:    cmpb $15, %al1053; AVX512-NEXT:    sete %al1054; AVX512-NEXT:    vzeroupper1055; AVX512-NEXT:    retq1056  %a = fcmp oge <4 x double> %x, %y1057  %s1 = shufflevector <4 x i1> %a, <4 x i1> undef, <4 x i32> <i32 2, i32 3, i32 undef, i32 undef>1058  %b = and <4 x i1> %s1, %a1059  %s2 = shufflevector <4 x i1> %b, <4 x i1> undef, <4 x i32> <i32 1, i32 undef, i32 undef, i32 undef>1060  %c = and <4 x i1> %s2, %b1061  %d = extractelement <4 x i1> %c, i32 01062  ret i1 %d1063}1064 1065define i1 @bool_reduction_v8f32(<8 x float> %x, <8 x float> %y) {1066; SSE-LABEL: bool_reduction_v8f32:1067; SSE:       # %bb.0:1068; SSE-NEXT:    cmpneqps %xmm3, %xmm11069; SSE-NEXT:    cmpneqps %xmm2, %xmm01070; SSE-NEXT:    packssdw %xmm1, %xmm01071; SSE-NEXT:    packsswb %xmm0, %xmm01072; SSE-NEXT:    pmovmskb %xmm0, %eax1073; SSE-NEXT:    cmpb $-1, %al1074; SSE-NEXT:    sete %al1075; SSE-NEXT:    retq1076;1077; AVX1-LABEL: bool_reduction_v8f32:1078; AVX1:       # %bb.0:1079; AVX1-NEXT:    vcmpneqps %ymm1, %ymm0, %ymm01080; AVX1-NEXT:    vxorps %xmm1, %xmm1, %xmm11081; AVX1-NEXT:    vcmptrueps %ymm1, %ymm1, %ymm11082; AVX1-NEXT:    vtestps %ymm1, %ymm01083; AVX1-NEXT:    setb %al1084; AVX1-NEXT:    vzeroupper1085; AVX1-NEXT:    retq1086;1087; AVX2-LABEL: bool_reduction_v8f32:1088; AVX2:       # %bb.0:1089; AVX2-NEXT:    vcmpneqps %ymm1, %ymm0, %ymm01090; AVX2-NEXT:    vpcmpeqd %ymm1, %ymm1, %ymm11091; AVX2-NEXT:    vtestps %ymm1, %ymm01092; AVX2-NEXT:    setb %al1093; AVX2-NEXT:    vzeroupper1094; AVX2-NEXT:    retq1095;1096; AVX512-LABEL: bool_reduction_v8f32:1097; AVX512:       # %bb.0:1098; AVX512-NEXT:    vcmpneqps %ymm1, %ymm0, %k01099; AVX512-NEXT:    kmovd %k0, %eax1100; AVX512-NEXT:    cmpb $-1, %al1101; AVX512-NEXT:    sete %al1102; AVX512-NEXT:    vzeroupper1103; AVX512-NEXT:    retq1104  %a = fcmp une <8 x float> %x, %y1105  %s1 = shufflevector <8 x i1> %a, <8 x i1> undef, <8 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef>1106  %b = and <8 x i1> %s1, %a1107  %s2 = shufflevector <8 x i1> %b, <8 x i1> undef, <8 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>1108  %c = and <8 x i1> %s2, %b1109  %s3 = shufflevector <8 x i1> %c, <8 x i1> undef, <8 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>1110  %d = and <8 x i1> %s3, %c1111  %e = extractelement <8 x i1> %d, i32 01112  ret i1 %e1113}1114 1115define i1 @bool_reduction_v2i64(<2 x i64> %x, <2 x i64> %y) {1116; SSE2-LABEL: bool_reduction_v2i64:1117; SSE2:       # %bb.0:1118; SSE2-NEXT:    pcmpeqd %xmm1, %xmm01119; SSE2-NEXT:    pshufd {{.*#+}} xmm1 = xmm0[1,0,3,2]1120; SSE2-NEXT:    pand %xmm0, %xmm11121; SSE2-NEXT:    movmskpd %xmm1, %eax1122; SSE2-NEXT:    testl %eax, %eax1123; SSE2-NEXT:    sete %al1124; SSE2-NEXT:    retq1125;1126; SSE42-LABEL: bool_reduction_v2i64:1127; SSE42:       # %bb.0:1128; SSE42-NEXT:    pcmpeqq %xmm1, %xmm01129; SSE42-NEXT:    movmskpd %xmm0, %eax1130; SSE42-NEXT:    testl %eax, %eax1131; SSE42-NEXT:    sete %al1132; SSE42-NEXT:    retq1133;1134; AVX1OR2-LABEL: bool_reduction_v2i64:1135; AVX1OR2:       # %bb.0:1136; AVX1OR2-NEXT:    vpcmpeqq %xmm1, %xmm0, %xmm01137; AVX1OR2-NEXT:    vtestpd %xmm0, %xmm01138; AVX1OR2-NEXT:    sete %al1139; AVX1OR2-NEXT:    retq1140;1141; AVX512-LABEL: bool_reduction_v2i64:1142; AVX512:       # %bb.0:1143; AVX512-NEXT:    vpcmpneqq %xmm1, %xmm0, %k01144; AVX512-NEXT:    kmovd %k0, %eax1145; AVX512-NEXT:    cmpb $3, %al1146; AVX512-NEXT:    sete %al1147; AVX512-NEXT:    retq1148  %a = icmp ne <2 x i64> %x, %y1149  %b = shufflevector <2 x i1> %a, <2 x i1> undef, <2 x i32> <i32 1, i32 undef>1150  %c = and <2 x i1> %a, %b1151  %d = extractelement <2 x i1> %c, i32 01152  ret i1 %d1153}1154 1155define i1 @bool_reduction_v4i32(<4 x i32> %x, <4 x i32> %y) {1156; SSE2-LABEL: bool_reduction_v4i32:1157; SSE2:       # %bb.0:1158; SSE2-NEXT:    movdqa {{.*#+}} xmm2 = [2147483648,2147483648,2147483648,2147483648]1159; SSE2-NEXT:    pxor %xmm2, %xmm11160; SSE2-NEXT:    pxor %xmm2, %xmm01161; SSE2-NEXT:    pcmpgtd %xmm1, %xmm01162; SSE2-NEXT:    movmskps %xmm0, %eax1163; SSE2-NEXT:    cmpl $15, %eax1164; SSE2-NEXT:    sete %al1165; SSE2-NEXT:    retq1166;1167; SSE42-LABEL: bool_reduction_v4i32:1168; SSE42:       # %bb.0:1169; SSE42-NEXT:    pminud %xmm0, %xmm11170; SSE42-NEXT:    pcmpeqd %xmm0, %xmm11171; SSE42-NEXT:    movmskps %xmm1, %eax1172; SSE42-NEXT:    testl %eax, %eax1173; SSE42-NEXT:    sete %al1174; SSE42-NEXT:    retq1175;1176; AVX1OR2-LABEL: bool_reduction_v4i32:1177; AVX1OR2:       # %bb.0:1178; AVX1OR2-NEXT:    vpminud %xmm1, %xmm0, %xmm11179; AVX1OR2-NEXT:    vpcmpeqd %xmm1, %xmm0, %xmm01180; AVX1OR2-NEXT:    vtestps %xmm0, %xmm01181; AVX1OR2-NEXT:    sete %al1182; AVX1OR2-NEXT:    retq1183;1184; AVX512-LABEL: bool_reduction_v4i32:1185; AVX512:       # %bb.0:1186; AVX512-NEXT:    vpcmpnleud %xmm1, %xmm0, %k01187; AVX512-NEXT:    kmovd %k0, %eax1188; AVX512-NEXT:    cmpb $15, %al1189; AVX512-NEXT:    sete %al1190; AVX512-NEXT:    retq1191  %a = icmp ugt <4 x i32> %x, %y1192  %s1 = shufflevector <4 x i1> %a, <4 x i1> undef, <4 x i32> <i32 2, i32 3, i32 undef, i32 undef>1193  %b = and <4 x i1> %s1, %a1194  %s2 = shufflevector <4 x i1> %b, <4 x i1> undef, <4 x i32> <i32 1, i32 undef, i32 undef, i32 undef>1195  %c = and <4 x i1> %s2, %b1196  %d = extractelement <4 x i1> %c, i32 01197  ret i1 %d1198}1199 1200define i1 @bool_reduction_v8i16(<8 x i16> %x, <8 x i16> %y) {1201; SSE-LABEL: bool_reduction_v8i16:1202; SSE:       # %bb.0:1203; SSE-NEXT:    pcmpgtw %xmm0, %xmm11204; SSE-NEXT:    packsswb %xmm1, %xmm11205; SSE-NEXT:    pmovmskb %xmm1, %eax1206; SSE-NEXT:    cmpb $-1, %al1207; SSE-NEXT:    sete %al1208; SSE-NEXT:    retq1209;1210; AVX1OR2-LABEL: bool_reduction_v8i16:1211; AVX1OR2:       # %bb.0:1212; AVX1OR2-NEXT:    vpcmpgtw %xmm0, %xmm1, %xmm01213; AVX1OR2-NEXT:    vpacksswb %xmm0, %xmm0, %xmm01214; AVX1OR2-NEXT:    vpmovmskb %xmm0, %eax1215; AVX1OR2-NEXT:    cmpb $-1, %al1216; AVX1OR2-NEXT:    sete %al1217; AVX1OR2-NEXT:    retq1218;1219; AVX512-LABEL: bool_reduction_v8i16:1220; AVX512:       # %bb.0:1221; AVX512-NEXT:    vpcmpgtw %xmm0, %xmm1, %k01222; AVX512-NEXT:    kmovd %k0, %eax1223; AVX512-NEXT:    cmpb $-1, %al1224; AVX512-NEXT:    sete %al1225; AVX512-NEXT:    retq1226  %a = icmp slt <8 x i16> %x, %y1227  %s1 = shufflevector <8 x i1> %a, <8 x i1> undef, <8 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef>1228  %b = and <8 x i1> %s1, %a1229  %s2 = shufflevector <8 x i1> %b, <8 x i1> undef, <8 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>1230  %c = and <8 x i1> %s2, %b1231  %s3 = shufflevector <8 x i1> %c, <8 x i1> undef, <8 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>1232  %d = and <8 x i1> %s3, %c1233  %e = extractelement <8 x i1> %d, i32 01234  ret i1 %e1235}1236 1237define i1 @bool_reduction_v16i8(<16 x i8> %x, <16 x i8> %y) {1238; SSE-LABEL: bool_reduction_v16i8:1239; SSE:       # %bb.0:1240; SSE-NEXT:    pcmpgtb %xmm1, %xmm01241; SSE-NEXT:    pmovmskb %xmm0, %eax1242; SSE-NEXT:    cmpl $65535, %eax # imm = 0xFFFF1243; SSE-NEXT:    sete %al1244; SSE-NEXT:    retq1245;1246; AVX1OR2-LABEL: bool_reduction_v16i8:1247; AVX1OR2:       # %bb.0:1248; AVX1OR2-NEXT:    vpcmpgtb %xmm1, %xmm0, %xmm01249; AVX1OR2-NEXT:    vpmovmskb %xmm0, %eax1250; AVX1OR2-NEXT:    cmpl $65535, %eax # imm = 0xFFFF1251; AVX1OR2-NEXT:    sete %al1252; AVX1OR2-NEXT:    retq1253;1254; AVX512-LABEL: bool_reduction_v16i8:1255; AVX512:       # %bb.0:1256; AVX512-NEXT:    vpcmpgtb %xmm1, %xmm0, %k01257; AVX512-NEXT:    kortestw %k0, %k01258; AVX512-NEXT:    setb %al1259; AVX512-NEXT:    retq1260  %a = icmp sgt <16 x i8> %x, %y1261  %s1 = shufflevector <16 x i1> %a, <16 x i1> undef, <16 x i32> <i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>1262  %b = and <16 x i1> %s1, %a1263  %s2 = shufflevector <16 x i1> %b, <16 x i1> undef, <16 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>1264  %c = and <16 x i1> %s2, %b1265  %s3 = shufflevector <16 x i1> %c, <16 x i1> undef, <16 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>1266  %d = and <16 x i1> %s3, %c1267  %s4 = shufflevector <16 x i1> %d, <16 x i1> undef, <16 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>1268  %e = and <16 x i1> %s4, %d1269  %f = extractelement <16 x i1> %e, i32 01270  ret i1 %f1271}1272 1273define i1 @bool_reduction_v4i64(<4 x i64> %x, <4 x i64> %y) {1274; SSE2-LABEL: bool_reduction_v4i64:1275; SSE2:       # %bb.0:1276; SSE2-NEXT:    movdqa {{.*#+}} xmm4 = [2147483648,2147483648]1277; SSE2-NEXT:    pxor %xmm4, %xmm11278; SSE2-NEXT:    pxor %xmm4, %xmm31279; SSE2-NEXT:    movdqa %xmm3, %xmm51280; SSE2-NEXT:    pcmpgtd %xmm1, %xmm51281; SSE2-NEXT:    pxor %xmm4, %xmm01282; SSE2-NEXT:    pxor %xmm4, %xmm21283; SSE2-NEXT:    movdqa %xmm2, %xmm41284; SSE2-NEXT:    pcmpgtd %xmm0, %xmm41285; SSE2-NEXT:    movdqa %xmm4, %xmm61286; SSE2-NEXT:    shufps {{.*#+}} xmm6 = xmm6[0,2],xmm5[0,2]1287; SSE2-NEXT:    pcmpeqd %xmm1, %xmm31288; SSE2-NEXT:    pcmpeqd %xmm0, %xmm21289; SSE2-NEXT:    shufps {{.*#+}} xmm2 = xmm2[1,3],xmm3[1,3]1290; SSE2-NEXT:    andps %xmm6, %xmm21291; SSE2-NEXT:    shufps {{.*#+}} xmm4 = xmm4[1,3],xmm5[1,3]1292; SSE2-NEXT:    orps %xmm2, %xmm41293; SSE2-NEXT:    movmskps %xmm4, %eax1294; SSE2-NEXT:    cmpl $15, %eax1295; SSE2-NEXT:    sete %al1296; SSE2-NEXT:    retq1297;1298; SSE42-LABEL: bool_reduction_v4i64:1299; SSE42:       # %bb.0:1300; SSE42-NEXT:    pcmpgtq %xmm1, %xmm31301; SSE42-NEXT:    pcmpgtq %xmm0, %xmm21302; SSE42-NEXT:    packssdw %xmm3, %xmm21303; SSE42-NEXT:    movmskps %xmm2, %eax1304; SSE42-NEXT:    cmpl $15, %eax1305; SSE42-NEXT:    sete %al1306; SSE42-NEXT:    retq1307;1308; AVX1-LABEL: bool_reduction_v4i64:1309; AVX1:       # %bb.0:1310; AVX1-NEXT:    vextractf128 $1, %ymm0, %xmm21311; AVX1-NEXT:    vextractf128 $1, %ymm1, %xmm31312; AVX1-NEXT:    vpcmpgtq %xmm2, %xmm3, %xmm21313; AVX1-NEXT:    vpcmpgtq %xmm0, %xmm1, %xmm01314; AVX1-NEXT:    vpand %xmm2, %xmm0, %xmm01315; AVX1-NEXT:    vpcmpeqd %xmm1, %xmm1, %xmm11316; AVX1-NEXT:    vtestpd %xmm1, %xmm01317; AVX1-NEXT:    setb %al1318; AVX1-NEXT:    vzeroupper1319; AVX1-NEXT:    retq1320;1321; AVX2-LABEL: bool_reduction_v4i64:1322; AVX2:       # %bb.0:1323; AVX2-NEXT:    vpcmpgtq %ymm0, %ymm1, %ymm01324; AVX2-NEXT:    vpcmpeqd %ymm1, %ymm1, %ymm11325; AVX2-NEXT:    vtestpd %ymm1, %ymm01326; AVX2-NEXT:    setb %al1327; AVX2-NEXT:    vzeroupper1328; AVX2-NEXT:    retq1329;1330; AVX512-LABEL: bool_reduction_v4i64:1331; AVX512:       # %bb.0:1332; AVX512-NEXT:    vpcmpgtq %ymm0, %ymm1, %k01333; AVX512-NEXT:    kmovd %k0, %eax1334; AVX512-NEXT:    cmpb $15, %al1335; AVX512-NEXT:    sete %al1336; AVX512-NEXT:    vzeroupper1337; AVX512-NEXT:    retq1338  %a = icmp slt <4 x i64> %x, %y1339  %s1 = shufflevector <4 x i1> %a, <4 x i1> undef, <4 x i32> <i32 2, i32 3, i32 undef, i32 undef>1340  %b = and <4 x i1> %s1, %a1341  %s2 = shufflevector <4 x i1> %b, <4 x i1> undef, <4 x i32> <i32 1, i32 undef, i32 undef, i32 undef>1342  %c = and <4 x i1> %s2, %b1343  %d = extractelement <4 x i1> %c, i32 01344  ret i1 %d1345}1346 1347define i1 @bool_reduction_v8i32(<8 x i32> %x, <8 x i32> %y) {1348; SSE2-LABEL: bool_reduction_v8i32:1349; SSE2:       # %bb.0:1350; SSE2-NEXT:    movdqa {{.*#+}} xmm4 = [2147483648,2147483648,2147483648,2147483648]1351; SSE2-NEXT:    pxor %xmm4, %xmm31352; SSE2-NEXT:    pxor %xmm4, %xmm11353; SSE2-NEXT:    pcmpgtd %xmm3, %xmm11354; SSE2-NEXT:    pxor %xmm4, %xmm21355; SSE2-NEXT:    pxor %xmm4, %xmm01356; SSE2-NEXT:    pcmpgtd %xmm2, %xmm01357; SSE2-NEXT:    packssdw %xmm1, %xmm01358; SSE2-NEXT:    packsswb %xmm0, %xmm01359; SSE2-NEXT:    pmovmskb %xmm0, %eax1360; SSE2-NEXT:    notl %eax1361; SSE2-NEXT:    cmpb $-1, %al1362; SSE2-NEXT:    sete %al1363; SSE2-NEXT:    retq1364;1365; SSE42-LABEL: bool_reduction_v8i32:1366; SSE42:       # %bb.0:1367; SSE42-NEXT:    pminud %xmm1, %xmm31368; SSE42-NEXT:    pcmpeqd %xmm1, %xmm31369; SSE42-NEXT:    pminud %xmm0, %xmm21370; SSE42-NEXT:    pcmpeqd %xmm0, %xmm21371; SSE42-NEXT:    packssdw %xmm3, %xmm21372; SSE42-NEXT:    packsswb %xmm2, %xmm21373; SSE42-NEXT:    pmovmskb %xmm2, %eax1374; SSE42-NEXT:    cmpb $-1, %al1375; SSE42-NEXT:    sete %al1376; SSE42-NEXT:    retq1377;1378; AVX1-LABEL: bool_reduction_v8i32:1379; AVX1:       # %bb.0:1380; AVX1-NEXT:    vextractf128 $1, %ymm1, %xmm21381; AVX1-NEXT:    vextractf128 $1, %ymm0, %xmm31382; AVX1-NEXT:    vpminud %xmm2, %xmm3, %xmm21383; AVX1-NEXT:    vpxor %xmm2, %xmm3, %xmm21384; AVX1-NEXT:    vpminud %xmm1, %xmm0, %xmm11385; AVX1-NEXT:    vpxor %xmm1, %xmm0, %xmm01386; AVX1-NEXT:    vpor %xmm2, %xmm0, %xmm01387; AVX1-NEXT:    vptest %xmm0, %xmm01388; AVX1-NEXT:    sete %al1389; AVX1-NEXT:    vzeroupper1390; AVX1-NEXT:    retq1391;1392; AVX2-LABEL: bool_reduction_v8i32:1393; AVX2:       # %bb.0:1394; AVX2-NEXT:    vpminud %ymm1, %ymm0, %ymm11395; AVX2-NEXT:    vpxor %ymm1, %ymm0, %ymm01396; AVX2-NEXT:    vptest %ymm0, %ymm01397; AVX2-NEXT:    sete %al1398; AVX2-NEXT:    vzeroupper1399; AVX2-NEXT:    retq1400;1401; AVX512-LABEL: bool_reduction_v8i32:1402; AVX512:       # %bb.0:1403; AVX512-NEXT:    vpcmpleud %ymm1, %ymm0, %k01404; AVX512-NEXT:    kmovd %k0, %eax1405; AVX512-NEXT:    cmpb $-1, %al1406; AVX512-NEXT:    sete %al1407; AVX512-NEXT:    vzeroupper1408; AVX512-NEXT:    retq1409  %a = icmp ule <8 x i32> %x, %y1410  %s1 = shufflevector <8 x i1> %a, <8 x i1> undef, <8 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef>1411  %b = and <8 x i1> %s1, %a1412  %s2 = shufflevector <8 x i1> %b, <8 x i1> undef, <8 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>1413  %c = and <8 x i1> %s2, %b1414  %s3 = shufflevector <8 x i1> %c, <8 x i1> undef, <8 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>1415  %d = and <8 x i1> %s3, %c1416  %e = extractelement <8 x i1> %d, i32 01417  ret i1 %e1418}1419 1420define i1 @bool_reduction_v16i16(<16 x i16> %x, <16 x i16> %y) {1421; SSE2-LABEL: bool_reduction_v16i16:1422; SSE2:       # %bb.0:1423; SSE2-NEXT:    pcmpeqb %xmm3, %xmm11424; SSE2-NEXT:    pcmpeqb %xmm2, %xmm01425; SSE2-NEXT:    pand %xmm1, %xmm01426; SSE2-NEXT:    pmovmskb %xmm0, %eax1427; SSE2-NEXT:    xorl $65535, %eax # imm = 0xFFFF1428; SSE2-NEXT:    sete %al1429; SSE2-NEXT:    retq1430;1431; SSE42-LABEL: bool_reduction_v16i16:1432; SSE42:       # %bb.0:1433; SSE42-NEXT:    pxor %xmm3, %xmm11434; SSE42-NEXT:    pxor %xmm2, %xmm01435; SSE42-NEXT:    por %xmm1, %xmm01436; SSE42-NEXT:    ptest %xmm0, %xmm01437; SSE42-NEXT:    sete %al1438; SSE42-NEXT:    retq1439;1440; AVX1-LABEL: bool_reduction_v16i16:1441; AVX1:       # %bb.0:1442; AVX1-NEXT:    vxorps %ymm1, %ymm0, %ymm01443; AVX1-NEXT:    vptest %ymm0, %ymm01444; AVX1-NEXT:    sete %al1445; AVX1-NEXT:    vzeroupper1446; AVX1-NEXT:    retq1447;1448; AVX2-LABEL: bool_reduction_v16i16:1449; AVX2:       # %bb.0:1450; AVX2-NEXT:    vpxor %ymm1, %ymm0, %ymm01451; AVX2-NEXT:    vptest %ymm0, %ymm01452; AVX2-NEXT:    sete %al1453; AVX2-NEXT:    vzeroupper1454; AVX2-NEXT:    retq1455;1456; AVX512-LABEL: bool_reduction_v16i16:1457; AVX512:       # %bb.0:1458; AVX512-NEXT:    vpxor %ymm1, %ymm0, %ymm01459; AVX512-NEXT:    vptest %ymm0, %ymm01460; AVX512-NEXT:    sete %al1461; AVX512-NEXT:    vzeroupper1462; AVX512-NEXT:    retq1463  %a = icmp eq <16 x i16> %x, %y1464  %s1 = shufflevector <16 x i1> %a, <16 x i1> undef, <16 x i32> <i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>1465  %b = and <16 x i1> %s1, %a1466  %s2 = shufflevector <16 x i1> %b, <16 x i1> undef, <16 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>1467  %c = and <16 x i1> %s2, %b1468  %s3 = shufflevector <16 x i1> %c, <16 x i1> undef, <16 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>1469  %d = and <16 x i1> %s3, %c1470  %s4 = shufflevector <16 x i1> %d, <16 x i1> undef, <16 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>1471  %e = and <16 x i1> %s4, %d1472  %f = extractelement <16 x i1> %e, i32 01473  ret i1 %f1474}1475 1476define i1 @bool_reduction_v32i8(<32 x i8> %x, <32 x i8> %y) {1477; SSE2-LABEL: bool_reduction_v32i8:1478; SSE2:       # %bb.0:1479; SSE2-NEXT:    pcmpeqb %xmm3, %xmm11480; SSE2-NEXT:    pcmpeqb %xmm2, %xmm01481; SSE2-NEXT:    pand %xmm1, %xmm01482; SSE2-NEXT:    pmovmskb %xmm0, %eax1483; SSE2-NEXT:    xorl $65535, %eax # imm = 0xFFFF1484; SSE2-NEXT:    sete %al1485; SSE2-NEXT:    retq1486;1487; SSE42-LABEL: bool_reduction_v32i8:1488; SSE42:       # %bb.0:1489; SSE42-NEXT:    pxor %xmm3, %xmm11490; SSE42-NEXT:    pxor %xmm2, %xmm01491; SSE42-NEXT:    por %xmm1, %xmm01492; SSE42-NEXT:    ptest %xmm0, %xmm01493; SSE42-NEXT:    sete %al1494; SSE42-NEXT:    retq1495;1496; AVX1-LABEL: bool_reduction_v32i8:1497; AVX1:       # %bb.0:1498; AVX1-NEXT:    vxorps %ymm1, %ymm0, %ymm01499; AVX1-NEXT:    vptest %ymm0, %ymm01500; AVX1-NEXT:    sete %al1501; AVX1-NEXT:    vzeroupper1502; AVX1-NEXT:    retq1503;1504; AVX2-LABEL: bool_reduction_v32i8:1505; AVX2:       # %bb.0:1506; AVX2-NEXT:    vpxor %ymm1, %ymm0, %ymm01507; AVX2-NEXT:    vptest %ymm0, %ymm01508; AVX2-NEXT:    sete %al1509; AVX2-NEXT:    vzeroupper1510; AVX2-NEXT:    retq1511;1512; AVX512-LABEL: bool_reduction_v32i8:1513; AVX512:       # %bb.0:1514; AVX512-NEXT:    vpxor %ymm1, %ymm0, %ymm01515; AVX512-NEXT:    vptest %ymm0, %ymm01516; AVX512-NEXT:    sete %al1517; AVX512-NEXT:    vzeroupper1518; AVX512-NEXT:    retq1519  %a = icmp eq <32 x i8> %x, %y1520  %s1 = shufflevector <32 x i1> %a, <32 x i1> undef, <32 x i32> <i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>1521  %b = and <32 x i1> %s1, %a1522  %s2 = shufflevector <32 x i1> %b, <32 x i1> undef, <32 x i32> <i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>1523  %c = and <32 x i1> %s2, %b1524  %s3 = shufflevector <32 x i1> %c, <32 x i1> undef, <32 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>1525  %d = and <32 x i1> %s3, %c1526  %s4 = shufflevector <32 x i1> %d, <32 x i1> undef, <32 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>1527  %e = and <32 x i1> %s4, %d1528  %s5 = shufflevector <32 x i1> %e, <32 x i1> undef, <32 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>1529  %f = and <32 x i1> %s5, %e1530  %g = extractelement <32 x i1> %f, i32 01531  ret i1 %g1532}1533 1534; PR598671535define i1 @select_v2i8(ptr %s0, ptr %s1) {1536; SSE2-LABEL: select_v2i8:1537; SSE2:       # %bb.0:1538; SSE2-NEXT:    movzwl (%rdi), %eax1539; SSE2-NEXT:    movd %eax, %xmm01540; SSE2-NEXT:    movzwl (%rsi), %eax1541; SSE2-NEXT:    movd %eax, %xmm11542; SSE2-NEXT:    pcmpeqb %xmm0, %xmm11543; SSE2-NEXT:    punpcklbw {{.*#+}} xmm1 = xmm1[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]1544; SSE2-NEXT:    pshuflw {{.*#+}} xmm0 = xmm1[0,0,1,1,4,5,6,7]1545; SSE2-NEXT:    pshufd {{.*#+}} xmm0 = xmm0[0,0,1,1]1546; SSE2-NEXT:    movmskpd %xmm0, %eax1547; SSE2-NEXT:    cmpl $3, %eax1548; SSE2-NEXT:    sete %al1549; SSE2-NEXT:    retq1550;1551; SSE42-LABEL: select_v2i8:1552; SSE42:       # %bb.0:1553; SSE42-NEXT:    movzwl (%rdi), %eax1554; SSE42-NEXT:    movd %eax, %xmm01555; SSE42-NEXT:    movzwl (%rsi), %eax1556; SSE42-NEXT:    movd %eax, %xmm11557; SSE42-NEXT:    pcmpeqb %xmm0, %xmm11558; SSE42-NEXT:    pmovsxbq %xmm1, %xmm01559; SSE42-NEXT:    movmskpd %xmm0, %eax1560; SSE42-NEXT:    cmpl $3, %eax1561; SSE42-NEXT:    sete %al1562; SSE42-NEXT:    retq1563;1564; AVX1OR2-LABEL: select_v2i8:1565; AVX1OR2:       # %bb.0:1566; AVX1OR2-NEXT:    movzwl (%rdi), %eax1567; AVX1OR2-NEXT:    vmovd %eax, %xmm01568; AVX1OR2-NEXT:    movzwl (%rsi), %eax1569; AVX1OR2-NEXT:    vmovd %eax, %xmm11570; AVX1OR2-NEXT:    vpcmpeqb %xmm1, %xmm0, %xmm01571; AVX1OR2-NEXT:    vpmovsxbq %xmm0, %xmm01572; AVX1OR2-NEXT:    vpcmpeqd %xmm1, %xmm1, %xmm11573; AVX1OR2-NEXT:    vtestpd %xmm1, %xmm01574; AVX1OR2-NEXT:    setb %al1575; AVX1OR2-NEXT:    retq1576;1577; AVX512-LABEL: select_v2i8:1578; AVX512:       # %bb.0:1579; AVX512-NEXT:    movzwl (%rdi), %eax1580; AVX512-NEXT:    vmovd %eax, %xmm01581; AVX512-NEXT:    movzwl (%rsi), %eax1582; AVX512-NEXT:    vmovd %eax, %xmm11583; AVX512-NEXT:    vpcmpeqb %xmm1, %xmm0, %k01584; AVX512-NEXT:    knotw %k0, %k01585; AVX512-NEXT:    kmovd %k0, %eax1586; AVX512-NEXT:    testb $3, %al1587; AVX512-NEXT:    sete %al1588; AVX512-NEXT:    retq1589  %v0 = load <2 x i8>, ptr %s0, align 11590  %v1 = load <2 x i8>, ptr %s1, align 11591  %cmp = icmp eq <2 x i8> %v0, %v11592  %cmp0 = extractelement <2 x i1> %cmp, i32 01593  %cmp1 = extractelement <2 x i1> %cmp, i32 11594  %res = select i1 %cmp0, i1 %cmp1, i1 false1595  ret i1 %res1596}1597 1598define i1 @PR116977(<32 x i8> %a, <32 x i8> %b, <32 x i8> %v) {1599; SSE-LABEL: PR116977:1600; SSE:       # %bb.0:1601; SSE-NEXT:    pcmpeqb %xmm4, %xmm01602; SSE-NEXT:    pcmpeqb %xmm5, %xmm11603; SSE-NEXT:    pcmpeqb %xmm4, %xmm21604; SSE-NEXT:    pand %xmm0, %xmm21605; SSE-NEXT:    pcmpeqb %xmm5, %xmm31606; SSE-NEXT:    pand %xmm1, %xmm31607; SSE-NEXT:    pand %xmm2, %xmm31608; SSE-NEXT:    pmovmskb %xmm3, %eax1609; SSE-NEXT:    cmpl $65535, %eax # imm = 0xFFFF1610; SSE-NEXT:    sete %al1611; SSE-NEXT:    retq1612;1613; AVX1-LABEL: PR116977:1614; AVX1:       # %bb.0:1615; AVX1-NEXT:    vpcmpeqb %xmm0, %xmm2, %xmm31616; AVX1-NEXT:    vextractf128 $1, %ymm0, %xmm01617; AVX1-NEXT:    vextractf128 $1, %ymm2, %xmm41618; AVX1-NEXT:    vpcmpeqb %xmm0, %xmm4, %xmm01619; AVX1-NEXT:    vpcmpeqb %xmm1, %xmm2, %xmm21620; AVX1-NEXT:    vpand %xmm2, %xmm3, %xmm21621; AVX1-NEXT:    vextractf128 $1, %ymm1, %xmm11622; AVX1-NEXT:    vpcmpeqb %xmm1, %xmm4, %xmm11623; AVX1-NEXT:    vpand %xmm1, %xmm0, %xmm01624; AVX1-NEXT:    vpand %xmm0, %xmm2, %xmm01625; AVX1-NEXT:    vpmovmskb %xmm0, %eax1626; AVX1-NEXT:    xorl $65535, %eax # imm = 0xFFFF1627; AVX1-NEXT:    sete %al1628; AVX1-NEXT:    vzeroupper1629; AVX1-NEXT:    retq1630;1631; AVX2-LABEL: PR116977:1632; AVX2:       # %bb.0:1633; AVX2-NEXT:    vpxor %ymm0, %ymm2, %ymm01634; AVX2-NEXT:    vpxor %ymm1, %ymm2, %ymm11635; AVX2-NEXT:    vpor %ymm1, %ymm0, %ymm01636; AVX2-NEXT:    vptest %ymm0, %ymm01637; AVX2-NEXT:    sete %al1638; AVX2-NEXT:    vzeroupper1639; AVX2-NEXT:    retq1640;1641; AVX512-LABEL: PR116977:1642; AVX512:       # %bb.0:1643; AVX512-NEXT:    vpcmpneqb %ymm0, %ymm2, %k01644; AVX512-NEXT:    vpcmpneqb %ymm1, %ymm2, %k11645; AVX512-NEXT:    kortestd %k1, %k01646; AVX512-NEXT:    sete %al1647; AVX512-NEXT:    vzeroupper1648; AVX512-NEXT:    retq1649  %ca = icmp ne <32 x i8> %v, %a1650  %cb = icmp ne <32 x i8> %v, %b1651  %or = or <32 x i1> %ca, %cb1652  %scl = bitcast <32 x i1> %or to i321653  %cmp = icmp eq i32 %scl, 01654  ret i1 %cmp1655}1656