RFR: 8287925: AArch64: intrinsics for compareUnsigned method in Integer and Long
Hao Sun
haosun at openjdk.org
Mon Dec 5 07:34:11 UTC 2022
On Thu, 1 Dec 2022 17:31:36 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:
> The motivation for these intrinsics, aside from unsigned comparison being a fairly basic operation, is for range checks of a load/store, which has the form of `0 <= offset && offset <= length - size`, by transforming this into `0 <= length - size && offset u<= length - size`, the first comparison as well as the computation of `length - size` can be hoisted out of the loop, which results in a single operation being loop varying. The reason this may not be recognised effectively by the idealiser is that if `size` is a constant, `(length - size) + MIN_VALUE` being folded into `length + (MIN_VALUE - size)`, breaks the pattern.
>
@merykitty Thanks for your explanation.
But I'm afraid I didn't fully get your point.
I think `offset u<= length - size` will be matched with `CmpU` node, rather than `CmpU3` node, right?
> @shqking I think your benchmark is not good, as the error is higher than the actual difference between samples, and the cost of the division may swallow everything inside the loop.
>
How about the case as suggested by aph, i.e. shown in the previous comment?
Thanks~
-------------
PR: https://git.openjdk.org/jdk/pull/11383
More information about the hotspot-compiler-dev
mailing list