From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 0C9C14D938 for ; Mon, 2 Jun 2025 18:41:57 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 6C0DF68DF2F; Mon, 2 Jun 2025 21:41:53 +0300 (EEST) Received: from mail-vk1-f171.google.com (mail-vk1-f171.google.com [209.85.221.171]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id D081168DEC8 for ; Mon, 2 Jun 2025 21:41:46 +0300 (EEST) Received: by mail-vk1-f171.google.com with SMTP id 71dfb90a1353d-528ce9731dbso1351568e0c.0 for ; Mon, 02 Jun 2025 11:41:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1748889705; x=1749494505; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=c9TyUfcdeTh0n58p9x+g3H8M3XN39FnbmnuMEvp3fwE=; b=cs1pZMYGO6CVHABCNPbfhmBjuJL9Gz5MzIoi//AItsNYQuEIvlavqnSPido9MbvdBI EntDYpCpG/yNSzGcqBWqsoN2yw4Hf5O4eweWloH3GwbcDEwWfSKdm9Dic1vMGU9F6jnx vv1HaDLM+ukZjZbqk0czlgIVfRmboWCSMz740PrJi6mEew1IWWIFPOm/+ChuR28um1YF YK0+qXxZBu5j3Gu4TsupsqG5Lgu5qiFtu5FZMva/7lLqWZTskqQ8n+v88s6fIUaFQcD7 YwMc2QYUU/+NJEzdN9Wg7720Xs3C/Jy95TYwBqW30LRFbpxX7lwirCn7JJUV8Hncg1Zv r1kA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748889705; x=1749494505; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=c9TyUfcdeTh0n58p9x+g3H8M3XN39FnbmnuMEvp3fwE=; b=YsW5V1KssOymo7E73yTXOqmpdXleJti2x6hxFQ/pHErq150Th/V8rqYvpZJPfLLWnd IIUR9RFpp2bizK4mTMG+pLR7SulSUayTQgEOjifAuMm5szrcHWClyDsmAqtYeW3vYF6e kL8zWWk4V7SgwifI2c89hDMdfjSer6grwC2T3S1rGQkmCNeI8qd/ay70xNngwBEwq0W0 QrJFn3riXacTRsvE+kWF+rSQZM4yLD1r99AtaWbhwHOemxbkchHXqJZ1yDVGmnwXhjR3 uYVuQDKqX7Qs7JtRSyzoUVZElruLEWgEgAlAMzj2VsRXElH6TCLgETxKrXG9jXmcqtKl Qd4A== X-Gm-Message-State: AOJu0YxRIBc0Cp2HrMo5C5vUO2xgLEcTAZZMtW86b5VSxvzBTuf317bm zX+nRQV+dnt9nd+pR31GIy8GJctlwD2V8xsJJEH0dWbkFl9RCs+XD6Ft8ki23w== X-Gm-Gg: ASbGncsYxYZTAf6ok61mW/GSRlsS8UgdYWx8vtHBA1Mi9wb8eRbpEhQZdSxA0MtKPLm hv3TN9rctRaNTxY8eNnruACWhiNBnYhgnl0koMgdQQI2vy38U0PzmuwGa6KGnDSeb32Ye29oQkv bLzf5IwPpwAqcV1GCOJ0oHab9hzvk929t27j/7b6VHtdTV4TqmHjVwe1meGWyeHfZOQSwHBycTK 9sBMFO4OpppPziNalsvDKIjywTvhIqhix95WcdKII7fbCo70v3mjZr4FELVgmye6BhSyxjLDl6E 1qiAblcteLr96XJVmF3qaKjyQyzG+hE5tgVDYaLLaXCO44K+vs9Ik7GoulsrfNTuQip2QtqQ2oL rK7AcXw== X-Google-Smtp-Source: AGHT+IFFHzm+lr75dYZcipuaHfYgi3vUcnIFZfXsrxwKYmgfWA1Wq+3quaJA0zo+UX+Pp9wcKC7Vwg== X-Received: by 2002:a05:6122:3087:b0:518:6286:87a4 with SMTP id 71dfb90a1353d-530936c605cmr6948722e0c.4.1748889704958; Mon, 02 Jun 2025 11:41:44 -0700 (PDT) Received: from localhost.localdomain ([2800:2121:b000:82e:3027:d8b2:9cdc:de82]) by smtp.gmail.com with ESMTPSA id 71dfb90a1353d-53074aaf42bsm8113598e0c.9.2025.06.02.11.41.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Jun 2025 11:41:44 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Mon, 2 Jun 2025 15:41:33 -0300 Message-ID: <20250602184133.2175-1-jamrial@gmail.com> X-Mailer: git-send-email 2.49.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avutil/x86/intmath: remove inline asm implementations for clip functions 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-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: GCC/Clang is smart enough to emit minss/maxss the same way as these functions. The only theoretical benefit was in x86_32, where x87 floats are used, but the penalty of making the clipping opaque to the compiler's scheduler plus moving values from mmx regs to xmm and back will offset any potential speedup. x86_32 builds targetting anything made in the last two decades and a half should use -msse -mfp=sse anyway. Signed-off-by: James Almer --- libavutil/x86/intmath.h | 62 ----------------------------------------- 1 file changed, 62 deletions(-) diff --git a/libavutil/x86/intmath.h b/libavutil/x86/intmath.h index 4893a1f1b4..735945ca95 100644 --- a/libavutil/x86/intmath.h +++ b/libavutil/x86/intmath.h @@ -114,68 +114,6 @@ static av_always_inline av_const unsigned av_zero_extend_bmi2(unsigned a, unsign #endif /* __BMI2__ */ -#if defined(__SSE2__) && !defined(__INTEL_COMPILER) - -#define av_clipd av_clipd_sse2 -static av_always_inline av_const double av_clipd_sse2(double a, double amin, double amax) -{ -#if defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2 - if (amin > amax) abort(); -#endif - __asm__ ("maxsd %1, %0 \n\t" - "minsd %2, %0 \n\t" - : "+&x"(a) : "xm"(amin), "xm"(amax)); - return a; -} - -#endif /* __SSE2__ */ - -#if defined(__SSE__) && !defined(__INTEL_COMPILER) - -#define av_clipf av_clipf_sse -static av_always_inline av_const float av_clipf_sse(float a, float amin, float amax) -{ -#if defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2 - if (amin > amax) abort(); -#endif - __asm__ ("maxss %1, %0 \n\t" - "minss %2, %0 \n\t" - : "+&x"(a) : "xm"(amin), "xm"(amax)); - return a; -} - -#endif /* __SSE__ */ - -#if defined(__AVX__) && !defined(__INTEL_COMPILER) - -#undef av_clipd -#define av_clipd av_clipd_avx -static av_always_inline av_const double av_clipd_avx(double a, double amin, double amax) -{ -#if defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2 - if (amin > amax) abort(); -#endif - __asm__ ("vmaxsd %1, %0, %0 \n\t" - "vminsd %2, %0, %0 \n\t" - : "+&x"(a) : "xm"(amin), "xm"(amax)); - return a; -} - -#undef av_clipf -#define av_clipf av_clipf_avx -static av_always_inline av_const float av_clipf_avx(float a, float amin, float amax) -{ -#if defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2 - if (amin > amax) abort(); -#endif - __asm__ ("vmaxss %1, %0, %0 \n\t" - "vminss %2, %0, %0 \n\t" - : "+&x"(a) : "xm"(amin), "xm"(amax)); - return a; -} - -#endif /* __AVX__ */ - #endif /* __GNUC__ */ #endif /* AVUTIL_X86_INTMATH_H */ -- 2.49.0 _______________________________________________ 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".