Anonymous | Login | Signup for a new account | 2023-03-20 17:33 CET |
Main | My View | View Issues |
Viewing Issue Simple Details [ Jump to Notes ] | [ View Advanced ] [ Issue History ] [ Print ] | |||||||||||
ID | Category | Severity | Reproducibility | Date Submitted | Last Update | |||||||
0000157 | [libFirm] x86 ia32 backend | feature | N/A | 2015-09-09 08:34 | 2016-01-18 22:22 | |||||||
Reporter | Matze | View Status | public | |||||||||
Assigned To | ||||||||||||
Priority | normal | Resolution | open | |||||||||
Status | new | Product Version | ||||||||||
Summary | 0000157: Should use sub instead of add with large immediate | |||||||||||
Description |
For this example: unsigned sub5(void) { unsigned x = rand(); return x - 5; } We get the following code: call rand /* ia32_Call T[133:13] t.c:2:19 */ addl $0xFFFFFFFB, %eax /* ia32_Add Iu[181:58] t.c:3:11 */ ret /* ia32_Return X[143:23] t.c:3:2 */ This is correct but bad for code size: We really should not use an add with a 4 byte immediate but instead choose sub 5, xxx which is only a 1 byte immediate. |
|||||||||||
Additional Information | ||||||||||||
Tags | No tags attached. | |||||||||||
Attached Files | ||||||||||||
|
![]() |
|
(0000231) Matze (administrator) 2015-09-09 08:39 |
I just realized that immediate get sign extended, so this isn't really a code size issue but merely a cosmetic one. |
Mantis 1.1.5[^] Copyright © 2000 - 2008 Mantis Group |