From patchwork Sun Dec 8 22:48:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848286 Delivered-To: patch@linaro.org Received: by 2002:a5d:50c2:0:b0:385:e875:8a9e with SMTP id f2csp1840153wrt; Sun, 8 Dec 2024 14:50:45 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUnoC3N1NjvgfJ8F3UFphY0sQCXuKuUZ1v9AicMzpxbcdRvafS5h8utA7D7X1dSAfRG1wStLA==@linaro.org X-Google-Smtp-Source: AGHT+IE4d9icXI0R+B81KIQjCpn/ne7fyd8A7Ge/YJu/8La1Tt7SFTK7qyewyV12tg79hn67lsjE X-Received: by 2002:a05:620a:29c2:b0:7b6:c4c7:ecf9 with SMTP id af79cd13be357-7b6c4c7f302mr963662085a.15.1733698244928; Sun, 08 Dec 2024 14:50:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733698244; cv=none; d=google.com; s=arc-20240605; b=VROiOQQ+ASbRWCWR6o4fuxHvCcITcCqQakfFGx/AvZ/aIJJ0SdANlOE5S3/GcJ2xLF tGpdmMfQHDOYEQK6dWgvYspIS2AkO3KZTu3sAzjRngyhlkH87Dc5pWqzPRF+LnvWagyn ftAQVN8aYx5MpeDngt2vcIkHzA4v1B5aQ41EQLt8h75ljdV4sX7GHdkjhSb44Rq3S3ho yFaxvNI1mbA9UrnwTFrZUKqGmnwzM9EI4fiTng2UPEMJ3TfH0gyuOaZ0Dv5WQg3Pk04s By+AY3QSGX3w+3UPm7I7bzDP3+6TyomoHw9EfBsZlk2mFX/5Qe9RHhhVUSYLhdh/2v3m sF7w== 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=kB6bt5gsM+uIGBlj2PVExFpGSSwWH11mu7Vzk4S/tlM=; fh=ZTutxOFfSTK00/NSefao3I8YzT34sqQTgDXNvfsMID8=; b=Vy5ulkefSJN7c4K/CJQbl/+eX/GiaspF4mEWnIcKdaTiYkHkbAIX+SdRiI9byvNuw9 hRfrNLHIFtTfwyr1AwAT71a37X5BTQaaQ8nsMOkIle/HwfFd/0+QMTgB8NCAJm9yzniP UI3HznqTiIzfBZAGP/Bt52kd5pbxZMl/6UxXRG+nwn5t5bh72Mil3S+1k+N5cz0YqKr5 1AvSBXqg2kQ3KzqIl8KIJVWoCYIk6IN7JWN9ayBxtuXbZUw068UR/0ve/mwgmuGC+5Q+ jIVBQ7OKb0RTjiwOfUQ+N8Ca223X5OgaLsu3ZUQiRN1l/pGwSplhGgSlmGkBt8wbqMQp G6Uw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WQzJ1+JN; 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 af79cd13be357-7b6b5aaa992si1021102985a.391.2024.12.08.14.50.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 08 Dec 2024 14:50:44 -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=WQzJ1+JN; 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 1tKQ5h-0007L8-8L; Sun, 08 Dec 2024 17:49:29 -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 1tKQ5M-0007D4-8f for qemu-devel@nongnu.org; Sun, 08 Dec 2024 17:49:08 -0500 Received: from mail-ot1-x32a.google.com ([2607:f8b0:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tKQ5K-0006GV-RO for qemu-devel@nongnu.org; Sun, 08 Dec 2024 17:49:08 -0500 Received: by mail-ot1-x32a.google.com with SMTP id 46e09a7af769-71df1f45b0cso170632a34.1 for ; Sun, 08 Dec 2024 14:49:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733698146; x=1734302946; 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=kB6bt5gsM+uIGBlj2PVExFpGSSwWH11mu7Vzk4S/tlM=; b=WQzJ1+JNa7euvYNVHjmsaOK5b4JQ22vBD094u7ZSml2jl4gdf/I6NBzrvJd2Q5FmqT 1lIep+UcTijxe883NAah0MugonXHIedLgBHrASLvZpeRbiWkqIk2hIAKrH2h2LQpOlrI O7cNZO8CcwzyAsZ6Zujfld4vFyKBSKqsZVY1VqAX4IAZucUc36InFxMQn14JXioBp7eC ve2pvXJqIWzQnpfhnFMq5VGHRyUABD31VEdm+MEbdk9gdWdFzKkJ1jdru1ycgGBcG9C7 r6K6oO8ckhjihj9jt/X0C+zh3JnFMUxQ/cOkMSBmCed4R+dKq0mZKRvn764ZEHSrOUap BRzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733698146; x=1734302946; 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=kB6bt5gsM+uIGBlj2PVExFpGSSwWH11mu7Vzk4S/tlM=; b=Y4rbxnXjgm0W1AJM43hTGNq/ihMjwo9UZ8wqwCoKaGMbmAl6myzYIpZ+uwa0/xnuLd IPUU+SlRhthH8IYbYH65WFGBQtiSHfFMgZD0GsXKlVVQj+taub7r58Xy0lc/cZ0RRm1u R43N17uVcZpyHPje+dbmulJ5Sdg3DD7u5icAH99Dl4u6SoiCeun8j2Eg9OdJ9bzd2dEb 9oADkSG7T82+tH8/mwt02amBsDB8zNwgMNnLtanTjQXPlglTPKA0lYIWr9DoptJPRJn3 We4sSQECpwJVAXQuC718b1cpck6dNM2azHVr+RV98NJUJ5GCrj5ZyTatGM92AyDQUDfT y1vg== X-Gm-Message-State: AOJu0YzFj0jN7Q+RSXvcT5G3LMHAeXvoViYb1HvYUyO+Q2LkfFV0SrtD FKbx7CvGFR/98cA9HiL6urEw3B0KS7OfTxFPE/IXca7al3P/ngkBmFATeNBLub1eJ3kDhrxOFI5 Cx5lZ7Q== X-Gm-Gg: ASbGncskL5p2R6OdmTz5zYVFboWGoRubcHfPZeghHlL/O25tiubj/IKjHCEvQ7W/u6k C1igPvBniWaqR3LVxiZQyemV9bfFeSXJ6y9tx5FL7vRF7HNxgeFxjHBPbxMC6K15xILT6Bw/yMw LMIy+6ILHUdOqGsuQIfQwk/uttMC2TJK7wIfKCWeAFEaEqpvchBQf9EY2ajUybbRYATU/QtAk96 q26Mjsi/nCafvE+1F8g3ImGhfdumu3tP22EkTJQ/+5AA1HVyesdgAaGDufo1/iq6uX/RLiE1NIn wdskw+8E9i20613I4N1UXTZV1wHzQGeibrSe X-Received: by 2002:a05:6830:25d0:b0:718:4fd:bd78 with SMTP id 46e09a7af769-71dced091famr6067572a34.13.1733698145830; Sun, 08 Dec 2024 14:49:05 -0800 (PST) Received: from localhost.localdomain (fixed-187-189-51-143.totalplay.net. [187.189.51.143]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-71dc497ee8fsm1925198a34.39.2024.12.08.14.49.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Dec 2024 14:49:05 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: bcain@oss.qualcomm.com, peter.maydell@linaro.org, mark.cave-ayland@ilande.co.uk Subject: [PATCH 16/17] target/hexagon: Use mulu64 for int128_mul_6464 Date: Sun, 8 Dec 2024 16:48:43 -0600 Message-ID: <20241208224844.570491-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241208224844.570491-1-richard.henderson@linaro.org> References: <20241208224844.570491-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::32a; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x32a.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. Signed-off-by: Richard Henderson Reviewed-by: Brian Cain --- 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 343c40a686..6749538c09 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)