On 6/30/24 06:59, Jeff Law wrote:
>> Any ideas on how I can keep this and then adjust rest of patterns.
> Yea. Drop the "SImode" references from the RTL template of the
> expander. Then you'll need to verify the modes in the C fragment that
> generates code. You'd want to test the mode of operand0 and the mode of
> the UNSPEC. If they aren't word_mode, then FAIL.
Testing specifically for word_mode doesn't work for int operand.
> This works because those expanders are allowed to use FAIL. Some
> expanders aren't allowed to do that (they're supposed to be documented
> appropriately in the internals manual).
>
> In the matching define_insns, you can use X and adjust their names.
Sorry I'm still not sure how to use X in the define insn. It seems we
have to skip mode in match_operand specification there as well.
I'll post v2 and take it from there.
>
>>> It shouldn't be terrible, but it's not trivial either.
>>>
>>> bext t0, a0, 0
>>> neg t0
>>> bext t1, a0, 7
>>> czero.nez res, t0, t1
>>> snez t1, t1
>>> add a0, a1, a0
>>>
>>> Or something reasonably close to that.
>> I wrote the "C" code and saw what compiler would do ;-) for the baseline
>> isa build.
>>
>> andi a5,a0,128
>> bne a5,zero,.L7
>> slli a5,a0,63
>> srai a0,a5,63
>> ret
>> .L7:
>> li a0,1
>> ret
>>
>> But again labels are hard (for me ) in md.
> I'm sure there examples. Look at <round_pattern><ANYF:mode>2
Cool, not sure how I missed it. I'll do this in v3 or a separate patch.
-Vineet