From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by sourceware.org (Postfix) with ESMTPS id C2F5C3858D3C for ; Fri, 9 Jun 2023 15:11:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C2F5C3858D3C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-655fce0f354so1556696b3a.0 for ; Fri, 09 Jun 2023 08:11:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686323464; x=1688915464; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=2uaFPdLeseqAyorjqax3+9XoXyI74fPczSAw6lm3dKo=; b=ftMPxKH0b7Vah5OyYIL+P0oSTYlW8tnRbcPF7IrIEsCukkRIuPisgSROlwgt4Z49fH 4A0LN9XbjKGnIeEj9VnqaCoT246zyVY+Ao50iEmoORIhX5l0DPtKivsHhK3CZaoeEfiD 9HsvT2vAsT91+HIUS9M/ddyZ3YFEncjduS1cJrzMKJPVfGq+6n5UFVc/xzHZX/+CBP9v pasnpLpSBZhfvRgDQHXIPYflVlmg1euCgzaftSgVG7HDcBhK8rXL+ChU1bbjcOX2xel4 ewjR5r6asMzUa/cmed3rMnow/qs7yC1TLiEcBMWaw6RUPtDfIpb2nw5nzMoM614E6WeJ qo7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686323464; x=1688915464; h=content-transfer-encoding:in-reply-to:from:references: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=2uaFPdLeseqAyorjqax3+9XoXyI74fPczSAw6lm3dKo=; b=gG3ga/+bZwrBbdQBKFlLg+7ZxpE3cOMT0xmZXBMPsXFwMsrr4FQs8xxYX660R9S1UB y6Xzl4s8IuVi2EG1SBlaC/O+W/1xzOvHrokWKLdKi9TwEgh8eStJ1iuGGYDZQYfgezE8 PJRGXGS2Wx9myXg+wJ2KmrTZAREhSS7O2tl3x+H4woCtBjvYxvrEijxdKI0Hv7eSo4Rr 45F6W2VpnCoskcYOT18R3BpMgNNbZx6dZ/lIbcT+V9PWG4nmnTP4BJUsVCKjbg0aje2T +xNr6LPilYs3bfXF7TU03SHxXczjE2SJA3abUyKGBtk2glKLlrtSbxNkXFBEVpMAUeQW xGrg== X-Gm-Message-State: AC+VfDzK271usZAKfCiQ2xRA4l5/MP+PjrHlcKI/cvsAkp8AXseL9e5W ioeejq1EXZd8tIf3FD6F2JNorljc2kQ= X-Google-Smtp-Source: ACHHUZ4yFZrrfUqbyPdP27YBdJC+ln3phJP+PkQmXv/cLptD10i7G0dA1zhRMZ5D/m9QNJ0jIIhWbQ== X-Received: by 2002:a05:6a20:7485:b0:10c:6:61d1 with SMTP id p5-20020a056a20748500b0010c000661d1mr1123358pzd.39.1686323463663; Fri, 09 Jun 2023 08:11:03 -0700 (PDT) Received: from [172.31.0.109] ([136.36.130.248]) by smtp.gmail.com with ESMTPSA id h21-20020a631215000000b0052858b41008sm3020676pgl.87.2023.06.09.08.11.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 09 Jun 2023 08:11:03 -0700 (PDT) Message-ID: Date: Fri, 9 Jun 2023 09:11:02 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.1 Subject: Re: [PATCH] simplify-rtx: Implement constant folding of SS_TRUNCATE, US_TRUNCATE Content-Language: en-US To: Kyrylo Tkachov , "gcc-patches@gcc.gnu.org" References: From: Jeff Law In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,KAM_SHORT,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SCC_BODY_URI_ONLY,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no 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 6/8/23 08:56, Kyrylo Tkachov via Gcc-patches wrote: > Hi all, > > This patch implements RTL constant-folding for the SS_TRUNCATE and US_TRUNCATE codes. > The semantics are a clamping operation on the argument with the min and max of the narrow mode, > followed by a truncation. The signedness of the clamp and the min/max extrema is derived from > the signedness of the saturating operation. > > We have a number of instructions in aarch64 that use SS_TRUNCATE and US_TRUNCATE to represent > their operations and we have pretty thorough runtime tests in gcc.target/aarch64/advsimd-intrinsics/vqmovn*.c. > With this patch the instructions are folded away at optimisation levels and the correctness checks still > pass. > > Bootstrapped and tested on aarch64-none-linux-gnu and aarch64_be-none-elf. > Ok for trunk? > > Thanks, > Kyrill > > gcc/ChangeLog: > > * simplify-rtx.cc (simplify_const_unary_operation): > Handle US_TRUNCATE, SS_TRUNCATE. OK. jeff