Re: [RFC PATCH v6 10/32] x86/apic: Change apic_*_vector() vector param to unsigned
From: Borislav Petkov
Date: Sat May 24 2025 - 08:16:14 EST
On Wed, May 14, 2025 at 12:47:41PM +0530, Neeraj Upadhyay wrote:
> Change vector parameter of apic_{set|clear|test}_vector to
> unsigned int to optimize code generation for modulo operation.
>
> On gcc-14.2, code generation for below C statement is given
> after it.
>
> long nr = APIC_VECTOR_TO_BIT_NUMBER(vec);
>
> * Without change:
>
> mov eax,edi
> sar eax,0x1f
> shr eax,0x1b
> add edi,eax
> and edi,0x1f
> sub edi,eax
> movsxd rdi,edi
> mov QWORD PTR [rsp-0x8],rdi
>
> * With change:
>
> and edi,0x1f
> mov QWORD PTR [rsp-0x8],rdi
AT&T assembly please.
This change needs to go first too.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette