From patchwork Wed Jul 2 08:54:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 366296 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4546A14009C for ; Wed, 2 Jul 2014 18:55:00 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:date:message-id:subject:from:to:cc:content-type; q=dns; s=default; b=qlgBXAmQT3Ni2QTaVz0Q3hNHdCjQMcJIYvETNeMbZcQ g5E3lMncbnUYJuIYi22s8xHXpfVorZn3eHjHNctkcwMO8TjjW1+oJKSUZ/VwhB6k Hplj6wBlvJKE+nb9eD8YXP8vE0PqLwA10nHFhOiEVNO0olvUVFUW/cRJF3VRitdY = DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:date:message-id:subject:from:to:cc:content-type; s=default; bh=YQ/8weQfCKZDLqMUME7JY9b7aqM=; b=xoTYPaee5fC8OT92t XA/A03WE9OfpMkLdNXsvasQMSo6hYgoo4ae7cYXu6pb/3kOOKnIdeaG6uPBePeaG LcYXozZ7aEhxDRjotXBJ38C+VJ2L28rWAgxraBiaavKMtDPh/bvT8BjqXfPcxwIb 0bfNe30Yi8YURvzrdy66xd8mKU= Received: (qmail 12805 invoked by alias); 2 Jul 2014 08:54:52 -0000 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 Received: (qmail 12729 invoked by uid 89); 2 Jul 2014 08:54:47 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mail-lb0-f177.google.com Received: from mail-lb0-f177.google.com (HELO mail-lb0-f177.google.com) (209.85.217.177) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Wed, 02 Jul 2014 08:54:43 +0000 Received: by mail-lb0-f177.google.com with SMTP id u10so7655734lbd.22 for ; Wed, 02 Jul 2014 01:54:39 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.152.179.131 with SMTP id dg3mr39700145lac.21.1404291279815; Wed, 02 Jul 2014 01:54:39 -0700 (PDT) Received: by 10.152.104.140 with HTTP; Wed, 2 Jul 2014 01:54:39 -0700 (PDT) Date: Wed, 2 Jul 2014 10:54:39 +0200 Message-ID: Subject: [PATCH, libgfortran]: Fix support_fpu_rounding_mode and add -mieee flags for alpha From: Uros Bizjak To: "gcc-patches@gcc.gnu.org" , Fortran List Cc: FX Coudert Hello! Attached patch fixes some fallout from IEEE support and enables -mieee for alpha. Also, the patch removes -O0 from dg-additiona-options in IEEE testsuite, as this always override default optimization flag. libgfortran/ChangeLog: 2014-07-02 Uros Bizjak * configure.host (ieee_flags): Add -mieee for alpha*. * config/fpu-glibc.h (support_fpu_rounding_mode): Correctly handle GFC_FPE_UPWARD, GFC_FPE_DOWNWARD and GFC_FPE_TOWARDZERO. * config/fpu-aix.h (support_fpu_rounding_mode): Ditto. testsuite/ChangeLog: 2014-07-02 Uros Bizjak * gfortran.dg/ieee/ieee_1.F90 (dg-additional-options): Remove -O0. * gfortran.dg/ieee/ieee_rounding_1.f90 (dg-additional-options): Add. Patch was tested on alphaev68-linux-gnu (uses fpu-glibc.h) and x86_64-linux-gnu. Patch was committed to mainline SVN. BTW: On alpha, it is possible to enable underflow handling: #ifdef __USE_GNU /* On later hardware, and later kernels for earlier hardware, we can forcibly underflow denormal inputs and outputs. This can speed up certain programs significantly, usually without affecting accuracy. */ enum { FE_MAP_DMZ = 1UL << 12, /* Map denorm inputs to zero */ #define FE_MAP_DMZ FE_MAP_DMZ FE_MAP_UMZ = 1UL << 13, /* Map underflowed outputs to zero */ #define FE_MAP_UMZ FE_MAP_UMZ }; #endif FX, if you care for this option, I can help test the patch and corresponding testcases. Uros. Index: libgfortran/configure.host =================================================================== --- libgfortran/configure.host (revision 212221) +++ libgfortran/configure.host (working copy) @@ -48,6 +48,8 @@ esac # Some targets require additional compiler options for NaN/Inf. ieee_flags= case "${host_cpu}" in + alpha*) + ieee_flags="-mieee" ;; sh*) ieee_flags="-mieee" ;; esac Index: libgfortran/config/fpu-aix.h =================================================================== --- libgfortran/config/fpu-aix.h (revision 212221) +++ libgfortran/config/fpu-aix.h (working copy) @@ -372,18 +372,21 @@ support_fpu_rounding_mode (int mode) return 0; #endif + case GFC_FPE_UPWARD: #ifdef FE_UPWARD return 1; #else return 0; #endif + case GFC_FPE_DOWNWARD: #ifdef FE_DOWNWARD return 1; #else return 0; #endif + case GFC_FPE_TOWARDZERO: #ifdef FE_TOWARDZERO return 1; #else Index: libgfortran/config/fpu-glibc.h =================================================================== --- libgfortran/config/fpu-glibc.h (revision 212221) +++ libgfortran/config/fpu-glibc.h (working copy) @@ -387,18 +387,21 @@ support_fpu_rounding_mode (int mode) return 0; #endif + case GFC_FPE_UPWARD: #ifdef FE_UPWARD return 1; #else return 0; #endif + case GFC_FPE_DOWNWARD: #ifdef FE_DOWNWARD return 1; #else return 0; #endif + case GFC_FPE_TOWARDZERO: #ifdef FE_TOWARDZERO return 1; #else Index: gcc/testsuite/gfortran.dg/ieee/ieee_1.F90 =================================================================== --- gcc/testsuite/gfortran.dg/ieee/ieee_1.F90 (revision 212221) +++ gcc/testsuite/gfortran.dg/ieee/ieee_1.F90 (working copy) @@ -1,5 +1,5 @@ ! { dg-do run } -! { dg-additional-options "-ffree-line-length-none -O0" } +! { dg-additional-options "-ffree-line-length-none" } ! ! Use dg-additional-options rather than dg-options to avoid overwriting the ! default IEEE options which are passed by ieee.exp and necessary. Index: gcc/testsuite/gfortran.dg/ieee/ieee_rounding_1.f90 =================================================================== --- gcc/testsuite/gfortran.dg/ieee/ieee_rounding_1.f90 (revision 212221) +++ gcc/testsuite/gfortran.dg/ieee/ieee_rounding_1.f90 (working copy) @@ -1,4 +1,5 @@ ! { dg-do run } +! { dg-additional-options "-mfp-rounding-mode=d" { target alpha*-*-* } } use, intrinsic :: ieee_features, only : ieee_rounding use, intrinsic :: ieee_arithmetic