On 17/12/15 16:12, Bernd Schmidt wrote:
On 12/17/2015 05:10 PM, Kyrill Tkachov wrote:
Well, this patch still produces the QImode comparison if the target has
a QImode comparison
(the have_insn_for check in the simplify_comparison hunk).

Ok, I didn't look that closely because I had doubts about the approach. This 
kind of check also goes somewhat against the principles of just producing 
canonical forms of RTL.


One could argue that if the target has (or advertises having) a native
QImode register comparison then it's objectively a simplification to transform 
a comparison in a wider mode
to a comparison in the shorter mode.

If, however, the target doesn't have such an instruction (like aarch64 doesn't 
have QImode registers) then
truncating the wider mode to QImode through a subreg is not less complex than a 
zero_extract, as both will
involve some form of extracting/masking the desired QImode bits. So picking a 
canonical form there makes sense,
and the documentation already specifies the zero_extract form as the canonical.

Would be nice to get a definite clarification on whether the subreg form is 
indeed the canonical one.
Then we can document it and I can just add a QI/HImode compare pattern to 
aarch64.

Thanks,
Kyrill


Bernd


Reply via email to