This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/30354] -Os doesn't optimize a/CONST even if it saves size.


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]