commit 3a3866071a8525ef21ffd66119419a4239797f8a
Author: Julian Brown <julian@henry8.codesourcery.com>
Date: Fri May 13 05:51:54 2011 -0700
Machine-independent configuration changes for ARM fixed-point support
new file mode 100644
@@ -0,0 +1,23 @@
+/* Null machine-specific override for fixed-point support routine names.
+ Copyright (C) 2011 Free Software Foundation, Inc.
+
+ 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.
+
+ Under Section 7 of GPL version 3, you are granted additional
+ permissions described in the GCC Runtime Library Exception, version
+ 3.1, as published by the Free Software Foundation.
+
+ You should have received a copy of the GNU General Public License and
+ a copy of the GCC Runtime Library Exception along with this program;
+ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+ <http://www.gnu.org/licenses/>. */
@@ -25,6 +25,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#ifndef _FIXED_BIT_H
#define _FIXED_BIT_H
+#include "fixed-bit-machine.h"
+
+/* This macro may be overridden for a given target in fixed-bit-machine.h. */
+#ifndef DECORATE_FIXED_NAME
+#define DECORATE_FIXED_NAME(X) __ ## X
+#endif
+
/* To use this file we need to define one of the following:
QQ_MODE, UQQ_MODE, HQ_MODE, UHQ_MODE, SQ_MODE, USQ_MODE, DQ_MODE, UDQ_MODE,
TQ_MODE, UTQ_MODE, HA_MODE, UHA_MODE, SA_MODE, USA_MODE, DA_MODE, UDA_MODE,
@@ -445,35 +452,37 @@ typedef union
#define IBITS IBITS2(MODE_NAME)
#define I_F_BITS (FBITS + IBITS)
-#define FIXED_OP(OP,MODE,NUM) OP ## MODE ## NUM
-
-#define FIXED_SATURATE1_TEMP(NAME) FIXED_OP(__saturate1,NAME,)
-#define FIXED_SATURATE2_TEMP(NAME) FIXED_OP(__saturate2,NAME,)
-#define FIXED_MULHELPER_TEMP(NAME) FIXED_OP(__mulhelper,NAME,)
-#define FIXED_DIVHELPER_TEMP(NAME) FIXED_OP(__divhelper,NAME,)
-#define FIXED_ASHLHELPER_TEMP(NAME) FIXED_OP(__ashlhelper,NAME,)
-#define FIXED_ADD_TEMP(NAME) FIXED_OP(__add,NAME,3)
-#define FIXED_SSADD_TEMP(NAME) FIXED_OP(__ssadd,NAME,3)
-#define FIXED_USADD_TEMP(NAME) FIXED_OP(__usadd,NAME,3)
-#define FIXED_SUB_TEMP(NAME) FIXED_OP(__sub,NAME,3)
-#define FIXED_SSSUB_TEMP(NAME) FIXED_OP(__sssub,NAME,3)
-#define FIXED_USSUB_TEMP(NAME) FIXED_OP(__ussub,NAME,3)
-#define FIXED_MUL_TEMP(NAME) FIXED_OP(__mul,NAME,3)
-#define FIXED_SSMUL_TEMP(NAME) FIXED_OP(__ssmul,NAME,3)
-#define FIXED_USMUL_TEMP(NAME) FIXED_OP(__usmul,NAME,3)
-#define FIXED_DIV_TEMP(NAME) FIXED_OP(__div,NAME,3)
-#define FIXED_UDIV_TEMP(NAME) FIXED_OP(__udiv,NAME,3)
-#define FIXED_SSDIV_TEMP(NAME) FIXED_OP(__ssdiv,NAME,3)
-#define FIXED_USDIV_TEMP(NAME) FIXED_OP(__usdiv,NAME,3)
-#define FIXED_NEG_TEMP(NAME) FIXED_OP(__neg,NAME,2)
-#define FIXED_SSNEG_TEMP(NAME) FIXED_OP(__ssneg,NAME,2)
-#define FIXED_USNEG_TEMP(NAME) FIXED_OP(__usneg,NAME,2)
-#define FIXED_ASHL_TEMP(NAME) FIXED_OP(__ashl,NAME,3)
-#define FIXED_ASHR_TEMP(NAME) FIXED_OP(__ashr,NAME,3)
-#define FIXED_LSHR_TEMP(NAME) FIXED_OP(__lshr,NAME,3)
-#define FIXED_SSASHL_TEMP(NAME) FIXED_OP(__ssashl,NAME,3)
-#define FIXED_USASHL_TEMP(NAME) FIXED_OP(__usashl,NAME,3)
-#define FIXED_CMP_TEMP(NAME) FIXED_OP(__cmp,NAME,2)
+#define FIXED_OP3(OP,MODE,NUM) OP ## MODE ## NUM
+#define FIXED_OP2(OP,MODE,NUM) FIXED_OP3 (OP, MODE, NUM)
+#define FIXED_OP(OP,MODE,NUM) FIXED_OP2 (DECORATE_FIXED_NAME (OP), MODE, NUM)
+
+#define FIXED_SATURATE1_TEMP(NAME) FIXED_OP(saturate1,NAME,)
+#define FIXED_SATURATE2_TEMP(NAME) FIXED_OP(saturate2,NAME,)
+#define FIXED_MULHELPER_TEMP(NAME) FIXED_OP(mulhelper,NAME,)
+#define FIXED_DIVHELPER_TEMP(NAME) FIXED_OP(divhelper,NAME,)
+#define FIXED_ASHLHELPER_TEMP(NAME) FIXED_OP(ashlhelper,NAME,)
+#define FIXED_ADD_TEMP(NAME) FIXED_OP(add,NAME,3)
+#define FIXED_SSADD_TEMP(NAME) FIXED_OP(ssadd,NAME,3)
+#define FIXED_USADD_TEMP(NAME) FIXED_OP(usadd,NAME,3)
+#define FIXED_SUB_TEMP(NAME) FIXED_OP(sub,NAME,3)
+#define FIXED_SSSUB_TEMP(NAME) FIXED_OP(sssub,NAME,3)
+#define FIXED_USSUB_TEMP(NAME) FIXED_OP(ussub,NAME,3)
+#define FIXED_MUL_TEMP(NAME) FIXED_OP(mul,NAME,3)
+#define FIXED_SSMUL_TEMP(NAME) FIXED_OP(ssmul,NAME,3)
+#define FIXED_USMUL_TEMP(NAME) FIXED_OP(usmul,NAME,3)
+#define FIXED_DIV_TEMP(NAME) FIXED_OP(div,NAME,3)
+#define FIXED_UDIV_TEMP(NAME) FIXED_OP(udiv,NAME,3)
+#define FIXED_SSDIV_TEMP(NAME) FIXED_OP(ssdiv,NAME,3)
+#define FIXED_USDIV_TEMP(NAME) FIXED_OP(usdiv,NAME,3)
+#define FIXED_NEG_TEMP(NAME) FIXED_OP(neg,NAME,2)
+#define FIXED_SSNEG_TEMP(NAME) FIXED_OP(ssneg,NAME,2)
+#define FIXED_USNEG_TEMP(NAME) FIXED_OP(usneg,NAME,2)
+#define FIXED_ASHL_TEMP(NAME) FIXED_OP(ashl,NAME,3)
+#define FIXED_ASHR_TEMP(NAME) FIXED_OP(ashr,NAME,3)
+#define FIXED_LSHR_TEMP(NAME) FIXED_OP(lshr,NAME,3)
+#define FIXED_SSASHL_TEMP(NAME) FIXED_OP(ssashl,NAME,3)
+#define FIXED_USASHL_TEMP(NAME) FIXED_OP(usashl,NAME,3)
+#define FIXED_CMP_TEMP(NAME) FIXED_OP(cmp,NAME,2)
#if defined (MODE_NAME)
#if defined (DINT_C_TYPE)
@@ -1146,14 +1155,22 @@ extern FIXED_C_TYPE FIXED_USASHL (FIXED_C_TYPE, word_type);
#define TO_HAVE_PADDING_BITS (TO_PADDING_BITS > 0)
#endif /* TO_TYPE == 4 */
-#define FIXED_CONVERT_OP(OP,FROM,TO) OP ## FROM ## TO
-#define FIXED_CONVERT_OP2(OP,FROM,TO) OP ## FROM ## TO ## 2
-#define FRACT_TEMP(N1,N2) FIXED_CONVERT_OP(__fract,N1,N2)
-#define FRACT2_TEMP(N1,N2) FIXED_CONVERT_OP2(__fract,N1,N2)
-#define SATFRACT_TEMP(N1,N2) FIXED_CONVERT_OP(__satfract,N1,N2)
-#define SATFRACT2_TEMP(N1,N2) FIXED_CONVERT_OP2(__satfract,N1,N2)
-#define FRACTUNS_TEMP(N1,N2) FIXED_CONVERT_OP(__fractuns,N1,N2)
-#define SATFRACTUNS_TEMP(N1,N2) FIXED_CONVERT_OP(__satfractuns,N1,N2)
+#define FIXED_CONVERT_OP_B(OP,FROM,TO) OP ## FROM ## TO
+#define FIXED_CONVERT_OP_A(OP,FROM,TO) FIXED_CONVERT_OP_B(OP, FROM, TO)
+#define FIXED_CONVERT_OP(OP,FROM,TO) \
+ FIXED_CONVERT_OP_A (DECORATE_FIXED_NAME (OP), FROM, TO)
+
+#define FIXED_CONVERT_OP2_B(OP,FROM,TO) OP ## FROM ## TO ## 2
+#define FIXED_CONVERT_OP2_A(OP,FROM,TO) FIXED_CONVERT_OP2_B (OP, FROM, TO)
+#define FIXED_CONVERT_OP2(OP,FROM,TO) \
+ FIXED_CONVERT_OP2_A (DECORATE_FIXED_NAME (OP), FROM, TO)
+
+#define FRACT_TEMP(N1,N2) FIXED_CONVERT_OP(fract,N1,N2)
+#define FRACT2_TEMP(N1,N2) FIXED_CONVERT_OP2(fract,N1,N2)
+#define SATFRACT_TEMP(N1,N2) FIXED_CONVERT_OP(satfract,N1,N2)
+#define SATFRACT2_TEMP(N1,N2) FIXED_CONVERT_OP2(satfract,N1,N2)
+#define FRACTUNS_TEMP(N1,N2) FIXED_CONVERT_OP(fractuns,N1,N2)
+#define SATFRACTUNS_TEMP(N1,N2) FIXED_CONVERT_OP(satfractuns,N1,N2)
/* Define conversions from fixed-point to fixed-point. */
#if FROM_TYPE == 4 && TO_TYPE == 4
@@ -647,6 +647,16 @@ endif
# Build fixed-point support.
ifeq ($(fixed_point),yes)
+FIXED_BIT_MACHINE := fixed-bit-machine.h
+
+# Use default header if a machine-specific one is not defined.
+ifeq ($(fixed_bit_machine_header),)
+fixed_bit_machine_header := fixed-bit-mach-generic.h
+endif
+
+$(FIXED_BIT_MACHINE): $(gcc_srcdir)/config/$(fixed_bit_machine_header)
+ cp $(gcc_srcdir)/config/$(fixed_bit_machine_header) $(FIXED_BIT_MACHINE)
+
# Generate permutations of function name and mode
fixed-labels := $(shell $(SHELL) $(srcdir)/gen-fixed.sh arith labels)
fixed-funcs := $(shell $(SHELL) $(srcdir)/gen-fixed.sh arith funcs)
@@ -22,10 +22,10 @@ endif
#$(info $o$(objext): -DL$($o-label) $($o-opt))
-$o$(objext): %$(objext): $(gcc_srcdir)/config/fixed-bit.c
+$o$(objext): %$(objext): $(gcc_srcdir)/config/fixed-bit.c $(FIXED_BIT_MACHINE)
$(gcc_compile) -DL$($*-label) $($*-opt) -c $(gcc_srcdir)/config/fixed-bit.c $(vis_hide)
ifeq ($(enable_shared),yes)
-$(o)_s$(objext): %_s$(objext): $(gcc_srcdir)/config/fixed-bit.c
+$(o)_s$(objext): %_s$(objext): $(gcc_srcdir)/config/fixed-bit.c $(FIXED_BIT_MACHINE)
$(gcc_s_compile) -DL$($*-label) $($*-opt) -c $(gcc_srcdir)/config/fixed-bit.c
endif