From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-eopbgr140055.outbound.protection.outlook.com [40.107.14.55]) by sourceware.org (Postfix) with ESMTPS id 096313858D37; Thu, 6 Aug 2020 07:40:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 096313858D37 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=Andrea.Corallo@arm.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nE64pc4yJoa2WRGgLm6LBTNski1xJj4i20OdHtbnv+Y=; b=KJ5k4AS+/56WyBZ5uinCtsp56v2icLAyrnmq+H2u7x0WCZ3TO1AY9BO85xDMZqfTT3SsUBi4iqtE+t70Ux7zCpmZasYdFidKUmeNC0IgyxHyu92/QmV1adcBX8UuITNE5O2eCVpppg57EMn0hffcKqx9bZnTZY7IGQXsQQWUJ20= Received: from DB6PR0202CA0028.eurprd02.prod.outlook.com (2603:10a6:4:a5::14) by AM6PR08MB3944.eurprd08.prod.outlook.com (2603:10a6:20b:a1::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.15; Thu, 6 Aug 2020 07:40:34 +0000 Received: from DB5EUR03FT026.eop-EUR03.prod.protection.outlook.com (2603:10a6:4:a5:cafe::a5) by DB6PR0202CA0028.outlook.office365.com (2603:10a6:4:a5::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.19 via Frontend Transport; Thu, 6 Aug 2020 07:40:34 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; gcc.gnu.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;gcc.gnu.org; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DB5EUR03FT026.mail.protection.outlook.com (10.152.20.159) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.16 via Frontend Transport; Thu, 6 Aug 2020 07:40:34 +0000 Received: ("Tessian outbound bac899b43a54:v64"); Thu, 06 Aug 2020 07:40:34 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: a5aff97fa15fe21f X-CR-MTA-TID: 64aa7808 Received: from d69e94dee762.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 21A024B3-7399-4052-86C5-93564EB80BB8.1; Thu, 06 Aug 2020 07:40:28 +0000 Received: from EUR04-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id d69e94dee762.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 06 Aug 2020 07:40:28 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hCrpZfaghWpAgjSqGFVYptYr2G8F6THN4cwhecal/QpipdhjY6xJk2reRkhQ/ATlFDY6U785wzLUX6GdR1dQ9Wa+Le6+zDRzE/bzEFeS0l87TGPgWetbUhiIzVG7r9cy6OVfNnmlF4DgHon0umkpMOgzzgvVjyF8HITMdevaVna4CS/3U1uN9f9zxfTeGGa3O7yJFOLvxgmUW5UJg+FVGMimswoAu0OSUESnP1jtkDjOkpePf4U19hsxw/3ZdgvuGJw3PV+8I8F7O0T01mjINehTpP8VQeOXc4NKMv/y5hTHWpLL5BJWJM7zUIkEPLgdBzrihsgiDvy2pPP9M6Ol7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nE64pc4yJoa2WRGgLm6LBTNski1xJj4i20OdHtbnv+Y=; b=WoPIBa/hGQ0fO44iukC5Huc/36JmfdizfJN4ltknoK48GNSe9hjuABwSVsQAqxaVP7hUjvWchDkaWOl1uR4L4IOHr10KwD4aD9y3IjEl0DBgVWYZFDJ+BanoYrBdX/fIWuOO0AStPDv7PcAxyTGU0Zq8PcMbm5yvn+cvDngkqZsRJl4O78Im9Lhs4IzzOAdYUownDoLYROzXdE8PpuJYLmKk1zOx3sOLGnwPCGXFio8DQf9RkuArFwdi5ubeAfhhnC3V62tpFSOGppU3m+gwia6N09iSM5qu+/7QnKZOkmmHexoS5J2b5o5RF/F8lSHMoFOYfdBoligWctaA8PRddQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nE64pc4yJoa2WRGgLm6LBTNski1xJj4i20OdHtbnv+Y=; b=KJ5k4AS+/56WyBZ5uinCtsp56v2icLAyrnmq+H2u7x0WCZ3TO1AY9BO85xDMZqfTT3SsUBi4iqtE+t70Ux7zCpmZasYdFidKUmeNC0IgyxHyu92/QmV1adcBX8UuITNE5O2eCVpppg57EMn0hffcKqx9bZnTZY7IGQXsQQWUJ20= Authentication-Results-Original: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=arm.com; Received: from AM0PR08MB3585.eurprd08.prod.outlook.com (2603:10a6:208:d9::21) by AM8PR08MB5652.eurprd08.prod.outlook.com (2603:10a6:20b:1d8::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3239.21; Thu, 6 Aug 2020 07:40:27 +0000 Received: from AM0PR08MB3585.eurprd08.prod.outlook.com ([fe80::7c84:50ed:11e3:7aed]) by AM0PR08MB3585.eurprd08.prod.outlook.com ([fe80::7c84:50ed:11e3:7aed%4]) with mapi id 15.20.3239.022; Thu, 6 Aug 2020 07:40:27 +0000 From: Andrea Corallo To: David Malcolm via Jit Cc: "jit@gcc.gnu.org" , nd , gcc-patches@gcc.gnu.org, Alex Coplan Subject: Re: [PATCH] libgccjit: Improve doc and comments regarding type casts References: Date: Thu, 06 Aug 2020 09:40:23 +0200 In-Reply-To: (Andrea Corallo's message of "Wed, 22 Jul 2020 10:45:20 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Content-Type: text/plain X-ClientProxiedBy: LO2P265CA0063.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:60::27) To AM0PR08MB3585.eurprd08.prod.outlook.com (2603:10a6:208:d9::21) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from e112547 (217.140.99.251) by LO2P265CA0063.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:60::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.19 via Frontend Transport; Thu, 6 Aug 2020 07:40:26 +0000 X-Originating-IP: [217.140.99.251] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 9dcb960c-3f36-4807-1fc1-08d839dc011c X-MS-TrafficTypeDiagnostic: AM8PR08MB5652:|AM6PR08MB3944: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:9508;OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: aKN5J/48lf+zQntOAMG+KJxLvAB0XXXMWwXFajapf4owBZP2Q2AsLmgzMcaI7TqgvwL1dahvSlzdKYECTqhO8S9vBAuhRUVZlByBEJEiWwlVfUCKjS/01j2aOME3sfGbOgwqXFShjAOh8BSMu2m9qCI2hR72t3YI2Pp7X76PlFuc8wb+2QzxYKVkJj3Q/a+s9cAmFKZPq7tNe6qE+/PfxJl6g48XCo2r8ed8bfmj8eA4Qem+5JRVR1i9JuitvMypXbRRzif35PMbJ4bhSLS0e55GsVjhJEgDqLKzHYAyP5kqWlavxFFVTByhoq4Kr82Tq0Onyp/VmUwpxBzaVnIUhw== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR08MB3585.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(366004)(396003)(346002)(39860400002)(136003)(376002)(450100002)(53546011)(44832011)(36756003)(16526019)(186003)(26005)(66946007)(66476007)(4326008)(66556008)(956004)(2616005)(5660300002)(8936002)(6666004)(2906002)(8676002)(478600001)(54906003)(83380400001)(316002)(6486002)(86362001)(52116002)(6916009)(6496006); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: IvJ1ZnvIRKmgg/IwEJbjm8UQ6BgSzS4do2mM7b+4gSKvvKmdIriss7D5rpF79RGnQKPUDJJk5sY1AHBhez4X4jSvX4fSDMXZ0lqBcc/ZAxUVMfFVRlkge4ocp+h62MpuoZom8NuCNIBYOuBVKSYjHdZZDh1bPfQrHtkbe6QBteXL016xl0BYYXY49UTbgh5NZZ4BpiXPUaIIHqpp0RtZUncXmwjkVeXXwbwVcTGRjRhEiCA2evFiLoU6XYYP8sgXvHxoF1DJgTWhrvp/1t9ncDGtrKq7zQLIUu5hH13VDIrfHTZef8akQiPHgmR/erzWz23QeCUt9ky/XTXzctYAMvfJzJOCKOuedVhwZ49jcgCgzUpc1+kxL6J57V743iC6ik62aQ9uOihkR+SQJ8DIHQ0to6JckLfNKizG9d7Dicws3xN7z81/o7lNPryj0FPnpnn6s2i6sGL8nPYRzU3hSYlOVX2W3azJauILJFteVXzWLMQf5g6w/wPodcNKP9JYbMNaMlUHCboEh/G69zcYC201YS/sPDRAiKA+R5bDUqvJCaFipMxDCD54+f42/Cr3L1hlPfU+ia/vRjpcGrAFuUADik8cic9hgmMI096RRzJkwO7hGHEYc2jVnzJFmX8/C4/80SKpbcF4KKIbgKr0yA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR08MB5652 Original-Authentication-Results: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT026.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 61645c6b-80a3-455a-1d5f-08d839dbfc8c X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FSBvL21BpHinGwhI0hWbSGuZPJLGDxwdJoS8Yfvttgo2262A0vKGsz8C0FNkzDWA3x/wpWP3ui8RyMWZvcny6QuwqqQIDEPFskWLTrA0NNWucuYVyP7/3qwwMd5HRK85HYi5GFQKTaGeWXqnL68oD4CEqv1/4ArCG8xuBOZkx2K7nLHLqI7rxUwQ0nuSAcDgxcvypRO9K2GgBOBJGjWofKtJIyMB351kQPaQxuGeaOf0bKyJNBhkxn64AOmW4l2sUde6rcgMLUZ+LM6UPUcvLhU32acii7MILENNfQnq+At5IaMk0sjhIJaL0WpNyCrhpk2Gqi9Oe3oEuiEQjWeKOK3tFfUY6ImuuuOp5QEchLJ+GKjhrxdhQSMo/FPVyUdrcC+SF/ZxrEVrsS2qkfgNCA== X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFTY:; SFS:(4636009)(376002)(346002)(136003)(39860400002)(396003)(46966005)(186003)(2616005)(16526019)(26005)(8676002)(83380400001)(82740400003)(81166007)(82310400002)(356005)(6486002)(956004)(47076004)(54906003)(53546011)(4326008)(6496006)(44832011)(8936002)(6666004)(70586007)(70206006)(6916009)(450100002)(316002)(336012)(5660300002)(2906002)(36756003)(478600001)(86362001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Aug 2020 07:40:34.7043 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9dcb960c-3f36-4807-1fc1-08d839dc011c X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: DB5EUR03FT026.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3944 X-Spam-Status: No, score=-15.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, MSGID_FROM_MTA_HEADER, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: jit@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Jit mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Aug 2020 07:40:40 -0000 Andrea Corallo writes: > Hi Alex, > > Looking at the code I believe all these casts are meant to be supported > (read your intuition was correct). > > Also IMO source of confusion is that the doc is mentioning 'int' and > 'float' but I believe would be better to have like 'integral' and > 'floating-point' to clearly disambiguates with respect to the C > types. > > AFAIU the set of supported casts should be like: > > integral <-> integral > floating-point <-> floating-point > integral <-> floating-point > integral <-> bool > P* <-> Q* for pointer types P and Q. > > I'd propose to install the following patch to make doc and comments > homogeneous at documenting what do we accept, and I guess we should just > consider bugs if some of these conversions is not handled correctly or > leads to ICE. > > Bests > > Andrea > > gcc/jit/ChangeLog > > 2020-07-21 Andrea Corallo > > * docs/_build/texinfo/libgccjit.texi (Type-coercion): Improve doc > on allowed type casting. > * docs/topics/expressions.rst (gccjit::context::new_cast) > (gcc_jit_context_new_cast): Likewise. > * libgccjit.c: Improve comment on allowed type casting. > * libgccjit.h: Likewise > > From 914b9e86808c947d4bb2b06c6960fd8031125f67 Mon Sep 17 00:00:00 2001 > From: Andrea Corallo > Date: Tue, 21 Jul 2020 20:12:23 +0200 > Subject: [PATCH] libgccjit: improve documentation on type conversions > > gcc/jit/ChangeLog > > 2020-07-21 Andrea Corallo > > * docs/_build/texinfo/libgccjit.texi (Type-coercion): Improve doc > on allowed type casting. > * docs/topics/expressions.rst (gccjit::context::new_cast) > (gcc_jit_context_new_cast): Likewise. > * libgccjit.c: Improve comment on allowed type casting. > * libgccjit.h: Likewise > --- > gcc/jit/docs/_build/texinfo/libgccjit.texi | 30 +++++++++++++++------- > gcc/jit/docs/topics/expressions.rst | 8 +++--- > gcc/jit/libgccjit.c | 8 +++--- > gcc/jit/libgccjit.h | 7 +++-- > 4 files changed, 36 insertions(+), 17 deletions(-) > > diff --git a/gcc/jit/docs/_build/texinfo/libgccjit.texi b/gcc/jit/docs/_build/texinfo/libgccjit.texi > index 1e14be010426..b170f24d1bb1 100644 > --- a/gcc/jit/docs/_build/texinfo/libgccjit.texi > +++ b/gcc/jit/docs/_build/texinfo/libgccjit.texi > @@ -6685,13 +6685,19 @@ Currently only a limited set of conversions are possible: > @itemize * > > @item > -int <-> float > +integral <-> integral > > @item > -int <-> bool > +floating-point <-> floating-point > > @item > -P* <-> Q*, for pointer types P and Q > +integral <-> floating-point > + > +@item > +integral <-> bool > + > +@item > +P* <-> Q* for pointer types P and Q > @end itemize > @end quotation > @end deffn > @@ -12964,14 +12970,20 @@ Currently only a limited set of conversions are possible: > > @itemize * > > -@item > -int <-> float > +@item > +integral <-> integral > > -@item > -int <-> bool > +@item > +floating-point <-> floating-point > > -@item > -P* <-> Q*, for pointer types P and Q > +@item > +integral <-> floating-point > + > +@item > +integral <-> bool > + > +@item > +P* <-> Q*, for pointer types P and Q > @end itemize > @end quotation > @end deffn > diff --git a/gcc/jit/docs/topics/expressions.rst b/gcc/jit/docs/topics/expressions.rst > index d783ceea51a8..051cee5db211 100644 > --- a/gcc/jit/docs/topics/expressions.rst > +++ b/gcc/jit/docs/topics/expressions.rst > @@ -504,9 +504,11 @@ Type-coercion > > Currently only a limited set of conversions are possible: > > - * int <-> float > - * int <-> bool > - * P* <-> Q*, for pointer types P and Q > + * integral <-> integral > + * floating-point <-> floating-point > + * integral <-> floating-point > + * integral <-> bool > + * P* <-> Q* for pointer types P and Q > > Lvalues > ------- > diff --git a/gcc/jit/libgccjit.c b/gcc/jit/libgccjit.c > index 3d04f6db3aff..403233d5577a 100644 > --- a/gcc/jit/libgccjit.c > +++ b/gcc/jit/libgccjit.c > @@ -1629,9 +1629,11 @@ gcc_jit_context_new_call_through_ptr (gcc_jit_context *ctxt, > > We only permit these kinds of cast: > > - int <-> float > - int <-> bool > - P* <-> Q* for pointer types P and Q. */ > + integral <-> integral > + floating-point <-> floating-point > + integral <-> floating-point > + integral <-> bool > + P* <-> Q* for pointer types P and Q. */ > > static bool > is_valid_cast (gcc::jit::recording::type *src_type, > diff --git a/gcc/jit/libgccjit.h b/gcc/jit/libgccjit.h > index 1c5a12e9c015..228befa896d7 100644 > --- a/gcc/jit/libgccjit.h > +++ b/gcc/jit/libgccjit.h > @@ -996,8 +996,11 @@ gcc_jit_context_new_call_through_ptr (gcc_jit_context *ctxt, > /* Type-coercion. > > Currently only a limited set of conversions are possible: > - int <-> float > - int <-> bool */ > + integral <-> integral > + floating-point <-> floating-point > + integral <-> floating-point > + integral <-> bool > + P* <-> Q* for pointer types P and Q. */ > extern gcc_jit_rvalue * > gcc_jit_context_new_cast (gcc_jit_context *ctxt, > gcc_jit_location *loc, Ping Thanks Andrea