RFR: 8353551: C2: Constant folding for ReverseBytes nodes

Vladimir Ivanov vlivanov at openjdk.org
Tue Apr 8 01:32:25 UTC 2025


On Wed, 2 Apr 2025 16:17:57 GMT, Hannes Greule <hgreule at openjdk.org> wrote:

> This change implements constant folding for ReverseBytes nodes.
> 
> Currently, `byteswap` is included transitively by `reverse_bits.hpp`. I'm not sure if this is fine or if I need to add an explicit include there.
> 
> I appreciate any reviews and comments.

test/hotspot/jtreg/compiler/c2/irTests/ReverseBytesConstantsTests.java line 72:

> 70:     @DontCompile
> 71:     public void assertResultI() {
> 72:         Asserts.assertEQ(Integer.reverseBytes(0x04030201), testI1());

Please, add more test cases (specifically, with negative constants).

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24382#discussion_r2032235559


More information about the hotspot-compiler-dev mailing list