From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8278 invoked by alias); 29 Oct 2014 07:02:01 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 8261 invoked by uid 89); 29 Oct 2014 07:02:00 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.7 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: e06smtp11.uk.ibm.com Received: from e06smtp11.uk.ibm.com (HELO e06smtp11.uk.ibm.com) (195.75.94.107) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Wed, 29 Oct 2014 07:01:59 +0000 Received: from /spool/local by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 29 Oct 2014 07:01:55 -0000 Received: from d06dlp03.portsmouth.uk.ibm.com (9.149.20.15) by e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 29 Oct 2014 07:01:53 -0000 Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id AB8271B08051 for ; Wed, 29 Oct 2014 07:01:55 +0000 (GMT) Received: from d06av03.portsmouth.uk.ibm.com (d06av03.portsmouth.uk.ibm.com [9.149.37.213]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id s9T71qDA19726662 for ; Wed, 29 Oct 2014 07:01:52 GMT Received: from d06av03.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av03.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s9T71qBG016125 for ; Wed, 29 Oct 2014 01:01:52 -0600 Received: from bl3ahm9f.de.ibm.com (dyn-9-152-212-249.boeblingen.de.ibm.com [9.152.212.249]) by d06av03.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id s9T71qSx016110 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO); Wed, 29 Oct 2014 01:01:52 -0600 Received: from dvogt by bl3ahm9f.de.ibm.com with local (Exim 4.76) (envelope-from ) id 1XjNGR-0002qB-KB; Wed, 29 Oct 2014 08:01:51 +0100 Date: Wed, 29 Oct 2014 09:13:00 -0000 From: Dominik Vogt To: gcc-patches , "gofrontend-dev@googlegroups.com" Subject: Re: [gofrontend-dev] [PATCH 8/9] Gccgo port to s390[x] -- part I Message-ID: <20141029070151.GA10538@linux.vnet.ibm.com> Reply-To: vogt@linux.vnet.ibm.com Mail-Followup-To: gcc-patches , "gofrontend-dev@googlegroups.com" References: <20140909124446.GA25290@linux.vnet.ibm.com> <20140909130414.GB29442@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="5vNYLRcllDrimb99" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14102907-0005-0000-0000-000001D8BC34 X-SW-Source: 2014-10/txt/msg03004.txt.bz2 --5vNYLRcllDrimb99 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 120 Patch updated to remove conflicts with changed tests in patch 7. Ciao Dominik ^_^ ^_^ -- Dominik Vogt IBM Germany --5vNYLRcllDrimb99 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0008-godump-Support-_Complex-types-in-go_format_type.patch" Content-length: 4521 >From e81ca934b619cad8b3872f28edbf3d2d0afeeec9 Mon Sep 17 00:00:00 2001 From: Dominik Vogt Date: Fri, 5 Sep 2014 07:31:01 +0100 Subject: [PATCH 8/9] Gccgo port to s390[x] -- part I godump: Support _Complex types in go_format_type. 1) float/double _Complex are represented as complex64/complex128 in Go as appropriate. 2) Add tests. --- gcc/godump.c | 34 +++++++++++++++++++++++++++++++++ gcc/testsuite/gcc.misc-tests/godump-1.c | 30 +++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) diff --git a/gcc/godump.c b/gcc/godump.c index 7a05664..fccd3eb 100644 --- a/gcc/godump.c +++ b/gcc/godump.c @@ -780,6 +780,40 @@ go_format_type (struct godump_container *container, tree type, } break; + case COMPLEX_TYPE: + { + const char *s; + char buf[100]; + tree real_type; + + real_type = TREE_TYPE (type); + if (TREE_CODE (real_type) == REAL_TYPE) + { + switch (TYPE_PRECISION (real_type)) + { + case 32: + s = "complex64"; + break; + case 64: + s = "complex128"; + break; + default: + snprintf (buf, sizeof buf, "INVALID-complex-%u", + 2 * TYPE_PRECISION (real_type)); + s = buf; + ret = false; + break; + } + } + else + { + s = "INVALID-complex-non-real"; + ret = false; + } + obstack_grow (ob, s, strlen (s)); + } + break; + case BOOLEAN_TYPE: obstack_grow (ob, "bool", 4); break; diff --git a/gcc/testsuite/gcc.misc-tests/godump-1.c b/gcc/testsuite/gcc.misc-tests/godump-1.c index 876cf28..f339cc9 100644 --- a/gcc/testsuite/gcc.misc-tests/godump-1.c +++ b/gcc/testsuite/gcc.misc-tests/godump-1.c @@ -104,6 +104,21 @@ d_t d_v2; typedef long double ld_t; long double ld_v1; ld_t ld_v2; +typedef _Complex cx_t; +_Complex cx_v1; +cx_t cx_v2; +typedef float _Complex fcx_t; +float _Complex fcx_v1; +fcx_t fcx_v2; +typedef double _Complex dcx_t; +double _Complex dcx_v1; +dcx_t dcx_v2; +typedef long double _Complex ldcx_t; +long double _Complex ldcx_v1; +ldcx_t ldcx_v2; +typedef int _Complex icx_t; +int _Complex icx_v1; +icx_t icx_v2; /* nested typedefs */ typedef int ni_t; @@ -301,6 +316,11 @@ typedef int8_t (*func_t)(void *p); /* { dg-final { scan-file godump-1.out "(?n)^type _f_t float\[0-9\]*$" } } */ /* { dg-final { scan-file godump-1.out "(?n)^type _d_t float\[0-9\]*$" } } */ /* { dg-final { scan-file godump-1.out "(?n)^// type _ld_t INVALID-float-\[0-9\]*$" } } */ +/* { dg-final { scan-file godump-1.out "(?n)^type _cx_t complex\[0-9\]*$" } } */ +/* { dg-final { scan-file godump-1.out "(?n)^type _fcx_t complex\[0-9\]*$" } } */ +/* { dg-final { scan-file godump-1.out "(?n)^type _dcx_t complex\[0-9\]*$" } } */ +/* { dg-final { scan-file godump-1.out "(?n)^// type _ldcx_t INVALID-complex-256$" } } */ +/* { dg-final { scan-file godump-1.out "(?n)^// type _icx_t INVALID-complex-non-real$" } } */ /* { dg-final { scan-file godump-1.out "(?n)^type _ni_t int\[0-9\]*$" } } */ /* { dg-final { scan-file godump-1.out "(?n)^type _ni2_t int\[0-9\]*$" } } */ /* { dg-final { scan-file godump-1.out "(?n)^type _ni3_t int\[0-9\]*$" } } */ @@ -414,6 +434,16 @@ typedef int8_t (*func_t)(void *p); /* { dg-final { scan-file godump-1.out "(?n)^var _d_v2 _d_t$" } } */ /* { dg-final { scan-file godump-1.out "(?n)^// var _ld_v1 INVALID-float-\[0-9\]*$" } } */ /* { dg-final { scan-file godump-1.out "(?n)^// var _ld_v2 INVALID-float-\[0-9\]*$" } } */ +/* { dg-final { scan-file godump-1.out "(?n)^var _cx_v1 complex\[0-9\]*$" } } */ +/* { dg-final { scan-file godump-1.out "(?n)^var _cx_v2 _cx_t$" } } */ +/* { dg-final { scan-file godump-1.out "(?n)^var _fcx_v1 complex\[0-9\]*$" } } */ +/* { dg-final { scan-file godump-1.out "(?n)^var _fcx_v2 _fcx_t$" } } */ +/* { dg-final { scan-file godump-1.out "(?n)^var _dcx_v1 complex\[0-9\]*$" } } */ +/* { dg-final { scan-file godump-1.out "(?n)^var _dcx_v2 _dcx_t$" } } */ +/* { dg-final { scan-file godump-1.out "(?n)^// var _ldcx_v1 INVALID-complex-256$" } } */ +/* { dg-final { scan-file godump-1.out "(?n)^// var _ldcx_v2 INVALID-complex-256$" } } */ +/* { dg-final { scan-file godump-1.out "(?n)^// var _icx_v1 INVALID-complex-non-real$" } } */ +/* { dg-final { scan-file godump-1.out "(?n)^// var _icx_v2 INVALID-complex-non-real$" } } */ /* { dg-final { scan-file godump-1.out "(?n)^var _ni2_v2 _ni2_t$" } } */ /* { dg-final { scan-file godump-1.out "(?n)^var _ni3_v2 _ni3_t$" } } */ /* { dg-final { scan-file godump-1.out "(?n)^var _e1_v1 int$" } } */ -- 1.8.4.2 --5vNYLRcllDrimb99--