diff options
| author | Uros Bizjak <[email protected]> | 2023-03-20 22:20:12 +0100 | 
|---|---|---|
| committer | Dave Hansen <[email protected]> | 2023-03-22 11:32:39 -0700 | 
| commit | 22767544e9763e82acb60c233051bc426381b61c (patch) | |
| tree | 694150434c58e6296a346c4138c503806b0c2bc1 /drivers/usb/cdns3/cdnsp-pci.c | |
| parent | e8d018dd0257f744ca50a729e3d042cf2ec9da65 (diff) | |
x86/ACPI/boot: Improve __acpi_acquire_global_lock
Improve __acpi_acquire_global_lock by using a temporary variable.
This enables compiler to perform if-conversion and improves generated
code from:
 ...
 72a:	d1 ea                	shr    %edx
 72c:	83 e1 fc             	and    $0xfffffffc,%ecx
 72f:	83 e2 01             	and    $0x1,%edx
 732:	09 ca                	or     %ecx,%edx
 734:	83 c2 02             	add    $0x2,%edx
 737:	f0 0f b1 17          	lock cmpxchg %edx,(%rdi)
 73b:	75 e9                	jne    726 <__acpi_acquire_global_lock+0x6>
 73d:	83 e2 03             	and    $0x3,%edx
 740:	31 c0                	xor    %eax,%eax
 742:	83 fa 03             	cmp    $0x3,%edx
 745:	0f 95 c0             	setne  %al
 748:	f7 d8                	neg    %eax
to:
 ...
 72a:	d1 e9                	shr    %ecx
 72c:	83 e2 fc             	and    $0xfffffffc,%edx
 72f:	83 e1 01             	and    $0x1,%ecx
 732:	09 ca                	or     %ecx,%edx
 734:	83 c2 02             	add    $0x2,%edx
 737:	f0 0f b1 17          	lock cmpxchg %edx,(%rdi)
 73b:	75 e9                	jne    726 <__acpi_acquire_global_lock+0x6>
 73d:	8d 41 ff             	lea    -0x1(%rcx),%eax
BTW: the compiler could generate:
	lea 0x2(%rcx,%rdx,1),%edx
instead of:
	or     %ecx,%edx
	add    $0x2,%edx
but unwated conversion from add to or when bits are known to be zero
prevents this improvement. This is GCC PR108477.
No functional change intended.
Signed-off-by: Uros Bizjak <[email protected]>
Signed-off-by: Dave Hansen <[email protected]>
Acked-by: Rafael J. Wysocki <[email protected]>
Link: https://lore.kernel.org/all/20230320212012.12704-1-ubizjak%40gmail.com
Diffstat (limited to 'drivers/usb/cdns3/cdnsp-pci.c')
0 files changed, 0 insertions, 0 deletions