[flac-dev] Again about encoding speed of different compiles

lvqcl lvqcl.mail at gmail.com
Wed Oct 9 08:03:20 PDT 2013


Erik de Castro Lopo wrote:

> Googling suggests that use of restrict is a little controvertial.

Maybe, but Opus encoder uses this keyword in its en-/decoding routines.
So I think it's not dangerous.

> Also, do you have any idea why this causes such a slow down in VS10 and
> VS12?

Without __restrict, VS12 generates the following pattern:
	...
	mov	eax, DWORD PTR [edi+32]
	adc	esi, edx
	imul	DWORD PTR [ebx+8]
	add	ecx, eax
	...etc...

With __restrict:
	...
	mov	eax, DWORD PTR [ecx+16]
	cdq
	mov	DWORD PTR tv7279[esp+116], eax
	mov	DWORD PTR tv7278[esp+116], edx
	...etc...

followed by

	...
	push	DWORD PTR tv7278[esp+116]
	mov	eax, DWORD PTR [ebx+24]
	push	DWORD PTR tv7279[esp+120]
	adc	edi, edx
	cdq
	push	edx
	push	eax
	call	__allmul
	add	esi, eax
	...etc...


I have no idea why it does this. Maybe it tries to "optimize"
32bit * 32bit -> 64bit multiplication?


More information about the flac-dev mailing list