From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 60EC344214 for ; Fri, 2 Sep 2022 13:26:50 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id DE00468BA1F; Fri, 2 Sep 2022 16:26:48 +0300 (EEST) Received: from mail8.parnet.fi (mail8.parnet.fi [77.234.108.134]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8B83268B71E for ; Fri, 2 Sep 2022 16:26:42 +0300 (EEST) Received: from mail9.parnet.fi (mail9.parnet.fi [77.234.108.21]) by mail8.parnet.fi with ESMTP id 282DQfdM004544-282DQfdN004544 for ; Fri, 2 Sep 2022 16:26:41 +0300 Received: from foo.martin.st (host-97-187.parnet.fi [77.234.97.187]) by mail9.parnet.fi (Postfix) with ESMTPS id ED414A1467 for ; Fri, 2 Sep 2022 16:26:41 +0300 (EEST) Date: Fri, 2 Sep 2022 16:26:41 +0300 (EEST) From: =?ISO-8859-15?Q?Martin_Storsj=F6?= To: ffmpeg-devel@ffmpeg.org In-Reply-To: <20220826193057.3016569-1-martin@martin.st> Message-ID: References: <2756bf93-56c9-fbca-2683-620e4d172e5c@gmail.com> <20220826193057.3016569-1-martin@martin.st> MIME-Version: 1.0 X-FE-Policy-ID: 3:14:2:SYSTEM X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: Re: [FFmpeg-devel] [PATCH v2] arm: Check the build time constants in av_clip_*intp2 X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-15"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On Fri, 26 Aug 2022, Martin Storsj=F6 wrote: > This fixes building for arm targets with optimizations disabled. > --- > libavutil/arm/intmath.h | 24 ++++++++++++++++++------ > 1 file changed, 18 insertions(+), 6 deletions(-) > > diff --git a/libavutil/arm/intmath.h b/libavutil/arm/intmath.h > index 5311a7d52b..f19b21e98d 100644 > --- a/libavutil/arm/intmath.h > +++ b/libavutil/arm/intmath.h > @@ -65,17 +65,29 @@ static av_always_inline av_const int av_clip_int16_ar= m(int a) > #define av_clip_intp2 av_clip_intp2_arm > static av_always_inline av_const int av_clip_intp2_arm(int a, int p) > { > - unsigned x; > - __asm__ ("ssat %0, %2, %1" : "=3Dr"(x) : "r"(a), "i"(p+1)); > - return x; > + if (av_builtin_constant_p(p)) { > + unsigned x; > + __asm__ ("ssat %0, %2, %1" : "=3Dr"(x) : "r"(a), "i"(p+1)); > + return x; > + } else { > + if (((unsigned)a + (1 << p)) & ~((2 << p) - 1)) > + return (a >> 31) ^ ((1 << p) - 1); > + else > + return a; > + } > } > > #define av_clip_uintp2 av_clip_uintp2_arm > static av_always_inline av_const unsigned av_clip_uintp2_arm(int a, int p) > { > - unsigned x; > - __asm__ ("usat %0, %2, %1" : "=3Dr"(x) : "r"(a), "i"(p)); > - return x; > + if (av_builtin_constant_p(p)) { > + unsigned x; > + __asm__ ("usat %0, %2, %1" : "=3Dr"(x) : "r"(a), "i"(p)); > + return x; > + } else { > + if (a & ~((1<> 31 & ((1< + else return a; > + } > } > > #define av_sat_add32 av_sat_add32_arm > -- = > 2.25.1 OK'd by James on irc, will push later today. // Martin _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".