This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/30354] -Os doesn't optimize a/CONST even if it saves size.
- From: "vda.linux at googlemail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 17 Apr 2016 15:56:27 +0000
- Subject: [Bug target/30354] -Os doesn't optimize a/CONST even if it saves size.
- Auto-submitted: auto-generated
- References: <bug-30354-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=30354
--- Comment #18 from Denis Vlasenko <vda.linux at googlemail dot com> ---
Created attachment 38297
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38297&action=edit
Comparison of generated code with 7.0.0.svn on i86
With div cost of 3:
00000000 <ud_x_100>:
- 0: 8b 44 24 04 mov 0x4(%esp),%eax
- 4: b9 64 00 00 00 mov $0x64,%ecx
- 9: 31 d2 xor %edx,%edx
- b: f7 f1 div %ecx
- d: c3 ret
With div cost of 13:
+ 0: b9 1f 85 eb 51 mov $0x51eb851f,%ecx
+ 5: 89 c8 mov %ecx,%eax
+ 7: f7 64 24 04 mull 0x4(%esp)
+ b: 89 d1 mov %edx,%ecx
+ d: 89 c8 mov %ecx,%eax
+ f: c1 e8 05 shr $0x5,%eax
+ 12: c3 ret