<div dir="ltr">This patch reorders two transforms that collide with each other:<div><br></div><div style>One performs: (X == 13 | X == 14) -> X-13 <u 2</div><div style>The other: (A == C1 || A == C2) -> (A & ~(C1 ^ C2)) == C1</div>
<div style><br></div><div style>The problem is that there are certain values of C1 and C2 that trigger both transforms but the first one blocks out the second, this generates suboptimal code.</div><div style><br></div><div style>
Reordering the transforms should be better in every case and allows us to do interesting stuff like turn:</div><div style><div>  %shr = lshr i32 %X, 4</div><div>  %and = and i32 %shr, 15</div><div>  %add = add i32 %and, -14</div>
<div>  %tobool = icmp ne i32 %add, 0</div><div><br></div><div style>into:</div><div style>  %and = and i32 %X, 240</div><div style>  %tobool = icmp ne i32 %and, 224</div><div style><br></div><div style>-- </div><div style>
David Majnemer</div></div></div>