[PATCH, i386 libgcc]: Define __FP_FRAC_ADDI_4 in 32bit sfp-machine.h

Uros Bizjak ubizjak@gmail.com
Thu Nov 28 17:40:00 GMT 2013


Hello!

Attached patch introduces __FP_FRAC_ADDI_4 to improve 32bit soft-fp
code a bit. The effect can be seen in a couple of places, for example
in divtf3 the part of code changes from:

     70f:    83 c0 04                 add    $0x4,%eax
     712:    89 84 24 90 00 00 00     mov    %eax,0x90(%esp)
     719:    83 f8 03                 cmp    $0x3,%eax
     71c:    8b 84 24 94 00 00 00     mov    0x94(%esp),%eax
     723:    0f 96 c2                 setbe  %dl
     726:    0f b6 d2                 movzbl %dl,%edx
     729:    01 d0                    add    %edx,%eax
     72b:    39 c2                    cmp    %eax,%edx
     72d:    89 84 24 94 00 00 00     mov    %eax,0x94(%esp)
     734:    8b 84 24 98 00 00 00     mov    0x98(%esp),%eax
     73b:    0f 97 c2                 seta   %dl
     73e:    0f b6 d2                 movzbl %dl,%edx
     741:    01 d0                    add    %edx,%eax
     743:    39 c2                    cmp    %eax,%edx
     745:    89 84 24 98 00 00 00     mov    %eax,0x98(%esp)
     74c:    0f 97 c0                 seta   %al
     74f:    0f b6 c0                 movzbl %al,%eax
     752:    03 84 24 9c 00 00 00     add    0x9c(%esp),%eax
     759:    89 84 24 9c 00 00 00     mov    %eax,0x9c(%esp)

to:

     71b:    8b b4 24 9c 00 00 00     mov    0x9c(%esp),%esi
     722:    8b 8c 24 98 00 00 00     mov    0x98(%esp),%ecx
     729:    8b 94 24 94 00 00 00     mov    0x94(%esp),%edx
     730:    83 c0 04                 add    $0x4,%eax
     733:    83 d2 00                 adc    $0x0,%edx
     736:    83 d1 00                 adc    $0x0,%ecx
     739:    83 d6 00                 adc    $0x0,%esi
     73c:    89 b4 24 9c 00 00 00     mov    %esi,0x9c(%esp)
     743:    89 8c 24 98 00 00 00     mov    %ecx,0x98(%esp)
     74a:    89 94 24 94 00 00 00     mov    %edx,0x94(%esp)
     751:    89 84 24 90 00 00 00     mov    %eax,0x90(%esp)

2013-11-28  Uros Bizjak  <ubizjak@gmail.com>

    * config/i386/32/sfp-machine.h (__FP_FRAC_ADDI_4): New macro.

Tested on x86_64-pc-linux-gnu {,-m32} and committed to mainline SVN.

Uros.
-------------- next part --------------
Index: config/i386/32/sfp-machine.h
===================================================================
--- config/i386/32/sfp-machine.h	(revision 205474)
+++ config/i386/32/sfp-machine.h	(working copy)
@@ -63,6 +63,16 @@
 	     "g" ((USItype) (y1)),				\
 	     "2" ((USItype) (x0)),				\
 	     "g" ((USItype) (y0)))
+#define __FP_FRAC_ADDI_4(x3,x2,x1,x0,i)				\
+  __asm__ ("add{l} {%4,%3|%3,%4}\n\t"				\
+	   "adc{l} {$0,%2|%2,0}\n\t"				\
+	   "adc{l} {$0,%1|%1,0}\n\t"				\
+	   "adc{l} {$0,%0|%0,0}"				\
+	   : "+r" ((USItype) (x3)),				\
+	     "+&r" ((USItype) (x2)),				\
+	     "+&r" ((USItype) (x1)),				\
+	     "+&r" ((USItype) (x0))				\
+	   : "g" ((USItype) (i)))
 
 
 #define _FP_MUL_MEAT_S(R,X,Y)				\


More information about the Gcc-patches mailing list