RFR: 8325438: Add exhaustive tests for Math.round intrinsics [v9]

Andrew Haley aph at openjdk.org
Thu Apr 4 09:21:11 UTC 2024


On Wed, 20 Mar 2024 19:11:34 GMT, Hamlin Li <mli at openjdk.org> wrote:

>> HI,
>> Can you have a look at this patch adding some tests for Math.round instrinsics?
>> Thanks!
>> 
>> ### FYI:
>> During the development of RoundVF/RoundF, we faced the issues which were only spotted by running test exhaustively against 32/64 bits range of int/long.
>> It's helpful to add these exhaustive tests in jdk for future possible usage, rather than build it everytime when needed.
>> Of course, we need to put it in `manual` mode, so it's not run when `-automatic` jtreg option is specified which I guess is the mode CI used, please correct me if I'm assume incorrectly.
>
> Hamlin Li has updated the pull request incrementally with one additional commit since the last revision:
> 
>   add more tests; add more IR filter for Double tests

test/hotspot/jtreg/compiler/vectorization/TestRoundVectorFloatRandom.java line 118:

> 116: 
> 117:     // generate input arrays for testing, then run tests & verify results
> 118: 

There's no need for randomness or arrays or special values in the 32-bit case. You can, and should, test the entire 32-bit range in a few lines of code by using floatBitsToInt. You can make the test much faster by copy-and-pasting the library code for Math.round(float) and letting the JIT compile it.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/17753#discussion_r1551305494


More information about the hotspot-compiler-dev mailing list