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=x86_64-unknown-unknown -mattr=+sse2 | FileCheck %s --check-prefix=SSE --check-prefix=SSE2
      3 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+sse4.1 | FileCheck %s --check-prefix=SSE --check-prefix=SSE41
      4 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx | FileCheck %s --check-prefix=AVX --check-prefix=AVX1
      5 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx2 | FileCheck %s --check-prefix=AVX --check-prefix=AVX2
      6 
      7 define <2 x i16> @test_urem_unary_v2i16() nounwind {
      8 ; SSE-LABEL: test_urem_unary_v2i16:
      9 ; SSE:       # %bb.0:
     10 ; SSE-NEXT:    xorps %xmm0, %xmm0
     11 ; SSE-NEXT:    retq
     12 ;
     13 ; AVX-LABEL: test_urem_unary_v2i16:
     14 ; AVX:       # %bb.0:
     15 ; AVX-NEXT:    vxorps %xmm0, %xmm0, %xmm0
     16 ; AVX-NEXT:    retq
     17   %I8 = insertelement <2 x i16> zeroinitializer, i16 -1, i32 0
     18   %I9 = insertelement <2 x i16> %I8, i16 -1, i32 1
     19   %B9 = urem <2 x i16> %I9, %I9
     20   ret <2 x i16> %B9
     21 }
     22 
     23 define <4 x i32> @PR20355(<4 x i32> %a) nounwind {
     24 ; SSE2-LABEL: PR20355:
     25 ; SSE2:       # %bb.0: # %entry
     26 ; SSE2-NEXT:    movdqa {{.*#+}} xmm1 = [1431655766,1431655766,1431655766,1431655766]
     27 ; SSE2-NEXT:    movdqa %xmm1, %xmm2
     28 ; SSE2-NEXT:    psrad $31, %xmm2
     29 ; SSE2-NEXT:    pand %xmm0, %xmm2
     30 ; SSE2-NEXT:    movdqa %xmm0, %xmm3
     31 ; SSE2-NEXT:    psrad $31, %xmm3
     32 ; SSE2-NEXT:    pand %xmm1, %xmm3
     33 ; SSE2-NEXT:    paddd %xmm2, %xmm3
     34 ; SSE2-NEXT:    pshufd {{.*#+}} xmm2 = xmm0[1,1,3,3]
     35 ; SSE2-NEXT:    pmuludq %xmm1, %xmm0
     36 ; SSE2-NEXT:    pshufd {{.*#+}} xmm4 = xmm0[1,3,2,3]
     37 ; SSE2-NEXT:    pshufd {{.*#+}} xmm0 = xmm1[1,1,3,3]
     38 ; SSE2-NEXT:    pmuludq %xmm2, %xmm0
     39 ; SSE2-NEXT:    pshufd {{.*#+}} xmm0 = xmm0[1,3,2,3]
     40 ; SSE2-NEXT:    punpckldq {{.*#+}} xmm4 = xmm4[0],xmm0[0],xmm4[1],xmm0[1]
     41 ; SSE2-NEXT:    psubd %xmm3, %xmm4
     42 ; SSE2-NEXT:    movdqa %xmm4, %xmm0
     43 ; SSE2-NEXT:    psrld $31, %xmm0
     44 ; SSE2-NEXT:    paddd %xmm4, %xmm0
     45 ; SSE2-NEXT:    retq
     46 ;
     47 ; SSE41-LABEL: PR20355:
     48 ; SSE41:       # %bb.0: # %entry
     49 ; SSE41-NEXT:    pshufd {{.*#+}} xmm1 = xmm0[1,1,3,3]
     50 ; SSE41-NEXT:    movdqa {{.*#+}} xmm2 = [1431655766,1431655766,1431655766,1431655766]
     51 ; SSE41-NEXT:    pmuldq %xmm2, %xmm1
     52 ; SSE41-NEXT:    pmuldq %xmm2, %xmm0
     53 ; SSE41-NEXT:    pshufd {{.*#+}} xmm2 = xmm0[1,1,3,3]
     54 ; SSE41-NEXT:    pblendw {{.*#+}} xmm2 = xmm2[0,1],xmm1[2,3],xmm2[4,5],xmm1[6,7]
     55 ; SSE41-NEXT:    movdqa %xmm2, %xmm0
     56 ; SSE41-NEXT:    psrld $31, %xmm0
     57 ; SSE41-NEXT:    paddd %xmm2, %xmm0
     58 ; SSE41-NEXT:    retq
     59 ;
     60 ; AVX1-LABEL: PR20355:
     61 ; AVX1:       # %bb.0: # %entry
     62 ; AVX1-NEXT:    vpshufd {{.*#+}} xmm1 = xmm0[1,1,3,3]
     63 ; AVX1-NEXT:    vmovdqa {{.*#+}} xmm2 = [1431655766,1431655766,1431655766,1431655766]
     64 ; AVX1-NEXT:    vpmuldq %xmm2, %xmm1, %xmm1
     65 ; AVX1-NEXT:    vpmuldq %xmm2, %xmm0, %xmm0
     66 ; AVX1-NEXT:    vpshufd {{.*#+}} xmm0 = xmm0[1,1,3,3]
     67 ; AVX1-NEXT:    vpblendw {{.*#+}} xmm0 = xmm0[0,1],xmm1[2,3],xmm0[4,5],xmm1[6,7]
     68 ; AVX1-NEXT:    vpsrld $31, %xmm0, %xmm1
     69 ; AVX1-NEXT:    vpaddd %xmm1, %xmm0, %xmm0
     70 ; AVX1-NEXT:    retq
     71 ;
     72 ; AVX2-LABEL: PR20355:
     73 ; AVX2:       # %bb.0: # %entry
     74 ; AVX2-NEXT:    vpbroadcastd {{.*#+}} xmm1 = [1431655766,1431655766,1431655766,1431655766]
     75 ; AVX2-NEXT:    vpshufd {{.*#+}} xmm2 = xmm1[1,1,3,3]
     76 ; AVX2-NEXT:    vpshufd {{.*#+}} xmm3 = xmm0[1,1,3,3]
     77 ; AVX2-NEXT:    vpmuldq %xmm2, %xmm3, %xmm2
     78 ; AVX2-NEXT:    vpmuldq %xmm1, %xmm0, %xmm0
     79 ; AVX2-NEXT:    vpshufd {{.*#+}} xmm0 = xmm0[1,1,3,3]
     80 ; AVX2-NEXT:    vpblendd {{.*#+}} xmm0 = xmm0[0],xmm2[1],xmm0[2],xmm2[3]
     81 ; AVX2-NEXT:    vpsrld $31, %xmm0, %xmm1
     82 ; AVX2-NEXT:    vpaddd %xmm1, %xmm0, %xmm0
     83 ; AVX2-NEXT:    retq
     84 entry:
     85   %sdiv = sdiv <4 x i32> %a, <i32 3, i32 3, i32 3, i32 3>
     86   ret <4 x i32> %sdiv
     87 }
     88