[fpc-devel] x86_64.inc CompareByte

Florian Klämpfl florian at freepascal.org
Sun Oct 15 22:14:50 CEST 2017


Am 12.10.2017 um 20:37 schrieb sserg.me at gmail.com:
> Hi.
> 
> Sorry for late message. But nobody still have said about possible problem with 
> suggested patch. 

Well, it's always very hard to review such highly optimized code. I had a look and tested it and it
worked, I didn't notice the problem below either.

> So I decide to pay attention on that proposed code may be 
> incorrect under some circumstances IMHO.
> 
> Instruction on line 657
> 
> subq %rcx, %rax
> 
> decreases value in %rax on %rcx, but previous code doesn't set any value to 32 
> high bits of %rax and 32 high bits of %rcx still contain 32 high bits of buf1 
> address. So I think that correct result is not guarantied.
> 
> I suggest to use mozbq instead of movzbl to fix this issue.

I think also the final xor should be a xorq %rax,%rax, right?



More information about the fpc-devel mailing list