From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) by sourceware.org (Postfix) with ESMTPS id B29253858426 for ; Fri, 6 Oct 2023 18:22:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B29253858426 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rivosinc.com Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-690d2441b95so1921683b3a.1 for ; Fri, 06 Oct 2023 11:22:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1696616577; x=1697221377; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=0YUXM9VS1suPvvmtYOaJXxav8f5UNRaWanyjMSmJ4cQ=; b=imWesKzfrvBAsNdeb6CZiOXEH/3JT22LaVevHo3bbu0UEmTX0megPdx+ReWFzGkEKI IKAowCL4euz8Hs0kJyRuklGK/c3VdZOzjgKPOYhMLObxceW0Ddcc9xjB3SnVBmeosSAU 6SYKa4rXOrMFXhTcxYWPpYtpDsi4myp9f9bcVnY5OA7Id2RGZBtxDbHsgX7IX20TeMaj lIcOjRX7aHT2aBXre8N+7QSjhMjLv5AyQtsDRT5SnbBZYamv7AuTsOpVxFiAsAHCC8Ta Y55esckWxRqj6JjDZbdkLHUiqYyw0E9KiLBOCHgtOrI6RHT9l8dgv10nYIML+FC84piM E45Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696616577; x=1697221377; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=0YUXM9VS1suPvvmtYOaJXxav8f5UNRaWanyjMSmJ4cQ=; b=qdNsc8M5ABz/2oLS4zTFv1w5STQyx5uRQZEfGvgV7ZfY1IhJOK0gatNBAMg8PbwVoW 53E7++CYK+nfnVSwaW0Rsr0fwdbxWBXfyNqhtI+wKOYU3h82UiTsQ7jLQtAt4DbXRrV8 yNZllNu/HUhKuWg2w0LJb9lwcG2a0rKW7L70L70uRf/588z1VPwl2uoN+hRGSQfghe6R rmByTdrP5fVjXZjMLETR1jcKrPjel3Lwwi/D223/akaraGGmBSiit/dFdRUwuY+po1tY J3QxwnaH5mLxa9amPq7PLRhAghKEj8P6TxAmnBbFfkyu9PsZ6QteOd7UAXoOKk5Kn3BV 9TCQ== X-Gm-Message-State: AOJu0Yy4oXc+6qb9UkPt6bzVrf4WIGth9492EM7mOCmqUlMNurstFKqO tsbqeKgNTiFUhpZpu6KzcGtxUiyFODhdBhgYQLY= X-Google-Smtp-Source: AGHT+IGS7ZSqETSsWp5jfHuRjn2kUkGNv8v22crAMQNBLs1hQjF28GIn+XRABQTs1zeiPVdpeRbPqA== X-Received: by 2002:a05:6a00:2d98:b0:68e:3616:604a with SMTP id fb24-20020a056a002d9800b0068e3616604amr8895117pfb.8.1696616577381; Fri, 06 Oct 2023 11:22:57 -0700 (PDT) Received: from vineet-framework.ba.rivosinc.com (c-98-210-197-24.hsd1.ca.comcast.net. [98.210.197.24]) by smtp.gmail.com with ESMTPSA id x20-20020a62fb14000000b006889081281bsm1784293pfm.138.2023.10.06.11.22.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Oct 2023 11:22:57 -0700 (PDT) From: Vineet Gupta To: gcc-patches@gcc.gnu.org Cc: kito.cheng@gmail.com, Jeff Law , Palmer Dabbelt , gnu-toolchain@rivosinc.com, Vineet Gupta Subject: [COMMITTED] RISC-V: const: hide mvconst splitter from IRA Date: Fri, 6 Oct 2023 11:22:50 -0700 Message-Id: <20231006182250.393162-1-vineetg@rivosinc.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-10.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,GIT_PATCH_0,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: Vlad recently introduced a new gate @ira_in_progress, similar to counterparts @{reload,lra}_in_progress. Use this to hide the constant synthesis splitter from being recog* () by IRA register equivalence logic which is eager to undo the splits, generating worse code for constants (and sometimes no code at all). See PR/109279 (large constant), PR/110748 (const -0.0) ... Granted the IRA logic is subsided with -fsched-pressure which is now enabled for RISC-V backend, the gate makes this future-proof in addition to helping with -O1 etc. This fixes 1 addition test ========= Summary of gcc testsuite ========= | # of unexpected case / # of unique unexpected case | gcc | g++ | gfortran | rv32imac/ ilp32/ medlow | 416 / 103 | 13 / 6 | 67 / 12 | rv32imafdc/ ilp32d/ medlow | 416 / 103 | 13 / 6 | 24 / 4 | rv64imac/ lp64/ medlow | 417 / 104 | 9 / 3 | 67 / 12 | rv64imafdc/ lp64d/ medlow | 416 / 103 | 5 / 2 | 6 / 1 | Also similar to v1, this doesn't move RISC-V SPEC scores at all. gcc/ChangeLog: * config/riscv/riscv.md (mvconst_internal): Add !ira_in_progress. Suggested-by: Jeff Law Signed-off-by: Vineet Gupta --- gcc/config/riscv/riscv.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/gcc/config/riscv/riscv.md b/gcc/config/riscv/riscv.md index 1ebe8f92284d..da84b9357bd3 100644 --- a/gcc/config/riscv/riscv.md +++ b/gcc/config/riscv/riscv.md @@ -1997,13 +1997,16 @@ ;; Pretend to have the ability to load complex const_int in order to get ;; better code generation around them. -;; ;; But avoid constants that are special cased elsewhere. +;; +;; Hide it from IRA register equiv recog* () to elide potential undoing of split +;; (define_insn_and_split "*mvconst_internal" [(set (match_operand:GPR 0 "register_operand" "=r") (match_operand:GPR 1 "splittable_const_int_operand" "i"))] - "!(p2m1_shift_operand (operands[1], mode) - || high_mask_shift_operand (operands[1], mode))" + "!ira_in_progress + && !(p2m1_shift_operand (operands[1], mode) + || high_mask_shift_operand (operands[1], mode))" "#" "&& 1" [(const_int 0)] -- 2.34.1