2012-06-04 11:27:21 +00:00
|
|
|
; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7-avx -mattr=+avx | FileCheck %s
|
2011-09-08 21:05:43 +00:00
|
|
|
|
2011-09-09 20:29:17 +00:00
|
|
|
; AVX128 tests:
|
|
|
|
|
2013-07-18 22:47:09 +00:00
|
|
|
;CHECK-LABEL: vsel_float:
|
2014-05-16 22:47:49 +00:00
|
|
|
;CHECK: vblendps $5
|
2011-09-08 21:05:43 +00:00
|
|
|
;CHECK: ret
|
|
|
|
define <4 x float> @vsel_float(<4 x float> %v1, <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 true, i1 false, i1 true, i1 false>, <4 x float> %v1, <4 x float> %v2
|
2011-09-08 21:05:43 +00:00
|
|
|
ret <4 x float> %vsel
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-07-18 22:47:09 +00:00
|
|
|
;CHECK-LABEL: vsel_i32:
|
2014-05-16 22:47:49 +00:00
|
|
|
;CHECK: vblendps $5
|
2011-09-08 21:05:43 +00:00
|
|
|
;CHECK: ret
|
|
|
|
define <4 x i32> @vsel_i32(<4 x i32> %v1, <4 x i32> %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 true, i1 false, i1 true, i1 false>, <4 x i32> %v1, <4 x i32> %v2
|
2011-09-08 21:05:43 +00:00
|
|
|
ret <4 x i32> %vsel
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-07-18 22:47:09 +00:00
|
|
|
;CHECK-LABEL: vsel_double:
|
[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: vmovsd
|
2011-09-08 21:05:43 +00:00
|
|
|
;CHECK: ret
|
|
|
|
define <2 x double> @vsel_double(<2 x double> %v1, <2 x double> %v2) {
|
|
|
|
%vsel = select <2 x i1> <i1 true, i1 false>, <2 x double> %v1, <2 x double> %v2
|
|
|
|
ret <2 x double> %vsel
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-07-18 22:47:09 +00:00
|
|
|
;CHECK-LABEL: vsel_i64:
|
[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: vmovsd
|
2011-09-08 21:05:43 +00:00
|
|
|
;CHECK: ret
|
|
|
|
define <2 x i64> @vsel_i64(<2 x i64> %v1, <2 x i64> %v2) {
|
|
|
|
%vsel = select <2 x i1> <i1 true, i1 false>, <2 x i64> %v1, <2 x i64> %v2
|
|
|
|
ret <2 x i64> %vsel
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-07-18 22:47:09 +00:00
|
|
|
;CHECK-LABEL: vsel_i8:
|
2011-09-08 21:05:43 +00:00
|
|
|
;CHECK: vpblendvb
|
|
|
|
;CHECK: ret
|
|
|
|
define <16 x i8> @vsel_i8(<16 x i8> %v1, <16 x i8> %v2) {
|
|
|
|
%vsel = select <16 x i1> <i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 false, i1 false>, <16 x i8> %v1, <16 x i8> %v2
|
|
|
|
ret <16 x i8> %vsel
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-09-09 20:29:17 +00:00
|
|
|
; AVX256 tests:
|
|
|
|
|
|
|
|
|
2013-07-18 22:47:09 +00:00
|
|
|
;CHECK-LABEL: vsel_float8:
|
2014-01-27 18:45:30 +00:00
|
|
|
;CHECK-NOT: vinsertf128
|
2014-05-16 22:47:49 +00:00
|
|
|
;CHECK: vblendps $17
|
2011-09-09 20:29:17 +00:00
|
|
|
;CHECK: ret
|
|
|
|
define <8 x float> @vsel_float8(<8 x float> %v1, <8 x float> %v2) {
|
|
|
|
%vsel = select <8 x i1> <i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 false, i1 false>, <8 x float> %v1, <8 x float> %v2
|
|
|
|
ret <8 x float> %vsel
|
|
|
|
}
|
|
|
|
|
2013-07-18 22:47:09 +00:00
|
|
|
;CHECK-LABEL: vsel_i328:
|
2014-01-27 18:45:30 +00:00
|
|
|
;CHECK-NOT: vinsertf128
|
2014-05-16 22:47:49 +00:00
|
|
|
;CHECK: vblendps $17
|
2014-01-27 18:45:30 +00:00
|
|
|
;CHECK-NEXT: ret
|
2011-09-09 20:29:17 +00:00
|
|
|
define <8 x i32> @vsel_i328(<8 x i32> %v1, <8 x i32> %v2) {
|
|
|
|
%vsel = select <8 x i1> <i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 false, i1 false>, <8 x i32> %v1, <8 x i32> %v2
|
|
|
|
ret <8 x i32> %vsel
|
|
|
|
}
|
|
|
|
|
2013-07-18 22:47:09 +00:00
|
|
|
;CHECK-LABEL: vsel_double8:
|
2011-09-09 20:29:17 +00:00
|
|
|
;CHECK: vblendvpd
|
|
|
|
;CHECK: ret
|
|
|
|
define <8 x double> @vsel_double8(<8 x double> %v1, <8 x double> %v2) {
|
|
|
|
%vsel = select <8 x i1> <i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 false, i1 false>, <8 x double> %v1, <8 x double> %v2
|
|
|
|
ret <8 x double> %vsel
|
|
|
|
}
|
|
|
|
|
2013-07-18 22:47:09 +00:00
|
|
|
;CHECK-LABEL: vsel_i648:
|
2011-09-09 20:29:17 +00:00
|
|
|
;CHECK: vblendvpd
|
|
|
|
;CHECK: ret
|
|
|
|
define <8 x i64> @vsel_i648(<8 x i64> %v1, <8 x i64> %v2) {
|
|
|
|
%vsel = select <8 x i1> <i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 false, i1 false>, <8 x i64> %v1, <8 x i64> %v2
|
|
|
|
ret <8 x i64> %vsel
|
|
|
|
}
|
|
|
|
|
2014-01-27 18:45:30 +00:00
|
|
|
;CHECK-LABEL: vsel_double4:
|
|
|
|
;CHECK-NOT: vinsertf128
|
2014-05-16 22:47:49 +00:00
|
|
|
;CHECK: vblendpd $5
|
2014-01-27 18:45:30 +00:00
|
|
|
;CHECK-NEXT: ret
|
|
|
|
define <4 x double> @vsel_double4(<4 x double> %v1, <4 x double> %v2) {
|
|
|
|
%vsel = select <4 x i1> <i1 true, i1 false, i1 true, i1 false>, <4 x double> %v1, <4 x double> %v2
|
|
|
|
ret <4 x double> %vsel
|
|
|
|
}
|
|
|
|
|
2011-09-12 19:30:40 +00:00
|
|
|
;; TEST blend + compares
|
2013-07-18 22:29:15 +00:00
|
|
|
; CHECK: testa
|
|
|
|
define <2 x double> @testa(<2 x double> %x, <2 x double> %y) {
|
2011-09-12 21:24:07 +00:00
|
|
|
; CHECK: vcmplepd
|
2011-09-12 19:30:40 +00:00
|
|
|
; CHECK: vblendvpd
|
|
|
|
%max_is_x = fcmp oge <2 x double> %x, %y
|
|
|
|
%max = select <2 x i1> %max_is_x, <2 x double> %x, <2 x double> %y
|
|
|
|
ret <2 x double> %max
|
|
|
|
}
|
|
|
|
|
2013-07-18 22:29:15 +00:00
|
|
|
; CHECK: testb
|
|
|
|
define <2 x double> @testb(<2 x double> %x, <2 x double> %y) {
|
2011-09-18 00:41:38 +00:00
|
|
|
; CHECK: vcmpnlepd
|
2011-09-12 19:30:40 +00:00
|
|
|
; CHECK: vblendvpd
|
2011-09-18 00:41:38 +00:00
|
|
|
%min_is_x = fcmp ult <2 x double> %x, %y
|
|
|
|
%min = select <2 x i1> %min_is_x, <2 x double> %x, <2 x double> %y
|
|
|
|
ret <2 x double> %min
|
2011-09-12 19:30:40 +00:00
|
|
|
}
|
|
|
|
|
2011-09-09 20:29:17 +00:00
|
|
|
|