Validity of SUBREG+AND-imm transformations

Kyrill Tkachov kyrylo.tkachov@foss.arm.com
Fri Mar 4 14:41:00 GMT 2016


On 04/03/16 11:59, Segher Boessenkool wrote:
> On Mon, Feb 29, 2016 at 10:51:24AM +0000, Kyrill Tkachov wrote:
>> So I'm trying to create a define_insn to match something like:
>>    [(set (match_operand:SI 0 "register_operand" "=r")
>>      (ashift:SI
>>        (match_operand:SI 1 "register_operand" "r")
>>        (and:QI
>>          (match_operand:QI 2 "register_operand" "r")
>>          (match_operand:QI 3 "const_int_operand" "n"))))]
>>
>>
>> where operands[3] is 31 for SImode. The 'and' expression has to be in
>> QImode because our shift expanders
>> expand the shift amount to QImode.
> Is there any reason for that?  Why not SImode?

It's been that way since the beginning. I don't know the reason.
I tried changing to SImode. It requires a lot mechanical changes to
all the shift+arithmetic patterns, but it does work.
It catches a few more cases that my original approach (not sure why yet,
would have to dig in the dumps) but it also widens a few memory accesses
i.e. we'll now be loading a 32-bit value from memory instead of a byte.
Overall it could be a better approach, though it would be a larger patch
and would need more investigation of potential side effects.

Thanks,
Kyrill

>
> Segher



More information about the Gcc mailing list