First off, thank you for volunteering to keep the Xbitmanip extension alive.
I read through the instruction prevalence statistics[0] used to justify only the inclusion of andc, but not any of the other complementing bitwise instructions (nand, xnor, nor, orn, and so on). One thing that has me confused is why `mv' followed by `not' appears as an eligible fusion pattern in the generated code. The only way to emit a `not` instruction isn't destructive, so why would it be fusible with `mv`?
I read the python script that generates the statistics, and it looks to me like its properly accounting for live ranges within each basic block. The catch is, that it doesn't account for live ranges that cross basic blocks in the control flow graph.
I was thinking that having either source_sinks == 0 or this_sinks == 0 could be used as a proxy to see how often keeping the search within a single basic block would be interfering with the analysis. Either of those conditions indicates that either the source or or the sink for the instruction is inside another basic block. So I instrumented the script with a warning on those conditions, and it got triggered about 800 times (out of 942 'not' insns), and 40 times out of 63 `neg` instructions.
So, that's not great. I've been thinking that rather than try to make the script build up the control flow graph and trace its way across basic blocks, that it might be easier to "just" add support for the candidate instructions in GCC and Binutils for A/B testing. What do you think?
[0]:
http://svn.clifford.at/handicraft/2017/bitcode/notneg.txtThanks,
-Jonathan