On 5/4/24 6:53 PM, Jeff Law wrote:

So another constant synthesis improvement.

In this patch we're looking at cases where we'd like to be able to use lui+slli, but can't because of the sign extending nature of lui on TARGET_64BIT.  For example: 0x8001100000020UL.  The trunk currently generates 4 instructions for that constant, when it can be done with 3 (lui+slli.uw+addi).

When Zba is enabled, we can use lui+slli.uw as the slli.uw masks off the bits 32..63 before shifting, giving us the precise semantics we want.

I strongly suspect we'll want to do the same for a set of constants with lui+add.uw, lui+shNadd.uw, so you'll see the beginnings of generalizing support for lui followed by a "uw" instruction.

The new test just tests the set of cases that showed up while exploring a particular space of the constant synthesis problem.  It's not meant to be exhaustive (failure to use shadd when profitable).

Tested on rv64gc and rv32gcv.  OK for the trunk assuming it passes CI?
I pushed this after fixing the two over-length lines.

jeff

Reply via email to