Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp4192156imm; Mon, 15 Oct 2018 10:31:49 -0700 (PDT) X-Google-Smtp-Source: ACcGV615OXDazi5b+abTnb+jA0CqyssOCwjaSOEN6WINzj+4IAM8FM9bZm88R34NsQC+JwrZKw/D X-Received: by 2002:a63:3f07:: with SMTP id m7-v6mr17254367pga.115.1539624709303; Mon, 15 Oct 2018 10:31:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539624709; cv=none; d=google.com; s=arc-20160816; b=q2ws60qnJVA6egjIdxEYmYi/u28Vqw2id6wUrjhh46r267bDwhj1IBhvBdBz0wDShv 3KWdieZsfomfLEQBHTk8mmTXOoVfbTP5b9TPtXWATKY9SzUG2XEhRIJHJbZb16uRz0tj ll8koYKWbKF9YYnCQdpnVS7KDGeWpFMP776GGzv4Yrhb4YVTrRQyli3yE4k2NPri8Auf TtOgmJnWVc3k+kwzzHAX3Fbgsp5FYpgjwf0Uush4upfIXuC5YbxSdc0RdOMUa8DdSBJX FkdiUD2ovi72bp3v/0UaXcPYXW1aTwDF7K/NzEsVkUfn9oehJn3RxJDqfII4ZopcvfXy M4oA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=We1z1pg/2JRKdoQlt+McwMEilHQph9BgJAd+knyK+J8=; b=ryKkoFTJu8AZK4F+0K+STz/FwbgrJHgTukgX72Hwt/EwDgZTZgHVDJhULc+9TJxKQb JVyGpKd8sGIg898cp5hnEUJY+YXyn1yQRR/G5N4feRDaC+uzAsW1MsimfLe6ixDPNVcQ z6BMq8ynX36MBPH8oUmYFnhve76/nNX/AkVWuTmIIBkd5ZCMDKuZnur3Zztx3q4xjfSr y4KniQagQEsYe6F5Cdyp193p3vboC8IkbL009I2f4QF6K5slpRAHU50pCx5Sj7gI73gy x+HuREUO/D9uJMqFyd2ie5FSN3StCZTTNPZKPogjmt5SHCkVFC6vo+d4yGnifzjoBn++ /ykw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y9-v6si11387128pgs.214.2018.10.15.10.31.33; Mon, 15 Oct 2018 10:31:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726864AbeJPBRL (ORCPT + 99 others); Mon, 15 Oct 2018 21:17:11 -0400 Received: from terminus.zytor.com ([198.137.202.136]:58897 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726588AbeJPBRK (ORCPT ); Mon, 15 Oct 2018 21:17:10 -0400 Received: from carbon-x1.hos.anvin.org (c-24-5-245-234.hsd1.ca.comcast.net [24.5.245.234] (may be forged)) (authenticated bits=0) by mail.zytor.com (8.15.2/8.15.2) with ESMTPSA id w9FHUm8j3715527 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Mon, 15 Oct 2018 10:30:49 -0700 Subject: Re: [PATCH] kvm/x86 : avoid shifting signed 32-bit value by 31 bits To: Paolo Bonzini , peng.hao2@zte.com.cn, richard.weiyang@gmail.com Cc: penghao122@sina.com.cn, rkrcmar@redhat.com, tglx@linutronix.de, mingo@redhat.com, joro@8bytes.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, x86@kernel.org References: <201810080904344038939@zte.com.cn> <717c02f3-bb36-33c4-a463-f5759fde30fd@zytor.com> <08fd066f-e6c5-f82c-544f-536e9f29e6f3@redhat.com> From: "H. Peter Anvin" Message-ID: <32ae2c96-51da-304f-9fc0-d531979eff97@zytor.com> Date: Mon, 15 Oct 2018 10:30:43 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <08fd066f-e6c5-f82c-544f-536e9f29e6f3@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/15/18 10:23 AM, Paolo Bonzini wrote: > > Even for a value from a 32-bit register? That would be _BIT, which > doesn't exist. > Just use _BITUL(). gcc is smart enough to know that that the resulting value is representable in 32 bits. Or if you really care, submit a patch to create _BITU(), but I don't personally see much of a point. -hpa