Home | History | Annotate | Download | only in X86
      1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
      2 ; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=+sse3 | FileCheck %s --check-prefix=SSE3
      3 ; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=+sse4.1 | FileCheck %s --check-prefix=SSE41
      4 ; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=+avx | FileCheck %s --check-prefix=AVX-32
      5 ; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=+avx2 | FileCheck %s --check-prefix=AVX-32
      6 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx2 | FileCheck %s --check-prefix=AVX-64
      7 
      8 define <3 x i16> @zext_i8(<3 x i8>) {
      9 ; SSE3-LABEL: zext_i8:
     10 ; SSE3:       # %bb.0:
     11 ; SSE3-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
     12 ; SSE3-NEXT:    movzbl {{[0-9]+}}(%esp), %ecx
     13 ; SSE3-NEXT:    movzbl {{[0-9]+}}(%esp), %edx
     14 ; SSE3-NEXT:    movd %edx, %xmm0
     15 ; SSE3-NEXT:    pinsrw $1, %ecx, %xmm0
     16 ; SSE3-NEXT:    pinsrw $2, %eax, %xmm0
     17 ; SSE3-NEXT:    pextrw $0, %xmm0, %eax
     18 ; SSE3-NEXT:    pextrw $1, %xmm0, %edx
     19 ; SSE3-NEXT:    pextrw $2, %xmm0, %ecx
     20 ; SSE3-NEXT:    # kill: def $ax killed $ax killed $eax
     21 ; SSE3-NEXT:    # kill: def $dx killed $dx killed $edx
     22 ; SSE3-NEXT:    # kill: def $cx killed $cx killed $ecx
     23 ; SSE3-NEXT:    retl
     24 ;
     25 ; SSE41-LABEL: zext_i8:
     26 ; SSE41:       # %bb.0:
     27 ; SSE41-NEXT:    pxor %xmm0, %xmm0
     28 ; SSE41-NEXT:    pinsrb $0, {{[0-9]+}}(%esp), %xmm0
     29 ; SSE41-NEXT:    pinsrb $4, {{[0-9]+}}(%esp), %xmm0
     30 ; SSE41-NEXT:    pinsrb $8, {{[0-9]+}}(%esp), %xmm0
     31 ; SSE41-NEXT:    movd %xmm0, %eax
     32 ; SSE41-NEXT:    pextrw $2, %xmm0, %edx
     33 ; SSE41-NEXT:    pextrw $4, %xmm0, %ecx
     34 ; SSE41-NEXT:    # kill: def $ax killed $ax killed $eax
     35 ; SSE41-NEXT:    # kill: def $dx killed $dx killed $edx
     36 ; SSE41-NEXT:    # kill: def $cx killed $cx killed $ecx
     37 ; SSE41-NEXT:    retl
     38 ;
     39 ; AVX-32-LABEL: zext_i8:
     40 ; AVX-32:       # %bb.0:
     41 ; AVX-32-NEXT:    vpxor %xmm0, %xmm0, %xmm0
     42 ; AVX-32-NEXT:    vpinsrb $0, {{[0-9]+}}(%esp), %xmm0, %xmm0
     43 ; AVX-32-NEXT:    vpinsrb $4, {{[0-9]+}}(%esp), %xmm0, %xmm0
     44 ; AVX-32-NEXT:    vpinsrb $8, {{[0-9]+}}(%esp), %xmm0, %xmm0
     45 ; AVX-32-NEXT:    vmovd %xmm0, %eax
     46 ; AVX-32-NEXT:    vpextrw $2, %xmm0, %edx
     47 ; AVX-32-NEXT:    vpextrw $4, %xmm0, %ecx
     48 ; AVX-32-NEXT:    # kill: def $ax killed $ax killed $eax
     49 ; AVX-32-NEXT:    # kill: def $dx killed $dx killed $edx
     50 ; AVX-32-NEXT:    # kill: def $cx killed $cx killed $ecx
     51 ; AVX-32-NEXT:    retl
     52 ;
     53 ; AVX-64-LABEL: zext_i8:
     54 ; AVX-64:       # %bb.0:
     55 ; AVX-64-NEXT:    vmovd %edi, %xmm0
     56 ; AVX-64-NEXT:    vpinsrd $1, %esi, %xmm0, %xmm0
     57 ; AVX-64-NEXT:    vpinsrd $2, %edx, %xmm0, %xmm0
     58 ; AVX-64-NEXT:    vpand {{.*}}(%rip), %xmm0, %xmm0
     59 ; AVX-64-NEXT:    vmovd %xmm0, %eax
     60 ; AVX-64-NEXT:    vpextrw $2, %xmm0, %edx
     61 ; AVX-64-NEXT:    vpextrw $4, %xmm0, %ecx
     62 ; AVX-64-NEXT:    # kill: def $ax killed $ax killed $eax
     63 ; AVX-64-NEXT:    # kill: def $dx killed $dx killed $edx
     64 ; AVX-64-NEXT:    # kill: def $cx killed $cx killed $ecx
     65 ; AVX-64-NEXT:    retq
     66   %2 = zext <3 x i8> %0 to <3 x i16>
     67   ret <3 x i16> %2
     68 }
     69 
     70 define <3 x i16> @sext_i8(<3 x i8>) {
     71 ; SSE3-LABEL: sext_i8:
     72 ; SSE3:       # %bb.0:
     73 ; SSE3-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
     74 ; SSE3-NEXT:    movzbl {{[0-9]+}}(%esp), %ecx
     75 ; SSE3-NEXT:    movzbl {{[0-9]+}}(%esp), %edx
     76 ; SSE3-NEXT:    movd %edx, %xmm0
     77 ; SSE3-NEXT:    pinsrw $1, %ecx, %xmm0
     78 ; SSE3-NEXT:    pinsrw $2, %eax, %xmm0
     79 ; SSE3-NEXT:    psllw $8, %xmm0
     80 ; SSE3-NEXT:    psraw $8, %xmm0
     81 ; SSE3-NEXT:    punpcklwd {{.*#+}} xmm0 = xmm0[0,0,1,1,2,2,3,3]
     82 ; SSE3-NEXT:    psrad $16, %xmm0
     83 ; SSE3-NEXT:    movd %xmm0, %eax
     84 ; SSE3-NEXT:    pextrw $2, %xmm0, %edx
     85 ; SSE3-NEXT:    pextrw $4, %xmm0, %ecx
     86 ; SSE3-NEXT:    # kill: def $ax killed $ax killed $eax
     87 ; SSE3-NEXT:    # kill: def $dx killed $dx killed $edx
     88 ; SSE3-NEXT:    # kill: def $cx killed $cx killed $ecx
     89 ; SSE3-NEXT:    retl
     90 ;
     91 ; SSE41-LABEL: sext_i8:
     92 ; SSE41:       # %bb.0:
     93 ; SSE41-NEXT:    movd {{.*#+}} xmm0 = mem[0],zero,zero,zero
     94 ; SSE41-NEXT:    pinsrb $4, {{[0-9]+}}(%esp), %xmm0
     95 ; SSE41-NEXT:    pinsrb $8, {{[0-9]+}}(%esp), %xmm0
     96 ; SSE41-NEXT:    pslld $24, %xmm0
     97 ; SSE41-NEXT:    psrad $24, %xmm0
     98 ; SSE41-NEXT:    movd %xmm0, %eax
     99 ; SSE41-NEXT:    pextrw $2, %xmm0, %edx
    100 ; SSE41-NEXT:    pextrw $4, %xmm0, %ecx
    101 ; SSE41-NEXT:    # kill: def $ax killed $ax killed $eax
    102 ; SSE41-NEXT:    # kill: def $dx killed $dx killed $edx
    103 ; SSE41-NEXT:    # kill: def $cx killed $cx killed $ecx
    104 ; SSE41-NEXT:    retl
    105 ;
    106 ; AVX-32-LABEL: sext_i8:
    107 ; AVX-32:       # %bb.0:
    108 ; AVX-32-NEXT:    vmovd {{.*#+}} xmm0 = mem[0],zero,zero,zero
    109 ; AVX-32-NEXT:    vpinsrb $4, {{[0-9]+}}(%esp), %xmm0, %xmm0
    110 ; AVX-32-NEXT:    vpinsrb $8, {{[0-9]+}}(%esp), %xmm0, %xmm0
    111 ; AVX-32-NEXT:    vpslld $24, %xmm0, %xmm0
    112 ; AVX-32-NEXT:    vpsrad $24, %xmm0, %xmm0
    113 ; AVX-32-NEXT:    vmovd %xmm0, %eax
    114 ; AVX-32-NEXT:    vpextrw $2, %xmm0, %edx
    115 ; AVX-32-NEXT:    vpextrw $4, %xmm0, %ecx
    116 ; AVX-32-NEXT:    # kill: def $ax killed $ax killed $eax
    117 ; AVX-32-NEXT:    # kill: def $dx killed $dx killed $edx
    118 ; AVX-32-NEXT:    # kill: def $cx killed $cx killed $ecx
    119 ; AVX-32-NEXT:    retl
    120 ;
    121 ; AVX-64-LABEL: sext_i8:
    122 ; AVX-64:       # %bb.0:
    123 ; AVX-64-NEXT:    vmovd %edi, %xmm0
    124 ; AVX-64-NEXT:    vpinsrd $1, %esi, %xmm0, %xmm0
    125 ; AVX-64-NEXT:    vpinsrd $2, %edx, %xmm0, %xmm0
    126 ; AVX-64-NEXT:    vpslld $24, %xmm0, %xmm0
    127 ; AVX-64-NEXT:    vpsrad $24, %xmm0, %xmm0
    128 ; AVX-64-NEXT:    vmovd %xmm0, %eax
    129 ; AVX-64-NEXT:    vpextrw $2, %xmm0, %edx
    130 ; AVX-64-NEXT:    vpextrw $4, %xmm0, %ecx
    131 ; AVX-64-NEXT:    # kill: def $ax killed $ax killed $eax
    132 ; AVX-64-NEXT:    # kill: def $dx killed $dx killed $edx
    133 ; AVX-64-NEXT:    # kill: def $cx killed $cx killed $ecx
    134 ; AVX-64-NEXT:    retq
    135   %2 = sext <3 x i8> %0 to <3 x i16>
    136   ret <3 x i16> %2
    137 }
    138