[aarch64-port-dev ] RFR 8248870: AARCH64: I2L conversions can be skipped for small positive masked values

Andrew Haley aph at redhat.com
Mon Jul 27 15:45:24 UTC 2020


> In my view, eliding the redundant 'sxt' above are more likely a
> machine code problem rather than a IR problem.  I think peephole is
> the best fit for above optimization. However, C2's peephole is very
> complicated and I'm not sure whether it has been enabled in AArch64.

> So I was thinking if it better to remove this kinds of instructions
> in macro-assembler, even this sounds somehow beyond the assembler's
> responsibility. By handling those pair in macro-assembler, we can
> only focus on instruction sequence rather than the type and shape of
> IR node.

Is that even possible? Sure, it works if an instruction's output is the
same as its sole register input, but that's all.

If these things can be canonicalized earlier in compilation they
should be. This one:

     sxth    w11, w1
     sxtw    x0, w11

Corresponds with

     (((long)n) << 48) >> 48

and

     and     w11, w1, #0xffff
     sxtw    x0, w11

with

     (((long)n) << 48) >>> 48

and that's how they could be canonicalized early in compilation.
Whether that's a good idea depends on other processors, though. It'll
probably not hurt them but it'll help us.

-- 
Andrew Haley  (he/him)
Java Platform Lead Engineer
Red Hat UK Ltd. <https://www.redhat.com>
https://keybase.io/andrewhaley
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671



More information about the hotspot-compiler-dev mailing list