RFR: 8349563: Improve AbsNode::Value() for integer types [v2]

Jasmine Karthikeyan jkarthikeyan at openjdk.org
Wed Apr 2 14:48:20 UTC 2025


On Sun, 23 Feb 2025 09:27:22 GMT, Tobias Hotz <duke at openjdk.org> wrote:

>> Jasmine Karthikeyan has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains two commits:
>> 
>>  - Merge
>>  - Improve AbsNode::Value
>
> test/hotspot/jtreg/compiler/c2/irTests/TestIRAbs.java line 295:
> 
>> 293:     public boolean testIntRange3(int in) {
>> 294:         // [-9, -2] => [2, 9]
>> 295:         return Math.abs(-((in & 7) + 2)) < 2;
> 
> Not sure if this is in scope for this PR, but `abs(x)` should be idealized into `0 - x` if x <= 0. This seems to be missing at the moment.

This is a good observation! I'll do this in a followup patch, to keep this one focused on just the Value() function.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/23685#discussion_r2024979524


More information about the hotspot-compiler-dev mailing list