From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id 323F73858D3C for ; Mon, 6 Nov 2023 11:24:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 323F73858D3C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 323F73858D3C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699269858; cv=none; b=Xtwf5h/CcQpJvYdUDhCjo3pindmdoo3MkoFiOTKdTRsFV1QhWBzrdQ+fPpWfJK2/vyvl7NbtgGG7EXyvf7cfg0cVcKquWTwRot4JHj/PcNjFj1Dc5UxJi7AlpIUdbrxrXYl0C7WrsSaLj/KAMNsmN9DtzhP+KmcW2r4G3loA2cM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699269858; c=relaxed/simple; bh=KV8VPzxng71Ji0UoedCxSsSsZ14EZQi3yl5sUQlIMSY=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=F8096aSjCY2Cc8LZxZG3445ISbr/EYVwikiI+1zNFy5x2GIjROWsh0qfMhkhHUIcUxacmBi6DsyPQIxU7nzB5BK67j30Un+gm6tM7+F+lHxgH7IBaz9sai/3qRGPAyA4ayjB4mGQue5482yTGdn3Zwzq5Wkpd9F9pMNIk9tBPQY= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id EE10E1FB; Mon, 6 Nov 2023 03:25:00 -0800 (PST) Received: from localhost (e121540-lin.manchester.arm.com [10.32.110.72]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3C4F33F64C; Mon, 6 Nov 2023 03:24:16 -0800 (PST) From: Richard Sandiford To: Stamatis Markianos-Wright Mail-Followup-To: Stamatis Markianos-Wright ,Stamatis Markianos-Wright via Gcc-patches , Richard Earnshaw , richard.sandiford@arm.com Cc: Stamatis Markianos-Wright via Gcc-patches , Richard Earnshaw Subject: Re: [PING][PATCH 2/2] arm: Add support for MVE Tail-Predicated Low Overhead Loops References: <949f5dd0-cdf0-715a-f04c-3de80c9b974f@arm.com> <32452185-e459-4521-9b77-e80d06573ee2@arm.com> Date: Mon, 06 Nov 2023 11:24:14 +0000 In-Reply-To: <32452185-e459-4521-9b77-e80d06573ee2@arm.com> (Stamatis Markianos-Wright's message of "Mon, 6 Nov 2023 11:03:55 +0000") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.3 required=5.0 tests=BAYES_00,KAM_DMARC_NONE,KAM_DMARC_STATUS,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_NONE,SPF_NONE,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: Stamatis Markianos-Wright writes: >> One of the main reasons for reading the arm bits was to try to answer >> the question: if we switch to a downcounting loop with a GE condition, >> how do we make sure that the start value is not a large unsigned >> number that is interpreted as negative by GE? E.g. if the loop >> originally counted up in steps of N and used an LTU condition, >> it could stop at a value in the range [INT_MAX + 1, UINT_MAX]. >> But the loop might never iterate if we start counting down from >> most values in that range. >> >> Does the patch handle that? > > So AFAICT this is actually handled in the generic code in `doloop_valid_p= `: > > This kind of loops fail because of they are "desc->infinite", then no=20 > loop-doloop conversion is attempted at all (even for standard dls/le loop= s) > > Thanks to that check I haven't been able to trigger anything like the=20 > behaviour you describe, do you think the=C2=A0doloop_valid_p checks are=20 > robust enough? The loops I was thinking of are provably not infinite though. E.g.: for (unsigned int i =3D 0; i < UINT_MAX - 100; ++i) ... is known to terminate. And doloop conversion is safe with the normal count-down-by-1 approach, so I don't think current code would need to reject it. I.e. a conversion to: unsigned int i =3D UINT_MAX - 101; do ... while (--i !=3D ~0U); would be safe, but a conversion to: int i =3D UINT_MAX - 101; do ... while ((i -=3D step, i > 0)); wouldn't, because the loop body would only be executed once. I'm only going off the name "infinite" though :) It's possible that it has more connotations than that. Thanks, Richard