Skip to content

Commit 07c1422

Browse files
rotaterighttstellar
authored andcommitted
Merging r372883:
------------------------------------------------------------------------ r372883 | spatel | 2019-09-25 07:57:45 -0700 (Wed, 25 Sep 2019) | 1 line [x86] add test for multi-use scalarization of vector binop; NFC ------------------------------------------------------------------------
1 parent 0acab01 commit 07c1422

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

llvm/test/CodeGen/X86/scalarize-fp.ll

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -773,3 +773,29 @@ define <8 x float> @splat0_fdiv_const_op0_v8f32(<8 x float> %vx) {
773773
%r = shufflevector <8 x float> %b, <8 x float> undef, <8 x i32> zeroinitializer
774774
ret <8 x float> %r
775775
}
776+
777+
define <4 x float> @multi_use_binop(<4 x float> %x, <4 x float> %y) {
778+
; SSE-LABEL: multi_use_binop:
779+
; SSE: # %bb.0:
780+
; SSE-NEXT: movaps %xmm0, %xmm2
781+
; SSE-NEXT: mulps %xmm1, %xmm2
782+
; SSE-NEXT: mulss %xmm1, %xmm0
783+
; SSE-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,0,0,0]
784+
; SSE-NEXT: movlhps {{.*#+}} xmm1 = xmm1[0],xmm2[0]
785+
; SSE-NEXT: addps %xmm1, %xmm0
786+
; SSE-NEXT: retq
787+
;
788+
; AVX-LABEL: multi_use_binop:
789+
; AVX: # %bb.0:
790+
; AVX-NEXT: vmulps %xmm1, %xmm0, %xmm2
791+
; AVX-NEXT: vmulss %xmm1, %xmm0, %xmm0
792+
; AVX-NEXT: vpermilps {{.*#+}} xmm0 = xmm0[0,0,0,0]
793+
; AVX-NEXT: vmovddup {{.*#+}} xmm1 = xmm2[0,0]
794+
; AVX-NEXT: vaddps %xmm1, %xmm0, %xmm0
795+
; AVX-NEXT: retq
796+
%mul = fmul <4 x float> %x, %y
797+
%mul0 = shufflevector <4 x float> %mul, <4 x float> undef, <4 x i32> <i32 undef, i32 undef, i32 undef, i32 0>
798+
%mul1 = shufflevector <4 x float> %mul, <4 x float> undef, <4 x i32> <i32 undef, i32 undef, i32 undef, i32 1>
799+
%r = fadd <4 x float> %mul0, %mul1
800+
ret <4 x float> %r
801+
}

0 commit comments

Comments
 (0)