2014-11-24 20:23:15 +08:00
|
|
|
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+sse2 | FileCheck %s --check-prefix=SSE2
|
|
|
|
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+sse4.1 | FileCheck %s --check-prefix=SSE41
|
[X86] Add extra rules for combining vselect dag nodes into movsd.
This improves the fix committed at revision 199683 adding the
following new target specific combine rules:
1) fold (v4i32: vselect <0,0,-1,-1>, A, B) ->
(v4i32 (bitcast (movsd (v2i64 (bitcast A)), (v2i64 (bitcast B))) ))
2) fold (v4f32: vselect <0,0,-1,-1>, A, B) ->
(v4f32 (bitcast (movsd (v2f64 (bitcast A)), (v2f64 (bitcast B))) ))
3) fold (v4i32: vselect <-1,-1,0,0>, A, B) ->
(v4i32 (bitcast (movsd (v2i64 (bitcast B)), (v2i64 (bitcast A))) ))
4) fold (v4f32: vselect <-1,-1,0,0>, A, B) ->
(v4f32 (bitcast (movsd (v2i64 (bitcast B)), (v2i64 (bitcast A))) ))
llvm-svn: 200324
2014-01-29 02:14:21 +08:00
|
|
|
|
|
|
|
define <4 x i32> @test1(<4 x i32> %A, <4 x i32> %B) {
|
2015-02-04 18:46:53 +08:00
|
|
|
; SSE2-LABEL: test1:
|
|
|
|
; SSE2: # BB#0:
|
|
|
|
; SSE2-NEXT: movsd {{.*#+}} xmm1 = xmm0[0],xmm1[1]
|
2015-02-04 18:58:53 +08:00
|
|
|
; SSE2-NEXT: movapd %xmm1, %xmm0
|
2015-02-04 18:46:53 +08:00
|
|
|
; SSE2-NEXT: retq
|
2014-11-24 20:23:15 +08:00
|
|
|
;
|
2015-02-04 18:46:53 +08:00
|
|
|
; SSE41-LABEL: test1:
|
2014-11-24 20:23:15 +08:00
|
|
|
; SSE41: # BB#0:
|
|
|
|
; SSE41-NEXT: pblendw {{.*#+}} xmm0 = xmm0[0,1,2,3],xmm1[4,5,6,7]
|
|
|
|
; SSE41-NEXT: retq
|
[X86] Add extra rules for combining vselect dag nodes into movsd.
This improves the fix committed at revision 199683 adding the
following new target specific combine rules:
1) fold (v4i32: vselect <0,0,-1,-1>, A, B) ->
(v4i32 (bitcast (movsd (v2i64 (bitcast A)), (v2i64 (bitcast B))) ))
2) fold (v4f32: vselect <0,0,-1,-1>, A, B) ->
(v4f32 (bitcast (movsd (v2f64 (bitcast A)), (v2f64 (bitcast B))) ))
3) fold (v4i32: vselect <-1,-1,0,0>, A, B) ->
(v4i32 (bitcast (movsd (v2i64 (bitcast B)), (v2i64 (bitcast A))) ))
4) fold (v4f32: vselect <-1,-1,0,0>, A, B) ->
(v4f32 (bitcast (movsd (v2i64 (bitcast B)), (v2i64 (bitcast A))) ))
llvm-svn: 200324
2014-01-29 02:14:21 +08:00
|
|
|
%select = select <4 x i1><i1 true, i1 true, i1 false, i1 false>, <4 x i32> %A, <4 x i32> %B
|
|
|
|
ret <4 x i32> %select
|
|
|
|
}
|
|
|
|
|
|
|
|
define <4 x i32> @test2(<4 x i32> %A, <4 x i32> %B) {
|
2015-02-04 18:46:53 +08:00
|
|
|
; SSE2-LABEL: test2:
|
|
|
|
; SSE2: # BB#0:
|
|
|
|
; SSE2-NEXT: movsd {{.*#+}} xmm0 = xmm1[0],xmm0[1]
|
|
|
|
; SSE2-NEXT: retq
|
2014-11-24 20:23:15 +08:00
|
|
|
;
|
2015-02-04 18:46:53 +08:00
|
|
|
; SSE41-LABEL: test2:
|
2014-11-24 20:23:15 +08:00
|
|
|
; SSE41: # BB#0:
|
|
|
|
; SSE41-NEXT: pblendw {{.*#+}} xmm0 = xmm1[0,1,2,3],xmm0[4,5,6,7]
|
|
|
|
; SSE41-NEXT: retq
|
[X86] Add extra rules for combining vselect dag nodes into movsd.
This improves the fix committed at revision 199683 adding the
following new target specific combine rules:
1) fold (v4i32: vselect <0,0,-1,-1>, A, B) ->
(v4i32 (bitcast (movsd (v2i64 (bitcast A)), (v2i64 (bitcast B))) ))
2) fold (v4f32: vselect <0,0,-1,-1>, A, B) ->
(v4f32 (bitcast (movsd (v2f64 (bitcast A)), (v2f64 (bitcast B))) ))
3) fold (v4i32: vselect <-1,-1,0,0>, A, B) ->
(v4i32 (bitcast (movsd (v2i64 (bitcast B)), (v2i64 (bitcast A))) ))
4) fold (v4f32: vselect <-1,-1,0,0>, A, B) ->
(v4f32 (bitcast (movsd (v2i64 (bitcast B)), (v2i64 (bitcast A))) ))
llvm-svn: 200324
2014-01-29 02:14:21 +08:00
|
|
|
%select = select <4 x i1><i1 false, i1 false, i1 true, i1 true>, <4 x i32> %A, <4 x i32> %B
|
|
|
|
ret <4 x i32> %select
|
|
|
|
}
|
|
|
|
|
|
|
|
define <4 x float> @test3(<4 x float> %A, <4 x float> %B) {
|
2015-02-04 18:46:53 +08:00
|
|
|
; SSE2-LABEL: test3:
|
|
|
|
; SSE2: # BB#0:
|
|
|
|
; SSE2-NEXT: movsd {{.*#+}} xmm1 = xmm0[0],xmm1[1]
|
2015-02-04 18:58:53 +08:00
|
|
|
; SSE2-NEXT: movapd %xmm1, %xmm0
|
2015-02-04 18:46:53 +08:00
|
|
|
; SSE2-NEXT: retq
|
2014-11-24 20:23:15 +08:00
|
|
|
;
|
2015-02-04 18:46:53 +08:00
|
|
|
; SSE41-LABEL: test3:
|
2014-11-24 20:23:15 +08:00
|
|
|
; SSE41: # BB#0:
|
|
|
|
; SSE41-NEXT: blendpd {{.*#+}} xmm0 = xmm0[0],xmm1[1]
|
|
|
|
; SSE41-NEXT: retq
|
[X86] Add extra rules for combining vselect dag nodes into movsd.
This improves the fix committed at revision 199683 adding the
following new target specific combine rules:
1) fold (v4i32: vselect <0,0,-1,-1>, A, B) ->
(v4i32 (bitcast (movsd (v2i64 (bitcast A)), (v2i64 (bitcast B))) ))
2) fold (v4f32: vselect <0,0,-1,-1>, A, B) ->
(v4f32 (bitcast (movsd (v2f64 (bitcast A)), (v2f64 (bitcast B))) ))
3) fold (v4i32: vselect <-1,-1,0,0>, A, B) ->
(v4i32 (bitcast (movsd (v2i64 (bitcast B)), (v2i64 (bitcast A))) ))
4) fold (v4f32: vselect <-1,-1,0,0>, A, B) ->
(v4f32 (bitcast (movsd (v2i64 (bitcast B)), (v2i64 (bitcast A))) ))
llvm-svn: 200324
2014-01-29 02:14:21 +08:00
|
|
|
%select = select <4 x i1><i1 true, i1 true, i1 false, i1 false>, <4 x float> %A, <4 x float> %B
|
|
|
|
ret <4 x float> %select
|
|
|
|
}
|
|
|
|
|
|
|
|
define <4 x float> @test4(<4 x float> %A, <4 x float> %B) {
|
2015-02-04 18:46:53 +08:00
|
|
|
; SSE2-LABEL: test4:
|
|
|
|
; SSE2: # BB#0:
|
|
|
|
; SSE2-NEXT: movsd {{.*#+}} xmm0 = xmm1[0],xmm0[1]
|
|
|
|
; SSE2-NEXT: retq
|
2014-11-24 20:23:15 +08:00
|
|
|
;
|
2015-02-04 18:46:53 +08:00
|
|
|
; SSE41-LABEL: test4:
|
2014-11-24 20:23:15 +08:00
|
|
|
; SSE41: # BB#0:
|
|
|
|
; SSE41-NEXT: blendpd {{.*#+}} xmm0 = xmm1[0],xmm0[1]
|
|
|
|
; SSE41-NEXT: retq
|
[X86] Add extra rules for combining vselect dag nodes into movsd.
This improves the fix committed at revision 199683 adding the
following new target specific combine rules:
1) fold (v4i32: vselect <0,0,-1,-1>, A, B) ->
(v4i32 (bitcast (movsd (v2i64 (bitcast A)), (v2i64 (bitcast B))) ))
2) fold (v4f32: vselect <0,0,-1,-1>, A, B) ->
(v4f32 (bitcast (movsd (v2f64 (bitcast A)), (v2f64 (bitcast B))) ))
3) fold (v4i32: vselect <-1,-1,0,0>, A, B) ->
(v4i32 (bitcast (movsd (v2i64 (bitcast B)), (v2i64 (bitcast A))) ))
4) fold (v4f32: vselect <-1,-1,0,0>, A, B) ->
(v4f32 (bitcast (movsd (v2i64 (bitcast B)), (v2i64 (bitcast A))) ))
llvm-svn: 200324
2014-01-29 02:14:21 +08:00
|
|
|
%select = select <4 x i1><i1 false, i1 false, i1 true, i1 true>, <4 x float> %A, <4 x float> %B
|
|
|
|
ret <4 x float> %select
|
|
|
|
}
|