From patchwork Tue Dec 24 20:05:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 853276 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp4085019wrq; Tue, 24 Dec 2024 12:18:54 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVpb/L0bu9tXNW05AWec8+jNCihoA5oNauak8sBM/srRp4Yqk8bySJv/poJeUAoGEB0rwGKRw==@linaro.org X-Google-Smtp-Source: AGHT+IHyWOz6ZiUo6VcW9L2l4mWweFXfFIfFXzxfG5ADx6h4pTKXuGuY8PZdkr6tqcqUjuCOUEM5 X-Received: by 2002:a05:622a:253:b0:46a:389d:17ac with SMTP id d75a77b69052e-46a3b0c28a3mr332583941cf.27.1735071534619; Tue, 24 Dec 2024 12:18:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1735071534; cv=none; d=google.com; s=arc-20240605; b=XLBm3zm35twvzKkhtWYvytNAwyqWEgzzl9bjJF4ZB0UxsJtTZZYP3nQvMA7RzZA932 /CiFPBLNg3CP2KFb++fnsIPNuzGNrMIa5BIlJFLUZ1/ZUYWBSR3J2bXxoVRcq/jCfxyE 2mCa/+vu1fBxq6Jfyat8NfXznVPlm0O7cxlpQhyETYhF1WwYO1M8RTark+1Lfx5M0Yyq gVEdRa3jJaD1M3pUkdNwpllm/gLUl/ZnyWVjEUed9uHiZBlO3o3c3kH79Al9TYaH2cE8 dOKkzG7OkKe6KfVLGVvKaS5f+j1JXSdyu4sASl4TkeOkXZRRMvdGBvpkR1nP3F19afqH PA0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=F3y+AMSb8rvB6VTUgl6UjDCiMyf5UHg9L6oBAf1WE4w=; fh=erpJr+t1J1nk7LsZaPa1TvOu4e//VqKoadf7h5wHEDQ=; b=YhgsOZEL/n5jX6A8/h/DRpOvtkxUza/2eXN7II4xZExRz6hpvUY9EE97CLiRiv+thQ v64rp7ZJYE4Za7W8Q4lKbyci7XNjV7PXrBtC+gu5HM2qCmlRssDRjN7tJG47L1yzlDuY 25d7GS/pkYRYSs+61CcmITgkR7hpfXi1S4n5nADvuToQalkRQywt4bZVg2mGGKu0n+b7 8t8XKsU9dQ8Nn+veRRQxeUuZpwOYkvh7BhrHp5/L5IjHexjNWCFgtNar5qMMURhqX9wR gIUN/LW68lKIRpTZCxxRIGLEOgEH23Oesq1nzmgRgFtHL0ZxiGaD4tq1pT61SSiQdEpf /Pqg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QRF+WSyt; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-46a3e680e90si154850421cf.113.2024.12.24.12.18.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 24 Dec 2024 12:18:54 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QRF+WSyt; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tQBDs-0000fH-0g; Tue, 24 Dec 2024 15:09:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tQBDh-0007cC-JG for qemu-devel@nongnu.org; Tue, 24 Dec 2024 15:09:34 -0500 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tQBDf-00030x-Ro for qemu-devel@nongnu.org; Tue, 24 Dec 2024 15:09:33 -0500 Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-21631789fcdso47001165ad.1 for ; Tue, 24 Dec 2024 12:09:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1735070970; x=1735675770; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=F3y+AMSb8rvB6VTUgl6UjDCiMyf5UHg9L6oBAf1WE4w=; b=QRF+WSytAizZEVmDGUAhMK9zkDw4TEbThe4XS++5AIS9IWhEaINDFsii7hflDkHdgy ifb+AszHk8hQUcLJnrc5D6azXz4vuq3KsPDvXJXCK4d85/TxE10xiMnPQHqAWfj2kLv1 hiUvxBloaQofBvVACArluwBRsLzLEXwL1vvWoq9m1IyAfIiwsWplWM04TvOzFvAH5v/B E8AyZUT9EpdcW1EWha6tzDVClB1C3oGSf9eQqbXBFJL3y7TYjm4g+VwDb+qoL3Wf8/UA 9UCIPQ2NNNp7luSMD/Pku3pbyrn6S0peORnnhcFoOEND/468nj0dd2kkVYg/w+yVPOFz WLLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735070970; x=1735675770; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=F3y+AMSb8rvB6VTUgl6UjDCiMyf5UHg9L6oBAf1WE4w=; b=g/6Z5GuR44NQ0zgL6XVz0R9GHrXFAGH9nwLF1Vk7UOWXxAcqdBdFkz+nHlSY0SKoLE 5IYocgaGuNNeS8ewPkbh9X4BMSRpQR2GoX9Hja2TdlDoRXKxu3BS3wOXqeKwvWn9g/sK TP67NvOoUws2TTwihPigLhunefzBbbV0S5a5K8D/qyxdVo/8iAh6ArKf4l2gX+UxZW2S sSlTtFvm6o4hI1jNi0jU3pwQ8XUk9sSjOfkP0shXuI+FqCIsh3Mh627HlvstD/M/F6pt g0AIgINhwfu4nd8X2jYItXFvGN1WXcOq6ddIXVYKHEC5fum9o94y7zyr0LehaLm5rari TrUg== X-Gm-Message-State: AOJu0Yygs2Hk6fhxqhbTy6LXZeNwzmL8RNZ1SAo7jmDdPLXKTMk2WTw2 9JJ06PdJWZYphjssEqg23XuXBjNTg5VmGKsSFCSPsMT4++YSHP2WbQ36NxkwDMkdyZ24uVmjiDQ 1WQc= X-Gm-Gg: ASbGncsIP+2VIXn36HZBqtfctf1YeehRzzRUnwpg5FZcgFdjaHB6seJ3MgkKQggjAQi MdFakmMPNqU9uiIw5HeE9Vs4rsY8NHNU8XB0dG5gNfLtcSYB5j7OASmuMl60hNqVBFQyehsYQ9F smoS37cjd9Z3nh/TFcCjm6B0yfm6EbSQymTvYgCtF6dpdlHdXI9nKMzSTPTDorW2VB+Kxy0XOBa ViuGi20OCFM3Y8yNpoJpRJjRI7QYXKwGrPSgcso0t8SBdAao/DWMk3FRQbGwfATpuJuRX8k+MQ6 tPeQ6KXpsiwnp/LbS/n9Tt0bmQ== X-Received: by 2002:a05:6a00:66cb:b0:725:41c4:dbc7 with SMTP id d2e1a72fcca58-72abdae93e4mr26701042b3a.4.1735070970632; Tue, 24 Dec 2024 12:09:30 -0800 (PST) Received: from stoup.. (syn-156-019-246-023.biz.spectrum.com. [156.19.246.23]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72aad8309acsm10033521b3a.45.2024.12.24.12.09.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Dec 2024 12:09:30 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Brian Cain Subject: [PULL 70/72] target/hexagon: Use mulu64 for int128_mul_6464 Date: Tue, 24 Dec 2024 12:05:19 -0800 Message-ID: <20241224200521.310066-71-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241224200521.310066-1-richard.henderson@linaro.org> References: <20241224200521.310066-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::635; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x635.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org No need to open-code 64x64->128-bit multiplication. Reviewed-by: Brian Cain Signed-off-by: Richard Henderson --- target/hexagon/fma_emu.c | 32 +++----------------------------- 1 file changed, 3 insertions(+), 29 deletions(-) diff --git a/target/hexagon/fma_emu.c b/target/hexagon/fma_emu.c index ddc793fe14..07d2880776 100644 --- a/target/hexagon/fma_emu.c +++ b/target/hexagon/fma_emu.c @@ -82,38 +82,12 @@ int32_t float32_getexp(float32 f32) return -1; } -static uint32_t int128_getw0(Int128 x) -{ - return int128_getlo(x); -} - -static uint32_t int128_getw1(Int128 x) -{ - return int128_getlo(x) >> 32; -} - static Int128 int128_mul_6464(uint64_t ai, uint64_t bi) { - Int128 a, b; - uint64_t pp0, pp1a, pp1b, pp1s, pp2; + uint64_t l, h; - a = int128_make64(ai); - b = int128_make64(bi); - pp0 = (uint64_t)int128_getw0(a) * (uint64_t)int128_getw0(b); - pp1a = (uint64_t)int128_getw1(a) * (uint64_t)int128_getw0(b); - pp1b = (uint64_t)int128_getw1(b) * (uint64_t)int128_getw0(a); - pp2 = (uint64_t)int128_getw1(a) * (uint64_t)int128_getw1(b); - - pp1s = pp1a + pp1b; - if ((pp1s < pp1a) || (pp1s < pp1b)) { - pp2 += (1ULL << 32); - } - uint64_t ret_low = pp0 + (pp1s << 32); - if ((ret_low < pp0) || (ret_low < (pp1s << 32))) { - pp2 += 1; - } - - return int128_make128(ret_low, pp2 + (pp1s >> 32)); + mulu64(&l, &h, ai, bi); + return int128_make128(l, h); } static Int128 int128_sub_borrow(Int128 a, Int128 b, int borrow)