Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4751748ybi; Tue, 30 Jul 2019 07:32:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqx1u2IrSLf5FSKnsQaq843DXWu76moj+l2XfajRYDo/+t3rIV25f/VpV8CwsEyP7Y+FXxVc X-Received: by 2002:a63:f452:: with SMTP id p18mr83599386pgk.373.1564497139814; Tue, 30 Jul 2019 07:32:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564497139; cv=none; d=google.com; s=arc-20160816; b=ZngUCLEak19M+KMTGRCNUnnKnQgd5fDvdKmgfXMrLWViIFHqT32zmVb3wvmzJPE+rY lDK7ja/1CSJAeczNfbeDnX4yeqjNWbiqjbX/nzD41sEhAiDXKAmPUtNA2SQGHbhvWo7h 3Di5tPzIy2n0ywm1/upBCdEQYnxrLQrkqiE4gLoc+vGo72wkMyAbRK3sf6fE7eY2gsZB JNsFry/9bqoCX8bcxArshs6aaZk3GIFKajHH4jZfuBa6z6IYVrqpi9svxBfnQKysiJXt +X2OQ6Nn1hnbfyAvwgDuysTV7DJaFYdBKg6cRV875wEEqHm/3RDHlADLvv4y9B/Fx1JK zyYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=Zr+6M31Gi9RIhd6WGjh1Vbf2RuBt7+NJdVFSHL2O2pg=; b=Stl60qzG3ZaBgZLK6gNpCOpf6Wg+9W+p3YfDMhkQj5FDtH1vK81fG6eBIvpfB3lfRz 1K1VKdpGbj0EYXHSooYrhIbEVm1Q/9+lRoR7cgGoqYoV5hjAd9lZCILgG48cQBewU/Yr ioePPXxpvnCitnQQ8YhyjhJ8M+BLCF6Vcx38NB2d4RHJ4h170VDCi/yPly13p6Dhgmi2 QSyMxd/SHqSbePz7BNmjdIZY7hfMaH32wr2sxbNJH18WpNG3zxfrAcjQ1Q7FsiNiKfGa WgkNszjMKKWozM9G20CwYIztsuf9IvM5cR+vDZ89co5ZJVJm0W2im89hQzoSPWniDD+B irrg== 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 m63si30010640pjb.8.2019.07.30.07.32.03; Tue, 30 Jul 2019 07:32:19 -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 S1730523AbfG3Heq (ORCPT + 99 others); Tue, 30 Jul 2019 03:34:46 -0400 Received: from mail-qk1-f196.google.com ([209.85.222.196]:39390 "EHLO mail-qk1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730509AbfG3Hep (ORCPT ); Tue, 30 Jul 2019 03:34:45 -0400 Received: by mail-qk1-f196.google.com with SMTP id w190so45875972qkc.6 for ; Tue, 30 Jul 2019 00:34:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Zr+6M31Gi9RIhd6WGjh1Vbf2RuBt7+NJdVFSHL2O2pg=; b=TaryWMMIw1asCdXr3irLnmKCisZfKs2JnwOX+AU+LBQY7fPxHjBGquXZ5VUbY8z6uF 5SWh1YeuPiG9my9J9OvEiHQqSa/nZ2bzqIsoydKeTtEqULZH68Fl9xRs6ri1H4y4G3oV IGf+sQcSR24ajyj2+CmpAIs83qhyyOhf1UVGjUuTTARleCmXIIvFTVkAKgUaiFv0ewlS 0JvNneuONzluJbjYAFeHu0NsrQa2dFE0AKiVqmaOw8742Ve0MDJuY6XlQ/l6/DvjSG7d 7QTwIKe1SV8eDwsw/nGPP9ErdGSi7KQXRwbYYM4JJICPR6O2DfnplFxt9ghKQl/IOHIe FKOw== X-Gm-Message-State: APjAAAUHmOolOfkWMBMovuNy8qwwXYhIPjmBCv4WRSbsw1WgXmFiiFdE nt5E3o8iRWTZYd0EV5oH7pX27JAUzjicy+sjdIM= X-Received: by 2002:a37:76c5:: with SMTP id r188mr74856027qkc.394.1564472084625; Tue, 30 Jul 2019 00:34:44 -0700 (PDT) MIME-Version: 1.0 References: <20190729202542.205309-1-ndesaulniers@google.com> <20190729203246.GA117371@archlinux-threadripper> <20190729215200.GN31406@gate.crashing.org> In-Reply-To: <20190729215200.GN31406@gate.crashing.org> From: Arnd Bergmann Date: Tue, 30 Jul 2019 09:34:28 +0200 Message-ID: Subject: Re: [PATCH] powerpc: workaround clang codegen bug in dcbz To: Segher Boessenkool Cc: Nathan Chancellor , Nick Desaulniers , Michael Ellerman , christophe leroy , kbuild test robot , Benjamin Herrenschmidt , Paul Mackerras , linuxppc-dev , Linux Kernel Mailing List , clang-built-linux Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Arnd