aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/Alpha/AlphaInstrInfo.td
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-10-11 05:13:56 +0000
committerChris Lattner <sabre@nondot.org>2006-10-11 05:13:56 +0000
commitd615ded96ed2ee8e6537a7132a5364a29f37b46e (patch)
tree434eebae0d704013ed98a1c0ae185ff8cf169d06 /lib/Target/Alpha/AlphaInstrInfo.td
parent3d2da9a426810e48fd797eaa385a5f072ccd5b69 (diff)
downloadexternal_llvm-d615ded96ed2ee8e6537a7132a5364a29f37b46e.zip
external_llvm-d615ded96ed2ee8e6537a7132a5364a29f37b46e.tar.gz
external_llvm-d615ded96ed2ee8e6537a7132a5364a29f37b46e.tar.bz2
Use cute tblgen tricks to make zap handling more powerful. Specifically,
when the dag combiner simplifies an and mask, notice this and allow those bits to be missing from the zap mask. This compiles Alpha/zapnot4.ll into: sll $16,3,$0 zapnot $0,3,$0 ret $31,($26),1 instead of: ldah $0,1($31) lda $0,-8($0) sll $16,3,$1 and $1,$0,$0 ret $31,($26),1 It would be *really* nice to replace the hunk of code in the AlphaISelDAGToDAG.cpp file that matches (and (srl (x, C), c2) into (SRL (ZAPNOTi)) with a similar pattern, but I've spent enough time poking at alpha. Make andrew will do this. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30875 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/Alpha/AlphaInstrInfo.td')
-rw-r--r--lib/Target/Alpha/AlphaInstrInfo.td26
1 files changed, 18 insertions, 8 deletions
diff --git a/lib/Target/Alpha/AlphaInstrInfo.td b/lib/Target/Alpha/AlphaInstrInfo.td
index d63d0ba..3f897a7 100644
--- a/lib/Target/Alpha/AlphaInstrInfo.td
+++ b/lib/Target/Alpha/AlphaInstrInfo.td
@@ -59,8 +59,9 @@ def LL16 : SDNodeXForm<imm, [{ //lda part of constant
def LH16 : SDNodeXForm<imm, [{ //ldah part of constant (or more if too big)
return getI64Imm(get_ldah16(N->getValue()));
}]>;
-def iZAPX : SDNodeXForm<imm, [{ // get imm to ZAPi
- return getI64Imm(get_zapImm((uint64_t)N->getValue()));
+def iZAPX : SDNodeXForm<and, [{ // get imm to ZAPi
+ ConstantSDNode *RHS = cast<ConstantSDNode>(N->getOperand(1));
+ return getI64Imm(get_zapImm(SDOperand(), RHS->getValue()));
}]>;
def nearP2X : SDNodeXForm<imm, [{
return getI64Imm(Log2_64(getNearPower2((uint64_t)N->getValue())));
@@ -85,10 +86,15 @@ def immSExt16 : PatLeaf<(imm), [{ //imm fits in 16 bit sign extended field
def immSExt16int : PatLeaf<(imm), [{ //(int)imm fits in a 16 bit sign extended field
return ((int64_t)N->getValue() << 48) >> 48 == ((int64_t)N->getValue() << 32) >> 32;
}], SExt16>;
-def immZAP : PatLeaf<(imm), [{ //imm is good for zapi
- uint64_t build = get_zapImm((uint64_t)N->getValue());
- return build != 0;
-}], iZAPX>;
+
+def zappat : PatFrag<(ops node:$LHS), (and node:$LHS, imm:$L), [{
+ if (ConstantSDNode *RHS = dyn_cast<ConstantSDNode>(N->getOperand(1))) {
+ uint64_t build = get_zapImm(N->getOperand(0), (uint64_t)RHS->getValue());
+ return build != 0;
+ }
+ return false;
+}]>;
+
def immFPZ : PatLeaf<(fpimm), [{ //the only fpconstant nodes are +/- 0.0
return true;
}]>;
@@ -386,8 +392,12 @@ def XOR : OForm< 0x11, 0x40, "xor $RA,$RB,$RC",
def XORi : OFormL<0x11, 0x40, "xor $RA,$L,$RC",
[(set GPRC:$RC, (xor GPRC:$RA, immUExt8:$L))], s_ilog>;
-def ZAPNOTi : OFormL<0x12, 0x31, "zapnot $RA,$L,$RC",
- [(set GPRC:$RC, (and GPRC:$RA, immZAP:$L))], s_ishf>;
+def ZAPNOTi : OFormL<0x12, 0x31, "zapnot $RA,$L,$RC", [], s_ishf>;
+
+// Define the pattern that produces ZAPNOTi.
+def : Pat<(i64 (zappat GPRC:$RA):$imm),
+ (ZAPNOTi GPRC:$RA, (iZAPX GPRC:$imm))>;
+
//Comparison, int
//So this is a waste of what this instruction can do, but it still saves something