OSDN Git Service

* config/bfin/t-bfin-elf (LIB1ASMFUNCS): Add _umulsi3_highpart and
authorbernds <bernds@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 27 Feb 2007 16:29:10 +0000 (16:29 +0000)
committerbernds <bernds@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 27 Feb 2007 16:29:10 +0000 (16:29 +0000)
_smulsi3_highpart.
* config/bfin/lib1funcs.asm (___umulsi3_highpart, ___smulsi3_highpart):
New functions.
* config/bfin/bfin.md (smulsi3_highpart, umulsi3_highpart): New
patterns.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@122379 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/bfin/bfin.md
gcc/config/bfin/lib1funcs.asm
gcc/config/bfin/t-bfin-elf

index bac6d56..468f90f 100644 (file)
@@ -1,3 +1,12 @@
+2007-02-27  Bernd Schmidt  <bernd.schmidt@analog.com>
+
+       * config/bfin/t-bfin-elf (LIB1ASMFUNCS): Add _umulsi3_highpart and
+       _smulsi3_highpart.
+       * config/bfin/lib1funcs.asm (___umulsi3_highpart, ___smulsi3_highpart):
+       New functions.
+       * config/bfin/bfin.md (smulsi3_highpart, umulsi3_highpart): New
+       patterns.
+
 2007-02-27  Mark Mitchell  <mark@codesourcery.com>
 
        * c-common.c (get_priority): Add check for
index b65e8dd..fd55f4f 100644 (file)
   "%0 *= %2;"
   [(set_attr "type" "mult")])
 
+(define_expand "umulsi3_highpart"
+  [(set (match_operand:SI 0 "register_operand" "")
+       (truncate:SI
+        (lshiftrt:DI
+         (mult:DI (zero_extend:DI
+                   (match_operand:SI 1 "nonimmediate_operand" ""))
+                  (zero_extend:DI
+                   (match_operand:SI 2 "register_operand" "")))
+         (const_int 32))))]
+  ""
+{
+  rtx umulsi3_highpart_libfunc
+    = init_one_libfunc ("__umulsi3_highpart");
+
+  emit_library_call_value (umulsi3_highpart_libfunc,
+                          operands[0], LCT_NORMAL, SImode,
+                          2, operands[1], SImode, operands[2], SImode);
+  DONE;
+})
+
+(define_expand "smulsi3_highpart"
+  [(set (match_operand:SI 0 "register_operand" "")
+       (truncate:SI
+        (lshiftrt:DI
+         (mult:DI (sign_extend:DI
+                   (match_operand:SI 1 "nonimmediate_operand" ""))
+                  (sign_extend:DI
+                   (match_operand:SI 2 "register_operand" "")))
+         (const_int 32))))]
+  ""
+{
+  rtx smulsi3_highpart_libfunc
+    = init_one_libfunc ("__smulsi3_highpart");
+
+  emit_library_call_value (smulsi3_highpart_libfunc,
+                          operands[0], LCT_NORMAL, SImode,
+                          2, operands[1], SImode, operands[2], SImode);
+  DONE;
+})
+
 (define_expand "ashlsi3"
   [(set (match_operand:SI 0 "register_operand" "")
         (ashift:SI (match_operand:SI 1 "register_operand" "")
index 77d4fff..1d2db9b 100644 (file)
@@ -117,3 +117,50 @@ ___umodsi3:
        RTS;
 #endif
 
+#ifdef L_umulsi3_highpart
+.align 2
+.global ___umulsi3_highpart;
+.type ___umulsi3_highpart, STT_FUNC;
+
+___umulsi3_highpart:
+       R2 = R1.H * R0.H, R3 = R1.L * R0.H (FU);
+       R0 = R1.L * R0.L, R1 = R1.H * R0.L (FU);
+       R0 >>= 16;
+       /* Unsigned multiplication has the nice property that we can
+          ignore carry on this first addition.  */
+       R0 = R0 + R3;
+       R0 = R0 + R1;
+       cc = ac0;
+       R1 = cc;
+       R1 = PACK(R1.l,R0.h);
+       R0 = R1 + R2;
+       RTS;
+#endif
+
+#ifdef L_smulsi3_highpart
+.align 2
+.global ___smulsi3_highpart;
+.type ___smulsi3_highpart, STT_FUNC;
+
+___smulsi3_highpart:
+       R2 = R1.L * R0.L (FU);
+       R3 = R1.H * R0.L (IS,M);
+       R0 = R0.H * R1.H, R1 = R0.H * R1.L (IS,M);
+
+       R1.L = R2.H + R1.L;
+       cc = ac0;
+       R2 = cc;
+
+       R1.L = R1.L + R3.L;
+       cc = ac0;
+       R1 >>>= 16;
+       R3 >>>= 16;
+       R1 = R1 + R3;
+       R1 = R1 + R2;
+       R2 = cc;
+       R1 = R1 + R2;
+
+       R0 = R0 + R1;
+       RTS;
+#endif
+
index 06aa0ae..1d9fce6 100644 (file)
@@ -1,7 +1,8 @@
 ## Target part of the Makefile
 
 LIB1ASMSRC = bfin/lib1funcs.asm
-LIB1ASMFUNCS = _divsi3 _udivsi3 _umodsi3 _modsi3
+LIB1ASMFUNCS = _divsi3 _udivsi3 _umodsi3 _modsi3 _umulsi3_highpart
+LIB1ASMFUNCS += _smulsi3_highpart
 
 EXTRA_PARTS = crtbegin.o crtend.o crtbeginS.o crtendS.o crti.o crtn.o crtlibid.o