Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1l0S93-0007MC-Cr for mharc-qemu-trivial@gnu.org; Fri, 15 Jan 2021 11:40:19 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58432) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l0S8t-0007JT-Sr for qemu-trivial@nongnu.org; Fri, 15 Jan 2021 11:40:13 -0500 Received: from mail-pg1-x52c.google.com ([2607:f8b0:4864:20::52c]:35796) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l0S8s-0000Cv-7q for qemu-trivial@nongnu.org; Fri, 15 Jan 2021 11:40:07 -0500 Received: by mail-pg1-x52c.google.com with SMTP id n7so6355481pgg.2 for ; Fri, 15 Jan 2021 08:40:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=CltrdbYuLXVKY3LDVHCnngcjOfhZpfm1o2jvOUIdbEM=; b=wMxo94kENtzUgOXsFcb0gkE9p2XqDnIBkKY0BZ8GN42xIGHBLyWP5Ve5DHD65dYQRJ 3uLyxVd95MDKSqL8jRE+vAkUgjoX/az9vOjqqviekUgkoFSLUIe4VHvI+XSpQkaBhRzT 8xH7f8GDq1mcasXXIQ65IeE892ZpHZx0OaZlFd/wv32223sBw3zg/PuSHxBsoN8XQn20 ydS7qDnPRaP9TLuTF3sH01ov7dK38T8l6XouVTe35O8XUkzM//2qKzWKsUOHVSyI2AnB Tx7j7QrlJFXgSCRfvId5/DscWpy4z4Vlzzua6uIjV3ynBHgjAjwt0Bn7gm2j+AHN82BQ 4TZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=CltrdbYuLXVKY3LDVHCnngcjOfhZpfm1o2jvOUIdbEM=; b=MjLAJ9N3zg+8XF7NC583M+Jd1zwfFPCp9kAV63UWqTjHq/Qhm14BSY7FEzq6nZt7eY LQQ/On7AnGQShrujRLslcvjRaVS2xdItyVXi/tvQvY+nJ1l9iJTlUUp7nEFhu8DuiPq/ fWYY2pRXywLMaPVT9IBNS5RwTOCnoUEnjmuJj4OBSW+ojzcBCC/fnJVRSU2jrsC3MhCC 1S4egzV/sLoEuDTJcJHj6A8rEGjA1yq0I31a/wle06CwBuOCGg6QZRP93uXtGwWEgW/N 3v3MHYE1XMJj8k1h2cSmOgHbqpsQSUvZWOiGGLAj8eLsrGA/qUnZ+VI8TA/mjrE9Z8op Ib1w== X-Gm-Message-State: AOAM531/xoDhSA604lW95ZeUrpE6Kh26UCje/ZikXZoX3CDfXteq3g2s CUCsj3kxph0xCAheDetx2oUGQw== X-Google-Smtp-Source: ABdhPJyvzSxPTxK8EFX3e37b8QdcTs7SSWCE/81rIZfaCbhkn2coEmZr3soYivm5iNaZk2uvPC+H0Q== X-Received: by 2002:a63:5407:: with SMTP id i7mr13671649pgb.418.1610728803945; Fri, 15 Jan 2021 08:40:03 -0800 (PST) Received: from [10.25.18.3] (rrcs-173-197-107-21.west.biz.rr.com. [173.197.107.21]) by smtp.gmail.com with ESMTPSA id a188sm1282543pfb.108.2021.01.15.08.40.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 15 Jan 2021 08:40:03 -0800 (PST) Subject: Re: [PATCH] util/cacheflush: Fix error generated by clang To: Gan Qixin , qemu-devel@nongnu.org, qemu-trivial@nongnu.org Cc: kuhn.chenqun@huawei.com, zhang.zhanghailiang@huawei.com, Euler Robot , Paolo Bonzini References: <20210115075656.717957-1-ganqixin@huawei.com> From: Richard Henderson Message-ID: <8d1971bb-0c0d-b7cb-5fed-4d105e17a511@linaro.org> Date: Fri, 15 Jan 2021 06:39:59 -1000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20210115075656.717957-1-ganqixin@huawei.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=2607:f8b0:4864:20::52c; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52c.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, NICE_REPLY_A=-0.001, 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-trivial@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jan 2021 16:40:13 -0000 On 1/14/21 9:56 PM, Gan Qixin wrote: > When compiling qemu-fuzz-i386 on aarch64 host, clang reported the following > error: > > ../util/cacheflush.c:38:44: error: value size does not match register size > specified by the constraint and modifier [-Werror,-Wasm-operand-widths] > asm volatile("mrs\t%0, ctr_el0" : "=r"(save_ctr_el0)); > ^ > ../util/cacheflush.c:38:24: note: use constraint modifier "w" > asm volatile("mrs\t%0, ctr_el0" : "=r"(save_ctr_el0)); > ^~ > %w0 > > Modify the type of save_ctr_el0 to uint64_t to fix it. > > Reported-by: Euler Robot > Signed-off-by: Gan Qixin > --- > Cc: Richard Henderson > Cc: Paolo Bonzini > --- > util/cacheflush.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) This is clang being overly-picky. IMO it should have done the mrs into a 64-bit register, then truncated the value when storing to the 32-bit variable. Which is what GCC does. Certainly the code as written only needs the low 20 bits of the result. But your change will not really make any difference to the generated code, except for 4 more bytes of storage, so: Reviewed-by: Richard Henderson r~