2013-08-23 20:39:19 +00:00
|
|
|
; RUN: llc < %s -march=x86 -mcpu=yonah -mattr=+sse2,-sse4.1 | FileCheck %s
|
2011-09-13 19:17:42 +00:00
|
|
|
|
[X86] Teach how to combine a vselect into a movss/movsd
Add target specific rules for combining vselect dag nodes into movss/movsd
when possible.
If the vector type of the vselect dag node in input is either MVT::v4i13 or
MVT::v4f32, then try to fold according to rules:
1) fold (vselect (build_vector (0, -1, -1, -1)), A, B) -> (movss A, B)
2) fold (vselect (build_vector (-1, 0, 0, 0)), A, B) -> (movss B, A)
If the vector type of the vselect dag node in input is either MVT::v2i64 or
MVT::v2f64 (and we have SSE2), then try to fold according to rules:
3) fold (vselect (build_vector (0, -1)), A, B) -> (movsd A, B)
4) fold (vselect (build_vector (-1, 0)), A, B) -> (movsd B, A)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199683 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-20 19:35:22 +00:00
|
|
|
; CHECK-LABEL: vsel_float
|
|
|
|
; CHECK-NOT: xorps
|
2013-12-27 20:20:28 +00:00
|
|
|
; CHECK: movss
|
[X86] Teach how to combine a vselect into a movss/movsd
Add target specific rules for combining vselect dag nodes into movss/movsd
when possible.
If the vector type of the vselect dag node in input is either MVT::v4i13 or
MVT::v4f32, then try to fold according to rules:
1) fold (vselect (build_vector (0, -1, -1, -1)), A, B) -> (movss A, B)
2) fold (vselect (build_vector (-1, 0, 0, 0)), A, B) -> (movss B, A)
If the vector type of the vselect dag node in input is either MVT::v2i64 or
MVT::v2f64 (and we have SSE2), then try to fold according to rules:
3) fold (vselect (build_vector (0, -1)), A, B) -> (movsd A, B)
4) fold (vselect (build_vector (-1, 0)), A, B) -> (movsd B, A)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199683 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-20 19:35:22 +00:00
|
|
|
; CHECK-NOT: orps
|
2012-11-27 08:17:04 +00:00
|
|
|
; CHECK: ret
|
|
|
|
define void@vsel_float(<4 x float>* %v1, <4 x float>* %v2) {
|
|
|
|
%A = load <4 x float>* %v1
|
|
|
|
%B = load <4 x float>* %v2
|
[X86] Teach how to combine a vselect into a movss/movsd
Add target specific rules for combining vselect dag nodes into movss/movsd
when possible.
If the vector type of the vselect dag node in input is either MVT::v4i13 or
MVT::v4f32, then try to fold according to rules:
1) fold (vselect (build_vector (0, -1, -1, -1)), A, B) -> (movss A, B)
2) fold (vselect (build_vector (-1, 0, 0, 0)), A, B) -> (movss B, A)
If the vector type of the vselect dag node in input is either MVT::v2i64 or
MVT::v2f64 (and we have SSE2), then try to fold according to rules:
3) fold (vselect (build_vector (0, -1)), A, B) -> (movsd A, B)
4) fold (vselect (build_vector (-1, 0)), A, B) -> (movsd B, A)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199683 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-20 19:35:22 +00:00
|
|
|
%vsel = select <4 x i1> <i1 false, i1 true, i1 true, i1 true>, <4 x float> %A, <4 x float> %B
|
2012-11-27 08:17:04 +00:00
|
|
|
store <4 x float > %vsel, <4 x float>* %v1
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
[X86] Teach how to combine a vselect into a movss/movsd
Add target specific rules for combining vselect dag nodes into movss/movsd
when possible.
If the vector type of the vselect dag node in input is either MVT::v4i13 or
MVT::v4f32, then try to fold according to rules:
1) fold (vselect (build_vector (0, -1, -1, -1)), A, B) -> (movss A, B)
2) fold (vselect (build_vector (-1, 0, 0, 0)), A, B) -> (movss B, A)
If the vector type of the vselect dag node in input is either MVT::v2i64 or
MVT::v2f64 (and we have SSE2), then try to fold according to rules:
3) fold (vselect (build_vector (0, -1)), A, B) -> (movsd A, B)
4) fold (vselect (build_vector (-1, 0)), A, B) -> (movsd B, A)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199683 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-20 19:35:22 +00:00
|
|
|
; CHECK-LABEL: vsel_i32
|
|
|
|
; CHECK-NOT: xorps
|
2013-12-27 20:20:28 +00:00
|
|
|
; CHECK: movss
|
[X86] Teach how to combine a vselect into a movss/movsd
Add target specific rules for combining vselect dag nodes into movss/movsd
when possible.
If the vector type of the vselect dag node in input is either MVT::v4i13 or
MVT::v4f32, then try to fold according to rules:
1) fold (vselect (build_vector (0, -1, -1, -1)), A, B) -> (movss A, B)
2) fold (vselect (build_vector (-1, 0, 0, 0)), A, B) -> (movss B, A)
If the vector type of the vselect dag node in input is either MVT::v2i64 or
MVT::v2f64 (and we have SSE2), then try to fold according to rules:
3) fold (vselect (build_vector (0, -1)), A, B) -> (movsd A, B)
4) fold (vselect (build_vector (-1, 0)), A, B) -> (movsd B, A)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199683 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-20 19:35:22 +00:00
|
|
|
; CHECK-NOT: orps
|
2012-11-27 08:17:04 +00:00
|
|
|
; CHECK: ret
|
|
|
|
define void@vsel_i32(<4 x i32>* %v1, <4 x i32>* %v2) {
|
|
|
|
%A = load <4 x i32>* %v1
|
|
|
|
%B = load <4 x i32>* %v2
|
|
|
|
%vsel = select <4 x i1> <i1 true, i1 false, i1 false, i1 false>, <4 x i32> %A, <4 x i32> %B
|
|
|
|
store <4 x i32 > %vsel, <4 x i32>* %v1
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; Without forcing instructions, fall back to the preferred PS domain.
|
[X86] Teach how to combine a vselect into a movss/movsd
Add target specific rules for combining vselect dag nodes into movss/movsd
when possible.
If the vector type of the vselect dag node in input is either MVT::v4i13 or
MVT::v4f32, then try to fold according to rules:
1) fold (vselect (build_vector (0, -1, -1, -1)), A, B) -> (movss A, B)
2) fold (vselect (build_vector (-1, 0, 0, 0)), A, B) -> (movss B, A)
If the vector type of the vselect dag node in input is either MVT::v2i64 or
MVT::v2f64 (and we have SSE2), then try to fold according to rules:
3) fold (vselect (build_vector (0, -1)), A, B) -> (movsd A, B)
4) fold (vselect (build_vector (-1, 0)), A, B) -> (movsd B, A)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199683 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-20 19:35:22 +00:00
|
|
|
; CHECK-LABEL: vsel_i64
|
2012-11-27 08:17:04 +00:00
|
|
|
; CHECK: andnps
|
|
|
|
; CHECK: orps
|
|
|
|
; CHECK: ret
|
|
|
|
|
2012-12-08 22:49:19 +00:00
|
|
|
define void@vsel_i64(<2 x i64>* %v1, <2 x i64>* %v2) {
|
|
|
|
%A = load <2 x i64>* %v1
|
|
|
|
%B = load <2 x i64>* %v2
|
|
|
|
%vsel = select <2 x i1> <i1 true, i1 false>, <2 x i64> %A, <2 x i64> %B
|
|
|
|
store <2 x i64 > %vsel, <2 x i64>* %v1
|
2012-11-27 08:17:04 +00:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2011-11-07 23:08:21 +00:00
|
|
|
; Without forcing instructions, fall back to the preferred PS domain.
|
[X86] Teach how to combine a vselect into a movss/movsd
Add target specific rules for combining vselect dag nodes into movss/movsd
when possible.
If the vector type of the vselect dag node in input is either MVT::v4i13 or
MVT::v4f32, then try to fold according to rules:
1) fold (vselect (build_vector (0, -1, -1, -1)), A, B) -> (movss A, B)
2) fold (vselect (build_vector (-1, 0, 0, 0)), A, B) -> (movss B, A)
If the vector type of the vselect dag node in input is either MVT::v2i64 or
MVT::v2f64 (and we have SSE2), then try to fold according to rules:
3) fold (vselect (build_vector (0, -1)), A, B) -> (movsd A, B)
4) fold (vselect (build_vector (-1, 0)), A, B) -> (movsd B, A)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199683 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-20 19:35:22 +00:00
|
|
|
; CHECK-LABEL: vsel_double
|
2012-01-03 22:19:42 +00:00
|
|
|
; CHECK: andnps
|
|
|
|
; CHECK: orps
|
2011-09-13 19:59:18 +00:00
|
|
|
; CHECK: ret
|
|
|
|
|
2012-12-08 22:49:19 +00:00
|
|
|
define void@vsel_double(<2 x double>* %v1, <2 x double>* %v2) {
|
|
|
|
%A = load <2 x double>* %v1
|
|
|
|
%B = load <2 x double>* %v2
|
|
|
|
%vsel = select <2 x i1> <i1 true, i1 false>, <2 x double> %A, <2 x double> %B
|
|
|
|
store <2 x double > %vsel, <2 x double>* %v1
|
2011-09-13 19:17:42 +00:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
|