gcc/libgcc/config/msp430/t-msp430
Jozef Lawrynowicz bf7b94d407 MSP430: Add 64-bit hardware multiply support
Hardware multipliers that support widening 32-bit multiplication can
be used to perform a 64-bit * 64-bit multiplication more efficiently
than a software implementation.

The following equation is used to perform 64-bit multiplication for
devices with "32bit" or "f5series" hardware multiply versions:

  64bit_result = (low32_op0 * lop32_op1)
    + ((low32_op0 * high32_op1) << 32)
       + ((high32_op0 * low32_op1) << 32)

libgcc/ChangeLog:

	* config/msp430/lib2hw_mul.S (mult64_hw): New.
	(if MUL_32): Use mult64_hw for __muldi3.
	(if MUL_F5): Use mult64_hw for __muldi3.
	* config/msp430/lib2mul.c (__muldi3): New.
	* config/msp430/t-msp430 (LIB2FUNCS_EXCLUDE): Define.
2020-11-18 11:05:27 +00:00

89 lines
2.9 KiB
Plaintext

# Makefile fragment for building LIBGCC for the TI MSP430 processor.
# Copyright (C) 2011-2020 Free Software Foundation, Inc.
# Contributed by Red Hat.
#
# This file is part of GCC.
#
# GCC is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published
# by the Free Software Foundation; either version 3, or (at your
# option) any later version.
#
# GCC is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
# the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
# Note - we have separate versions of the lib2div<mode> files
# as the functions are quite large and we do not want to pull
# in unneeded division routines.
LIB2ADD = \
$(srcdir)/config/msp430/lib2divQI.c \
$(srcdir)/config/msp430/lib2divHI.c \
$(srcdir)/config/msp430/lib2divSI.c \
$(srcdir)/config/msp430/lib2bitcountHI.c \
$(srcdir)/config/msp430/lib2mul.c \
$(srcdir)/config/msp430/lib2shift.c \
$(srcdir)/config/msp430/epilogue.S \
$(srcdir)/config/msp430/slli.S \
$(srcdir)/config/msp430/srai.S \
$(srcdir)/config/msp430/srli.S \
$(srcdir)/config/msp430/cmpsi2.S \
$(srcdir)/config/msp430/floatunhisf.c \
$(srcdir)/config/msp430/floatunhidf.c \
$(srcdir)/config/msp430/floathidf.c \
$(srcdir)/config/msp430/floathisf.c \
$(srcdir)/config/msp430/cmpd.c
# 32-bit and F5series hardware multiply have their own version of this function.
# To handle the case when there is no hardware multiply or only 16-bit hardware
# multiply, the libgcc version has been copied to lib2mul.c.
LIB2FUNCS_EXCLUDE += _muldi3
HOST_LIBGCC2_CFLAGS += -Os -ffunction-sections -fdata-sections -mhwmult=none
crtbegin_no_eh.o: $(srcdir)/crtstuff.c
$(crt_compile) -U__LIBGCC_EH_FRAME_SECTION_NAME__ -c $< -DCRT_BEGIN
crtend_no_eh.o: $(srcdir)/crtstuff.c
$(crt_compile) -U__LIBGCC_EH_FRAME_SECTION_NAME__ -c $< -DCRT_END
mpy.o: $(srcdir)/config/msp430/mpy.c
$(gcc_compile) $< -c
lib2_mul_none.o: $(srcdir)/config/msp430/lib2mul.c
$(gcc_compile) $< -c -DMUL_NONE
lib2_mul_16bit.o: $(srcdir)/config/msp430/lib2mul.c
$(gcc_compile) $< -c -DMUL_16
lib2hw_mul_16.o: $(srcdir)/config/msp430/lib2hw_mul.S
$(gcc_compile) $< -c -DMUL_16
lib2hw_mul_32.o: $(srcdir)/config/msp430/lib2hw_mul.S
$(gcc_compile) $< -c -DMUL_32
lib2hw_mul_f5.o: $(srcdir)/config/msp430/lib2hw_mul.S
$(gcc_compile) $< -c -DMUL_F5
libmul_none.a: lib2_mul_none.o mpy.o
$(AR_CREATE_FOR_TARGET) $@ $(filter %.o,$^)
libmul_16.a: lib2hw_mul_16.o lib2_mul_16bit.o
$(AR_CREATE_FOR_TARGET) $@ $(filter %.o,$^)
libmul_32.a: lib2hw_mul_32.o
$(AR_CREATE_FOR_TARGET) $@ $(filter %.o,$^)
libmul_f5.a: lib2hw_mul_f5.o
$(AR_CREATE_FOR_TARGET) $@ $(filter %.o,$^)
# Local Variables:
# mode: Makefile
# End: