catch constants more often

llvm-svn: 30534
This commit is contained in:
Andrew Lenharth 2006-09-20 15:05:49 +00:00
parent 054efcd85d
commit d12f2d614a
2 changed files with 14 additions and 16 deletions

View File

@ -214,6 +214,20 @@ def : Pat<(select GPRC:$which, GPRC:$src1, GPRC:$src2),
def : Pat<(select GPRC:$which, GPRC:$src1, immUExt8:$src2),
(CMOVEQi GPRC:$src1, immUExt8:$src2, GPRC:$which)>;
//Invert sense when we can for constants:
def : Pat<(select (seteq GPRC:$RCOND, 0), immUExt8:$RFALSE, GPRC:$RTRUE),
(CMOVEQi GPRC:$RTRUE, immUExt8:$RFALSE, GPRC:$RCOND)>;
def : Pat<(select (setne GPRC:$RCOND, 0), immUExt8:$RFALSE, GPRC:$RTRUE),
(CMOVNEi GPRC:$RTRUE, immUExt8:$RFALSE, GPRC:$RCOND)>;
def : Pat<(select (setgt GPRC:$RCOND, 0), immUExt8:$RFALSE, GPRC:$RTRUE),
(CMOVGTi GPRC:$RTRUE, immUExt8:$RFALSE, GPRC:$RCOND)>;
def : Pat<(select (setge GPRC:$RCOND, 0), immUExt8:$RFALSE, GPRC:$RTRUE),
(CMOVGEi GPRC:$RTRUE, immUExt8:$RFALSE, GPRC:$RCOND)>;
def : Pat<(select (setlt GPRC:$RCOND, 0), immUExt8:$RFALSE, GPRC:$RTRUE),
(CMOVLTi GPRC:$RTRUE, immUExt8:$RFALSE, GPRC:$RCOND)>;
def : Pat<(select (setle GPRC:$RCOND, 0), immUExt8:$RFALSE, GPRC:$RTRUE),
(CMOVLEi GPRC:$RTRUE, immUExt8:$RFALSE, GPRC:$RCOND)>;
def ADDL : OForm< 0x10, 0x00, "addl $RA,$RB,$RC",
[(set GPRC:$RC, (intop (add GPRC:$RA, GPRC:$RB)))], s_iadd>;

View File

@ -1,19 +1,3 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Fix cmovs with a constant on the wrong side
aka:
lda $0,10($31)
cmovlt $17,$0,$16
is bad for:
long %cmov_lt2(long %a, long %c) {
entry:
%tmp.1 = setlt long %c, 0
%retval = select bool %tmp.1, long 10, long %a
ret long %retval
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Fix Ordered/Unordered FP stuff