Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2086357ybk; Mon, 11 May 2020 11:34:22 -0700 (PDT) X-Google-Smtp-Source: APiQypL63inMaCGwxZFzkBTZg0F2Rk80uBOuwMU/62LZ9wSth+Ep3n0C/rOdtYIfBOx6ObxUe6pE X-Received: by 2002:a17:906:400a:: with SMTP id v10mr13999960ejj.300.1589222061904; Mon, 11 May 2020 11:34:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589222061; cv=none; d=google.com; s=arc-20160816; b=RwcLbeP79c9nVs8/FEx6VVcFepDiIYZ2lm+KC961tZHWh2gIcJbuvPv/6B/69Zjrs9 1xN9dLYb/Fdw7Iz6dd+AzMBStzdI6m/1UEqTivtm0DJGi12ozgItl19nlgJVzIvnxIUI XyxOfzhiBpkshF4Uc63OOiu4eedF3dDqPdAo/c3XxZO57x1fkWtqDMBnEoMwJ779Vojy Stqi8euLJACv7V9QezuGOjyLjO6//LEsE+WwOgbSkPOdvLzVEhLSMqVAwfkZlqG1NiHa 4LxArTGIEPaeuSVh+7043NKOEiZzO2TjDERkDzLgTWqyCi2eqRdwjlKJfsuwhQbafHsJ xiHg== 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:dkim-signature; bh=xryJwG59JLB17PZEyr7DCd9/6LaHNOFAsde4B/bIMlo=; b=cG9gcXXpKgv11JK8vZYsqOhmTXsiaOtaGdQA/OLSNE57N+mdyqrxrA9PiN5uu8BZRF UxRqFgFdPL5dKFTIxomIYiG+ZEw5F4dJqJ91mhN+fCE222Az3mu8ydLiLIRhb+F7n6gf C+AOcokTb89biiMoeqw0NclVAxytuZlBpljjx0OEif09rbz11HCkuZsp5cvB9Uwgq8y5 w9kGEmEVzKW3V0qZh9J06StvCv6XKIIBc+aeOgxjc6qP2GHyMKUd9miOVLJvrqCrAjS7 xPeUgRVBMgE65QZH2nKWf3UilcS2CIgXspwRRIeGXCWoBf09qiHcT/AbZCX8Le2in6gg UopA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b="g/MBnQ5L"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d6si6292657ejr.400.2020.05.11.11.33.58; Mon, 11 May 2020 11:34:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b="g/MBnQ5L"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731118AbgEKSac (ORCPT + 99 others); Mon, 11 May 2020 14:30:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1729905AbgEKSac (ORCPT ); Mon, 11 May 2020 14:30:32 -0400 Received: from mail-ed1-x542.google.com (mail-ed1-x542.google.com [IPv6:2a00:1450:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A74EAC061A0C for ; Mon, 11 May 2020 11:30:31 -0700 (PDT) Received: by mail-ed1-x542.google.com with SMTP id d16so8846181edq.7 for ; Mon, 11 May 2020 11:30:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=xryJwG59JLB17PZEyr7DCd9/6LaHNOFAsde4B/bIMlo=; b=g/MBnQ5L6r5hjAiqwK3Lokfo6oOGGuM5QvnhrybDQ8sLEIE9qu0oU9BD1e40bwbjAC M+dhC4n2RQfKhcKsZNLukjmvWdhFWzFs4+nXX9dq4XhIt5ePh2P/IqRFgcbyzxa/All8 k52VX6HiUg8D6PfcVMkdAhelN3aqeQxt4UIbs= 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=xryJwG59JLB17PZEyr7DCd9/6LaHNOFAsde4B/bIMlo=; b=fYdknLbFWuMMXNj96oCYEvtBJUdIJOOHpJd8pXAkVJFXqhL8Vmt9OC8a3KlfIgB6qc YIVxUz9a3tyGuyYmS2Zq4Ud7xgLNKTvWS9AMk2hSEjtEzeCVjshDoiqbJ5nu0W1Lvukt CotuybGmOKjx4wft2Tp3ZkNwlGIQWBK6MLDyzMkEkxBi3A+5NMpb0nNCx1fl3WrHpjW6 gl1jfwAK8LjTyarbI1A2ePH5V9Z+pgqtZTe5YpyDnxTMuM6cm+Oib4M1BAj/u3tYMW/8 6x8Pq5ZO+CrJjbJ5wraYkgcbhV9s+dxLXDdaFfCxi9DmFhpXYFjdSuMASDiB1WrPVHIB UOpg== X-Gm-Message-State: AGi0PuYxkOPJL6K+pyN38oWB+CXyZUYRGCE5yRo3TgIVQm+E1gS2MZNF 3TdlQf74c7uuaNcV/g36zUkyM2U2QWM= X-Received: by 2002:a50:9e6a:: with SMTP id z97mr13974085ede.375.1589221830071; Mon, 11 May 2020 11:30:30 -0700 (PDT) Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com. [209.85.221.53]) by smtp.gmail.com with ESMTPSA id k21sm1283608ejr.61.2020.05.11.11.30.29 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 11 May 2020 11:30:29 -0700 (PDT) Received: by mail-wr1-f53.google.com with SMTP id w7so12232043wre.13 for ; Mon, 11 May 2020 11:30:29 -0700 (PDT) X-Received: by 2002:a2e:9a54:: with SMTP id k20mr11787437ljj.265.1589221464037; Mon, 11 May 2020 11:24:24 -0700 (PDT) MIME-Version: 1.0 References: <20200504230309.237398-1-ndesaulniers@google.com> In-Reply-To: From: Linus Torvalds Date: Mon, 11 May 2020 11:24:07 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] x86: support i386 with Clang To: Nick Desaulniers Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , David Woodhouse , Arnd Bergmann , Dmitry Golovin , Dennis Zhou , Tejun Heo , Christoph Lameter , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "H. Peter Anvin" , Al Viro , Josh Poimboeuf , Masami Hiramatsu , Peter Zijlstra , LKML , clang-built-linux Content-Type: multipart/mixed; boundary="000000000000d91fe305a563741a" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --000000000000d91fe305a563741a Content-Type: text/plain; charset="UTF-8" On Mon, May 11, 2020 at 11:12 AM Linus Torvalds wrote: > > Would using "__builtin_choose_expr()" be able to avoid this whole issue? We actually have a fair amount of "pick expression based on size", so with a few helper macros we could make the code look better than the case statements too. Something (ENTIRELY UNTESTED!) like the attached patch, perhaps? NOTE! I only converted one single use to that "pick_size_xyz()" model. If this actually works for clang too, we could do the others. I guess I should just test it, since I have that clang tree. Linus --000000000000d91fe305a563741a Content-Type: application/octet-stream; name=patch Content-Disposition: attachment; filename=patch Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_ka2tez6f0 IGFyY2gveDg2L2luY2x1ZGUvYXNtL3BlcmNwdS5oIHwgMzEgKysrKysrKysrKysrKysrKy0tLS0t LS0tLS0tLS0tLQogMSBmaWxlIGNoYW5nZWQsIDE2IGluc2VydGlvbnMoKyksIDE1IGRlbGV0aW9u cygtKQoKZGlmZiAtLWdpdCBhL2FyY2gveDg2L2luY2x1ZGUvYXNtL3BlcmNwdS5oIGIvYXJjaC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KLQl9CQkJCQkJXAorCQkgICAgOiAicmUiICgocHRvX1RfXyko dmFsKSkpKTsJCVwKIH0gd2hpbGUgKDApCiAKIC8qCg== --000000000000d91fe305a563741a--