RFR: 8294816: C2: Math.min/max vectorization miscompilation [v2]

Bhavana Kilambi bkilambi at openjdk.org
Wed Nov 2 14:42:20 UTC 2022


> C2 miscompiles during auto-vectorization of MinI/MaxI nodes when "short" type operands are involved. When a short and an integer value is compared, C2 generates vector min/max nodes for "short" types which does not result in correct output as it disregards the higher order bits of the integer input. Java API for Math.min/max also only supports the int, long, float and double types but not the subword integer types namely - char, byte and short. Hence, char/short/byte min/max vector instructions should not be generated.
> This patch ensures that MaxV and MinV vector nodes are only generated for the "int" type for MaxI and MinI nodes during auto-vectorization.

Bhavana Kilambi has updated the pull request incrementally with one additional commit since the last revision:

  Updated string names for Min and Max IR nodes

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/10944/files
  - new: https://git.openjdk.org/jdk/pull/10944/files/064dbc1e..74d9886c

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=10944&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=10944&range=00-01

  Stats: 4 lines in 1 file changed: 0 ins; 0 del; 4 mod
  Patch: https://git.openjdk.org/jdk/pull/10944.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/10944/head:pull/10944

PR: https://git.openjdk.org/jdk/pull/10944


More information about the hotspot-compiler-dev mailing list