RFR: 8282204: Use lea instructions for arithmetic operations on x86_64 [v5]
Jie Fu
jiefu at openjdk.java.net
Fri Feb 25 23:22:54 UTC 2022
On Fri, 25 Feb 2022 23:19:09 GMT, Jie Fu <jiefu at openjdk.org> wrote:
> I tested the following code pattern with `clang -c -O{1, 2, 3} ...`.
> `lea` is generated for all the cases.
The generated `lea`:
const.o: file format Mach-O 64-bit x86-64
Disassembly of section __TEXT,__text:
0000000000000000 __Z8testInt1ii:
0: 55 pushq %rbp
1: 48 89 e5 movq %rsp, %rbp
4: 8d 44 b7 20 leal 32(%rdi,%rsi,4), %eax
8: 5d popq %rbp
9: c3 retq
a: 66 0f 1f 44 00 00 nopw (%rax,%rax)
0000000000000010 __Z8testInt2ii:
10: 55 pushq %rbp
11: 48 89 e5 movq %rsp, %rbp
14: 8d 04 b7 leal (%rdi,%rsi,4), %eax
17: 5d popq %rbp
18: c3 retq
19: 0f 1f 80 00 00 00 00 nopl (%rax)
0000000000000020 __Z8testInt3ii:
20: 55 pushq %rbp
21: 48 89 e5 movq %rsp, %rbp
24: 8d 44 37 10 leal 16(%rdi,%rsi), %eax
28: 5d popq %rbp
29: c3 retq
2a: 66 0f 1f 44 00 00 nopw (%rax,%rax)
0000000000000030 __Z9testLong1ll:
30: 55 pushq %rbp
31: 48 89 e5 movq %rsp, %rbp
34: 48 8d 44 b7 20 leaq 32(%rdi,%rsi,4), %rax
39: 5d popq %rbp
3a: c3 retq
3b: 0f 1f 44 00 00 nopl (%rax,%rax)
0000000000000040 __Z9testLong2ll:
40: 55 pushq %rbp
41: 48 89 e5 movq %rsp, %rbp
44: 48 8d 04 b7 leaq (%rdi,%rsi,4), %rax
48: 5d popq %rbp
49: c3 retq
4a: 66 0f 1f 44 00 00 nopw (%rax,%rax)
0000000000000050 __Z9testLong3ll:
50: 55 pushq %rbp
51: 48 89 e5 movq %rsp, %rbp
54: 48 8d 44 37 10 leaq 16(%rdi,%rsi), %rax
59: 5d popq %rbp
5a: c3 retq
-------------
PR: https://git.openjdk.java.net/jdk/pull/7560
More information about the hotspot-compiler-dev
mailing list