Special case tblgen generated code for patterns like (and X, 255) or (or X, 42).
authorChris Lattner <sabre@nondot.org>
Wed, 11 Oct 2006 04:05:55 +0000 (04:05 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 11 Oct 2006 04:05:55 +0000 (04:05 +0000)
commit39e73f7c8318ab2791884d1c4e78ff849ddbaa16
tree4c3c9b1c92c0fd08f6edb2814eecb0a9df5e7ab3
parent2f239b9289a8c0998705003fdc87648c47b763a3
Special case tblgen generated code for patterns like (and X, 255) or (or X, 42).
The dag/inst combiners often 'simplify' the masked value based on whether
or not the bits are live or known zero/one.  This is good and dandy, but
often causes special case patterns to fail, such as alpha's CMPBGE pattern,
which looks like "(set GPRC:$RC, (setuge (and GPRC:$RA, 255), (and GPRC:$RB, 255)))".
Here the pattern for (and X, 255) should match actual dags like (and X, 254) if
the dag combiner proved that the missing bits are already zero (one for 'or').

For CodeGen/Alpha/cmpbge.ll:test2 for example, this results in:

        sll $16,1,$0
        cmpbge $0,$17,$0
        ret $31,($26),1

instead of:

        sll $16,1,$0
        and $0,254,$0
        and $17,255,$1
        cmpule $1,$0,$0
        ret $31,($26),1

... and requires no target-specific code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30871 91177308-0d34-0410-b5e6-96231b3b80d8
utils/TableGen/DAGISelEmitter.cpp