From patchwork Tue Oct 31 18:35:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vineet Gupta X-Patchwork-Id: 160309 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b90f:0:b0:403:3b70:6f57 with SMTP id t15csp437706vqg; Tue, 31 Oct 2023 11:35:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHB+E12cLtepBGb+CUDHSplAwhjmeKeF1TWCZoR6GllSqgQQD58pifS9AzJVbvF8eJyj8XQ X-Received: by 2002:ac8:5c07:0:b0:412:395c:e794 with SMTP id i7-20020ac85c07000000b00412395ce794mr17419311qti.50.1698777334691; Tue, 31 Oct 2023 11:35:34 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1698777334; cv=pass; d=google.com; s=arc-20160816; b=hfTYqzcRgkBTvE7LHnOPAwcjRDzrCDAAl6xEc1YGphoVvKc0mWVEeeVYmxza7Xs6Dm YXBYjp8Wn216jAwknJKIbNHdzqK45hy99R79HHP/TcqfpRBjimE04kiNg3kyM9+a5osT b/f26Br7tSx1jjnUnasjVE3F9iOlHVTEdkeNBgKMkgBkIUKjjF27SJxiSDUeVQ0c/vVJ 1A9yS6xkELPST7wL2lJ1UhiwKSbeccKs9kgHBl8Ws0wyBgfiuZmat3nUxcL3nIOIm3PC uUBjPNvgD7uV+rxDI0HHTCL6lT8R4TqBVhIRwq4T51OUS42Eknl9zMN9DyyQ2xRpGZJf 6Rpw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=nckNZrdAD+VIw0/AYspCiwtZC156CWQwwMeCAQ/VWKI=; fh=viazKkcHi6DoYbA2Nlz5k3jWdn5ZGzo/0R9UcRXACb8=; b=tPnCj5TPip0lFIty2WgctX21Wd061gM7YoExLT58WzDeYNLrSI27s9xPjjb6/Te1hn EYUSu/7ZfjWZpWB3tIIVGnahsRe9wc4QFR6FM8qpbFMZJW2cd3IcdxJbgF4jJWT++w/t 64vhcivgC3D7YrOEJclYMSTDYgP0OK1k3U1PmGK9B3y68dhr1zy9bNhIp4pabyTZNyDU hw3R4H17Qm3Mgi5FuY5A9e2GqYDIqZA4F0beTLkB4karAu2qz33QmaX6R8TSwIQCMq29 NqEw9OixxemsPLsvZtf7tHJnfOPJXWzVZiDHY414Q6j5CXofL0UMfC2g3ZKf1Dq9RdYI oKrQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b="1JR/hQjq"; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id s2-20020a05622a1a8200b0041814373040si1621071qtc.49.2023.10.31.11.35.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 11:35:34 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b="1JR/hQjq"; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 52B223858031 for ; Tue, 31 Oct 2023 18:35:34 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ot1-x32a.google.com (mail-ot1-x32a.google.com [IPv6:2607:f8b0:4864:20::32a]) by sourceware.org (Postfix) with ESMTPS id B4D793858418 for ; Tue, 31 Oct 2023 18:35:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B4D793858418 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rivosinc.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B4D793858418 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::32a ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698777311; cv=none; b=Wo3t1W+uyEmVjJix6kyufSq22rQfNIwN4lZGa/IZFfLlgYF40sxyNExT5GkWR5lb+AzvAEStHIzyseZp3cl/U8D8eFkNYjZAZOzWeYEwEfz/GtRgBM1kquglk/Eb1XnhXZ0VqNef/dgvlIPP4uGDdn+YBzLlaaVspvp1A+9vGSI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698777311; c=relaxed/simple; bh=sObq2CvaWA3tvQYlLLskGRy/lnPX//Og03krtOMnYHE=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=TihgjHwfyVMM1xe9Q7wlTzW+Z2IrbnnYL5QT+hTrh0D1f5vhtVjwqngorpC51cf9aKXeoZsEFxZV18OoBlMXgQEErMDFFqJXxuaZG8PEkB5iDsQZ5VeQqiHjzJlsbDIBPGI7+MkgupB0eISILxYA2842ef7WX/GMnVZSYZX5a6U= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ot1-x32a.google.com with SMTP id 46e09a7af769-6ce2c5b2154so3892797a34.3 for ; Tue, 31 Oct 2023 11:35:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1698777309; x=1699382109; 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=nckNZrdAD+VIw0/AYspCiwtZC156CWQwwMeCAQ/VWKI=; b=1JR/hQjq184kL9wiocxEKLIk+epVKTwnuM+QI+jDhQNRD17QhoP2gAnzwuYSk7UC8s OLgYfzka7ahIU/v/CPFnfFz6fgGqyFLtowgwynyz/9KZd5YYi7WeIWKcK5j3oRCFvpbq NG1mM9zx8lPtHDMnMb/SYjZs2Fgve1esEEdI61GOfjDkhJtnp1lc5rkepshk9A0ZF1lW a5xzOIBWzXIZrD8TLmEERkp5MDsLEIrEMLaecveTFTY5m2PV5w8HnNhcWFos8dcjTrCS 6czukR1ojbpr9ziMyo/UCmSJEw4/rWgBwBJXPuY4qZrdIahQBfeAmUPwAZMr3CXBdUEW 6Wsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698777309; x=1699382109; 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=nckNZrdAD+VIw0/AYspCiwtZC156CWQwwMeCAQ/VWKI=; b=sN0yTl8O0Y91985ufuxmiNhPLI5/1eoteEW4E7xErYd3sdESlJzeLASnajgycm5BSD 0vfG5q57B5w0vdrQ3qFCLTWO/c7BqRihdnXzxbESnHX0s/a6452NsO6N13Y1lzHfw6hk Iwrl7mr+APnlXNy46YmyWUjWTkMuyVRcFaDRDgO99vjIb5BoRXaSACpBlXqlOOhGkKLp 1hl6R2uZT0dA0LroiE9ML7WI68X2oHYAKzMobWjqouzS0Sikf+5CCsCWV7Zy+BKHhL0G Iu4tQu+54Hl5afhKh8gdPEXmJ2IoHHbHvPnesj940f1Q0+shOw3Kl/W+PTboWAVMEDvA Nh7A== X-Gm-Message-State: AOJu0YxrTZHFFh9FNX6FbWMkIAnNLh4X6U2r/WwkvGk3V92+anxXNPXx W59lWcwKP0ckcSsxF3cS+DRSrUZmPfSdDbHQMs3egA== X-Received: by 2002:a9d:7c8b:0:b0:6be:fdab:dc65 with SMTP id q11-20020a9d7c8b000000b006befdabdc65mr15035559otn.19.1698777308857; Tue, 31 Oct 2023 11:35:08 -0700 (PDT) Received: from vineet-framework.hq.rivosinc.com ([12.44.203.122]) by smtp.gmail.com with ESMTPSA id j9-20020a056830270900b006ce33dc3004sm311109otu.49.2023.10.31.11.35.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 11:35:08 -0700 (PDT) From: Vineet Gupta To: gcc-patches@gcc.gnu.org Cc: gnu-toolchain@rivosinc.com, Jeff Law , Vineet Gupta Subject: [PATCH] RISC-V: fix TARGET_PROMOTE_FUNCTION_MODE hook for libcalls Date: Tue, 31 Oct 2023 11:35:04 -0700 Message-Id: <20231031183504.832611-1-vineetg@rivosinc.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 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, T_SCC_BODY_TEXT_LINE, URIBL_BLACK autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781297142072050497 X-GMAIL-MSGID: 1781297142072050497 riscv_promote_function_mode doesn't promote a SI to DI for libcalls case. The fix is what generic promote_mode () in explow.cc does. I really don't understand why the old code didn't work, but stepping thru the debugger shows old code didn't and fixed does. This showed up when testing Ajit's REE ABI extension series which probes the ABI (using a NULL tree type) and ends up hitting the libcall code path. [Usual caveat, I'll wait for Pre-commit CI to run the tests and report] gcc/ChangeLog: * config/riscv/riscv.cc (riscv_promote_function_mode): Fix mode returned for libcall case. Signed-off-by: Vineet Gupta Tested-by: Patrick O'Neill --- gcc/config/riscv/riscv.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc index 3e27897d6d30..7b8e9af0a5af 100644 --- a/gcc/config/riscv/riscv.cc +++ b/gcc/config/riscv/riscv.cc @@ -8630,9 +8630,10 @@ riscv_promote_function_mode (const_tree type ATTRIBUTE_UNUSED, return promote_mode (type, mode, punsignedp); unsignedp = *punsignedp; - PROMOTE_MODE (as_a (mode), unsignedp, type); + scalar_mode smode = as_a (mode); + PROMOTE_MODE (smode, unsignedp, type); *punsignedp = unsignedp; - return mode; + return smode; } /* Implement TARGET_MACHINE_DEPENDENT_REORG. */