2011-10-10 22:28:47 +00:00
|
|
|
; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7-avx -mattr=+avx | FileCheck %s
|
|
|
|
|
|
|
|
; PR11102
|
|
|
|
define <4 x float> @test1(<4 x float> %a) nounwind {
|
|
|
|
%b = shufflevector <4 x float> zeroinitializer, <4 x float> %a, <4 x i32> <i32 2, i32 5, i32 undef, i32 undef>
|
|
|
|
ret <4 x float> %b
|
|
|
|
; CHECK: test1:
|
|
|
|
; CHECK: vshufps
|
2012-12-07 19:01:13 +00:00
|
|
|
; CHECK: vpshufd
|
2011-10-10 22:28:47 +00:00
|
|
|
}
|
2011-12-08 22:30:45 +00:00
|
|
|
|
|
|
|
; rdar://10538417
|
2011-12-09 21:54:10 +00:00
|
|
|
define <3 x i64> @test2(<2 x i64> %v) nounwind readnone {
|
2011-12-08 22:30:45 +00:00
|
|
|
; CHECK: test2:
|
2012-01-17 21:44:01 +00:00
|
|
|
; CHECK: vinsertf128
|
2011-12-09 21:54:10 +00:00
|
|
|
%1 = shufflevector <2 x i64> %v, <2 x i64> %v, <3 x i32> <i32 0, i32 1, i32 undef>
|
2011-12-08 22:30:45 +00:00
|
|
|
%2 = shufflevector <3 x i64> zeroinitializer, <3 x i64> %1, <3 x i32> <i32 3, i32 4, i32 2>
|
|
|
|
ret <3 x i64> %2
|
2012-01-17 21:44:01 +00:00
|
|
|
; CHECK: ret
|
2011-12-08 22:30:45 +00:00
|
|
|
}
|
2011-12-28 08:14:01 +00:00
|
|
|
|
|
|
|
define <4 x i64> @test3(<4 x i64> %a, <4 x i64> %b) nounwind {
|
|
|
|
%c = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 4, i32 5, i32 2, i32 undef>
|
|
|
|
ret <4 x i64> %c
|
|
|
|
; CHECK: test3:
|
|
|
|
; CHECK: vperm2f128
|
2012-01-17 21:44:01 +00:00
|
|
|
; CHECK: ret
|
2011-12-28 08:14:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
define <8 x float> @test4(float %a) nounwind {
|
|
|
|
%b = insertelement <8 x float> zeroinitializer, float %a, i32 0
|
|
|
|
ret <8 x float> %b
|
|
|
|
; CHECK: test4:
|
|
|
|
; CHECK: vinsertf128
|
2012-01-03 21:05:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
; rdar://10594409
|
|
|
|
define <8 x float> @test5(float* nocapture %f) nounwind uwtable readonly ssp {
|
|
|
|
entry:
|
|
|
|
%0 = bitcast float* %f to <4 x float>*
|
|
|
|
%1 = load <4 x float>* %0, align 16
|
2012-01-14 01:46:51 +00:00
|
|
|
; CHECK: test5
|
2012-01-03 21:05:52 +00:00
|
|
|
; CHECK: vmovaps
|
|
|
|
; CHECK-NOT: vxorps
|
|
|
|
; CHECK-NOT: vinsertf128
|
|
|
|
%shuffle.i = shufflevector <4 x float> %1, <4 x float> <float 0.000000e+00, float undef, float undef, float undef>, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 4, i32 4, i32 4>
|
|
|
|
ret <8 x float> %shuffle.i
|
|
|
|
}
|
|
|
|
|
|
|
|
define <4 x double> @test6(double* nocapture %d) nounwind uwtable readonly ssp {
|
|
|
|
entry:
|
|
|
|
%0 = bitcast double* %d to <2 x double>*
|
|
|
|
%1 = load <2 x double>* %0, align 16
|
2012-01-14 01:46:51 +00:00
|
|
|
; CHECK: test6
|
2012-01-03 21:05:52 +00:00
|
|
|
; CHECK: vmovaps
|
|
|
|
; CHECK-NOT: vxorps
|
|
|
|
; CHECK-NOT: vinsertf128
|
|
|
|
%shuffle.i = shufflevector <2 x double> %1, <2 x double> <double 0.000000e+00, double undef>, <4 x i32> <i32 0, i32 1, i32 2, i32 2>
|
|
|
|
ret <4 x double> %shuffle.i
|
2012-01-12 20:33:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
define <16 x i16> @test7(<4 x i16> %a) nounwind {
|
|
|
|
; CHECK: test7
|
|
|
|
%b = shufflevector <4 x i16> %a, <4 x i16> undef, <16 x i32> <i32 1, 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>
|
2012-01-17 09:13:19 +00:00
|
|
|
; CHECK: ret
|
2012-01-12 20:33:10 +00:00
|
|
|
ret <16 x i16> %b
|
|
|
|
}
|
2012-01-17 09:13:19 +00:00
|
|
|
|
|
|
|
; CHECK: test8
|
|
|
|
define void @test8() {
|
|
|
|
entry:
|
|
|
|
%0 = load <16 x i64> addrspace(1)* null, align 128
|
|
|
|
%1 = shufflevector <16 x i64> <i64 undef, i64 undef, i64 0, i64 undef, i64 0, i64 0, i64 0, i64 0, i64 0, i64 0, i64 undef, i64 0, i64 undef, i64 undef, i64 undef, i64 undef>, <16 x i64> %0, <16 x i32> <i32 17, i32 18, i32 2, i32 undef, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 undef, i32 11, i32 undef, i32 undef, i32 undef, i32 26>
|
|
|
|
%2 = shufflevector <16 x i64> %1, <16 x i64> %0, <16 x i32> <i32 0, i32 1, i32 2, i32 30, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 undef, i32 11, i32 undef, i32 22, i32 20, i32 15>
|
|
|
|
store <16 x i64> %2, <16 x i64> addrspace(1)* undef, align 128
|
|
|
|
; CHECK: ret
|
|
|
|
ret void
|
|
|
|
}
|
2012-01-17 21:44:01 +00:00
|
|
|
|
|
|
|
; Extract a value from a shufflevector..
|
|
|
|
define i32 @test9(<4 x i32> %a) nounwind {
|
|
|
|
; CHECK: test9
|
|
|
|
; CHECK: vpextrd
|
2013-06-25 02:48:58 +00:00
|
|
|
%b = shufflevector <4 x i32> %a, <4 x i32> undef, <8 x i32> <i32 1, i32 1, i32 2, i32 2, i32 3, i32 3, i32 undef, i32 4>
|
2012-01-17 21:44:01 +00:00
|
|
|
%r = extractelement <8 x i32> %b, i32 2
|
|
|
|
; CHECK: ret
|
|
|
|
ret i32 %r
|
|
|
|
}
|
|
|
|
|
|
|
|
; Extract a value which is the result of an undef mask.
|
|
|
|
define i32 @test10(<4 x i32> %a) nounwind {
|
|
|
|
; CHECK: @test10
|
2012-06-25 18:12:18 +00:00
|
|
|
; CHECK-NOT: {{^[^#]*[a-z]}}
|
|
|
|
; CHECK: ret
|
2012-01-17 21:44:01 +00:00
|
|
|
%b = shufflevector <4 x i32> %a, <4 x i32> undef, <8 x i32> <i32 1, i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
|
|
|
|
%r = extractelement <8 x i32> %b, i32 2
|
|
|
|
ret i32 %r
|
|
|
|
}
|
2012-01-30 07:50:31 +00:00
|
|
|
|
|
|
|
define <4 x float> @test11(<4 x float> %a) nounwind {
|
2013-02-16 12:16:56 +00:00
|
|
|
; CHECK: test11
|
|
|
|
; CHECK: vpshufd $27
|
2012-01-30 07:50:31 +00:00
|
|
|
%tmp1 = shufflevector <4 x float> %a, <4 x float> undef, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
|
|
|
|
ret <4 x float> %tmp1
|
|
|
|
}
|
|
|
|
|
|
|
|
define <4 x float> @test12(<4 x float>* %a) nounwind {
|
2012-02-07 06:28:42 +00:00
|
|
|
; CHECK: test12
|
2012-12-07 19:01:13 +00:00
|
|
|
; CHECK: vpshufd
|
2012-01-30 07:50:31 +00:00
|
|
|
%tmp0 = load <4 x float>* %a
|
|
|
|
%tmp1 = shufflevector <4 x float> %tmp0, <4 x float> undef, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
|
|
|
|
ret <4 x float> %tmp1
|
|
|
|
}
|
2012-02-03 13:18:25 +00:00
|
|
|
|
2012-02-07 06:28:42 +00:00
|
|
|
define <4 x i32> @test13(<4 x i32> %a) nounwind {
|
2013-02-16 12:16:56 +00:00
|
|
|
; CHECK: test13
|
|
|
|
; CHECK: vpshufd $27
|
2012-02-07 06:28:42 +00:00
|
|
|
%tmp1 = shufflevector <4 x i32> %a, <4 x i32> undef, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
|
|
|
|
ret <4 x i32> %tmp1
|
|
|
|
}
|
|
|
|
|
|
|
|
define <4 x i32> @test14(<4 x i32>* %a) nounwind {
|
|
|
|
; CHECK: test14
|
|
|
|
; CHECK: vpshufd $27, (
|
|
|
|
%tmp0 = load <4 x i32>* %a
|
|
|
|
%tmp1 = shufflevector <4 x i32> %tmp0, <4 x i32> undef, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
|
|
|
|
ret <4 x i32> %tmp1
|
|
|
|
}
|
|
|
|
|
|
|
|
; CHECK: test15
|
|
|
|
; CHECK: vpshufd $8
|
|
|
|
; CHECK: ret
|
|
|
|
define <4 x i32> @test15(<2 x i32>%x) nounwind readnone {
|
2012-02-03 13:18:25 +00:00
|
|
|
%x1 = shufflevector <2 x i32> %x, <2 x i32> undef, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef>
|
|
|
|
ret <4 x i32>%x1
|
|
|
|
}
|
2012-02-07 06:28:42 +00:00
|
|
|
|
2012-03-09 02:00:48 +00:00
|
|
|
; rdar://10974078
|
|
|
|
define <8 x float> @test16(float* nocapture %f) nounwind uwtable readonly ssp {
|
|
|
|
entry:
|
|
|
|
%0 = bitcast float* %f to <4 x float>*
|
|
|
|
%1 = load <4 x float>* %0, align 8
|
|
|
|
; CHECK: test16
|
|
|
|
; CHECK: vmovups
|
|
|
|
; CHECK-NOT: vxorps
|
|
|
|
; CHECK-NOT: vinsertf128
|
|
|
|
%shuffle.i = shufflevector <4 x float> %1, <4 x float> <float 0.000000e+00, float undef, float undef, float undef>, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 4, i32 4, i32 4>
|
|
|
|
ret <8 x float> %shuffle.i
|
|
|
|
}
|
2012-04-06 14:38:25 +00:00
|
|
|
|
|
|
|
; PR12413
|
2012-05-21 06:40:16 +00:00
|
|
|
; CHECK: shuf1
|
2012-04-06 14:38:25 +00:00
|
|
|
; CHECK: vpshufb
|
|
|
|
; CHECK: vpshufb
|
|
|
|
; CHECK: vpshufb
|
|
|
|
; CHECK: vpshufb
|
2012-05-21 06:40:16 +00:00
|
|
|
define <32 x i8> @shuf1(<32 x i8> %inval1, <32 x i8> %inval2) {
|
2012-04-06 14:38:25 +00:00
|
|
|
entry:
|
2012-05-21 06:40:16 +00:00
|
|
|
%0 = shufflevector <32 x i8> %inval1, <32 x i8> %inval2, <32 x i32> <i32 0, i32 2, i32 4, i32 6, i32 8, i32 10, i32 12, i32 14, i32 16, i32 18, i32 20, i32 22, i32 24, i32 26, i32 28, i32 30, i32 32, i32 34, i32 36, i32 38, i32 40, i32 42, i32 44, i32 46, i32 48, i32 50, i32 52, i32 54, i32 56, i32 58, i32 60, i32 62>
|
|
|
|
ret <32 x i8> %0
|
|
|
|
}
|
|
|
|
|
|
|
|
; handle the case where only half of the 256-bits is splittable
|
|
|
|
; CHECK: shuf2
|
|
|
|
; CHECK: vpshufb
|
|
|
|
; CHECK: vpshufb
|
|
|
|
; CHECK: vpextrb
|
|
|
|
; CHECK: vpextrb
|
|
|
|
define <32 x i8> @shuf2(<32 x i8> %inval1, <32 x i8> %inval2) {
|
|
|
|
entry:
|
|
|
|
%0 = shufflevector <32 x i8> %inval1, <32 x i8> %inval2, <32 x i32> <i32 0, i32 2, i32 4, i32 6, i32 8, i32 10, i32 12, i32 14, i32 16, i32 18, i32 20, i32 22, i32 24, i32 26, i32 28, i32 30, i32 31, i32 34, i32 36, i32 38, i32 40, i32 42, i32 44, i32 46, i32 48, i32 50, i32 52, i32 54, i32 56, i32 58, i32 60, i32 62>
|
2012-04-06 14:38:25 +00:00
|
|
|
ret <32 x i8> %0
|
|
|
|
}
|
2012-04-09 08:33:21 +00:00
|
|
|
|
|
|
|
; CHECK: blend1
|
2012-04-11 06:40:27 +00:00
|
|
|
; CHECK: vblendps
|
2012-04-09 08:33:21 +00:00
|
|
|
; CHECK: ret
|
|
|
|
define <4 x i32> @blend1(<4 x i32> %a, <4 x i32> %b) nounwind alwaysinline {
|
|
|
|
%t = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 1, i32 2, i32 7>
|
|
|
|
ret <4 x i32> %t
|
|
|
|
}
|
|
|
|
|
|
|
|
; CHECK: blend2
|
2012-04-11 06:40:27 +00:00
|
|
|
; CHECK: vblendps
|
2012-04-09 08:33:21 +00:00
|
|
|
; CHECK: ret
|
|
|
|
define <4 x i32> @blend2(<4 x i32> %a, <4 x i32> %b) nounwind alwaysinline {
|
|
|
|
%t = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 5, i32 2, i32 7>
|
|
|
|
ret <4 x i32> %t
|
|
|
|
}
|
|
|
|
|
|
|
|
; CHECK: blend2a
|
2012-04-11 06:40:27 +00:00
|
|
|
; CHECK: vblendps
|
2012-04-09 08:33:21 +00:00
|
|
|
; CHECK: ret
|
|
|
|
define <4 x float> @blend2a(<4 x float> %a, <4 x float> %b) nounwind alwaysinline {
|
|
|
|
%t = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32> <i32 0, i32 5, i32 2, i32 7>
|
|
|
|
ret <4 x float> %t
|
|
|
|
}
|
|
|
|
|
|
|
|
; CHECK: blend3
|
2012-04-11 06:40:27 +00:00
|
|
|
; CHECK-NOT: vblendps
|
2012-04-09 08:33:21 +00:00
|
|
|
; CHECK: ret
|
|
|
|
define <4 x i32> @blend3(<4 x i32> %a, <4 x i32> %b) nounwind alwaysinline {
|
|
|
|
%t = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 1, i32 5, i32 2, i32 7>
|
|
|
|
ret <4 x i32> %t
|
|
|
|
}
|
|
|
|
|
|
|
|
; CHECK: blend4
|
2012-04-11 06:40:27 +00:00
|
|
|
; CHECK: vblendpd
|
2012-04-09 08:33:21 +00:00
|
|
|
; CHECK: ret
|
|
|
|
define <4 x i64> @blend4(<4 x i64> %a, <4 x i64> %b) nounwind alwaysinline {
|
|
|
|
%t = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 0, i32 1, i32 2, i32 7>
|
|
|
|
ret <4 x i64> %t
|
|
|
|
}
|
2012-05-04 04:44:49 +00:00
|
|
|
|
|
|
|
; CHECK: narrow
|
|
|
|
; CHECK: vpermilps
|
|
|
|
; CHECK: ret
|
|
|
|
define <16 x i16> @narrow(<16 x i16> %a) nounwind alwaysinline {
|
|
|
|
%t = shufflevector <16 x i16> %a, <16 x i16> undef, <16 x i32> <i32 2, i32 3, i32 undef, i32 1, i32 6, i32 7, i32 4, i32 5, i32 10, i32 11, i32 8, i32 undef, i32 14, i32 15, i32 undef, i32 undef>
|
|
|
|
ret <16 x i16> %t
|
|
|
|
}
|
2012-06-20 05:39:26 +00:00
|
|
|
|
|
|
|
;CHECK: test17
|
|
|
|
;CHECK-NOT: vinsertf128
|
|
|
|
;CHECK: ret
|
|
|
|
define <8 x float> @test17(<4 x float> %y) {
|
|
|
|
%x = shufflevector <4 x float> %y, <4 x float> undef, <8 x i32> <i32 undef, i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
|
|
|
|
ret <8 x float> %x
|
|
|
|
}
|
Shuffle optimization for AVX/AVX2.
The current patch optimizes frequently used shuffle patterns and gives these instruction sequence reduction.
Before:
vshufps $-35, %xmm1, %xmm0, %xmm2 ## xmm2 = xmm0[1,3],xmm1[1,3]
vpermilps $-40, %xmm2, %xmm2 ## xmm2 = xmm2[0,2,1,3]
vextractf128 $1, %ymm1, %xmm1
vextractf128 $1, %ymm0, %xmm0
vshufps $-35, %xmm1, %xmm0, %xmm0 ## xmm0 = xmm0[1,3],xmm1[1,3]
vpermilps $-40, %xmm0, %xmm0 ## xmm0 = xmm0[0,2,1,3]
vinsertf128 $1, %xmm0, %ymm2, %ymm0
After:
vshufps $13, %ymm0, %ymm1, %ymm1 ## ymm1 = ymm1[1,3],ymm0[0,0],ymm1[5,7],ymm0[4,4]
vshufps $13, %ymm0, %ymm0, %ymm0 ## ymm0 = ymm0[1,3,0,0,5,7,4,4]
vunpcklps %ymm1, %ymm0, %ymm0 ## ymm0 = ymm0[0],ymm1[0],ymm0[1],ymm1[1],ymm0[4],ymm1[4],ymm0[5],ymm1[5]
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159188 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-26 08:04:10 +00:00
|
|
|
|
|
|
|
; CHECK: test18
|
This patch optimizes shuffle instruction - generates 2 instructions instead of 4.
Since this specific shuffle is widely used in many workloads we have ~10% performance on them.
shufflevector <8 x float> %A, <8 x float> %B, <8 x i32> <i32 0, i32 8, i32 2, i32 10, i32 4, i32 12, i32 6, i32 14>
vmovaps (%rdx), %ymm0
vshufps $8, %ymm0, %ymm0, %ymm0
vmovaps (%rcx), %ymm1
vshufps $8, %ymm0, %ymm1, %ymm1
vunpcklps %ymm0, %ymm1, %ymm0
vmovaps (%rcx), %ymm0
vmovsldup (%rdx), %ymm1
vblendps $85, %ymm0, %ymm1, %ymm0
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163134 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-04 12:49:02 +00:00
|
|
|
; CHECK: vmovshdup
|
|
|
|
; CHECK: vblendps
|
Shuffle optimization for AVX/AVX2.
The current patch optimizes frequently used shuffle patterns and gives these instruction sequence reduction.
Before:
vshufps $-35, %xmm1, %xmm0, %xmm2 ## xmm2 = xmm0[1,3],xmm1[1,3]
vpermilps $-40, %xmm2, %xmm2 ## xmm2 = xmm2[0,2,1,3]
vextractf128 $1, %ymm1, %xmm1
vextractf128 $1, %ymm0, %xmm0
vshufps $-35, %xmm1, %xmm0, %xmm0 ## xmm0 = xmm0[1,3],xmm1[1,3]
vpermilps $-40, %xmm0, %xmm0 ## xmm0 = xmm0[0,2,1,3]
vinsertf128 $1, %xmm0, %ymm2, %ymm0
After:
vshufps $13, %ymm0, %ymm1, %ymm1 ## ymm1 = ymm1[1,3],ymm0[0,0],ymm1[5,7],ymm0[4,4]
vshufps $13, %ymm0, %ymm0, %ymm0 ## ymm0 = ymm0[1,3,0,0,5,7,4,4]
vunpcklps %ymm1, %ymm0, %ymm0 ## ymm0 = ymm0[0],ymm1[0],ymm0[1],ymm1[1],ymm0[4],ymm1[4],ymm0[5],ymm1[5]
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159188 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-26 08:04:10 +00:00
|
|
|
; CHECK: ret
|
|
|
|
define <8 x float> @test18(<8 x float> %A, <8 x float>%B) nounwind {
|
|
|
|
%S = shufflevector <8 x float> %A, <8 x float> %B, <8 x i32> <i32 1, i32 9, i32 3, i32 11, i32 5, i32 13, i32 7, i32 15>
|
|
|
|
ret <8 x float>%S
|
|
|
|
}
|
|
|
|
|
|
|
|
; CHECK: test19
|
This patch optimizes shuffle instruction - generates 2 instructions instead of 4.
Since this specific shuffle is widely used in many workloads we have ~10% performance on them.
shufflevector <8 x float> %A, <8 x float> %B, <8 x i32> <i32 0, i32 8, i32 2, i32 10, i32 4, i32 12, i32 6, i32 14>
vmovaps (%rdx), %ymm0
vshufps $8, %ymm0, %ymm0, %ymm0
vmovaps (%rcx), %ymm1
vshufps $8, %ymm0, %ymm1, %ymm1
vunpcklps %ymm0, %ymm1, %ymm0
vmovaps (%rcx), %ymm0
vmovsldup (%rdx), %ymm1
vblendps $85, %ymm0, %ymm1, %ymm0
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163134 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-04 12:49:02 +00:00
|
|
|
; CHECK: vmovsldup
|
|
|
|
; CHECK: vblendps
|
Shuffle optimization for AVX/AVX2.
The current patch optimizes frequently used shuffle patterns and gives these instruction sequence reduction.
Before:
vshufps $-35, %xmm1, %xmm0, %xmm2 ## xmm2 = xmm0[1,3],xmm1[1,3]
vpermilps $-40, %xmm2, %xmm2 ## xmm2 = xmm2[0,2,1,3]
vextractf128 $1, %ymm1, %xmm1
vextractf128 $1, %ymm0, %xmm0
vshufps $-35, %xmm1, %xmm0, %xmm0 ## xmm0 = xmm0[1,3],xmm1[1,3]
vpermilps $-40, %xmm0, %xmm0 ## xmm0 = xmm0[0,2,1,3]
vinsertf128 $1, %xmm0, %ymm2, %ymm0
After:
vshufps $13, %ymm0, %ymm1, %ymm1 ## ymm1 = ymm1[1,3],ymm0[0,0],ymm1[5,7],ymm0[4,4]
vshufps $13, %ymm0, %ymm0, %ymm0 ## ymm0 = ymm0[1,3,0,0,5,7,4,4]
vunpcklps %ymm1, %ymm0, %ymm0 ## ymm0 = ymm0[0],ymm1[0],ymm0[1],ymm1[1],ymm0[4],ymm1[4],ymm0[5],ymm1[5]
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159188 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-26 08:04:10 +00:00
|
|
|
; CHECK: ret
|
|
|
|
define <8 x float> @test19(<8 x float> %A, <8 x float>%B) nounwind {
|
|
|
|
%S = shufflevector <8 x float> %A, <8 x float> %B, <8 x i32> <i32 0, i32 8, i32 2, i32 10, i32 4, i32 12, i32 6, i32 14>
|
|
|
|
ret <8 x float>%S
|
|
|
|
}
|
|
|
|
|
2012-11-13 19:13:05 +00:00
|
|
|
; rdar://12684358
|
|
|
|
; Make sure loads happen before stores.
|
|
|
|
; CHECK: swap8doubles
|
|
|
|
; CHECK: vmovups {{[0-9]*}}(%rdi), %xmm{{[0-9]+}}
|
|
|
|
; CHECK: vmovups {{[0-9]*}}(%rdi), %xmm{{[0-9]+}}
|
2013-06-25 02:48:58 +00:00
|
|
|
; CHECK: vmovups {{[0-9]*}}(%rdi), %xmm{{[0-9]+}}
|
|
|
|
; CHECK: vmovups {{[0-9]*}}(%rdi), %xmm{{[0-9]+}}
|
2012-11-13 19:13:05 +00:00
|
|
|
; CHECK: vmovaps {{[0-9]*}}(%rsi), %ymm{{[0-9]+}}
|
|
|
|
; CHECK: vmovaps {{[0-9]*}}(%rsi), %ymm{{[0-9]+}}
|
|
|
|
; CHECK: vmovaps %xmm{{[0-9]+}}, {{[0-9]*}}(%rdi)
|
|
|
|
; CHECK: vextractf128
|
|
|
|
; CHECK: vmovaps %xmm{{[0-9]+}}, {{[0-9]*}}(%rdi)
|
|
|
|
; CHECK: vextractf128
|
|
|
|
; CHECK: vmovaps %ymm{{[0-9]+}}, {{[0-9]*}}(%rsi)
|
|
|
|
; CHECK: vmovaps %ymm{{[0-9]+}}, {{[0-9]*}}(%rsi)
|
|
|
|
define void @swap8doubles(double* nocapture %A, double* nocapture %C) nounwind uwtable ssp {
|
|
|
|
entry:
|
|
|
|
%add.ptr = getelementptr inbounds double* %A, i64 2
|
|
|
|
%v.i = bitcast double* %A to <2 x double>*
|
|
|
|
%0 = load <2 x double>* %v.i, align 1
|
|
|
|
%shuffle.i.i = shufflevector <2 x double> %0, <2 x double> <double 0.000000e+00, double undef>, <4 x i32> <i32 0, i32 1, i32 2, i32 2>
|
|
|
|
%v1.i = bitcast double* %add.ptr to <2 x double>*
|
|
|
|
%1 = load <2 x double>* %v1.i, align 1
|
|
|
|
%2 = tail call <4 x double> @llvm.x86.avx.vinsertf128.pd.256(<4 x double> %shuffle.i.i, <2 x double> %1, i8 1) nounwind
|
|
|
|
%add.ptr1 = getelementptr inbounds double* %A, i64 6
|
|
|
|
%add.ptr2 = getelementptr inbounds double* %A, i64 4
|
|
|
|
%v.i27 = bitcast double* %add.ptr2 to <2 x double>*
|
|
|
|
%3 = load <2 x double>* %v.i27, align 1
|
|
|
|
%shuffle.i.i28 = shufflevector <2 x double> %3, <2 x double> <double 0.000000e+00, double undef>, <4 x i32> <i32 0, i32 1, i32 2, i32 2>
|
|
|
|
%v1.i29 = bitcast double* %add.ptr1 to <2 x double>*
|
|
|
|
%4 = load <2 x double>* %v1.i29, align 1
|
|
|
|
%5 = tail call <4 x double> @llvm.x86.avx.vinsertf128.pd.256(<4 x double> %shuffle.i.i28, <2 x double> %4, i8 1) nounwind
|
|
|
|
%6 = bitcast double* %C to <4 x double>*
|
|
|
|
%7 = load <4 x double>* %6, align 32
|
|
|
|
%add.ptr5 = getelementptr inbounds double* %C, i64 4
|
|
|
|
%8 = bitcast double* %add.ptr5 to <4 x double>*
|
|
|
|
%9 = load <4 x double>* %8, align 32
|
|
|
|
%shuffle.i26 = shufflevector <4 x double> %7, <4 x double> undef, <2 x i32> <i32 0, i32 1>
|
|
|
|
%10 = tail call <2 x double> @llvm.x86.avx.vextractf128.pd.256(<4 x double> %7, i8 1)
|
|
|
|
%shuffle.i = shufflevector <4 x double> %9, <4 x double> undef, <2 x i32> <i32 0, i32 1>
|
|
|
|
%11 = tail call <2 x double> @llvm.x86.avx.vextractf128.pd.256(<4 x double> %9, i8 1)
|
|
|
|
store <2 x double> %shuffle.i26, <2 x double>* %v.i, align 16
|
|
|
|
store <2 x double> %10, <2 x double>* %v1.i, align 16
|
|
|
|
store <2 x double> %shuffle.i, <2 x double>* %v.i27, align 16
|
|
|
|
store <2 x double> %11, <2 x double>* %v1.i29, align 16
|
|
|
|
store <4 x double> %2, <4 x double>* %6, align 32
|
|
|
|
store <4 x double> %5, <4 x double>* %8, align 32
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
declare <2 x double> @llvm.x86.avx.vextractf128.pd.256(<4 x double>, i8) nounwind readnone
|
|
|
|
declare <4 x double> @llvm.x86.avx.vinsertf128.pd.256(<4 x double>, <2 x double>, i8) nounwind readnone
|