From patchwork Fri May 13 13:58:00 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julian Brown X-Patchwork-Id: 95481 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 8C23FB6EF1 for ; Fri, 13 May 2011 23:58:25 +1000 (EST) Received: (qmail 4661 invoked by alias); 13 May 2011 13:58:22 -0000 Received: (qmail 4637 invoked by uid 22791); 13 May 2011 13:58:19 -0000 X-SWARE-Spam-Status: No, hits=-0.3 required=5.0 tests=AWL, BAYES_50, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 13 May 2011 13:58:04 +0000 Received: (qmail 17421 invoked from network); 13 May 2011 13:58:03 -0000 Received: from unknown (HELO rex.config) (julian@127.0.0.2) by mail.codesourcery.com with ESMTPA; 13 May 2011 13:58:03 -0000 Date: Fri, 13 May 2011 14:58:00 +0100 From: Julian Brown To: gcc-patches@gcc.gnu.org Subject: [PATCH] ARM fixed-point support [4/6]: allow overriding of fixed-point helper function names Message-ID: <20110513145800.447aee1f@rex.config> Mime-Version: 1.0 X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org This patch allows the decoration of helper function names for fixed-point support to be changed from the default "__foo" to a different scheme, as required by the ARM EABI (these are "vendor-specific" helpers, so should go in a particular namespace). These are only the machine-independent changes: the ARM-specific bits come later. Tested alongside other patches in the series. OK to apply? Julian ChangeLog gcc/ * config/fixed-bit.h (fixed-bit-machine.h): Include. (DECORATE_FIXED_NAME): Conditionally define if undefined. Use throughout file to decorate function names. * config/fixed-bit-mach-generic.h: New. libgcc/ * Makefile.in (FIXED_BIT_MACHINE): New rule. Include target-specific or generic fixed_bit_machine_header to decorate the names of fixed-point helper functions. * fixed-obj.mk ($(o)_s$(objext)): Depend on $(FIXED_BIT_MACHINE). commit 3a3866071a8525ef21ffd66119419a4239797f8a Author: Julian Brown Date: Fri May 13 05:51:54 2011 -0700 Machine-independent configuration changes for ARM fixed-point support diff --git a/gcc/config/fixed-bit-mach-generic.h b/gcc/config/fixed-bit-mach-generic.h new file mode 100644 index 0000000..8bfbf53 --- /dev/null +++ b/gcc/config/fixed-bit-mach-generic.h @@ -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 + . */ diff --git a/gcc/config/fixed-bit.h b/gcc/config/fixed-bit.h index 562772d..1cce4ef 100644 --- a/gcc/config/fixed-bit.h +++ b/gcc/config/fixed-bit.h @@ -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 diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in index 7e2ab93..5874267 100644 --- a/libgcc/Makefile.in +++ b/libgcc/Makefile.in @@ -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) diff --git a/libgcc/fixed-obj.mk b/libgcc/fixed-obj.mk index 3c7c2f3..1bc8220 100644 --- a/libgcc/fixed-obj.mk +++ b/libgcc/fixed-obj.mk @@ -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