RFR: 8301739: AArch64: Add optimized rules for vector compare with immediate for SVE [v4]

Chang Peng duke at openjdk.org
Fri May 5 09:25:42 UTC 2023


> We can use SVE compare-with-integer-immediate instructions like cmpgt(immediate)[1] to avoid the extra scalar2vector operations.
> 
> The following instruction sequence
> 
> 
> movi    v17.16b, #12
> cmpgt   p0.b, p7/z, z16.b, z17.b
> 
> 
> can be optimized to:
> 
> 
> cmpgt   p0.b, p7/z, z16.b, #12
> 
> 
> This patch does the following:
> 1. Add SVE compare-with-7bit-unsigned-immediate instructions to C2's backend.
> SVE cmp<cc>(immediate) instructions can support vector comparing with 7bit unsigned integer immediate (range from 0 to 
> 127)or 5bit signed integer immediate (range from -16 to 15).
> 
> 2. Add optimized match rules to generate the compare-with-immediate instructions.
> 
> [1]: https://developer.arm.com/documentation/ddi0596/2021-12/SVE-Instructions/CMP-cc---immediate---Compare-vector-to-immediate-

Chang Peng has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains four additional commits since the last revision:

 - Merge branch 'openjdk:master' into add_sve_cmpU
 - Refactor some code
 - Merge branch 'openjdk:master' into add_sve_cmpU
 - 8301739: AArch64: Add optimized rules for vector compare with immediate for SVE
   
   We can use SVE compare-with-integer-immediate instructions like
   cmpgt(immediate)[1] to avoid the extra scalar2vector
   operations.
   
   The following instruction sequence
   
   ```
   movi    v17.16b, #12
   cmpgt   p0.b, p7/z, z16.b, z17.b
   ```
   
   can be optimized to:
   
   ```
   cmpgt   p0.b, p7/z, z16.b, #12
   ```
   
   This patch does the following:
   1. Add SVE compare-with-7bit-unsigned-immediate instructions to C2's backend.
   
   SVE cmp<cc>(immediate) instructions can support vector comparing with
   7bit unsigned integer immediate (range from 0 to 127) or 5bit signed
   integer immediate (range from -16 to 15).
   
   2. Add optimized match rules to generate the compare-with-immediate
   instructions.
   
   [1]: https://developer.arm.com/documentation/ddi0596/2021-12/SVE-Instructions/CMP-cc---immediate---Compare-vector-to-immediate-
   
   TEST_LABEL: v1 || n2, aarch64&&ubuntu&&conformance-enabled
   JDK_SCOPE: hotspot:compiler/vectorapi, jdk:jdk/incubator/vector/
   
   Jira: ENTLLT-5294
   Change-Id: I6b915864308faf9a8ec6e35ca1b4948666d75dca

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/13200/files
  - new: https://git.openjdk.org/jdk/pull/13200/files/d9d861ea..2bcd41ed

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=13200&range=03
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=13200&range=02-03

  Stats: 69484 lines in 1244 files changed: 47473 ins; 13552 del; 8459 mod
  Patch: https://git.openjdk.org/jdk/pull/13200.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/13200/head:pull/13200

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


More information about the hotspot-compiler-dev mailing list