From patchwork Thu Jun 18 04:25:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 190978 Delivered-To: patch@linaro.org Received: by 2002:a92:cf06:0:0:0:0:0 with SMTP id c6csp1060456ilo; Wed, 17 Jun 2020 21:29:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwgAKdetmfGSlOWLSnHge03uXKbiuoy3YYdWQaBgaQT7XxD7oQVbdw1Jcg8YOJQM7Phh0vI X-Received: by 2002:a25:4b87:: with SMTP id y129mr3499083yba.412.1592454555401; Wed, 17 Jun 2020 21:29:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592454555; cv=none; d=google.com; s=arc-20160816; b=P7kd5a9wwWMnbdjuYZOcAEJLE0DnslfYzkNIHZaTCdRtPx7nDKR6gkOpleg7M4uyYZ hkXswRuZoOgodhKM3DrL44SI56D0Irs28RGcUHXyYO5m7JFGV5WY0NR4cGlGA7mTQC3L 9/ZTGbwyROpPj7eHD9Z7ohgelpI03pvPx9D3mg/kGvsgmeBpQqkRBA6zrbivYXWpBSzg HME3G4eZwB4wSt+I9zNkuSdjmL5wnTW9Rg4O8t7yl+mEOB3E0FHmbxXVVNKm7kPy0Xxq gxnmvATWiEsBbKiduG94FsFD/8ArFjcAOvQ8nBkKjQFvNYW54E2UxpTqNRn2e/x6ALbx xKaQ== 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=OMm299yW1noZuTFMyG6RsR7KdTTmKa+BiRJfFhXjG+KXXoWl9eJIrenUVM/QAvKIM1 4bU50Taf+C5f7cUhN7Vtxf+ht0NX2Z3q8eHrbGydQcJpg1S8zB+eaFaCud2Cn1uQIRZi xt031fSkDncgUT7xsgDdmXZkLG2ppiSHw1n76qnYo8y63UGeD3w1umWIhWUGhxPmqfiO blBSd3Q0q3P68rLvkuiV8Mn11v1wg1BVvddj93GrmqPApuJBdkPhIbhUuQFO+BDm5NS9 4Rj6y9amWNOZJ1Bo6aPzM2FzI72PiYgwhtZhT4qT9W8M2heD+3OEHpdnI/zoXdsFKXGS XqQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=bdRYW64H; 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=fail (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 64si1265287ybt.471.2020.06.17.21.29.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 17 Jun 2020 21:29:15 -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=fail header.i=@linaro.org header.s=google header.b=bdRYW64H; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:34966 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlmAs-0005qy-EN for patch@linaro.org; Thu, 18 Jun 2020 00:29:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58920) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlm8a-0001d8-Pp for qemu-devel@nongnu.org; Thu, 18 Jun 2020 00:26:52 -0400 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]:43896) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlm8Z-0002Fc-62 for qemu-devel@nongnu.org; Thu, 18 Jun 2020 00:26:52 -0400 Received: by mail-pg1-x542.google.com with SMTP id h10so2318929pgq.10 for ; Wed, 17 Jun 2020 21:26:50 -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=bdRYW64Hb395HdicS6bYyY+bGfI6LT6K3jr+lkYBl2rloASfODwrF3o3SWoqOxc6EX QCg/AejFxoP0UL9YMTiue9UZ4k/xdnpjW4fbOt8UjF5MMJa32QwO1vwcXVZaOKEmAv9a P2Glkzr559TE86VRoGblkBggXGYKVNTCeI4livOr9WrAHpSQ1c/er0xmJfy6ErzngjhD yZfJkAxBDaIIJ+koziHNd3u5pNBeXLKFL79sDxZfSQ3qm2gKBPgd2pHKAdr0yv0TWqpY ny7yXo+kyqL6+yaZoYQOrPCJpyqx0KUpQVZehEnHqwkMXdUj5d1bR26CRMWj+LI8++fI Hheg== 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=DqwVpWKefdKBi+TmDerahSxXWdODDJ/x25j1P63ziLCFUpHeXh81NRiPmyoXbFrRvP Onf68NDKCGil4Tk6SHWBOv63dAJj/MvEefafNtsLirjIEOQde/P2hd1zuN+iWP6yAXFs 0H5KK8Hi4/DJ7LBk1WSyxTeDh7A+OsHGyEo05S0PGjLvUvnDfqZV3grvmy7gCjhJQm+M tgrfrvBTybmPYeBbgHf3migQXEFzBiqyJYT6GnENjqcznfAgXXrVnrdzCF/QSC6dLBs3 MLgUaXofAHFL45rT3mztIGL4Ogz0knrY++ish9yuj1vwqrYQx7NQk+a4vcAkeyAzv2gk pvXw== X-Gm-Message-State: AOAM530O88unXGrdx6ZYhH+2lH4/fBQeNJJ+ynidya1A5g8xOvjlXwfO 7hUOz/oMm5ZrOwmKXEqOyqYoRbt2uWE= X-Received: by 2002:a62:7dd1:: with SMTP id y200mr1857673pfc.184.1592454409462; Wed, 17 Jun 2020 21:26:49 -0700 (PDT) Received: from localhost.localdomain (174-21-143-238.tukw.qwest.net. [174.21.143.238]) by smtp.gmail.com with ESMTPSA id o16sm1162035pgg.57.2020.06.17.21.26.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 21:26:48 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 002/100] qemu/int128: Add int128_lshift Date: Wed, 17 Jun 2020 21:25:06 -0700 Message-Id: <20200618042644.1685561-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200618042644.1685561-1-richard.henderson@linaro.org> References: <20200618042644.1685561-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::542; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x542.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=_AUTOLEARN 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: qemu-arm@nongnu.org, steplong@quicinc.com 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 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;