<div>Hello everyone,</div><div><br></div><div>I've added the "S" suffixed versions of ARM and Thumb2 instructions to tablegen. Those are, for example, "movs" or "muls".</div><div>Of course, some instructions have already had their twins, such as add/adds, and I leaved them untouched.</div>
<div>Besides, I propose the codegen optimization based on them, which removes the redundant comparison in patterns like</div><div><br></div><div>orr r1, r2, r3         ---->        orrs r1, r2, r3</div><div>cmp r1, 0</div>
<div><br></div><div>This optimization has shown nice acceleration, e.g. 3.3% in SQLite on CortexA8 and works fine.</div><div>I have some questions though.</div><div><br></div><div>1)"neverHasSideEffects" in tablegen means that CPSR is not implicitly defined, doesn't it?</div>
<div>2)What else can be done using that super "S" power?</div><div>3)Current optimization implementation works similar to peephole (peephole pitiful cmp optimization was disabled),</div><div>right before ifcvt. Should I raise it up somewhere? What do you think is the right place for such thing?</div>
<div>4)Consider the following C code:</div><div><br></div><div>int a, b, c;</div><div>...</div><div>a = b * c;</div><div>if (a > 0) { ... }</div><div><br></div><div>One gets the corresponding ARM assembler</div><div><br>
</div><div>mul r(a), r(b), r(c)</div><div>cmp r(a), 1</div><div>blt LABEL</div><div><br></div><div>// r(x) is the register where x is</div><div><br></div><div>The other cases ("if (a == 0)", "if (a < 0)") produce expected</div>
<div><br></div><div>cmp r(a), 0</div><div><br></div><div>So what is the hidden idea of this resultant comparison with 1?</div><div>Where should I look for the code behind that logic?</div><div><br></div><div>Thanks,</div>
<div>  Vadim Markovtsev,</div><div>  ISP RAS.</div>