diff options
author | Chris Lattner <sabre@nondot.org> | 2006-11-14 05:28:08 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-11-14 05:28:08 +0000 |
commit | ac011bce9e8a69f99f92d46133adbf883a91cb6f (patch) | |
tree | 34da12c0a906915f3c2a4d720abc7c197a33d580 /utils/TableGen/CodeGenTarget.cpp | |
parent | 472c7918b0bc155e002db6f682c899e21bff852c (diff) |
lower "X = seteq Y, Z" to '(shr (ctlz (xor Y, Z)), 5)' instead of
'(shr (ctlz (sub Y, Z)), 5)'.
The use of xor better exposes the operation to bit-twiddling logic in the
dag combiner. For example, this:
typedef struct {
unsigned prefix : 4;
unsigned code : 4;
unsigned unsigned_p : 4;
} tree_common;
int foo(tree_common *a, tree_common *b) {
return a->code == b->code;
}
Now compiles to:
_foo:
lwz r2, 0(r4)
lwz r3, 0(r3)
xor r2, r3, r2
rlwinm r2, r2, 28, 28, 31
cntlzw r2, r2
srwi r3, r2, 5
blr
instead of:
_foo:
lbz r2, 3(r4)
lbz r3, 3(r3)
srwi r2, r2, 4
srwi r3, r3, 4
subf r2, r2, r3
cntlzw r2, r2
srwi r3, r2, 5
blr
saving a cycle.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31725 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/CodeGenTarget.cpp')
0 files changed, 0 insertions, 0 deletions