AVX-512: Fixed a bug in comparison of i1 vectors.

cmp eq should give kxnor instruction
cmp neq should give kxor 

https://llvm.org/bugs/show_bug.cgi?id=23631



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239460 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Elena Demikhovsky 2015-06-10 06:49:28 +00:00
parent a6f2be013a
commit 189930760d
3 changed files with 9 additions and 9 deletions

View File

@ -13239,13 +13239,13 @@ static SDValue LowerBoolVSETCC_AVX512(SDValue Op, SelectionDAG &DAG) {
DAG.getConstant(-1, dl, VT)); DAG.getConstant(-1, dl, VT));
switch (SetCCOpcode) { switch (SetCCOpcode) {
default: llvm_unreachable("Unexpected SETCC condition"); default: llvm_unreachable("Unexpected SETCC condition");
case ISD::SETNE: case ISD::SETEQ:
// (x != y) -> ~(x ^ y) // (x == y) -> ~(x ^ y)
return DAG.getNode(ISD::XOR, dl, VT, return DAG.getNode(ISD::XOR, dl, VT,
DAG.getNode(ISD::XOR, dl, VT, Op0, Op1), DAG.getNode(ISD::XOR, dl, VT, Op0, Op1),
DAG.getConstant(-1, dl, VT)); DAG.getConstant(-1, dl, VT));
case ISD::SETEQ: case ISD::SETNE:
// (x == y) -> (x ^ y) // (x != y) -> (x ^ y)
return DAG.getNode(ISD::XOR, dl, VT, Op0, Op1); return DAG.getNode(ISD::XOR, dl, VT, Op0, Op1);
case ISD::SETUGT: case ISD::SETUGT:
case ISD::SETGT: case ISD::SETGT:

View File

@ -2044,11 +2044,11 @@ defm : avx512_binop_pat<xor, KXORWrr>;
def : Pat<(xor (xor VK16:$src1, VK16:$src2), (v16i1 immAllOnesV)), def : Pat<(xor (xor VK16:$src1, VK16:$src2), (v16i1 immAllOnesV)),
(KXNORWrr VK16:$src1, VK16:$src2)>; (KXNORWrr VK16:$src1, VK16:$src2)>;
def : Pat<(xor (xor VK8:$src1, VK8:$src2), (v8i1 immAllOnesV)), def : Pat<(xor (xor VK8:$src1, VK8:$src2), (v8i1 immAllOnesV)),
(KXNORBrr VK8:$src1, VK8:$src2)>; (KXNORBrr VK8:$src1, VK8:$src2)>, Requires<[HasDQI]>;
def : Pat<(xor (xor VK32:$src1, VK32:$src2), (v32i1 immAllOnesV)), def : Pat<(xor (xor VK32:$src1, VK32:$src2), (v32i1 immAllOnesV)),
(KXNORDrr VK32:$src1, VK32:$src2)>; (KXNORDrr VK32:$src1, VK32:$src2)>, Requires<[HasBWI]>;
def : Pat<(xor (xor VK64:$src1, VK64:$src2), (v64i1 immAllOnesV)), def : Pat<(xor (xor VK64:$src1, VK64:$src2), (v64i1 immAllOnesV)),
(KXNORQrr VK64:$src1, VK64:$src2)>; (KXNORQrr VK64:$src1, VK64:$src2)>, Requires<[HasBWI]>;
let Predicates = [NoDQI] in let Predicates = [NoDQI] in
def : Pat<(xor (xor VK8:$src1, VK8:$src2), (v8i1 immAllOnesV)), def : Pat<(xor (xor VK8:$src1, VK8:$src2), (v8i1 immAllOnesV)),

View File

@ -394,7 +394,7 @@ define <8 x i64> @test27(<8 x i64> %x, i64* %yb.ptr, <8 x i64> %x1, <8 x i64> %y
; KNL-LABEL: test28 ; KNL-LABEL: test28
; KNL: vpcmpgtq ; KNL: vpcmpgtq
; KNL: vpcmpgtq ; KNL: vpcmpgtq
; KNL: kxorw ; KNL: kxnorw
define <8 x i32>@test28(<8 x i64> %x, <8 x i64> %y, <8 x i64> %x1, <8 x i64> %y1) { define <8 x i32>@test28(<8 x i64> %x, <8 x i64> %y, <8 x i64> %x1, <8 x i64> %y1) {
%x_gt_y = icmp sgt <8 x i64> %x, %y %x_gt_y = icmp sgt <8 x i64> %x, %y
%x1_gt_y1 = icmp sgt <8 x i64> %x1, %y1 %x1_gt_y1 = icmp sgt <8 x i64> %x1, %y1
@ -406,7 +406,7 @@ define <8 x i32>@test28(<8 x i64> %x, <8 x i64> %y, <8 x i64> %x1, <8 x i64> %y1
; KNL-LABEL: test29 ; KNL-LABEL: test29
; KNL: vpcmpgtd ; KNL: vpcmpgtd
; KNL: vpcmpgtd ; KNL: vpcmpgtd
; KNL: kxnorw ; KNL: kxorw
define <16 x i8>@test29(<16 x i32> %x, <16 x i32> %y, <16 x i32> %x1, <16 x i32> %y1) { define <16 x i8>@test29(<16 x i32> %x, <16 x i32> %y, <16 x i32> %x1, <16 x i32> %y1) {
%x_gt_y = icmp sgt <16 x i32> %x, %y %x_gt_y = icmp sgt <16 x i32> %x, %y
%x1_gt_y1 = icmp sgt <16 x i32> %x1, %y1 %x1_gt_y1 = icmp sgt <16 x i32> %x1, %y1