RFR: 8255553: [PPC64] Introduce and use setbc and setnbc P10 instructions [v4]
Ziviani
github.com+670087+jrziviani at openjdk.java.net
Wed Nov 4 03:14:09 UTC 2020
> - setbc RT,BI: sets RT to 1 if CR(BI) is 1, otherwise 0.
> - setnbc RT,BI: sets RT to -1 if CR(BI) is 1, otherwise 0.
> Ref: PowerISA 3.1, page 129.
>
> These instructions are particularly interesting to improve the following
> pattern `(src1<src2)? -1: ((src1>src2)? 1: 0)`, which can be found in
> `instruct cmpL3_reg_reg_ExEx()@ppc.ad`, by removing its branches.
>
> Long.toString, that generate such pattern in getChars, has showed a
> good performance gain by using these new instructions.
>
> Example:
> for (int i = 0; i < 200_000; i++)
> res = Long.toString((long)i);
>
> java -Xcomp -XX:CompileThreshold=1 -XX:-TieredCompilation TestToString
>
> Without setbc (average): 0.1178 seconds
> With setbc (average): 0.0396 seconds
Ziviani 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 one additional commit since the last revision:
8255553: [PPC64] Introduce and use setbc and setnbc P10 instructions
- setbc RT,BI: sets RT to 1 if CR(BI) is 1, otherwise 0.
- setnbc RT,BI: sets RT to -1 if CR(BI) is 1, otherwise 0.
Ref: PowerISA 3.1, page 129.
These instructions are particularly interesting to improve the following
pattern `(src1<src2)? -1: ((src1>src2)? 1: 0)`, which can be found in
`instruct cmpL3_reg_reg_ExEx()@ppc.ad`, by removing its branches.
Long.toString, that generate such pattern in getChars, has showed a
good performance gain by using these new instructions.
Example:
for (int i = 0; i < 200_000; i++)
res = Long.toString((long)i);
java -Xcomp -XX:CompileThreshold=1 -XX:-TieredCompilation TestToString
Without setbc (average): 0.1178 seconds
With setbc (average): 0.0396 seconds
-------------
Changes:
- all: https://git.openjdk.java.net/jdk/pull/907/files
- new: https://git.openjdk.java.net/jdk/pull/907/files/41502730..0af02057
Webrevs:
- full: https://webrevs.openjdk.java.net/?repo=jdk&pr=907&range=03
- incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=907&range=02-03
Stats: 8084 lines in 281 files changed: 4806 ins; 2000 del; 1278 mod
Patch: https://git.openjdk.java.net/jdk/pull/907.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/907/head:pull/907
PR: https://git.openjdk.java.net/jdk/pull/907
More information about the hotspot-dev
mailing list