Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2145159ybk; Mon, 11 May 2020 13:04:01 -0700 (PDT) X-Google-Smtp-Source: APiQypK0jjNfM5Ft6WjRjB+eJzQ03UzBzotI/uJt5TnHUAhn8RMwBCvYWnDjPcXJglcIovzkzj+I X-Received: by 2002:a17:906:6b05:: with SMTP id q5mr14595467ejr.329.1589227441211; Mon, 11 May 2020 13:04:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589227441; cv=none; d=google.com; s=arc-20160816; b=KareDnEQnTdT6r8PtxJHGmKjyElzPrgmIvArCUoCcXwLsYG+qcSG+cglRzeGxb3j8p NbJbEbfWmypf4+lVOl5WHtDxpxLKWf/oNfhg6HQxbxYBPvjDPozxiYQG/MtYPeaiK2A4 qTum2SEbt5005Fu7xVkFRCAPC92zvTFlxSIj6oIXam3q4t8KDxhES/AcDo1Vl/hECiye p5KdKci3JItnVn0mJc4dEXuJxhVLfzUI42BBEDZJkzZltepDCGIEmSuo+66/Y3gdcrOF 6nRSB9EO0njTYava/AoTP87PlopeuEw1ffdHkXjZA2VwkdiVOuB51CJyLTKzZgLgUNMw aPUA== 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=qxWS8BqpexPsTW15vsMEf9TiqtDG6ywAaC/lrYZHjg8=; b=G5fU76mm0WiF6ycyirJ6x2QetMmN9tL9cHuHxKBY8ij7OC4hx95B1XY2eYIkoytyvq nQNDm/jGuev1CUdbVxY2Ww+YGjZ/PHrd6CPZTtgqc4SAf3Bnzb8Q9FyBycVL8GfaUXyy HwVcrZ0/ZXoCXkdrY2vxrM/YZ6lZDFpLm+EIhGeNvRtWY2TOi21eCxBC/W6Mpu/uu21q 9DmuHzvmjSLvs2Z/mIvyixXbOY3PdqzoFXZfmHBGaMtC2Us2bvhsFAwg10Y3wqtw7UrQ UGDblDxKiw5PCMwvDuLnbLZVf28bCvVNkKdwV9fumCwagJYRJ2l/WN2CM6AV2NGlAqY2 GisA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=SAhc+XRd; 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 p21si6856549edm.75.2020.05.11.13.03.38; Mon, 11 May 2020 13:04:01 -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=SAhc+XRd; 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 S1731320AbgEKUBh (ORCPT + 99 others); Mon, 11 May 2020 16:01:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727873AbgEKUBh (ORCPT ); Mon, 11 May 2020 16:01:37 -0400 Received: from mail-lj1-x242.google.com (mail-lj1-x242.google.com [IPv6:2a00:1450:4864:20::242]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF083C061A0C for ; Mon, 11 May 2020 13:01:36 -0700 (PDT) Received: by mail-lj1-x242.google.com with SMTP id g4so10977678ljl.2 for ; Mon, 11 May 2020 13:01:36 -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=qxWS8BqpexPsTW15vsMEf9TiqtDG6ywAaC/lrYZHjg8=; b=SAhc+XRdE2bzNzWVFE7tynEUkeDYtjq8hOohw+RGPZQrwwF4x7AKFQiUp29mWK0p6Q 8c5CTRCzMZIlZOZ+O/p96zbWICjULP4QYQc4IOiajmhp4HnF2vcI0Zyl7EVJtoPwSxia xuSxiPB0VpCHDyPh0GGHenK6kvvZ1PnSfJ+T0= 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=qxWS8BqpexPsTW15vsMEf9TiqtDG6ywAaC/lrYZHjg8=; b=KZvYBQX43U/GvzCiaA2wv1o0YMATtxOLBScrrcBd6gm/XMJXryVzlHOIFWEcPW5HO7 VNAyQRMxpbzE8B8hHGcJ0pImV+2OXv5/MGfSws9UZIY/cnbO1H+oM5tKStvtJpLU7dYX ryVS9PklYk4wg83prozjSthpc3X8I2HnlI5aS0aLXZZUoPItO8IeHIs76xHS65Y01Khc QP/eRFwhottJefpgsbHFt6lCJoKbSZcpDFQpI/7WiWadMLHm4u9IjNFs3Ykttr6L8xyO Zk12kymFjDJ6Rbv5GPnq/rUUBGCWZkn6MAXHch8HHTsxhxkeShxw1FIdZhYDu0DF8SBX Sm2A== X-Gm-Message-State: AOAM5307jetGlzMLi8FqBcW0Ug8eQ09slrO4ghrI5OOhq/uD79seQ7zc TIjDn+sZv4lrmoNOL5zxsiiRjzy9dts= X-Received: by 2002:a2e:978d:: with SMTP id y13mr8558608lji.80.1589227291868; Mon, 11 May 2020 13:01:31 -0700 (PDT) Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com. [209.85.208.176]) by smtp.gmail.com with ESMTPSA id r20sm10732105ljj.44.2020.05.11.13.01.29 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 11 May 2020 13:01:29 -0700 (PDT) Received: by mail-lj1-f176.google.com with SMTP id u15so10982226ljd.3 for ; Mon, 11 May 2020 13:01:29 -0700 (PDT) X-Received: by 2002:a2e:814e:: with SMTP id t14mr11207205ljg.204.1589227288953; Mon, 11 May 2020 13:01:28 -0700 (PDT) MIME-Version: 1.0 References: <20200504230309.237398-1-ndesaulniers@google.com> In-Reply-To: From: Linus Torvalds Date: Mon, 11 May 2020 13:01:13 -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: 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, May 11, 2020 at 12:52 PM Nick Desaulniers wrote: > > Interesting approach. Researching __builtin_choose_expr, it looks > like it was cited as prior art for C11's _Generic keyword. Well, the thing that made me think that __builtin_choose_expr() would work is that unlike the switch statement, you absolutely _have_ to do the choice in the front end. You can't leave it as some kind of optimization for later phases, because the choice od expression ends up also determining the type of the result, so it isn't just a local choice - it affects everything around that expression. But clang still doesn't like that "qi" constraint with a (non-chosen) expression that has a "u64" type. I guess we can take the stupid extra cast, but I think it would at least need a comment (maybe through a helper function) about why "qi" needs it, but "ri" does not, and why the cast to "unsigned long" is needed, even though "clearly" the type is already just 8 bits. Otherwise somebody will just remove that "obviously pointless" cast, and gcc will eat the result happily, and clang will fail. And nobody will notice for a while anyway, because this issue only happens on 32-bit targets, and developers don't use those any more. Linus