This rounds out the most popular instructions. There's a histogram of remaining instructions in the projects I know about in this gist.
Added instructions:
addc
adde
addze
subfc
subfe
subfze
andc
eqv
cntlzw
fres
frsqrte
fsel
The carry/extended behavior of the -c/-e instructions is not implemented. Usually these instructions are used to implement 64-bit integer arithmetic, but the codebase isn't currently equipped to easily handle this. (The instructions may be interleaved, and the value may be in an arbitrary pair of registers.)
Added a pattern to fold_divmod to rewrite CLZ(x) >> 5 into x == 0.
This accounts for ~80% of cntlzw usage (and is why its implemented as a UnaryOp instead of a fn_op). This is tested by the comparison e2e test.
Also expanded the pattern for modulo-by-power-of-2 to match the MWCC version, which emits (x - (x >> N) * M) instead of (x - (x / N) * N).
The other comparison patterns aren't detected yet (see the comparison e2e test).
This rounds out the most popular instructions. There's a histogram of remaining instructions in the projects I know about in this gist.
Added instructions:
addc
adde
addze
subfc
subfe
subfze
andc
eqv
cntlzw
fres
frsqrte
fsel
The carry/extended behavior of the
-c
/-e
instructions is not implemented. Usually these instructions are used to implement 64-bit integer arithmetic, but the codebase isn't currently equipped to easily handle this. (The instructions may be interleaved, and the value may be in an arbitrary pair of registers.)Added a pattern to
fold_divmod
to rewriteCLZ(x) >> 5
intox == 0
. This accounts for ~80% ofcntlzw
usage (and is why its implemented as aUnaryOp
instead of afn_op
). This is tested by thecomparison
e2e test.Also expanded the pattern for modulo-by-power-of-2 to match the MWCC version, which emits
(x - (x >> N) * M)
instead of(x - (x / N) * N)
.The other comparison patterns aren't detected yet (see the
comparison
e2e test).