Closed
Description
There are many optimizations in amd64.rules that apply to many architectures. As we add architectures, it'd be nice not to repeat discovering and encoding these rules.
To pick an example at random:
(ANDLconst [c] (ANDLconst [d] x)) -> (ANDLconst [c & d] x)
This could probably be done in generic.rules by introducing generic AndNNconst ops.
In some cases, we'd still need the arch-specific rules because optimizable patterns are introduced during lowering. If there are enough of those cases, it might be worth introducing common lowered ops and common lowered optimizations. The best way to find out it to start migrating rules and see.