From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by sourceware.org (Postfix) with ESMTPS id C9CF43853D6E for ; Fri, 18 Nov 2022 19:37:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C9CF43853D6E 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-pj1-x102c.google.com with SMTP id t17so4677045pjo.3 for ; Fri, 18 Nov 2022 11:37:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=6lkf+NTnkeG6AQfKWVc60nGBUKyIC9GevlionOy+B+M=; b=XIesg4w1VvfK18JWRDyjGaXcQSGguWpXNbTdXsBa/Y9u++O9+RuoVjxaK54RyzYB56 1baqrbPxUMs1mdo+O5AYpyLZsh7WiA+37Vm8D0B87NgvJrj27ZkpqGNdAFgfkI2oe+/X b6TluvLwLE1fH10uFJOOhNLQSlsT4MCBXRtOD07uB3DnE/CvO1W8XGMRARzdcK9AEhH6 ukR8Y3F/wQzxB+PRgZeaHnkRV/gvJukHGvxrf9D6H1sP8lxe+/f+VBidIVx1MZAbyjBd yzix/FKZHMjbzp4d3XkLc3t7bzy0Yc4eq3FMEUNB2TmIGFVlbXkcISw2ipoWsjx7yL4m ZNKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=6lkf+NTnkeG6AQfKWVc60nGBUKyIC9GevlionOy+B+M=; b=YJVTO7Luuzw2OSWYaJxpS4HQaJ9Su0FXeb9UKF+0jyq1Vl9n99RfQOLFltRgppwcU3 457DMK3bvFnhwNlvoQjyuZpHv7Z88LOoK/SOaa4/flbQCmY0ohKQ02iu/yze3ITZLfJI uXlAt8VHrGDqras0jwFWh5EVBJXxYdCX24sxv+/fMsZVgwtzBSRursxE8BiyB+2GVoLX wTAInkLbOdO4IlVCsIVD1aNxtCJ50RJ4yaDYuoGAifvu4LVvjz6kB9UAz6tvhuW+T75/ 8W0YMGeQtI4OkcNpit5OmrF3Sj5uQjM6nRl741oZmQ2w2blQ+Sp4tHhuRl2C6AdjAYBi jhQw== X-Gm-Message-State: ANoB5pmCfk/vRTTmdNAOzUbvnGAoRWjVHclpxqzoeKwMvkYP+Lu+3tCb A1p2nVYfgKdZLShgAoUhnEo= X-Google-Smtp-Source: AA0mqf7Ta50eLPufF4Jjp0qrve45athB+dZx22VDups7tX1EFNTSN4r//VqkKdG7y1bVWQixe3K0yw== X-Received: by 2002:a17:90b:4b89:b0:213:d2c:1923 with SMTP id lr9-20020a17090b4b8900b002130d2c1923mr15449388pjb.234.1668800268743; Fri, 18 Nov 2022 11:37:48 -0800 (PST) Received: from ?IPV6:2601:681:8600:13d0::f0a? ([2601:681:8600:13d0::f0a]) by smtp.gmail.com with ESMTPSA id n25-20020a63a519000000b0046ec057243asm3125519pgf.12.2022.11.18.11.37.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 18 Nov 2022 11:37:47 -0800 (PST) Message-ID: Date: Fri, 18 Nov 2022 12:37:45 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.1 Subject: Re: [PATCH] RISC-V: split to allow formation of sh[123]add before divw Content-Language: en-US To: Philipp Tomsich , gcc-patches@gcc.gnu.org Cc: Kito Cheng , Vineet Gupta , Palmer Dabbelt , Christoph Muellner , Jeff Law References: <20221108195617.2701379-1-philipp.tomsich@vrull.eu> From: Jeff Law In-Reply-To: <20221108195617.2701379-1-philipp.tomsich@vrull.eu> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.5 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,SPF_HELO_NONE,SPF_PASS,TXREP 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 11/8/22 12:56, Philipp Tomsich wrote: > When using strength-reduction, we will reduce a multiplication to a > sequence of shifts and adds. If this is performed with 32-bit types > and followed by a division, the lack of w-form sh[123]add will make > combination impossible and lead to a slli + addw being generated. > > Split the sequence with the knowledge that a w-form div will perform > implicit sign-extensions. > > gcc/ChangeLog: > > * config/riscv/bitmanip.md: Add a define_split to optimize > slliw + addiw + divw into sh[123]add + divw. > > gcc/testsuite/ChangeLog: > > * gcc.target/riscv/zba-shNadd-05.c: New test. OK.  I won't complain about the subregs on this one :-) jeff