From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qk1-x729.google.com (mail-qk1-x729.google.com [IPv6:2607:f8b0:4864:20::729]) by sourceware.org (Postfix) with ESMTPS id A82683858D28; Thu, 28 Dec 2023 18:27:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A82683858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A82683858D28 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::729 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703788026; cv=none; b=l6VE8EgbslN73MXXJlugHzuny5poeuU9dR9XMB7qzRv2tlkLo9WnogbG/GlW0yZQe1ow0bpuPrFYIsyKoBUU/ZQvkHRFgm2X2JDci3TY/CDCR/6vinn1fiwWOEkIEZvHRLUClGGSsnP3dB2JJQGYjZvMg7ntU0ecuuSyV+30G6I= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703788026; c=relaxed/simple; bh=5ljlSCwSQqZdqDFJX8QeyOypGePbBNHxevq47+qkX74=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=ip+bmuaLlYZhmxRMhPB7Er4rQhsp5lKuYFxeFvHv9DCXH3h81dl8FAIjy7nJUGWGHfYxaWFPftE88LstdesX6QXlMDoqOs6/WSWwaa7LRaEmQjIydBBIhoPc280/uJog/kKjFdcz933r4Zuuom5ZxtDIvE8ONvvX92eQDYuFeaY= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-qk1-x729.google.com with SMTP id af79cd13be357-7810c332a2cso524845985a.1; Thu, 28 Dec 2023 10:27:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703788024; x=1704392824; darn=gcc.gnu.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=SHve5s79yMIQDTBZMTDH7d1vis6DIT8PxAODeaqQX6I=; b=R0GZ0Z6wVjC2EEncGzZSOOtSq3adPukkOlbXwiyMdulJflkU6eGB2Ein0DBrXnBk3w EQjuk2Zbwo/gW7NugIzNjkZdaVNoSdE6VPEwnMbfozni9kQ5WnBs2sT0P7IB6+zz3w7V JnhyxBfUj9mvvBMsFGDyouf8ssHKzwTdJ2KjnWDTJ3Q8rCg3/fSQpPrPru/Rk8LU5pJs NhqHDZ4vnUOrOpLR+LOF9wdrGO1uKQ1/nxJVNOTZbri1T3JLShMtL/KqPFPJwnvlDJJV 50OAPqa/6/FodQbfywDDbW28VhBqBiPYCDCU58A9rY80y8TwcfSSefs86FdlqZXxuAos N6rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703788024; x=1704392824; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=SHve5s79yMIQDTBZMTDH7d1vis6DIT8PxAODeaqQX6I=; b=SLDtu9+GNGglG+MYRyUbFBvwdyIcowRIFeQrXF6TyBZex175+9h9MsBwWzmegsx7DZ LJelpg6VC714AsxCKfqcrpDVgGh1K7ZZMvM8FBUQBIIAgij3KlhFkrOz0JXTwrvokjwj uxJBH5GSmUxJSe7yLwR8GGlQT3Zu3//gyTFuP3KOA0XT2mUfvl5tO3Q/VRJ/qii/0QtY yXLFW0E8H2NgwP8nxa6b/zDRNb5OY90IZfECiggRvi+Wpkc2hyXUM7LKp2H1IY2gPeTz fLAjDlS5uCXgNoGh7J05RFQltqpTNt3xhhodEI+MPSdRFQ6o5A1a3df6K1VJ6LOQYWXP 2Jig== X-Gm-Message-State: AOJu0Yz2enDWGLPl+J2BgvDFQk6/FnCbmm/iOLeOm8eD6FbLRop9/MLB Z0X15JsfhijtDYbfLat3Is0= X-Google-Smtp-Source: AGHT+IFNkpO5GvcPgw1ysiGad5rwa8THz8QQQunmURggutbqygm8MJTJp9dXHDCJCsdMFeR6QVWmOw== X-Received: by 2002:a0c:fe8b:0:b0:67f:9d77:e32e with SMTP id d11-20020a0cfe8b000000b0067f9d77e32emr11708708qvs.61.1703788023885; Thu, 28 Dec 2023 10:27:03 -0800 (PST) Received: from ?IPV6:2607:fb91:1dfa:8702:b88c:e239:7328:301b? ([2607:fb91:1dfa:8702:b88c:e239:7328:301b]) by smtp.gmail.com with ESMTPSA id d9-20020a0cf6c9000000b0067f8f04a2fcsm5878587qvo.57.2023.12.28.10.27.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 28 Dec 2023 10:27:03 -0800 (PST) Message-ID: <3718e844-df6d-451b-bded-08e10d318b5f@gmail.com> Date: Thu, 28 Dec 2023 11:26:59 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3] EXPR: Emit an truncate if 31+ bits polluted for SImode Content-Language: en-US To: Roger Sayle , 'YunQiang Su' Cc: gcc-patches@gcc.gnu.org References: <000901da3603$10e97cb0$32bc7610$@nextmovesoftware.com> <7518ec8d-ac4a-4d3e-a063-caa0ee520acf@gmail.com> <000f01da3646$57092a40$051b7ec0$@nextmovesoftware.com> <002201da3664$364d0e20$a2e72a60$@nextmovesoftware.com> From: Jeff Law In-Reply-To: <002201da3664$364d0e20$a2e72a60$@nextmovesoftware.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 12/24/23 05:24, Roger Sayle wrote: > >>>> What's exceedingly weird is T_N_T_M_P (DImode, SImode) isn't >>>> actually a truncation! The output precision is first, the input >>>> precision is second. The docs explicitly state the output precision >>>> should be smaller than the input precision (which makes sense for truncation). >>>> >>>> That's where I'd start with trying to untangle this mess. >>> >>> Thanks (both) for correcting my misunderstanding. >>> At the very least might I suggest that we introduce a new >>> TRULY_NOOP_EXTENSION_MODES_P target hook that MIPS can use for this >>> purpose? It'd help reduce confusion, and keep the >>> documentation/function naming correct. >>> >> >> Yes. It is good for me. >> T_N_T_M_P is a really confusion naming. > > Ignore my suggestion for a new target hook. GCC already has one. > You shouldn't be using TRULY_NOOP_TRUNCATION_MODES_P > with incorrectly ordered arguments. The correct target hook is > TARGET_MODE_REP_EXTENDED, which the MIPS backend correctly > defines via mips_mode_rep_extended. > > It's MIPS definition of (and interpretation of) mips_truly_noop_truncation > that's suspect. > > My latest theory is that these sign extensions should be: > (set (reg:DI) (sign_extend:DI (truncate:SI (reg:DI)))) > and not > (set (reg:DI) (sign_extend:DI (subreg:SI (reg:DI)))) In isolation these are the same. I think the fact that the MIPS backend wipes out the sign extension turning the result into a NOP is what makes them different. Of course that's kind of the point behind the TRULY_NOOP_TRUNCATION macro. That's what allows the MIPS target to wipe out the sign extension. ISTM this might be worth noting in the docs for TRULY_NOOP_TRUNCATION. Jeff