Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp4513ybk; Tue, 12 May 2020 13:40:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxmZfyBq5o6wIp5IO/fHTqJQ1S2nDNcf6lcMRyfBqy9zuNeS9Q2VRLz4kur6EDib7a+7hP7 X-Received: by 2002:a17:906:2f90:: with SMTP id w16mr7878019eji.252.1589316013575; Tue, 12 May 2020 13:40:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589316013; cv=none; d=google.com; s=arc-20160816; b=Eo6QIHc3lRqGCImiXq7ZNjzVe0SSekCLRX5z5Ad7ESIIglGa47gEUrPV1HLKy4MfVr cv2uabY3wOW1P6T2CmfLhNtt4pdhPX+PFvJJQR7KfJ63c45zIingWx2yK2EXFiqXYGJz nwvC1M7vHs7WGIFiE6WqoCMfbxSBJGQlawVue00IB4tqauFiSrKmGHs89GkSMJ9KkVQ6 B13W0f4Fncgtge1eJ7Ahi3dFnjAwNsmWoVlER+QJAo3xpe91YBoKOJy90v3tCru9LmqJ E5mWBSMDuo+uYpTkgg8d645YxiVsNNmMJkGcMnbJHdgkmYmOZJtcbo/ONsdxzP69xRRB 8eYg== 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=fA+SFwBMG0B5q95uQj1Y/25AozYOQi3LQJpnB/wY8BA=; b=pti5+bdWUJ1YGToG8YDDQwa96m1bZvfC0WXZuXxk0uFGZ0syqZn21wW2gUWlScmCND 4q5nczrfcitFb6l8RNlPBEofXBoW8x/bkQg3Z0vQuHQWeCirp2U//4kebUAYbpR4PuaR yIgPbpybwvv4o3KzeQwivS3pUYAhCGiW5MKCSkgeJUB/C5eEXJ7E08yIxY2vHqsskdae rWqGdkAMivlVRU3jbS27xlHavIbfFuU3yODDI/PaBewoy6rvmBWJwAif6dhAfMpnMFf4 n20CC0cmiZ04sRfIEFBUaX5QDWQbbsxcI0+251QgmecIJ7y29PAt/UBQ+qRaNdWDXhNP VCWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="dVt1sse/"; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f15si8372089ejf.515.2020.05.12.13.39.43; Tue, 12 May 2020 13:40:13 -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=@google.com header.s=20161025 header.b="dVt1sse/"; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731237AbgELUfv (ORCPT + 99 others); Tue, 12 May 2020 16:35:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1731204AbgELUfr (ORCPT ); Tue, 12 May 2020 16:35:47 -0400 Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C3C6C061A0C for ; Tue, 12 May 2020 13:35:46 -0700 (PDT) Received: by mail-pf1-x442.google.com with SMTP id x15so6349532pfa.1 for ; Tue, 12 May 2020 13:35:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=fA+SFwBMG0B5q95uQj1Y/25AozYOQi3LQJpnB/wY8BA=; b=dVt1sse/36kMvyQZ7SdShYsjAHg2CeZhz7Zucj1eJ6xyjAZoaG7YXH9LVJTofoiHoJ Fn/kXQ8xNwJfVW+qX58+1aopWn5WBOVaM5vMUPbpLCsqYJ0ESQjtV0cF4/2UVGcAjyPV 54tfeSq01hKoj+TnT66yYB5mVPEdWWaCRWVjttK9Stb8BfJLH2IlJCOZWKflZt65eCY+ ronz3+RQOuNIHdojaZ3ED0chh13WJKch96qCwmAPkP80djafLZkkBZ9qGt175uE9ENQ7 HW9ldYLxe2nNbwm0+SOC/5qgSv9GvYIEcI+Q0rwWuR94sIJcS+V4j45gD7epInhggPA5 oLUw== 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=fA+SFwBMG0B5q95uQj1Y/25AozYOQi3LQJpnB/wY8BA=; b=Le4N2TH4anIMflkW3GiF3a6OBFWlmjuVivfWwgYWyl/JIXpkD9d41r063mkR6erd1Q g4CneCSiqa5nhdShDUbJNeMbZfZihTw+F+XQ0scPydlaM3F63lUMbKae5ywyRLfUzMsh zF3S+wgrCG10FvGZXoegso6SEFkkXHylOBZFigNaE1Fv9DyQ4hvaZ1wknXgP3Lp7mfqZ sFJ5QUVeeJ2mJR7OGuZy84qsc/5uwn1cKoiO7ktidVVmEEHD2ro3+w/b1HcWdktSCyrv jH0iv9nWZ3c6FRo6Qm2lU3fkKW2XAffR1k/4NKQQXLl7yAWcQHGu98NuLd9+MXO1YJOO LorQ== X-Gm-Message-State: AGi0Pubh9JKQVKc63Nt3GaSom8H1tdgu2dah6F4L0a+P72xRSGdMS8GK 3QoL2UNjUf09TmEsW0AaWiNO9to2Q5x0Jn2RwX5kkw== X-Received: by 2002:a65:5b84:: with SMTP id i4mr21863134pgr.263.1589315745789; Tue, 12 May 2020 13:35:45 -0700 (PDT) MIME-Version: 1.0 References: <20200504230309.237398-1-ndesaulniers@google.com> <7fa3a927ff63ca2f6587cfbac0ac76d2c11c4b5f.camel@infradead.org> In-Reply-To: <7fa3a927ff63ca2f6587cfbac0ac76d2c11c4b5f.camel@infradead.org> From: Nick Desaulniers Date: Tue, 12 May 2020 13:35:34 -0700 Message-ID: Subject: Re: [PATCH] x86: support i386 with Clang To: David Woodhouse Cc: Linus Torvalds , Thomas Gleixner , Ingo Molnar , Borislav Petkov , 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 1:03 PM David Woodhouse wrote: > > On Mon, 2020-05-11 at 13:01 -0700, Linus Torvalds wrote: > > 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. > > I'm also mildly concerned that LLVM will start to whine about the 'ri' > case too. It's odd that it doesn't, even when GCC does. Ah, sorry, it took me a while to understand what case you meant by this. I recall you pointing this out previously in https://bugs.llvm.org/show_bug.cgi?id=33587#c16, but at the time I simply wasn't well versed enough in inline asm to understand. The case you're referring to is 64b operands, "r" constraint, -m32 target. Yes, if I fix that: https://reviews.llvm.org/D79804, then this whole patch needs to be reworked. Back to the drawing board. -- Thanks, ~Nick Desaulniers