[aarch64-port-dev ] RFR: 88158361: AArch64: Address calculation missed optimizations
Zhongwei Yao
zhongwei.yao at linaro.org
Tue Jun 27 03:16:53 UTC 2017
[ I re-send this mail due to my attachment is too big and the previous mail
is under approving. ]
It is strange, because I haven't seen such pattern locally.
Here is what I do (jdk is built as fastdebug based on latest master with my
patch applied):
$java -XX:+PrintCompilation -XX:-TieredCompilation
-XX:CompilerDirectivesFile=/tmp/compile_directive.txt ExtTest >
func_ExtTest_20170627_10_41_56.log
log file is at
http://cr.openjdk.java.net/~njian/8158361/func_ExtTest_20170627_10_41_56.log
.
And compile_directive.txt is:
[
{
match: ["*.func"],
c2: {
PrintAssembly: true,
},
},
]
And for case:
public Flonglong adduxtb = new Flonglong() {
public long func(long x, long y) {
return y + ((x & 255) << 3);
}
};
It generates:
0x0000ffff908ef5e8: add x0, x3, w2, uxtb #3 ;*ladd {reexecute=0
rethrow=0 return_oop=0}
; - ExtTest$1::func at 8 (line
25)
For case:
public Flonglong adduxtb2 = new Flonglong() {
public long func(long x, long y) {
return y + (((x << 56) >>> 56) << 4);
}
};
It generates:
0x0000ffff908f4568: add x0, x3, w2, uxtb #4 ;*ladd {reexecute=0
rethrow=0 return_oop=0}
; - ExtTest$33::func at 10
(line 281)
For case:
public Flonglong subuxtb2 = new Flonglong() {
public long func(long x, long y) {
return y - (((x << 56) >>> 56) << 4);
}
};
It generates:
0x0000ffff908f7568: sub x0, x3, w2, uxtb #4 ;*lsub {reexecute=0
rethrow=0 return_oop=0}
; - ExtTest$41::func at 10
(line 345)
On 26 June 2017 at 19:17, Andrew Haley <aph at redhat.com> wrote:
> On 23/06/17 10:50, Zhongwei Yao wrote:
> > Hi, Andrew,
> >
> > Besides pass jtreg on aarch64 and x86, for each pattern, I added one or
> two
> > test cases, which will hit the testing pattern. And check the test cases'
> > assembly output to ensure the hit pattern generates correct instructions.
> >
> > Here is a test case for: AddExtL_uxtb_and_shift pattern:
> >
> > // testrule: AddExtL_uxtb_and_shift
> > // geninst: add.*x.*, x.*, w.*, uxtb #3
> > public Flonglong adduxtb = new Flonglong() {
> > public long func(long x, long y) {
> > return y + ((x & 255) << 3);
> > }
> > };
> >
> > And the "geninst" line defines this case's required generated assembly
> > instruction pattern.
> >
> > A script will check whether this case's generated C2 assembly has the
> > required instruction "add.*x.*, x.*, w.*, uxtb #3". If yes, the test
> > passes. And if there is a "nosense" on "// testrule" line, such check is
> > skipped.
> >
> > All test cases are at http://cr.openjdk.java.net/~
> njian/8158361/ExtTest.java
>
> This looks great, just one problem.
>
> I'm seeing this with current JDK10 HotSpot:
>
> 0x000003ff95285b64: and x10, x2, #0xff
> 0x000003ff95285b68: add x0, x3, x10, lsl #3 ;*ladd {reexecute=0
> rethrow=0 return_oop=0}
> ; - ExtTest$1::func at 8
> (line 25)
>
> This happens in three of the patterns.
>
> public Flonglong adduxtb = new Flonglong() {
> public long func(long x, long y) {
> return y + ((x & 255) << 3);
> }
> };
>
> public Flonglong adduxtb2 = new Flonglong() {
> public long func(long x, long y) {
> return y + (((x << 56) >>> 56) << 4);
> }
> };
>
> public Flonglong subuxtb2 = new Flonglong() {
> public long func(long x, long y) {
> return y - (((x << 56) >>> 56) << 4);
> }
> };
>
> --
> Andrew Haley
> Java Platform Lead Engineer
> Red Hat UK Ltd. <https://www.redhat.com>
> EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671
>
--
Best regards,
Zhongwei
More information about the aarch64-port-dev
mailing list