From patchwork Thu Jul 21 19:03:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Palmer Dabbelt X-Patchwork-Id: 56236 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D89263838A8F for ; Thu, 21 Jul 2022 19:08:10 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by sourceware.org (Postfix) with ESMTPS id E66083838F0B for ; Thu, 21 Jul 2022 19:07:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E66083838F0B 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-pl1-x629.google.com with SMTP id c6so2702255pla.6 for ; Thu, 21 Jul 2022 12:07:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; h=subject:date:message-id:mime-version:content-transfer-encoding:cc :from:to; bh=uNjpnHXlyNVarhuwVNsVzkf9J79fhbEEpRIntl61cS4=; b=479851b72QPifiY9L28/8VPOZaM8AjSqe3g4yMpSHSOXeYm52eg7TZZN0HVl1YwbR1 mlKFH1+26Upj4ybGbDU8IxsFVfjOL11ayb9VaS2KsJfXj4Ky7OeCq1ZoEkp670a7r+fz eBrhGXGynqUO8I0cdGqTmcZNWC1P7yokoqO0Fn8gjQ2ezGu4PYfRwgkYU2mCqiIf6sEm Hh0lAxo/4MSrzp4Jm1MHN2Y5ink2j8w1ybHv6gobikTL/hE/3FYU4gVxnFwJnfiwdm1e Zy/MfWZEwDZkzJR7JMM4kF84hIzkK5csfRIMBOmNQlaCh/z2umhROaV2UljTdnDW9KCs lnTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:date:message-id:mime-version :content-transfer-encoding:cc:from:to; bh=uNjpnHXlyNVarhuwVNsVzkf9J79fhbEEpRIntl61cS4=; b=WEi/ps5oO9BggNCbTS8MeAma6kzrbeurVdoulduJeS5JcqHu6OSq0BX3R+W7xOGfA3 jBOfBaCOdXOgK2d+cb+Vsk/GpRX/ULkm17kIlwjCAtws4Ba3aeehIv0hsG+znnwUpACV WpjHNIDVpyKQcTtTCn0dlCIGEwqUvSAeliuUBPuAKm0yGQvAV+fzGJLm/zHvIfImbjpS K7lABCYpk23Sd4DUnz+jJrEQA113tp+hPOzWJA+m6e0/Wp5oM6nGPkeOw+0cTunnRGLy ozeEqBOPCDvOAiBv9o0xJ4BCIQmGw8E51ZEQOtGZ38MGMCN4KrQ7NcByZDP5zO4LXg48 7+dA== X-Gm-Message-State: AJIora+rd/jJMWortZB1nhh8Aa0OGoFjQ21Amjm9vcuM2GUbHia179K6 LjRF1bWtWxcj0Z7aO7hJgs7k6q2VGp5ErA== X-Google-Smtp-Source: AGRyM1t+rEzPNm/P2SuwU6E3+EwTsJqEWdvJIIHBfYCbR/4fpTeZUOsGu/lE5QQsj5fLEIE6qTj5QA== X-Received: by 2002:a17:90a:9488:b0:1f2:2768:facf with SMTP id s8-20020a17090a948800b001f22768facfmr7847209pjo.38.1658430476808; Thu, 21 Jul 2022 12:07:56 -0700 (PDT) Received: from localhost (76-210-143-223.lightspeed.sntcca.sbcglobal.net. [76.210.143.223]) by smtp.gmail.com with ESMTPSA id o42-20020a17090a0a2d00b001f21f0f6d7csm3688374pjo.25.2022.07.21.12.07.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Jul 2022 12:07:56 -0700 (PDT) Subject: [PATCH] longlong: Update the checks for "mul" on RISC-V Date: Thu, 21 Jul 2022 12:03:30 -0700 Message-Id: <20220721190330.9739-1-palmer@rivosinc.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 From: Palmer Dabbelt To: libc-alpha@sourceware.org X-Spam-Status: No, score=-13.1 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 X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" I was poking around the RISC-V C API docs while reading the Zmmul code. I'd thought that "__riscv_mul" meant "the multiply instructions are available", but it's actually defined as "the M extension is available". Those used to be the same, but with Zmmul they're now different. Additionally "__riscv_mul" has been deprecated in favor of "__riscv_m". This patch updates the #ifdef test to match the current C API spec, while retaining compatibility for old toolchains that only set "__riscv_mul". --- It's not super clear that keeping glibc support for non-M systems is even useful, as we're now mandating M in Linux, but what's there might as well match the docs. We don't have the zmmul code upstream anywhere else yet, so probably best to hold off merging this until things get sorted out elsewhere. --- stdlib/longlong.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stdlib/longlong.h b/stdlib/longlong.h index 9b89469ac2..fe3f1989af 100644 --- a/stdlib/longlong.h +++ b/stdlib/longlong.h @@ -1053,7 +1053,7 @@ extern UDItype __umulsidi3 (USItype, USItype); #endif #if defined(__riscv) -#ifdef __riscv_mul +#if defined(__riscv_mul) || defined(__riscv_m) || defined(__riscv_zmmul) #define __umulsidi3(u,v) ((UDWtype)(UWtype)(u) * (UWtype)(v)) #define __muluw3(a, b) ((UWtype)(a) * (UWtype)(b)) #else @@ -1076,7 +1076,7 @@ extern UDItype __umulsidi3 (USItype, USItype); : "ra", "a2", "a3"); \ __op0; \ }) -#endif /* __riscv_mul */ +#endif /* __riscv_mul || __riscv_m || __riscv_zmmul */ #define umul_ppmm(w1, w0, u, v) \ do { \ UWtype __x0, __x1, __x2, __x3; \