From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gateway24.websitewelcome.com (gateway24.websitewelcome.com [192.185.51.31]) by sourceware.org (Postfix) with ESMTPS id 95FA0385DC33 for ; Sat, 20 Feb 2021 18:20:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 95FA0385DC33 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=tom@tromey.com Received: from cm16.websitewelcome.com (cm16.websitewelcome.com [100.42.49.19]) by gateway24.websitewelcome.com (Postfix) with ESMTP id 0155F3E3E for ; Sat, 20 Feb 2021 12:20:37 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id DWrslcBzgHPnUDWrsl31ux; Sat, 20 Feb 2021 12:20:36 -0600 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=PTrNf2cxu/vMWGh553L3uWMun+t/W4AeXWoK11Xonj0=; b=lmsiynoWt1R7BsCXXu+H5xLMji houlOmF0aJID0ML/hd3diDf5HistfWgS0fhWQj4Qqrr425OjuufRwbjEwWpRzwSqWCnT/e2oMM48g RUBnPRRe35okFj+a+ikfbWqGP; Received: from 97-122-70-152.hlrn.qwest.net ([97.122.70.152]:45780 helo=localhost.localdomain) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1lDWrs-0031Bc-JS; Sat, 20 Feb 2021 11:20:36 -0700 From: Tom Tromey To: Antoni Boucher via Gcc-patches Cc: jit@gcc.gnu.org, Antoni Boucher Subject: Re: [PATCH] libgccjit: Handle truncation and extension for casts [PR 95498] References: <20200713003002.bs5hwv4gav6ml5rt@bouanto-laptop.localdomain> X-Attribution: Tom Date: Sat, 20 Feb 2021 11:20:35 -0700 In-Reply-To: <20200713003002.bs5hwv4gav6ml5rt@bouanto-laptop.localdomain> (Antoni Boucher via Gcc-patches's message of "Sun, 12 Jul 2020 20:30:02 -0400") Message-ID: <874ki6txcc.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - gcc.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 97.122.70.152 X-Source-L: No X-Exim-ID: 1lDWrs-0031Bc-JS X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-70-152.hlrn.qwest.net (localhost.localdomain) [97.122.70.152]:45780 X-Source-Auth: tom+tromey.com X-Email-Count: 2 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Status: No, score=-3028.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, JMQ_SPF_NEUTRAL, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_NEUTRAL, TXREP autolearn=no 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: Sat, 20 Feb 2021 18:20:40 -0000 >>>>> "Antoni" == Antoni Boucher via Gcc-patches writes: Antoni> gcc/jit/ Antoni> PR target/95498 Antoni> * jit-playback.c: Add support to handle truncation and extension Antoni> in the convert function. Antoni> + switch (dst_code) Antoni> + { Antoni> + case INTEGER_TYPE: Antoni> + case ENUMERAL_TYPE: Antoni> + t_ret = convert_to_integer (dst_type, expr); Antoni> + goto maybe_fold; Antoni> + Antoni> + default: Antoni> + gcc_assert (gcc::jit::active_playback_ctxt); Antoni> + gcc::jit::active_playback_ctxt->add_error (NULL, "unhandled conversion"); Antoni> + fprintf (stderr, "input expression:\n"); Antoni> + debug_tree (expr); Antoni> + fprintf (stderr, "requested type:\n"); Antoni> + debug_tree (dst_type); Antoni> + return error_mark_node; Antoni> + Antoni> + maybe_fold: Antoni> + if (TREE_CODE (t_ret) != C_MAYBE_CONST_EXPR) Antoni> + t_ret = fold (t_ret); Antoni> + return t_ret; It seems weird to have a single 'goto' to maybe_fold, especially inside a switch like this. If you think the maybe_fold code won't be reused, then it should just be hoisted up and the 'goto' removed. On the other hand, if the maybe_fold code might be reused for some other case, then I suppose I would have the case end with 'break' and then have this code outside the switch. In another message, you wrote: Antoni> For your question, the current code already works with boolean and Antoni> reals and casts between integers and pointers is currently not Antoni> supported. I am curious why this wasn't supported. It seems like something that one might want to do. thanks, Tom