From patchwork Fri Sep 5 08:04:40 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ramana Radhakrishnan X-Patchwork-Id: 36784 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f71.google.com (mail-pa0-f71.google.com [209.85.220.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 011C9202A1 for ; Fri, 5 Sep 2014 08:12:37 +0000 (UTC) Received: by mail-pa0-f71.google.com with SMTP id et14sf101429672pad.10 for ; Fri, 05 Sep 2014 01:12:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:mailing-list:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:sender :delivered-to:message-id:date:from:user-agent:mime-version:to:cc :subject:references:in-reply-to:x-original-sender :x-original-authentication-results:content-type; bh=9FaI9rdmY3zxs9OBnb7lHojrRcr/gN2ANe7m5cKz0DQ=; b=YLzLi3pUVMSx5VijYlihA+ZJKYDz9mpYW5yShhKn/UZYZcFeXiWNF8e44gxw2L8nJN CMlQkiuG+hCFIZ6cJJ0JD3k9HcOuG2zwykgvkR09BOrJ0dkXz+N/jpAiDMvUGMz55Tbi pYIS0RjzELJFJmZaYIVt5rLvY+/p2Ss0B34gZ3u190Pt1lfRGMBc3tCHoLqc76fK4GGn AqvGhmaVkz+dLh0kxjoQDcU0sdWgg4rhvTaoByuFj/vYFpA/ouuWxfjeKIj/aMCC1Ndg fm575NVjqjjUCX4Mz4mMfMlW+oBmiUE73IbBvMAcGkchsFW7NcTVFrvs/n8FJbwFXM8L eUnA== X-Gm-Message-State: ALoCoQnTOWnkukGbKvBCwXoYLDQQOJbIB7pe+vdUmJ9vOnU4Kx+ivxyy4VcDbOaQXMHfVDlKNIkV X-Received: by 10.66.65.131 with SMTP id x3mr5401498pas.13.1409904380037; Fri, 05 Sep 2014 01:06:20 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.31.161 with SMTP id f30ls119234qgf.39.gmail; Fri, 05 Sep 2014 01:06:19 -0700 (PDT) X-Received: by 10.52.97.233 with SMTP id ed9mr7609304vdb.16.1409904379843; Fri, 05 Sep 2014 01:06:19 -0700 (PDT) Received: from mail-vc0-x233.google.com (mail-vc0-x233.google.com [2607:f8b0:400c:c03::233]) by mx.google.com with ESMTPS id ts8si805828vdc.34.2014.09.05.01.06.19 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 05 Sep 2014 01:06:19 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2607:f8b0:400c:c03::233 as permitted sender) client-ip=2607:f8b0:400c:c03::233; Received: by mail-vc0-f179.google.com with SMTP id hy4so11758082vcb.24 for ; Fri, 05 Sep 2014 01:06:19 -0700 (PDT) X-Received: by 10.220.97.138 with SMTP id l10mr8925446vcn.25.1409904379640; Fri, 05 Sep 2014 01:06:19 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.45.67 with SMTP id uj3csp46286vcb; Fri, 5 Sep 2014 01:06:19 -0700 (PDT) X-Received: by 10.43.155.13 with SMTP id lg13mr12204173icc.15.1409904378729; Fri, 05 Sep 2014 01:06:18 -0700 (PDT) Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id tk9si2314298pbc.159.2014.09.05.01.06.07 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 Sep 2014 01:06:07 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-376974-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Received: (qmail 11709 invoked by alias); 5 Sep 2014 08:04:45 -0000 Mailing-List: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org Precedence: list 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 Received: (qmail 11696 invoked by uid 89); 5 Sep 2014 08:04:45 -0000 X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.8 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 X-HELO: collaborate-mta1.arm.com Received: from fw-tnat.austin.arm.com (HELO collaborate-mta1.arm.com) (217.140.110.23) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 05 Sep 2014 08:04:43 +0000 Received: from [10.1.209.40] (e105545-lin.cambridge.arm.com [10.1.209.40]) by collaborate-mta1.arm.com (Postfix) with ESMTPS id 853EF13F697; Fri, 5 Sep 2014 03:04:33 -0500 (CDT) Message-ID: <54096E98.900@arm.com> Date: Fri, 05 Sep 2014 09:04:40 +0100 From: Ramana Radhakrishnan User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0 MIME-Version: 1.0 To: Richard Henderson , "gcc-patches@gcc.gnu.org" CC: Marcus Shawcroft Subject: Re: [Patch AArch64] Add support for crtfastmath.c References: <54087170.1040505@arm.com> <54089D9A.1090106@redhat.com> In-Reply-To: <54089D9A.1090106@redhat.com> X-IsSubscribed: yes X-Original-Sender: ramana.radhakrishnan@arm.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2607:f8b0:400c:c03::233 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=pass header.i=@gcc.gnu.org X-Google-Group-Id: 836684582541 On 04/09/14 18:12, Richard Henderson wrote: > On 09/04/2014 07:04 AM, Ramana Radhakrishnan wrote: >> gcc/Changelog >> >> 2014-09-04 Marcus Shawcroft >> Ramana Radhakrishnan >> >> * config/aarch64/aarch64-elf-raw.h (ENDFILE_SPEC): Add crtfastmath.o. >> * config/aarch64/aarch64-linux.h >> (GNU_USER_TARGET_MATH_ENDFILE_SPEC): Define. >> (ENDFILE_SPEC): Define and use GNU_USER_TARGET_MATH_ENDFILE_SPEC. >> >> libgcc/Changelog >> >> 2014-09-04 Marcus Shawcroft >> Ramana Radhakrishnan >> >> * config.host (aarch64*): Include crtfastmath and t-crtfm. >> * config/aarch64/crtfastmath.c: New file. > > ENOPATCH. > > > r~ > Bah - ofcourse. Here it is attached. Ramana diff --git a/gcc/config/aarch64/aarch64-elf-raw.h b/gcc/config/aarch64/aarch64-elf-raw.h index adec7e7..b9d4e8d 100644 --- a/gcc/config/aarch64/aarch64-elf-raw.h +++ b/gcc/config/aarch64/aarch64-elf-raw.h @@ -23,7 +23,9 @@ #define GCC_AARCH64_ELF_RAW_H #define STARTFILE_SPEC " crti%O%s crtbegin%O%s crt0%O%s" -#define ENDFILE_SPEC " crtend%O%s crtn%O%s" +#define ENDFILE_SPEC \ + " crtend%O%s crtn%O%s " \ + "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s}" #ifndef LINK_SPEC #define LINK_SPEC "%{mbig-endian:-EB} %{mlittle-endian:-EL} -X \ diff --git a/gcc/config/aarch64/aarch64-linux.h b/gcc/config/aarch64/aarch64-linux.h index 8d20310..1731432 100644 --- a/gcc/config/aarch64/aarch64-linux.h +++ b/gcc/config/aarch64/aarch64-linux.h @@ -37,6 +37,14 @@ #define LINK_SPEC LINUX_TARGET_LINK_SPEC +#define GNU_USER_TARGET_MATHFILE_SPEC \ + "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s}" + +#undef ENDFILE_SPEC +#define ENDFILE_SPEC \ + GNU_USER_TARGET_MATHFILE_SPEC " " \ + GNU_USER_TARGET_ENDFILE_SPEC + #define TARGET_OS_CPP_BUILTINS() \ do \ { \ diff --git a/libgcc/config.host b/libgcc/config.host index 0550c34..2ea8f20 100644 --- a/libgcc/config.host +++ b/libgcc/config.host @@ -322,13 +322,15 @@ esac case ${host} in aarch64*-*-elf) extra_parts="$extra_parts crtbegin.o crtend.o crti.o crtn.o" + extra_parts="$extra_parts crtfastmath.o" tmake_file="${tmake_file} ${cpu_type}/t-aarch64" - tmake_file="${tmake_file} ${cpu_type}/t-softfp t-softfp" + tmake_file="${tmake_file} ${cpu_type}/t-softfp t-softfp t-crtfm" ;; aarch64*-*-linux*) + extra_parts="$extra_parts crtfastmath.o" md_unwind_header=aarch64/linux-unwind.h tmake_file="${tmake_file} ${cpu_type}/t-aarch64" - tmake_file="${tmake_file} ${cpu_type}/t-softfp t-softfp" + tmake_file="${tmake_file} ${cpu_type}/t-softfp t-softfp t-crtfm" ;; alpha*-*-linux*) tmake_file="${tmake_file} alpha/t-alpha alpha/t-ieee t-crtfm alpha/t-linux" diff --git a/libgcc/config/aarch64/crtfastmath.c b/libgcc/config/aarch64/crtfastmath.c new file mode 100644 index 0000000..3a8ddfc --- /dev/null +++ b/libgcc/config/aarch64/crtfastmath.c @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2014 Free Software Foundation, Inc. + * + * This file 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. + * + * This file 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 + * . + */ + +#define _FPU_FPCR_FZ 0x1000000 + +#define _FPU_SETCW(fpcr) \ + { \ + __asm__ __volatile__ ("msr fpcr, %0" : : "r" (fpcr)); \ + } + +static void __attribute__((constructor)) +set_fast_math (void) +{ + /* Flush to zero, round to nearest, IEEE exceptions disabled. */ + _FPU_SETCW (_FPU_FPCR_FZ); +}