2014-10-15 23:42:14 +00:00
|
|
|
; RUN: llc < %s -march=x86-64 -mtriple=x86_64-apple-darwin -mcpu=knl | FileCheck --check-prefix=KNL --check-prefix=CHECK %s
|
|
|
|
; RUN: llc < %s -march=x86-64 -mtriple=x86_64-apple-darwin -mcpu=skx | FileCheck --check-prefix=SKX --check-prefix=CHECK %s
|
2013-07-31 11:35:14 +00:00
|
|
|
|
2013-08-09 17:50:15 +00:00
|
|
|
;CHECK-LABEL: test1:
|
2013-07-31 11:35:14 +00:00
|
|
|
;CHECK: vinsertps
|
|
|
|
;CHECK: vinsertf32x4
|
|
|
|
;CHECK: ret
|
|
|
|
define <16 x float> @test1(<16 x float> %x, float* %br, float %y) nounwind {
|
|
|
|
%rrr = load float* %br
|
|
|
|
%rrr2 = insertelement <16 x float> %x, float %rrr, i32 1
|
|
|
|
%rrr3 = insertelement <16 x float> %rrr2, float %y, i32 14
|
|
|
|
ret <16 x float> %rrr3
|
|
|
|
}
|
|
|
|
|
2013-08-09 17:50:15 +00:00
|
|
|
;CHECK-LABEL: test2:
|
2014-10-15 23:42:17 +00:00
|
|
|
;KNL: vinsertf32x4 $0
|
|
|
|
;SKX: vinsertf64x2 $0
|
2014-09-25 23:48:47 +00:00
|
|
|
;CHECK: vextractf32x4 $3
|
2014-10-15 23:42:17 +00:00
|
|
|
;KNL: vinsertf32x4 $3
|
|
|
|
;SKX: vinsertf64x2 $3
|
2013-07-31 11:35:14 +00:00
|
|
|
;CHECK: ret
|
|
|
|
define <8 x double> @test2(<8 x double> %x, double* %br, double %y) nounwind {
|
|
|
|
%rrr = load double* %br
|
|
|
|
%rrr2 = insertelement <8 x double> %x, double %rrr, i32 1
|
|
|
|
%rrr3 = insertelement <8 x double> %rrr2, double %y, i32 6
|
|
|
|
ret <8 x double> %rrr3
|
|
|
|
}
|
|
|
|
|
2013-08-09 17:50:15 +00:00
|
|
|
;CHECK-LABEL: test3:
|
2014-09-25 23:48:47 +00:00
|
|
|
;CHECK: vextractf32x4 $1
|
|
|
|
;CHECK: vinsertf32x4 $0
|
2013-07-31 11:35:14 +00:00
|
|
|
;CHECK: ret
|
|
|
|
define <16 x float> @test3(<16 x float> %x) nounwind {
|
|
|
|
%eee = extractelement <16 x float> %x, i32 4
|
|
|
|
%rrr2 = insertelement <16 x float> %x, float %eee, i32 1
|
|
|
|
ret <16 x float> %rrr2
|
|
|
|
}
|
|
|
|
|
2013-08-09 17:50:15 +00:00
|
|
|
;CHECK-LABEL: test4:
|
2014-09-25 23:48:47 +00:00
|
|
|
;CHECK: vextracti32x4 $2
|
2014-10-15 23:42:17 +00:00
|
|
|
;KNL: vinserti32x4 $0
|
|
|
|
;SKX: vinserti64x2 $0
|
2013-07-31 11:35:14 +00:00
|
|
|
;CHECK: ret
|
|
|
|
define <8 x i64> @test4(<8 x i64> %x) nounwind {
|
|
|
|
%eee = extractelement <8 x i64> %x, i32 4
|
|
|
|
%rrr2 = insertelement <8 x i64> %x, i64 %eee, i32 1
|
|
|
|
ret <8 x i64> %rrr2
|
2013-08-04 10:46:07 +00:00
|
|
|
}
|
|
|
|
|
2013-08-09 17:50:15 +00:00
|
|
|
;CHECK-LABEL: test5:
|
2013-12-11 14:31:04 +00:00
|
|
|
;CHECK: vextractps
|
2013-08-04 10:46:07 +00:00
|
|
|
;CHECK: ret
|
|
|
|
define i32 @test5(<4 x float> %x) nounwind {
|
|
|
|
%ef = extractelement <4 x float> %x, i32 3
|
|
|
|
%ei = bitcast float %ef to i32
|
|
|
|
ret i32 %ei
|
|
|
|
}
|
|
|
|
|
2013-08-09 17:50:15 +00:00
|
|
|
;CHECK-LABEL: test6:
|
2013-12-11 14:31:04 +00:00
|
|
|
;CHECK: vextractps {{.*}}, (%rdi)
|
2013-08-04 10:46:07 +00:00
|
|
|
;CHECK: ret
|
|
|
|
define void @test6(<4 x float> %x, float* %out) nounwind {
|
|
|
|
%ef = extractelement <4 x float> %x, i32 3
|
|
|
|
store float %ef, float* %out, align 4
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2013-09-12 08:55:00 +00:00
|
|
|
;CHECK-LABEL: test7
|
2013-12-11 14:31:04 +00:00
|
|
|
;CHECK: vmovd
|
2013-09-12 08:55:00 +00:00
|
|
|
;CHECK: vpermps %zmm
|
|
|
|
;CHECK: ret
|
|
|
|
define float @test7(<16 x float> %x, i32 %ind) nounwind {
|
|
|
|
%e = extractelement <16 x float> %x, i32 %ind
|
|
|
|
ret float %e
|
|
|
|
}
|
|
|
|
|
|
|
|
;CHECK-LABEL: test8
|
2013-12-11 14:31:04 +00:00
|
|
|
;CHECK: vmovq
|
2013-09-12 08:55:00 +00:00
|
|
|
;CHECK: vpermpd %zmm
|
|
|
|
;CHECK: ret
|
|
|
|
define double @test8(<8 x double> %x, i32 %ind) nounwind {
|
|
|
|
%e = extractelement <8 x double> %x, i32 %ind
|
|
|
|
ret double %e
|
|
|
|
}
|
|
|
|
|
|
|
|
;CHECK-LABEL: test9
|
|
|
|
;CHECK: vmovd
|
|
|
|
;CHECK: vpermps %ymm
|
|
|
|
;CHECK: ret
|
|
|
|
define float @test9(<8 x float> %x, i32 %ind) nounwind {
|
|
|
|
%e = extractelement <8 x float> %x, i32 %ind
|
|
|
|
ret float %e
|
|
|
|
}
|
|
|
|
|
|
|
|
;CHECK-LABEL: test10
|
2013-12-11 14:31:04 +00:00
|
|
|
;CHECK: vmovd
|
2013-09-12 08:55:00 +00:00
|
|
|
;CHECK: vpermd %zmm
|
2014-03-02 09:19:44 +00:00
|
|
|
;CHECK: vmovd %xmm0, %eax
|
2013-09-12 08:55:00 +00:00
|
|
|
;CHECK: ret
|
|
|
|
define i32 @test10(<16 x i32> %x, i32 %ind) nounwind {
|
|
|
|
%e = extractelement <16 x i32> %x, i32 %ind
|
|
|
|
ret i32 %e
|
|
|
|
}
|
|
|
|
|
2013-11-14 11:29:27 +00:00
|
|
|
;CHECK-LABEL: test11
|
2013-12-16 13:52:35 +00:00
|
|
|
;CHECK: vpcmpltud
|
2014-03-02 09:19:44 +00:00
|
|
|
;CHECK: kshiftlw $11
|
|
|
|
;CHECK: kshiftrw $15
|
2013-12-16 13:52:35 +00:00
|
|
|
;CHECK: kortestw
|
2014-02-16 11:34:23 +00:00
|
|
|
;CHECK: je
|
2013-12-16 13:52:35 +00:00
|
|
|
;CHECK: ret
|
2013-11-14 11:29:27 +00:00
|
|
|
;CHECK: ret
|
|
|
|
define <16 x i32> @test11(<16 x i32>%a, <16 x i32>%b) {
|
|
|
|
%cmp_res = icmp ult <16 x i32> %a, %b
|
|
|
|
%ia = extractelement <16 x i1> %cmp_res, i32 4
|
|
|
|
br i1 %ia, label %A, label %B
|
|
|
|
A:
|
|
|
|
ret <16 x i32>%b
|
|
|
|
B:
|
|
|
|
%c = add <16 x i32>%b, %a
|
2013-12-16 13:52:35 +00:00
|
|
|
ret <16 x i32>%c
|
2013-11-14 11:29:27 +00:00
|
|
|
}
|
2014-02-10 07:02:39 +00:00
|
|
|
|
|
|
|
;CHECK-LABEL: test12
|
|
|
|
;CHECK: vpcmpgtq
|
2014-03-02 09:19:44 +00:00
|
|
|
;CHECK: kshiftlw $15
|
|
|
|
;CHECK: kshiftrw $15
|
2014-02-10 07:02:39 +00:00
|
|
|
;CHECK: kortestw
|
|
|
|
;CHECK: ret
|
|
|
|
|
|
|
|
define i64 @test12(<16 x i64>%a, <16 x i64>%b, i64 %a1, i64 %b1) {
|
|
|
|
|
|
|
|
%cmpvector_func.i = icmp slt <16 x i64> %a, %b
|
|
|
|
%extract24vector_func.i = extractelement <16 x i1> %cmpvector_func.i, i32 0
|
|
|
|
%res = select i1 %extract24vector_func.i, i64 %a1, i64 %b1
|
|
|
|
ret i64 %res
|
|
|
|
}
|
|
|
|
|
2014-02-16 11:34:23 +00:00
|
|
|
;CHECK-LABEL: test13
|
|
|
|
;CHECK: cmpl
|
|
|
|
;CHECK: sbbl
|
2014-03-02 09:19:44 +00:00
|
|
|
;CHECK: orl $65532
|
2014-02-16 11:34:23 +00:00
|
|
|
;CHECK: ret
|
|
|
|
define i16 @test13(i32 %a, i32 %b) {
|
|
|
|
%cmp_res = icmp ult i32 %a, %b
|
|
|
|
%maskv = insertelement <16 x i1> <i1 true, i1 false, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true>, i1 %cmp_res, i32 0
|
|
|
|
%res = bitcast <16 x i1> %maskv to i16
|
|
|
|
ret i16 %res
|
|
|
|
}
|
|
|
|
|
2014-03-02 09:19:44 +00:00
|
|
|
;CHECK-LABEL: test14
|
|
|
|
;CHECK: vpcmpgtq
|
|
|
|
;CHECK: kshiftlw $11
|
|
|
|
;CHECK: kshiftrw $15
|
|
|
|
;CHECK: kortestw
|
|
|
|
;CHECK: ret
|
2014-02-16 11:34:23 +00:00
|
|
|
|
2014-03-02 09:19:44 +00:00
|
|
|
define i64 @test14(<8 x i64>%a, <8 x i64>%b, i64 %a1, i64 %b1) {
|
2014-02-10 07:02:39 +00:00
|
|
|
|
2014-03-02 09:19:44 +00:00
|
|
|
%cmpvector_func.i = icmp slt <8 x i64> %a, %b
|
|
|
|
%extract24vector_func.i = extractelement <8 x i1> %cmpvector_func.i, i32 4
|
|
|
|
%res = select i1 %extract24vector_func.i, i64 %a1, i64 %b1
|
|
|
|
ret i64 %res
|
|
|
|
}
|
2014-04-09 12:37:50 +00:00
|
|
|
|
|
|
|
;CHECK-LABEL: test15
|
|
|
|
;CHECK: kshiftlw
|
|
|
|
;CHECK: kmovw
|
|
|
|
;CHECK: ret
|
|
|
|
define i16 @test15(i1 *%addr) {
|
|
|
|
%x = load i1 * %addr, align 128
|
|
|
|
%x1 = insertelement <16 x i1> undef, i1 %x, i32 10
|
|
|
|
%x2 = bitcast <16 x i1>%x1 to i16
|
|
|
|
ret i16 %x2
|
|
|
|
}
|
|
|
|
|
|
|
|
;CHECK-LABEL: test16
|
|
|
|
;CHECK: kshiftlw
|
|
|
|
;CHECK: kshiftrw
|
|
|
|
;CHECK: korw
|
|
|
|
;CHECK: ret
|
|
|
|
define i16 @test16(i1 *%addr, i16 %a) {
|
|
|
|
%x = load i1 * %addr, align 128
|
|
|
|
%a1 = bitcast i16 %a to <16 x i1>
|
|
|
|
%x1 = insertelement <16 x i1> %a1, i1 %x, i32 10
|
|
|
|
%x2 = bitcast <16 x i1>%x1 to i16
|
|
|
|
ret i16 %x2
|
|
|
|
}
|
|
|
|
|
|
|
|
;CHECK-LABEL: test17
|
|
|
|
;CHECK: kshiftlw
|
|
|
|
;CHECK: kshiftrw
|
2014-10-15 23:42:14 +00:00
|
|
|
;KNL: korw
|
|
|
|
;SKX: korb
|
2014-04-09 12:37:50 +00:00
|
|
|
;CHECK: ret
|
|
|
|
define i8 @test17(i1 *%addr, i8 %a) {
|
|
|
|
%x = load i1 * %addr, align 128
|
|
|
|
%a1 = bitcast i8 %a to <8 x i1>
|
2014-10-15 23:42:11 +00:00
|
|
|
%x1 = insertelement <8 x i1> %a1, i1 %x, i32 4
|
2014-04-09 12:37:50 +00:00
|
|
|
%x2 = bitcast <8 x i1>%x1 to i8
|
|
|
|
ret i8 %x2
|
|
|
|
}
|
|
|
|
|