From patchwork Sat Aug 15 01:31:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 247753 Delivered-To: patch@linaro.org Received: by 2002:a92:cc90:0:0:0:0:0 with SMTP id x16csp1240265ilo; Sat, 15 Aug 2020 08:28:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxjgUcbCJ6nYdMTWckIxkRuma1q5DkI0nPZfVb7Y6DML3flc7CFNjiJ43AOFWlAF8GPiGM+ X-Received: by 2002:a25:40cb:: with SMTP id n194mr10342761yba.380.1597505317823; Sat, 15 Aug 2020 08:28:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597505317; cv=none; d=google.com; s=arc-20160816; b=C7DyYtEATjMSxfapyEEs3CnA98F6uxCCTCycqsmTEZ7+c/B0hQyolqpLvM/+c1YrXy Lkt1YQHCfDJS/VhdhE+dNHNKL8ec4A2IPJmxmvYjnFjnsol/a+2Y7yMxBLRoplLitkgp MgYwZORyH1PRhTnVnqaBbr9rnSZRhg5Gpmwk195aDwqgwc+4amTC8gCe3CnGWRUbwsyo 2/OSwjLv5K9VVPzDlwFZCmkJxz+kSdj1TJZyM6XZ+oRS8jr+txVyiaOKx0JHE30upFYi KYl0fhXiqPm2mMVSoxw/DdwRQwLo/9RDE/+jT0a4dFzUOUlc3DYxU3WOp0qad1VILfJz wYDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=SYhTH7/NoKSZMnkGd9mMb4nrqyxVnLFVoR2e/Dwfxy0=; b=v7pfnQFyZvlIq4TVaaQrlRhrOXCw5J/43VgiJTNB5sQkL9WlLDDsoTZaq2TFiIyz5u 5hkbVCj4aPxGPbXWnJcT4jXvjN5+KdZMN9XL7tbbHQDIYIOisSADdLjYzKkxk2HAQroj 3n0uCA1DHNEVL6+VF5i8G6lqX5euBGZ3zlDZ5Yx+ByP9joWEKaZ1BUFhHbh3Ovre3T3h a1SAbZJYFzmmeJIIUu1pmUyWeYTquphP0n1S/IjX+067TjShvO/77mRTvo9G+NHvYxL7 Hhx749H0t2UEYgEUHNfYP49wGnHES1gZHRHTfCrbCx6fb7rAuMB+c2/uqkilxlx0Nn5x 6tqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YebU2m56; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id o128si11822860ybg.8.2020.08.15.08.28.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 15 Aug 2020 08:28:37 -0700 (PDT) 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=YebU2m56; 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 Received: from localhost ([::1]:40428 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k6y6n-00025r-9e for patch@linaro.org; Sat, 15 Aug 2020 11:28:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36458) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k6y53-0007vk-6Q for qemu-devel@nongnu.org; Sat, 15 Aug 2020 11:26:49 -0400 Received: from mail-vs1-xe41.google.com ([2607:f8b0:4864:20::e41]:42417) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k6y51-0003gM-Bc for qemu-devel@nongnu.org; Sat, 15 Aug 2020 11:26:48 -0400 Received: by mail-vs1-xe41.google.com with SMTP id q13so6126273vsn.9 for ; Sat, 15 Aug 2020 08:26:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SYhTH7/NoKSZMnkGd9mMb4nrqyxVnLFVoR2e/Dwfxy0=; b=YebU2m56OOBYOl+xeB0Xu+Cg4A9AkuO8hy4+NFP+uKIwYR0wepCJJ7XSpJwsRvrn+8 kiP6OCUsbEqkz5wjbkFQ4L6+/Qzv3iQ+1IejuISOvYUvAyqbfEoE034TlFciSCUtualk c0lnPWRlwWsGbIvaOEBRRFbFaXO72919u4Z2bTDs8vT89sarlQm7hOZ6g/v+bZQwiyOZ MzFof9KfbCAR7194J0vTMmBXYvb1a+a+2gHAxJs+o7l+i63VMn1eTxjKCudzzhKen6Eu 83ZukN/gANdnHwdZWAeCe/hOdHAvS/sV7VLUllkJ1s0MlLohLWf1rYAKL2Z20vExarm2 yJ9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SYhTH7/NoKSZMnkGd9mMb4nrqyxVnLFVoR2e/Dwfxy0=; b=HoYlJYPN/1ANkNlUMezT3O/WerMGjlWThJ6t19ur/XCWWv396QIqepxrbBE62CakHe CvksUQ+0YQH7crBEDCRmmzv5rTz5AwaYdx8P9V+pQyxoxiuztJ7h9WKl83aTuHG5fE32 MELJWVrRCb2qa+UbI86M8jhVwDePKyqMhrfp/aXTcLvl+95L9D9fKqlGtdB3Rn/yx93k HpohniIZ09G3IW5RH4UfSYUlXyntaYKACa6KQ4KWilDDOAt5GvhMpn2rl/691mAa5iJ+ Ti2VjNEoPLFyFyJM9NE0JLhQsJdui0V9niP6whiGUsd6yRFDVUgZ6OdPVnwCBC8Omlcf MDRw== X-Gm-Message-State: AOAM530HMGCMCb59rXDGI14iAQqgcAaeZqtspDFuzQuwgSn29zwn2MrA jvgOjEoMAjHfnGkIh6jNRZViFNEoODt/8w== X-Received: by 2002:a17:902:bd09:: with SMTP id p9mr4005177pls.322.1597455109367; Fri, 14 Aug 2020 18:31:49 -0700 (PDT) Received: from localhost.localdomain ([71.212.141.89]) by smtp.gmail.com with ESMTPSA id y196sm10625528pfc.202.2020.08.14.18.31.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Aug 2020 18:31:48 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 01/20] qemu/int128: Add int128_lshift Date: Fri, 14 Aug 2020 18:31:26 -0700 Message-Id: <20200815013145.539409-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200815013145.539409-1-richard.henderson@linaro.org> References: <20200815013145.539409-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::e41; envelope-from=richard.henderson@linaro.org; helo=mail-vs1-xe41.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Add left-shift to match the existing right-shift. Signed-off-by: Richard Henderson --- include/qemu/int128.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) -- 2.25.1 Reviewed-by: Peter Maydell diff --git a/include/qemu/int128.h b/include/qemu/int128.h index 5c9890db8b..76ea405922 100644 --- a/include/qemu/int128.h +++ b/include/qemu/int128.h @@ -63,6 +63,11 @@ static inline Int128 int128_rshift(Int128 a, int n) return a >> n; } +static inline Int128 int128_lshift(Int128 a, int n) +{ + return a << n; +} + static inline Int128 int128_add(Int128 a, Int128 b) { return a + b; @@ -217,6 +222,17 @@ static inline Int128 int128_rshift(Int128 a, int n) } } +static inline Int128 int128_lshift(Int128 a, int n) +{ + uint64_t l = a.lo << (n & 63); + if (n >= 64) { + return int128_make128(0, l); + } else if (n > 0) { + return int128_make128(l, (a.hi << n) | (a.lo >> (64 - n))); + } + return a; +} + static inline Int128 int128_add(Int128 a, Int128 b) { uint64_t lo = a.lo + b.lo;