2015-01-25 12:47:15 +00:00
|
|
|
; RUN: llc < %s -march=x86-64 -mtriple=x86_64-apple-darwin -mcpu=knl | FileCheck %s --check-prefix=KNL --check-prefix=CHECK
|
|
|
|
; RUN: llc < %s -march=x86-64 -mtriple=x86_64-apple-darwin -mcpu=skx | FileCheck %s --check-prefix=SKX --check-prefix=CHECK
|
2013-08-05 08:52:21 +00:00
|
|
|
|
2015-01-25 12:47:15 +00:00
|
|
|
; CHECK-LABEL: mask16
|
|
|
|
; CHECK: kmovw
|
|
|
|
; CHECK-NEXT: knotw
|
|
|
|
; CHECK-NEXT: kmovw
|
2013-08-05 08:52:21 +00:00
|
|
|
define i16 @mask16(i16 %x) {
|
|
|
|
%m0 = bitcast i16 %x to <16 x i1>
|
|
|
|
%m1 = xor <16 x i1> %m0, <i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1>
|
|
|
|
%ret = bitcast <16 x i1> %m1 to i16
|
|
|
|
ret i16 %ret
|
|
|
|
}
|
|
|
|
|
2015-01-25 12:47:15 +00:00
|
|
|
; CHECK-LABEL: mask8
|
|
|
|
; KNL: kmovw
|
|
|
|
; KNL-NEXT: knotw
|
|
|
|
; KNL-NEXT: kmovw
|
|
|
|
; SKX: kmovb
|
|
|
|
; SKX-NEXT: knotb
|
|
|
|
; SKX-NEXT: kmovb
|
|
|
|
|
2013-08-05 08:52:21 +00:00
|
|
|
define i8 @mask8(i8 %x) {
|
|
|
|
%m0 = bitcast i8 %x to <8 x i1>
|
|
|
|
%m1 = xor <8 x i1> %m0, <i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1>
|
|
|
|
%ret = bitcast <8 x i1> %m1 to i8
|
|
|
|
ret i8 %ret
|
2015-01-25 12:47:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
; CHECK-LABEL: mask16_mem
|
|
|
|
; CHECK: kmovw ([[ARG1:%rdi|%rcx]]), %k{{[0-7]}}
|
2014-07-23 14:49:42 +00:00
|
|
|
; CHECK-NEXT: knotw
|
2015-01-25 12:47:15 +00:00
|
|
|
; CHECK-NEXT: kmovw %k{{[0-7]}}, ([[ARG1]])
|
2014-07-23 14:49:42 +00:00
|
|
|
; CHECK: ret
|
|
|
|
|
|
|
|
define void @mask16_mem(i16* %ptr) {
|
2015-02-27 21:17:42 +00:00
|
|
|
%x = load i16, i16* %ptr, align 4
|
2014-07-23 14:49:42 +00:00
|
|
|
%m0 = bitcast i16 %x to <16 x i1>
|
|
|
|
%m1 = xor <16 x i1> %m0, <i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1>
|
|
|
|
%ret = bitcast <16 x i1> %m1 to i16
|
|
|
|
store i16 %ret, i16* %ptr, align 4
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2015-01-25 12:47:15 +00:00
|
|
|
; CHECK-LABEL: mask8_mem
|
|
|
|
; KNL: kmovw ([[ARG1]]), %k{{[0-7]}}
|
|
|
|
; KNL-NEXT: knotw
|
|
|
|
; KNL-NEXT: kmovw %k{{[0-7]}}, ([[ARG1]])
|
|
|
|
; SKX: kmovb ([[ARG1]]), %k{{[0-7]}}
|
|
|
|
; SKX-NEXT: knotb
|
|
|
|
; SKX-NEXT: kmovb %k{{[0-7]}}, ([[ARG1]])
|
|
|
|
|
2014-07-23 14:49:42 +00:00
|
|
|
define void @mask8_mem(i8* %ptr) {
|
2015-02-27 21:17:42 +00:00
|
|
|
%x = load i8, i8* %ptr, align 4
|
2014-07-23 14:49:42 +00:00
|
|
|
%m0 = bitcast i8 %x to <8 x i1>
|
|
|
|
%m1 = xor <8 x i1> %m0, <i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1>
|
|
|
|
%ret = bitcast <8 x i1> %m1 to i8
|
|
|
|
store i8 %ret, i8* %ptr, align 4
|
|
|
|
ret void
|
2013-08-05 08:52:21 +00:00
|
|
|
}
|
|
|
|
|
2015-01-25 12:47:15 +00:00
|
|
|
; CHECK-LABEL: mand16
|
|
|
|
; CHECK: kandw
|
|
|
|
; CHECK: kxorw
|
|
|
|
; CHECK: korw
|
2013-08-05 08:52:21 +00:00
|
|
|
define i16 @mand16(i16 %x, i16 %y) {
|
|
|
|
%ma = bitcast i16 %x to <16 x i1>
|
|
|
|
%mb = bitcast i16 %y to <16 x i1>
|
|
|
|
%mc = and <16 x i1> %ma, %mb
|
|
|
|
%md = xor <16 x i1> %ma, %mb
|
|
|
|
%me = or <16 x i1> %mc, %md
|
|
|
|
%ret = bitcast <16 x i1> %me to i16
|
|
|
|
ret i16 %ret
|
|
|
|
}
|
|
|
|
|
2015-01-25 12:47:15 +00:00
|
|
|
; CHECK-LABEL: shuf_test1
|
2013-08-05 08:52:21 +00:00
|
|
|
; CHECK: kshiftrw $8
|
|
|
|
define i8 @shuf_test1(i16 %v) nounwind {
|
|
|
|
%v1 = bitcast i16 %v to <16 x i1>
|
|
|
|
%mask = shufflevector <16 x i1> %v1, <16 x i1> undef, <8 x i32> <i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
|
|
|
|
%mask1 = bitcast <8 x i1> %mask to i8
|
|
|
|
ret i8 %mask1
|
|
|
|
}
|
2014-02-17 07:29:33 +00:00
|
|
|
|
2015-01-25 12:47:15 +00:00
|
|
|
; CHECK-LABEL: zext_test1
|
2014-02-17 07:29:33 +00:00
|
|
|
; CHECK: kshiftlw
|
|
|
|
; CHECK: kshiftrw
|
|
|
|
; CHECK: kmovw
|
2015-01-25 12:47:15 +00:00
|
|
|
|
2014-02-17 07:29:33 +00:00
|
|
|
define i32 @zext_test1(<16 x i32> %a, <16 x i32> %b) {
|
|
|
|
%cmp_res = icmp ugt <16 x i32> %a, %b
|
|
|
|
%cmp_res.i1 = extractelement <16 x i1> %cmp_res, i32 5
|
|
|
|
%res = zext i1 %cmp_res.i1 to i32
|
|
|
|
ret i32 %res
|
|
|
|
}
|
|
|
|
|
2015-01-25 12:47:15 +00:00
|
|
|
; CHECK-LABEL: zext_test2
|
2014-02-17 07:29:33 +00:00
|
|
|
; CHECK: kshiftlw
|
|
|
|
; CHECK: kshiftrw
|
|
|
|
; CHECK: kmovw
|
2015-01-25 12:47:15 +00:00
|
|
|
|
2014-02-17 07:29:33 +00:00
|
|
|
define i16 @zext_test2(<16 x i32> %a, <16 x i32> %b) {
|
|
|
|
%cmp_res = icmp ugt <16 x i32> %a, %b
|
|
|
|
%cmp_res.i1 = extractelement <16 x i1> %cmp_res, i32 5
|
|
|
|
%res = zext i1 %cmp_res.i1 to i16
|
|
|
|
ret i16 %res
|
|
|
|
}
|
|
|
|
|
2015-01-25 12:47:15 +00:00
|
|
|
; CHECK-LABEL: zext_test3
|
2014-02-17 07:29:33 +00:00
|
|
|
; CHECK: kshiftlw
|
|
|
|
; CHECK: kshiftrw
|
|
|
|
; CHECK: kmovw
|
2015-01-25 12:47:15 +00:00
|
|
|
|
2014-02-17 07:29:33 +00:00
|
|
|
define i8 @zext_test3(<16 x i32> %a, <16 x i32> %b) {
|
|
|
|
%cmp_res = icmp ugt <16 x i32> %a, %b
|
|
|
|
%cmp_res.i1 = extractelement <16 x i1> %cmp_res, i32 5
|
|
|
|
%res = zext i1 %cmp_res.i1 to i8
|
|
|
|
ret i8 %res
|
|
|
|
}
|
2015-01-25 12:47:15 +00:00
|
|
|
|
|
|
|
; CHECK-LABEL: conv1
|
|
|
|
; KNL: kmovw %k0, %eax
|
|
|
|
; KNL: movb %al, (%rdi)
|
|
|
|
; SKX: kmovb %k0, (%rdi)
|
|
|
|
define i8 @conv1(<8 x i1>* %R) {
|
|
|
|
entry:
|
|
|
|
store <8 x i1> <i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1>, <8 x i1>* %R
|
|
|
|
|
|
|
|
%maskPtr = alloca <8 x i1>
|
|
|
|
store <8 x i1> <i1 0, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1>, <8 x i1>* %maskPtr
|
2015-02-27 21:17:42 +00:00
|
|
|
%mask = load <8 x i1>, <8 x i1>* %maskPtr
|
2015-01-25 12:47:15 +00:00
|
|
|
%mask_convert = bitcast <8 x i1> %mask to i8
|
|
|
|
ret i8 %mask_convert
|
|
|
|
}
|