[llvm] r359238 - [x86] add tests for vector fdiv reciprocal estimate; NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 25 13:35:47 PDT 2019


Author: spatel
Date: Thu Apr 25 13:35:47 2019
New Revision: 359238

URL: http://llvm.org/viewvc/llvm-project?rev=359238&view=rev
Log:
[x86] add tests for vector fdiv reciprocal estimate; NFC

Modified:
    llvm/trunk/test/CodeGen/X86/fdiv-combine-vec.ll

Modified: llvm/trunk/test/CodeGen/X86/fdiv-combine-vec.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/fdiv-combine-vec.ll?rev=359238&r1=359237&r2=359238&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/fdiv-combine-vec.ll (original)
+++ llvm/trunk/test/CodeGen/X86/fdiv-combine-vec.ll Thu Apr 25 13:35:47 2019
@@ -105,3 +105,67 @@ define <8 x float> @splat_fdiv_v8f32(<8
   %r = fdiv fast <8 x float> %x, %splaty
   ret <8 x float> %r
 }
+
+define <4 x float> @splat_fdiv_v4f32_estimate(<4 x float> %x, float %y) #0 {
+; SSE-LABEL: splat_fdiv_v4f32_estimate:
+; SSE:       # %bb.0:
+; SSE-NEXT:    shufps {{.*#+}} xmm1 = xmm1[0,0,0,0]
+; SSE-NEXT:    rcpps %xmm1, %xmm2
+; SSE-NEXT:    mulps %xmm2, %xmm1
+; SSE-NEXT:    movaps {{.*#+}} xmm3 = [1.0E+0,1.0E+0,1.0E+0,1.0E+0]
+; SSE-NEXT:    subps %xmm1, %xmm3
+; SSE-NEXT:    mulps %xmm2, %xmm3
+; SSE-NEXT:    addps %xmm2, %xmm3
+; SSE-NEXT:    mulps %xmm3, %xmm0
+; SSE-NEXT:    retq
+;
+; AVX-LABEL: splat_fdiv_v4f32_estimate:
+; AVX:       # %bb.0:
+; AVX-NEXT:    vpermilps {{.*#+}} xmm1 = xmm1[0,0,0,0]
+; AVX-NEXT:    vrcpps %xmm1, %xmm2
+; AVX-NEXT:    vmulps %xmm2, %xmm1, %xmm1
+; AVX-NEXT:    vmovaps {{.*#+}} xmm3 = [1.0E+0,1.0E+0,1.0E+0,1.0E+0]
+; AVX-NEXT:    vsubps %xmm1, %xmm3, %xmm1
+; AVX-NEXT:    vmulps %xmm1, %xmm2, %xmm1
+; AVX-NEXT:    vaddps %xmm1, %xmm2, %xmm1
+; AVX-NEXT:    vmulps %xmm1, %xmm0, %xmm0
+; AVX-NEXT:    retq
+  %vy = insertelement <4 x float> undef, float %y, i32 0
+  %splaty = shufflevector <4 x float> %vy, <4 x float> undef, <4 x i32> zeroinitializer
+  %r = fdiv arcp reassoc <4 x float> %x, %splaty
+  ret <4 x float> %r
+}
+
+define <8 x float> @splat_fdiv_v8f32_estimate(<8 x float> %x, float %y) #0 {
+; SSE-LABEL: splat_fdiv_v8f32_estimate:
+; SSE:       # %bb.0:
+; SSE-NEXT:    rcpss %xmm2, %xmm3
+; SSE-NEXT:    mulss %xmm3, %xmm2
+; SSE-NEXT:    movss {{.*#+}} xmm4 = mem[0],zero,zero,zero
+; SSE-NEXT:    subss %xmm2, %xmm4
+; SSE-NEXT:    mulss %xmm3, %xmm4
+; SSE-NEXT:    addss %xmm3, %xmm4
+; SSE-NEXT:    shufps {{.*#+}} xmm4 = xmm4[0,0,0,0]
+; SSE-NEXT:    mulps %xmm4, %xmm0
+; SSE-NEXT:    mulps %xmm4, %xmm1
+; SSE-NEXT:    retq
+;
+; AVX-LABEL: splat_fdiv_v8f32_estimate:
+; AVX:       # %bb.0:
+; AVX-NEXT:    vpermilps {{.*#+}} xmm1 = xmm1[0,0,0,0]
+; AVX-NEXT:    vinsertf128 $1, %xmm1, %ymm1, %ymm1
+; AVX-NEXT:    vrcpps %ymm1, %ymm2
+; AVX-NEXT:    vmulps %ymm2, %ymm1, %ymm1
+; AVX-NEXT:    vmovaps {{.*#+}} ymm3 = [1.0E+0,1.0E+0,1.0E+0,1.0E+0,1.0E+0,1.0E+0,1.0E+0,1.0E+0]
+; AVX-NEXT:    vsubps %ymm1, %ymm3, %ymm1
+; AVX-NEXT:    vmulps %ymm1, %ymm2, %ymm1
+; AVX-NEXT:    vaddps %ymm1, %ymm2, %ymm1
+; AVX-NEXT:    vmulps %ymm1, %ymm0, %ymm0
+; AVX-NEXT:    retq
+  %vy = insertelement <8 x float> undef, float %y, i32 0
+  %splaty = shufflevector <8 x float> %vy, <8 x float> undef, <8 x i32> zeroinitializer
+  %r = fdiv fast <8 x float> %x, %splaty
+  ret <8 x float> %r
+}
+
+attributes #0 = { "reciprocal-estimates"="divf,vec-divf" }




More information about the llvm-commits mailing list