From patchwork Wed Sep 10 08:42:11 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Krebbel X-Patchwork-Id: 387636 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 8C59714009C for ; Wed, 10 Sep 2014 18:42:27 +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:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=D2r5Nqx+4CNAGOKiJ5RCmU7mLHtQQoKx3DUv59Kl44wqA+8CObldP BlXdnRKaOMzekVjmxyT+/eUzAa8WiBKW7MBbmI0xXdpkAAhprLLf464qZLMayqAT 9QHEjmfgJ/ZenR7WHdQhSIo0UbhueI2yHXk1pxV4BhqFZ3xaNytIt4= 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:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=nrTeDXM3aOkGubmSdxmY/l/9iaI=; b=N97R80Y30/3L7g33bUUo DW5D2zuLjhhHkkVvK1x/nPdKmlxWKMIsP8N4N9WvSSAGCNSDQFtchh6nO8j7SQO8 SoraAzxt5ugGiVH+3aqAKq9UNz7l288hqhOaeD0qGuIDIM8Op2wZ4IdEPFYojyfc Z5brVlEuil+MTIySa8UlRuc= Received: (qmail 10092 invoked by alias); 10 Sep 2014 08:42:21 -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 10082 invoked by uid 89); 10 Sep 2014 08:42:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.6 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: e06smtp15.uk.ibm.com Received: from e06smtp15.uk.ibm.com (HELO e06smtp15.uk.ibm.com) (195.75.94.111) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Wed, 10 Sep 2014 08:42:19 +0000 Received: from /spool/local by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 10 Sep 2014 09:42:16 +0100 Received: from d06dlp02.portsmouth.uk.ibm.com (9.149.20.14) by e06smtp15.uk.ibm.com (192.168.101.145) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 10 Sep 2014 09:42:14 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id BF6DB2190056 for ; Wed, 10 Sep 2014 09:41:54 +0100 (BST) Received: from d06av09.portsmouth.uk.ibm.com (d06av09.portsmouth.uk.ibm.com [9.149.37.250]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id s8A8gEWe35389524 for ; Wed, 10 Sep 2014 08:42:14 GMT Received: from d06av09.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av09.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s8A8gE6P023318 for ; Wed, 10 Sep 2014 02:42:14 -0600 Received: from bart (icon-9-164-174-93.megacenter.de.ibm.com [9.164.174.93]) by d06av09.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with SMTP id s8A8gCYn023253 for ; Wed, 10 Sep 2014 02:42:13 -0600 Received: by bart (sSMTP sendmail emulation); Wed, 10 Sep 2014 10:42:11 +0200 Date: Wed, 10 Sep 2014 10:42:11 +0200 From: Andreas Krebbel To: gcc-patches@gcc.gnu.org Subject: [PATCH] S/390: Implement SD<->TD conversions Message-ID: <20140910084211.GA4734@maggie> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14091008-0342-0000-0000-00000100D0B3 X-IsSubscribed: yes Hi, on S/390 we have DFP conversions for SD<->DD and DD<->TD but miss SD<->TD. The attached patch expands the missing patterns to SD->DD->TD and TD->DD->SD to avoid library calls being emitted. No regressions on s390 and s390x. Bye, -Andreas- 2014-09-10 Andreas Krebbel * config/s390/s390.md ("trunctdsd2", "extendsdtd2"): New expanders. 2014-09-10 Andreas Krebbel * gcc.target/s390/dfp-conv1.c: New testcase. diff --git a/gcc/config/s390/s390.md b/gcc/config/s390/s390.md index bcfe8f9..73ac0dc 100644 --- a/gcc/config/s390/s390.md +++ b/gcc/config/s390/s390.md @@ -4406,6 +4406,18 @@ [(set_attr "op_type" "RRF") (set_attr "type" "ftruncsd")]) +(define_expand "trunctdsd2" + [(parallel + [(set (match_dup 3) + (float_truncate:DD (match_operand:TD 1 "register_operand" ""))) + (clobber (match_scratch:TD 2 ""))]) + (set (match_operand:SD 0 "register_operand" "") + (float_truncate:SD (match_dup 3)))] + "TARGET_HARD_DFP" +{ + operands[3] = gen_reg_rtx (DDmode); +}) + ; ; extend(sf|df)(df|tf)2 instruction pattern(s). ; @@ -4442,6 +4454,16 @@ [(set_attr "op_type" "RRF") (set_attr "type" "fsimptf")]) +(define_expand "extendsdtd2" + [(set (match_dup 2) + (float_extend:DD (match_operand:SD 1 "register_operand" ""))) + (set (match_operand:TD 0 "register_operand" "") + (float_extend:TD (match_dup 2)))] + "TARGET_HARD_DFP" +{ + operands[2] = gen_reg_rtx (DDmode); +}) + ; Binary Floating Point - load fp integer ; Expanders for: floor, btrunc, round, ceil, and nearbyint diff --git a/gcc/testsuite/gcc.target/s390/dfp-conv1.c b/gcc/testsuite/gcc.target/s390/dfp-conv1.c new file mode 100644 index 0000000..3c553a3 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/dfp-conv1.c @@ -0,0 +1,22 @@ +/* We do not have hardware instructions which do a direct conversion + between the 32 and 128 bit DFP types. But we can easily do it in + two steps. Older libdfp implementations require this not to call + into a lib in order to prevent an endless loop. */ + +/* { dg-do compile } */ +/* { dg-options "-O3 -march=z10 -mzarch" } */ + +_Decimal32 +foo (_Decimal128 a) +{ + return (_Decimal32)a; +} + +_Decimal128 +bar (_Decimal32 a) +{ + return (_Decimal128)a; +} + +/* Make sure no library call is emitted. */ +/* { dg-final { scan-assembler-not "brasl" } } */