From patchwork Mon Jan 3 15:38:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 49480 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C46333858405 for ; Mon, 3 Jan 2022 15:39:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C46333858405 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1641224371; bh=j7T8Yy4bXl9UI+EAhOiK3xPc9+06cKwC0iwVprfsFRE=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=M/YAa58EIPw3rIISOGJJ5Smo+GdZaAlnGQEo7i12hFUsYhNGwJHneMAS9k/B/AKiQ +/LwuWe0bJ8k+NnQzeGwSbetqHc5jtCdEE+84dYzhsWO44x80aO29QggGq3Yror/bN xeUyup9MlBGiZjRtlv6x0FpCI3kvWypyw+ulhQ/Q= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id E1D423858403 for ; Mon, 3 Jan 2022 15:38:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E1D423858403 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-541-xUyZIXf4OWCzMdeUblXqNg-1; Mon, 03 Jan 2022 10:38:41 -0500 X-MC-Unique: xUyZIXf4OWCzMdeUblXqNg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C4FB4101520D; Mon, 3 Jan 2022 15:38:39 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.2.16.169]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 725C87D3D5; Mon, 3 Jan 2022 15:38:39 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.16.1/8.16.1) with ESMTPS id 203FcaOf1356008 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Mon, 3 Jan 2022 16:38:36 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.16.1/8.16.1/Submit) id 203FcZCh1356007; Mon, 3 Jan 2022 16:38:35 +0100 Date: Mon, 3 Jan 2022 16:38:35 +0100 To: Thomas Koenig Subject: [power-ieee128] fortran: trans-io.c side of -mabi=ieeelongdouble I/O support Message-ID: <20220103153835.GM2664@tucnak> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=unavailable autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jakub Jelinek via Gcc-patches From: Jakub Jelinek Reply-To: Jakub Jelinek Cc: Michael Meissner , Segher Boessenkool , "fortran@gcc.gnu.org" , Peter Bergner , Bill Schmidt , gcc-patches@gcc.gnu.org, David Edelsohn Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Hi! Here is the compiler side of those changes, but depends of course on the decision what to do with those *real128* and *complex128* symbols. With all the 4 patches e.g. print *, var for real(kind=16) var; var = 1.0; works both with -mabi=ibmlongdouble and -mabi=ieeelongdouble. 2022-01-03 Jakub Jelinek * trans-io.c (transfer_namelist_element): Use gfc_type_abi_kind, formatting fixes. (transfer_expr): Use gfc_type_abi_kind, use *REAL128* APIs even for abi_kind == 17. Jakub --- gcc/fortran/trans-io.c.jj 2021-12-31 11:00:15.052190585 +0000 +++ gcc/fortran/trans-io.c 2022-01-03 14:20:55.238159269 +0000 @@ -1765,18 +1765,17 @@ transfer_namelist_element (stmtblock_t * else tmp = build_int_cst (gfc_charlen_type_node, 0); + int abi_kind = gfc_type_abi_kind (ts); if (dtio_proc == null_pointer_node) - tmp = build_call_expr_loc (input_location, - iocall[IOCALL_SET_NML_VAL], 6, - dt_parm_addr, addr_expr, string, - build_int_cst (gfc_int4_type_node, ts->kind), - tmp, dtype); + tmp = build_call_expr_loc (input_location, iocall[IOCALL_SET_NML_VAL], 6, + dt_parm_addr, addr_expr, string, + build_int_cst (gfc_int4_type_node, abi_kind), + tmp, dtype); else - tmp = build_call_expr_loc (input_location, - iocall[IOCALL_SET_NML_DTIO_VAL], 8, - dt_parm_addr, addr_expr, string, - build_int_cst (gfc_int4_type_node, ts->kind), - tmp, dtype, dtio_proc, vtable); + tmp = build_call_expr_loc (input_location, iocall[IOCALL_SET_NML_DTIO_VAL], + 8, dt_parm_addr, addr_expr, string, + build_int_cst (gfc_int4_type_node, abi_kind), + tmp, dtype, dtio_proc, vtable); gfc_add_expr_to_block (block, tmp); /* If the object is an array, transfer rank times: @@ -2298,7 +2297,7 @@ transfer_expr (gfc_se * se, gfc_typespec ts->kind = gfc_index_integer_kind; } - kind = ts->kind; + kind = gfc_type_abi_kind (ts); function = NULL; arg2 = NULL; arg3 = NULL; @@ -2318,14 +2317,14 @@ transfer_expr (gfc_se * se, gfc_typespec arg2 = build_int_cst (integer_type_node, kind); if (last_dt == READ) { - if (gfc_real16_is_float128 && ts->kind == 16) + if ((gfc_real16_is_float128 && kind == 16) || kind == 17) function = iocall[IOCALL_X_REAL128]; else function = iocall[IOCALL_X_REAL]; } else { - if (gfc_real16_is_float128 && ts->kind == 16) + if ((gfc_real16_is_float128 && kind == 16) || kind == 17) function = iocall[IOCALL_X_REAL128_WRITE]; else function = iocall[IOCALL_X_REAL_WRITE]; @@ -2337,14 +2336,14 @@ transfer_expr (gfc_se * se, gfc_typespec arg2 = build_int_cst (integer_type_node, kind); if (last_dt == READ) { - if (gfc_real16_is_float128 && ts->kind == 16) + if ((gfc_real16_is_float128 && kind == 16) || kind == 17) function = iocall[IOCALL_X_COMPLEX128]; else function = iocall[IOCALL_X_COMPLEX]; } else { - if (gfc_real16_is_float128 && ts->kind == 16) + if ((gfc_real16_is_float128 && kind == 16) || kind == 17) function = iocall[IOCALL_X_COMPLEX128_WRITE]; else function = iocall[IOCALL_X_COMPLEX_WRITE];