llvm.org GIT mirror llvm / 82a51de
Revert "SelectionDAG: Enable (and (setcc x), (setcc y)) -> (setcc (and x, y)) for vectors" This reverts commit r210540, adds a testcase for the regression it caused, and marks the R600 test it was supposed to fix as XFAIL. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210792 91177308-0d34-0410-b5e6-96231b3b80d8 Tom Stellard 5 years ago
3 changed file(s) with 52 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
27572757 ISD::CondCode Op0 = cast(CC0)->get();
27582758 ISD::CondCode Op1 = cast(CC1)->get();
27592759
2760 if (LR == RR && Op0 == Op1 &&
2760 if (LR == RR && isa(LR) && Op0 == Op1 &&
27612761 LL.getValueType().isInteger()) {
27622762 // fold (and (seteq X, 0), (seteq Y, 0)) -> (seteq (or X, Y), 0)
2763 if (TLI.isConstFalseVal(LR.getNode()) && Op1 == ISD::SETEQ) {
2763 if (cast(LR)->isNullValue() && Op1 == ISD::SETEQ) {
27642764 SDValue ORNode = DAG.getNode(ISD::OR, SDLoc(N0),
27652765 LR.getValueType(), LL, RL);
27662766 AddToWorkList(ORNode.getNode());
27672767 return DAG.getSetCC(SDLoc(N), VT, ORNode, LR, Op1);
27682768 }
27692769 // fold (and (seteq X, -1), (seteq Y, -1)) -> (seteq (and X, Y), -1)
2770 if (TLI.isConstTrueVal(LR.getNode()) && Op1 == ISD::SETEQ) {
2770 if (cast(LR)->isAllOnesValue() && Op1 == ISD::SETEQ) {
27712771 SDValue ANDNode = DAG.getNode(ISD::AND, SDLoc(N0),
27722772 LR.getValueType(), LL, RL);
27732773 AddToWorkList(ANDNode.getNode());
27742774 return DAG.getSetCC(SDLoc(N), VT, ANDNode, LR, Op1);
27752775 }
27762776 // fold (and (setgt X, -1), (setgt Y, -1)) -> (setgt (or X, Y), -1)
2777 if (TLI.isConstTrueVal(LR.getNode()) && Op1 == ISD::SETGT) {
2777 if (cast(LR)->isAllOnesValue() && Op1 == ISD::SETGT) {
27782778 SDValue ORNode = DAG.getNode(ISD::OR, SDLoc(N0),
27792779 LR.getValueType(), LL, RL);
27802780 AddToWorkList(ORNode.getNode());
0 ; RUN: llc -march=r600 -mcpu=cypress < %s | FileCheck -check-prefix=EG %s
1 ; XFAIL: *
12
23 ; EG-LABEL: @and_setcc_setcc_i32
34 ; EG: AND_INT
0 ; RUN: llc < %s | FileCheck %s
1
2 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
3 target triple = "x86_64-apple-macosx10.10.0"
4
5 ; Function Attrs: nounwind
6 declare i32 @printf(i8* nocapture readonly, ...)
7
8 ; On X86 1 is true and 0 is false, so we can't perform the combine:
9 ; (and (setgt X, true), (setgt Y, true)) -> (setgt (or X, Y), true)
10 ; This combine only works if the true value is -1.
11
12
13 ;CHECK: cmpl
14 ;CHECK: setg
15 ;CHECK: cmpl
16 ;CHECK: setg
17 ;CHECK: andb
18
19 @.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
20 ; Function Attrs: optsize ssp uwtable
21 define i32 @foo(i32 %a, i32 %b, i32 * %c) {
22 if.else429:
23 %cmp.i1144 = icmp eq i32* %c, null
24 %cmp430 = icmp slt i32 %a, 2
25 %cmp432 = icmp slt i32 %b, 2
26 %or.cond710 = or i1 %cmp430, %cmp432
27 %or.cond710.not = xor i1 %or.cond710, true
28 %brmerge1448 = or i1 %cmp.i1144, %or.cond710.not
29 br i1 %brmerge1448, label %ret1, label %ret2
30
31 ret1:
32 ret i32 0
33
34 ret2:
35 ret i32 1
36 }
37
38 define i32 @main(i32 %argc, i8** nocapture readnone %argv) {
39 %res = alloca i32, align 4
40 %t = call i32 @foo(i32 1, i32 2, i32* %res) #3
41 %v = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i64 0, i64 0), i32 %t)
42 ret i32 0
43 }
44
45
46