Commit 01e7cd6e by Bernd Schmidt Committed by Bernd Schmidt

t-bfin-elf (LIB1ASMFUNCS): Add _umulsi3_highpart and _smulsi3_highpart.

	* 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.

From-SVN: r122379
parent f6fc5c86
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
......
......@@ -1436,6 +1436,46 @@
"%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" "")
......
......@@ -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
## 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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment