From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 4DFA63856964 for ; Mon, 22 May 2023 20:52:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4DFA63856964 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684788726; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=V/0ajGgLvbRDrS76aTe9+iEPRPSJHzFjaTYbpnQg7Yw=; b=f8jYRWRr7yn5lfLdRF1ZVBa39g7LJVAmIjd5BHaAqHyVsNWXW9vl9y8ZxDvzDpdv/u6MFb KSBHtjL7LTisuxEKoIp5DOoQwBNKWJ/Pv2+faSxxL0K+fj60uAI/lpyGTSLSZTgYWvS4t1 wUDqY5H9aFgD4aja2mGhCXH+/Ve885I= Received: from mail-lf1-f71.google.com (mail-lf1-f71.google.com [209.85.167.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-614-eEbbWKh4NASO1edXtFIiPA-1; Mon, 22 May 2023 16:52:01 -0400 X-MC-Unique: eEbbWKh4NASO1edXtFIiPA-1 Received: by mail-lf1-f71.google.com with SMTP id 2adb3069b0e04-4f3a9670ae0so2353601e87.2 for ; Mon, 22 May 2023 13:52:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684788720; x=1687380720; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=V/0ajGgLvbRDrS76aTe9+iEPRPSJHzFjaTYbpnQg7Yw=; b=CdBgUaf+8+yT4DWolaMflV7KM9GoqWbPg2e5k49b8uvNYpOasI2LWlHrKhhBPu0JIH kSbRGrZpZr+Ku26Hb5BPcVqRP3pUn2enDvYEzBVddIWK0T7r53GikcoTEashc7XPdJH2 JIXrVBe4c/GLNTTkNR62i83h9VMpSSoxWw7RJD4AE8pz6xjB1MCTohNxMy2mbwMpLYX2 jKtLBTn3HiDkaHZAHRdhNsLLFs/cCIKGfG+Luz6XwaSRe4+g8U/JE7qwFIsOsW0cC+5G NwrSSzXqpd2qtc9O83y2YbZBwV5MF/StNTEW4PmyxOVLHsylPRUdhkXkS/AWVr/os/uT DPvQ== X-Gm-Message-State: AC+VfDydzd9Ie+xbA5ll7jj/GX7lUdKvUPae9Adc/wwE0SBuqpfGbomm hqbmuOOII9hJjeLC9lMtbI6MehrMvTIPvXgPrwefUDOOxY0EaKgTKSxs8XO9sglcC600zB0dJ7p B3B1/6XJx9p1uZaz0Z27p7FLlBk8dWyU= X-Received: by 2002:ac2:5a0b:0:b0:4ef:e87e:df88 with SMTP id q11-20020ac25a0b000000b004efe87edf88mr3537361lfn.64.1684788720404; Mon, 22 May 2023 13:52:00 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ58fl6v4rnbY1jjBPHGJcad60YwWoX8fM45RBK1NaHInJnobbSTRJEG1/SJnGl0VsLgq1qtaaqMj8Z6gfMGmng= X-Received: by 2002:ac2:5a0b:0:b0:4ef:e87e:df88 with SMTP id q11-20020ac25a0b000000b004efe87edf88mr3537357lfn.64.1684788720092; Mon, 22 May 2023 13:52:00 -0700 (PDT) MIME-Version: 1.0 References: <116291317.nniJfEyVGO@minbar> <13129784.rMLUfLXkoz@minbar> In-Reply-To: <13129784.rMLUfLXkoz@minbar> From: Jonathan Wakely Date: Mon, 22 May 2023 21:51:49 +0100 Message-ID: Subject: Re: [PATCH] libstdc++: Add missing constexpr to simd To: Matthias Kretz Cc: gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/alternative; boundary="0000000000002ee0b205fc4e71a5" X-Spam-Status: No, score=-6.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --0000000000002ee0b205fc4e71a5 Content-Type: text/plain; charset="UTF-8" On Mon, 22 May 2023 at 21:27, Matthias Kretz wrote: > On Monday, 22 May 2023 18:25:15 CEST Jonathan Wakely wrote: > > I note that using if (not __builtin_constant_evaluated()) will fail if > > compiled with -fno-operator-names, which is why we don't use 'not', > 'and', > > etc. elsewhere in libstdc++. I don't know if (or why) anybody uses that > > option though, so I don't think you need to hange anything in stdx::simd. > > Ah, I just recently convinced myself that "operator-names" are more > readable > (=> easier to maintain). I tend to agree, but every time I decide to start using them some testcases start to fail and I remember why we don't use them :-( > But OTOH a mix isn't necessarily better. I'm fine > with keeping it consistent. > > > > * subscripting vector builtins is not allowed in constant expressions > > > > Is that just because nobody made it work (yet)? > > That is a good question. I guess I should open a PR. > > > * if the implementation needs/uses memcpy > > > > > * if the implementation would otherwise call SIMD intrinsics/builtins > > > > The indentation looks off here and in the _M_set member function > following > > it: > > Yes. I had to put an #if between an else and an if. Looks like this: > > else > #ifdef _GLIBCXX_SIMD_USE_ALIASING_LOADS > if (not __builtin_is_constant_evaluated()) > return reinterpret_cast*>(this)[__i]; > else > #endif > if constexpr (__is_scalar_abi<_Abi0>()) > > Ah yes, so the if is indented two spaces from the else above it. What looks wrong to me is that the return is the at the same indentation as the if controlling it. > Should the `if` be aligned to the `else` instead? > How about moving the two else tokens? #ifdef _GLIBCXX_SIMD_USE_ALIASING_LOADS else if (not __builtin_is_constant_evaluated()) return reinterpret_cast*>(this)[__i]; #endif else if constexpr (__is_scalar_abi<_Abi0>()) I think that avoids the issue. > > > Are the copyright years on > > testsuite/experimental/simd/pr109261_constexpr_simd.cc correct, or just > > copy&paste? > > Right, copy&paste. Should I simply remove the complete header? > > You could do. I don't think there's much in that test that's novel or worth asserting copyright over - but if you disagree and want to assign whatever is copyrightable to the FSF, keep the header but fix the years. Either way is fine by me. OK for trunk and backports, with the comments above suitably resolved. --0000000000002ee0b205fc4e71a5--