Wrong ASM generation in O2-mode
Original Reporter info from Mantis: Eugene Kryukov
-
Reporter name:
Original Reporter info from Mantis: Eugene Kryukov
- Reporter name:
Description:
We noticed that latest build in beta branch 3.2.0 in some cases generate wrong asm code. After investigation and comparing asm-code for one particular procedure we noticed that one line of ASM just missed. We use march'18 build of FPC (3.1.1 branch) rev: 39946 and code looks and works fine.
Steps to reproduce:
The one issue we found that buggy version misses one asm-line, here is correct version:
Ll1473:
# [2548] h := MaxOf(h, -MIDIOutList.RowHeight * 3 * 2);
movq 2832(%r15),%rax
movslq 1688(%rax),%rax
negq %rax
imulq $3,%rax
shlq $1,%rax
movslq %edx,%rdx
cmpq %rdx,%rax
cmovnleq %rax,%rdx
# Var h located in register ebx
movl %edx,%ebx
Ll1474:
and here is a buggy version:
Ll1472:
# [2551] h := MaxOf(h, -MIDIOutList.RowHeight * 3 * 2);
movq 2832(%r15),%rax
movslq 1688(%rax),%rax
negq %rax
imulq $3,%rax
shlq $1,%rax
movslq %edx,%rdx
cmpq %rdx,%rax
cmovnleq %rax,%rdx
# Var h located in register ebx
Ll1473:
As you can see "movl %edx,%ebx" missed in one version - after this commend - "# Var h located in register ebx"
Mantis conversion info:
- Mantis ID: 35367
- OS: macOS 10.14
- OS Build: 10.14
- Build: 3.2.0-beta [2019/04/08] for x86_
- Platform: Darwin
- Version: 3.2.0
- Monitored by: » @engkin (engkin), » Ville Krumlinde (Ville Krumlinde), » @CuriousKit (J. Gareth Moreton)