From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by sourceware.org (Postfix) with ESMTPS id C2C4F3854558 for ; Mon, 28 Nov 2022 15:38:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C2C4F3854558 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embecosm.com Received: by mail-wr1-x434.google.com with SMTP id b12so17502181wrn.2 for ; Mon, 28 Nov 2022 07:38:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=content-transfer-encoding:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to; bh=6Q2UQbMcMgMHcrI0vfpxpsKTYH6USY9fJhbGH+0DivM=; b=UBMB01XG0vtQXtUfEOl+Q6Q8TIFVl7j2uxILN4dUfnFScgbl5nzbivtV33iLaaNe08 lXj0gUr8O4YggZ1eNM8g5sH/SxJTaUQF5cd+2eaw6z8tt1GMTyMJM0iCdtmIaDYjlMaJ PDUY2ybteE5yiXF3qPxdlz3bemaO60yMQK0CkJYef5GDCp90ftmU0ETaABXT8pdHuMg3 O2Qa+bcHeAfbJBhQ80IUl7qToCCUMRhlVQmaGGxkx7EfaRinZN8SGSC2Kng5fKIfegJp YaFmgqras9dg6dHQ9QakDfs9EWL2eWu14EohCMg+3KOgamhtRUYtNRtpXzFdHJz+Tb0E +amg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=6Q2UQbMcMgMHcrI0vfpxpsKTYH6USY9fJhbGH+0DivM=; b=ZE+mKKd1W4RB1+pzzbG6u/eMMZykX23HA8Py9SMrln53MZT5SeXMFlvH8Eu6vNDwPm uaiEaKbXtOSDYBdtxle5zFBHdVgtK7HJZtDqgrnXjK4AAmmpkwnvWGTYbXrQCvZOXcXu LRoNaey5c8VefLux4vwJ0oOFzz540dqS5XFXSfrGadLLmV5o4dd3tQ0+EuzOZXotheAa TN9gM0hYsHQ2sDFdhQ8d0aVEYnJkciFMnUEyvdVGiktomDz8M1ucgSA3szgz0V0JAhkj Yrl+9/9k1MFYhvJb9JzDnWCtJSqFq3SKvSTGA1sGGmqRFkWQuEJggnuwd/boZ1Q32iAl bc0Q== X-Gm-Message-State: ANoB5pmmyO02OmieCXltKjgsvnbsuE+e85X1+PPf3OKermSpKOAJH+9h jbvZlEBX5jrieAiUnC15TMh7TA== X-Google-Smtp-Source: AA0mqf4KY5ep/CtrYlrcGyigJDTFxLyBv+KMyXYSQzWfQmbLJtSREaFFK7ejMFG0nKROtS7JfyBjEA== X-Received: by 2002:adf:e64b:0:b0:242:165e:a034 with SMTP id b11-20020adfe64b000000b00242165ea034mr4021633wrn.614.1669649927621; Mon, 28 Nov 2022 07:38:47 -0800 (PST) Received: from [192.168.0.201] ([212.69.42.53]) by smtp.gmail.com with ESMTPSA id t6-20020adfeb86000000b00241e5b917d0sm13085100wrn.36.2022.11.28.07.38.46 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 Nov 2022 07:38:47 -0800 (PST) Date: Mon, 28 Nov 2022 15:38:40 +0000 (GMT) From: "Maciej W. Rozycki" To: Jeff Law cc: Kito Cheng , GCC Patches , Andrew Waterman Subject: Re: [PING][PATCH] RISC-V: Avoid redundant sign-extension for SImode SGE, SGEU, SLE, SLEU In-Reply-To: <904539a8-00ca-851c-b893-d6684d58df73@gmail.com> Message-ID: References: <904539a8-00ca-851c-b893-d6684d58df73@gmail.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_SHORT,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 Mon, 28 Nov 2022, Jeff Law wrote: > > > > LGTM, but with a nit, I don't get set.w but get an andi like below, so > > > > maybe we should also scan-assembler-not andi? feel free to commit that > > > > directly with that fix > > > > > > > > ```asm > > > > sleu: > > > > sgtu a0,a0,a1 # 9 [c=4 l=4] *sgtu_disi > > > > xori a0,a0,1 # 10 [c=4 l=4] *xorsi3_internal/1 > > > > andi a0,a0,1 # 16 [c=4 l=4] anddi3/1 > > > > ret # 25 [c=0 l=4] simple_return > > > > ``` > > > Interesting. I can do that, but can you please share the compilation > > > options, given or defaulted (from `--with...' configuration options), this > > > happens with? > > I have noticed it went nowhere. Can you please check what compilation > > options lead to this discrepancy so that we can have the fix included in > > GCC 13? I'd like to understand what's going on here. > > FWIW, I don't see the redundant sign extension with this testcase at -O2 on > the trunk.  Is it possible the patch has been made redundant over the last few > months? Maybe at -O2, but the test cases continue to fail in my configuration for other optimisation levels: FAIL: gcc.target/riscv/sge.c -O1 scan-assembler-not sext\\.w FAIL: gcc.target/riscv/sge.c -Og -g scan-assembler-not sext\\.w FAIL: gcc.target/riscv/sgeu.c -O1 scan-assembler-not sext\\.w FAIL: gcc.target/riscv/sgeu.c -Og -g scan-assembler-not sext\\.w FAIL: gcc.target/riscv/sle.c -O1 scan-assembler-not sext\\.w FAIL: gcc.target/riscv/sle.c -Og -g scan-assembler-not sext\\.w FAIL: gcc.target/riscv/sleu.c -O1 scan-assembler-not sext\\.w FAIL: gcc.target/riscv/sleu.c -Og -g scan-assembler-not sext\\.w when applied on top of: $ riscv64-linux-gnu-gcc --version riscv64-linux-gnu-gcc (GCC) 13.0.0 20221128 (experimental) Not anymore with the whole patch applied. Does it make sense to bisect the change that removed the pessimisation at -O2 to understand what is going on here? I think my change is worthwhile anyway: why to rely on the optimiser to get things sorted while we can produce the best code in the backend right away in the first place? Maciej