RFR: 8353665: RISC-V: IR verification fails in TestSubNodeFloatDoubleNegation.java [v2]

Manuel Hässig duke at openjdk.org
Fri Apr 4 13:47:55 UTC 2025


On Fri, 4 Apr 2025 13:25:13 GMT, Hamlin Li <mli at openjdk.org> wrote:

>> Hi,
>> Can you help to review this patch?
>> The newly added TestSubNodeFloatDoubleNegation.java (in https://github.com/openjdk/jdk/pull/24150) is to check `0 - (0 - x)` is not folded to `x` for float and double.
>> I have manually checked the IR and generated assembly code, it's not folded on riscv either, just there is an extra SubF in some code path.
>> So, the fix for this test on riscv should be simply make the check as `>= 2` rather than `2`.
>> 
>> Tested on both x86 and riscv64.
>> 
>> Thanks
>
> Hamlin Li has updated the pull request incrementally with one additional commit since the last revision:
> 
>   refine

Looks good to me, with or without my suggestion.

Thank you for catching and fixing this!

test/hotspot/jtreg/compiler/floatingpoint/TestSubNodeFloatDoubleNegation.java line 60:

> 58:     @IR(counts = { IRNode.SUB, "2" }, applyIfPlatform = {"riscv64", "false"})
> 59:     @IR(counts = { IRNode.SUB, "2" }, applyIfCPUFeature = {"zfh", "false"})
> 60:     @IR(counts = { IRNode.SUB, ">= 2" }, applyIfCPUFeature = {"zfh", "true"})

Just a small nit: I find the following expresses the intention of the test more precisely

Suggestion:

    @IR(counts = { IRNode.SUB_HF, "2" }, applyIfCPUFeature = {"zfh", "true"})

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

Marked as reviewed by mhaessig at github.com (no known OpenJDK username).

PR Review: https://git.openjdk.org/jdk/pull/24421#pullrequestreview-2743050562
PR Review Comment: https://git.openjdk.org/jdk/pull/24421#discussion_r2028842855


More information about the hotspot-compiler-dev mailing list