Re: [fpc-devel] Optimization of redundant mov's

2017-03-24 Thread Florian Klämpfl
Am 20.03.2017 um 08:50 schrieb Jonas Maebe: >> And again, I've seen this happen more than once on i386 code, where it even >> creates "fake" register pressure (by using 2 or more registers to hold >> exactly >> the same temporary) > > That's again something that needs to be solved at the register

Re: [fpc-devel] Optimization of redundant mov's

2017-03-20 Thread Jonas Maebe
On 19/03/17 21:28, Martok wrote: It's called register spilling: once there are no registers left to hold values, the compiler has to pick registers whose value will be kept in memory instead. I thought it would be something like that... Still, my main issue was with the repeated fetches. I'd

Re: [fpc-devel] Optimization of redundant mov's

2017-03-20 Thread Martok
Hi, > It's called register spilling: once there are no registers left to hold > values, the compiler has to pick registers whose value will be kept in > memory instead. I thought it would be something like that... Still, my main issue was with the repeated fetches. I'd (naively!) say that it shou

Re: [fpc-devel] Optimization of redundant mov's

2017-03-19 Thread Jonas Maebe
Martok wrote: > a:= CurrentHash[0]; b:= CurrentHash[1]; c:= CurrentHash[2]; d:= > CurrentHash[3]; > 000100074943 488b8424a002 mov0x2a0(%rsp),%rax > 00010007494B 4c8b5038 mov0x38(%rax),%r10 > 00010007494F 488b8424a002 mov0x2a0(%rsp)

[fpc-devel] Optimization of redundant mov's

2017-03-19 Thread Martok
Hi all, there has been some discussion about FPCs optimizer in #31444, prompting me to investigate some of my own code. Generally speaking the generated assembler is not all that bad (I like how it uses LEA for almost all integer arithmetics), but I keep seeing sections with lots of redundant MOVs