Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4905750ybi; Tue, 30 Jul 2019 10:10:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqwomWan1YhkslbY4Qye4pjKAnENcbrgy88/q0Eqj3rUxZhAgEh7T8vvfs+uaHkdbFmyKqIH X-Received: by 2002:a63:eb06:: with SMTP id t6mr104377641pgh.107.1564506631257; Tue, 30 Jul 2019 10:10:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564506631; cv=none; d=google.com; s=arc-20160816; b=MzttCy3dy7jvOaNb1WeUL1gtx4khBeLm8ehK3K8UoVFJ4pBaseOogqYRTPUQQUymES n2MhV8lOvg4R06QrHc5+OHLNdxFVMErmpfJ73lHA3gYPJ56oTmpyn4vZU+3xIu2XVcMN gSVrSHuIaDf9ha5Gq9rxyKbCPZ7Wk/0DYRQ4ptqHYvrYRZGzeXkuQNT6XIShHtR7VPrV 49aeXfbCZu0cifg4ojwMkpmfV9Eb014qIHEIwYu6AYliwAtMRanWiCvQp/6DySMfroy+ P6NAabKHIKKBJaOY8xb6u6qhO0nJMM0ICaN9EteDiopqfdt46INH7LuMESEY/n6e/X1k ABIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from; bh=7Da2f815UiVffluS2tiAN1Tx2FbDRNc1/mdMnHHtD4I=; b=vdLSiBmXu4pBvyIv1PU77zbfZ2illXkjjEX+VHzdwJ6OQTs79YS9ndl9CNjIPnSNIG admQHfWjI6vLZXATRtstDjIo2xEvN92aytmcm1NySdyhF+6CPPZlFLHZYwPqqXjioZwk rYpAWl5hXwkhDgv5LESTP2EJ4vR95MrrJ9qSh2COlNDmRZtpVOicCnCAzzbpoLw1A9zg ZXTlPostbfkYR6wNcuCzVHBm5vgjqwGGlbe31RTuNjJjWLNDbUFAivxToZwIfDpWUNba OXOtuaAsPNMOX29cMdOHAoiNOpL3jmLW2AQujeaVawMxdLGx9K7Ue+brYxAJaNEf1I9j mU3Q== 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 h9si28242123pgp.435.2019.07.30.10.10.15; Tue, 30 Jul 2019 10:10:31 -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 S1728835AbfG3LRy (ORCPT + 99 others); Tue, 30 Jul 2019 07:17:54 -0400 Received: from ozlabs.org ([203.11.71.1]:53757 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727036AbfG3LRy (ORCPT ); Tue, 30 Jul 2019 07:17:54 -0400 Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 45yYv11BhNz9s8m; Tue, 30 Jul 2019 21:17:48 +1000 (AEST) From: Michael Ellerman To: Arnd Bergmann , Segher Boessenkool Cc: Nathan Chancellor , Nick Desaulniers , christophe leroy , kbuild test robot , Benjamin Herrenschmidt , Paul Mackerras , linuxppc-dev , Linux Kernel Mailing List , clang-built-linux Subject: Re: [PATCH] powerpc: workaround clang codegen bug in dcbz In-Reply-To: References: <20190729202542.205309-1-ndesaulniers@google.com> <20190729203246.GA117371@archlinux-threadripper> <20190729215200.GN31406@gate.crashing.org> Date: Tue, 30 Jul 2019 21:17:43 +1000 Message-ID: <87h873zs88.fsf@concordia.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Arnd Bergmann writes: > On Mon, Jul 29, 2019 at 11:52 PM Segher Boessenkool > wrote: >> On Mon, Jul 29, 2019 at 01:32:46PM -0700, Nathan Chancellor wrote: >> > For the record: >> > >> > https://godbolt.org/z/z57VU7 >> > >> > This seems consistent with what Michael found so I don't think a revert >> > is entirely unreasonable. >> >> Try this: >> >> https://godbolt.org/z/6_ZfVi >> >> This matters in non-trivial loops, for example. But all current cases >> where such non-trivial loops are done with cache block instructions are >> actually written in real assembler already, using two registers. >> Because performance matters. Not that I recommend writing code as >> critical as memset in C with inline asm :-) > > Upon a second look, I think the issue is that the "Z" is an input argument > when it should be an output. clang decides that it can make a copy of the > input and pass that into the inline asm. This is not the most efficient > way, but it seems entirely correct according to the constraints. > > Changing it to an output "=Z" constraint seems to make it work: > > https://godbolt.org/z/FwEqHf > > Clang still doesn't use the optimum form, but it passes the correct pointer. Thanks Arnd. This seems like a better solution. I'll drop the revert I have staged. Segher does this look OK to you? Nathan/Nick, are one of you able to test this with your clang CI? cheers