From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id B510A3858D3C for ; Sat, 27 May 2023 21:48:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B510A3858D3C Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=gmail.com Received: from mail-oi1-x22e.google.com ([2607:f8b0:4864:20::22e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q31ly-0000bZ-40 for gcc@gnu.org; Sat, 27 May 2023 17:48:27 -0400 Received: by mail-oi1-x22e.google.com with SMTP id 5614622812f47-39810ce3e13so1439006b6e.2 for ; Sat, 27 May 2023 14:48:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685224105; x=1687816105; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=dPLm9aczxFAVeXBTC0kmrkU2NkS3a1ZDbXxbHLQ6hSc=; b=mHeZyxMTGB9CEyKd0mNsdOva61eVXibHm6QsGqYM+x7KSIe0VQaT0/piYvUupTsAeh 9bNOcEVKNIG+K/g/ZGY4iqQf15N5xPaMRrX3LVWfrKppiCXPerKTFVPF6439atRiRXsH e1oI0NIy2MP+DUvaZZxTTTba0WlCE1gAau6V+U6pFqQWpJmsxcJMeMnZKJmSoB3sZL2C 5it3MFKkS5IgbEh1buUtpzGxz8kIpUIVRDMFVtkFgMO5XG3HyTIOY32HVMTJDLm1fLsN vjeGyL+V/ZXpQgnqeAUhGAo9ZxWG7ko6Cr1vgWIA65QVM31/V5vG2WorB1qKoLBXjSkz maow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685224105; x=1687816105; h=content-transfer-encoding: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=dPLm9aczxFAVeXBTC0kmrkU2NkS3a1ZDbXxbHLQ6hSc=; b=UTYs69TcWTQ2YHuAA1mng+UY4jKP4K54LO6CRcQV5zbZBQUaDD//jSQDjdk6OSg8cL VmRwCYPvNr0jMWFLi1c+8hqNp70ZRnpTFEUnRsUvxgJ6Xim6/J5n7tlpzvAfP/TAlka0 MBuVbWAAdf0oNnyPuUJ6v4jxmomk/Yr85eBnYHl9tclBc3s5kpdvIMN9QyjxL9IKPKXK XJ+FtgZ87rLHMV4llovI4nzAa6RCtdB67Q5sBGUxN6/spBvi8pqBMhGFz2Si/7t3NOBt kJvKbM3Cvq22YVBhjn1nW4/WTu9gKqhGl9baQziFJ7BqIxNRzrTaDreQArOCS0CGj6CO 6AYQ== X-Gm-Message-State: AC+VfDwyE8fpo5Bsx23usBBWAdUTCfYfRTKLvJ4SOsfKgA93c+cu7sg2 YehLxY7ZxmJB7wOOEwdJmYN1k8ivzenkxENYL3cSXxaq X-Google-Smtp-Source: ACHHUZ6ETb1uHmAkJ2MTSK4mBfO/cuIAQZULviFuV3S60cL2kZT1lvJG8AbOkYrDwEIYgHxRJHRyk1PrgDMznNpjBdY= X-Received: by 2002:a05:6808:91a:b0:398:937:6018 with SMTP id w26-20020a056808091a00b0039809376018mr2956492oih.10.1685224104725; Sat, 27 May 2023 14:48:24 -0700 (PDT) MIME-Version: 1.0 References: <23A490318B7149D88618A7CDA2CEDB14@H270> In-Reply-To: <23A490318B7149D88618A7CDA2CEDB14@H270> From: Andrew Pinski Date: Sat, 27 May 2023 14:47:52 -0700 Message-ID: Subject: Re: Who cares about performance (or Intel's CPU errata)? To: Stefan Kanthak Cc: gcc@gnu.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2607:f8b0:4864:20::22e; envelope-from=pinskia@gmail.com; helo=mail-oi1-x22e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9,DKIM_SIGNED=0.1,DKIM_VALID=-0.1,DKIM_VALID_AU=-0.1,DKIM_VALID_EF=-0.1,FREEMAIL_FROM=0.001,RCVD_IN_DNSWL_NONE=-0.0001,SPF_HELO_NONE=0.001,SPF_PASS=-0.001,T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_PASS,SPF_SOFTFAIL,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Sat, May 27, 2023 at 2:25=E2=80=AFPM Stefan Kanthak wrote: > > Just to show how SLOPPY, INCONSEQUENTIAL and INCOMPETENT GCC's developers= are: > > --- dontcare.c --- > int ispowerof2(unsigned __int128 argument) { > return __builtin_popcountll(argument) + __builtin_popcountll(argument= >> 64) =3D=3D 1; > } > --- EOF --- > > GCC 13.3 gcc -march=3Dhaswell -O3 > > https://gcc.godbolt.org/z/PPzYsPzMc > ispowerof2(unsigned __int128): > popcnt rdi, rdi > popcnt rsi, rsi > add esi, edi > xor eax, eax > cmp esi, 1 > sete al > ret > > OOPS: what about Intel's CPU errata regarding the false dependency on POP= CNTs output? Because the popcount is going to the same register, there is no false dependency .... The false dependency errata only applies if the result of the popcnt is going to a different register, the processor thinks it depends on the result in that register from a previous instruction but it does not (which is why it is called a false dependency). In this case it actually does depend on the previous result since the input is the same as the input. Thanks, Andrew > > See https://gcc.godbolt.org/z/jdjTc3EET for comparison! > > FIX YOUR BUGS, KIDS! > > Stefan