From patchwork Sat Aug 19 02:14:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brad Smith X-Patchwork-Id: 43269 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:47ca:b0:130:ccc6:6c4b with SMTP id ey10csp153714pzb; Fri, 18 Aug 2023 19:14:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFO01CoFD/dG/bfJfq7hM8BsPz1c56yL+WziGoNhPCKQXJC7CIBgdYkkz2IDhjnXBynmp55 X-Received: by 2002:a2e:9c98:0:b0:2b4:75f0:b9e9 with SMTP id x24-20020a2e9c98000000b002b475f0b9e9mr590752lji.10.1692411259430; Fri, 18 Aug 2023 19:14:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692411259; cv=none; d=google.com; s=arc-20160816; b=zdKiilkdbKxbEha4B4+QN3rekKGg+ymH387PQjblM9ELZEd3B+6mTtz4QQ+oo8/E2p 9YBuZr3KDS7GxLDAEkHp6UN7HmS9ad1G7sTXgvgdtC8lWKTJ8Yh21rtsN49dXJhtVykO QNIWdoggMM91BwsJCEGbx8+soYH08E/nZaqQyRZouww6Y/+Wl6a90XBk1NH0NDLxjQFv 6SvuSrKHb7+XEI4lEkjuazs9l5/2btJOuGh8E4DkxmGDm5fPp0E6ZHJXYhsrVtBw816u 3q0CJqTTddwKizEC+xdpsQtEFgZmNSSkpnPgx/BupRuOj1mR1baBOIK8ohKIAoemQQE4 yEoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:content-disposition:mime-version:message-id:to :from:date:domainkey-signature:dkim-signature:delivered-to; bh=U3Q+BaUVn/cdYAvPqPKTbCNa7ya6ktLyfss1Tnvh3Ao=; fh=+1STrpO0RulMF+g5MgEH9Wqquz8o1fugVmKEC/dDZ0I=; b=Nad9k0RRsRdM/+IQwGfR3lG8a4QXYitdtFPIVS/DdUfGAlHUEwfD6xB8J2uNBINsAj AMqFB6vHN78sK1ASNis3RwyrZspW9MQluI5TG0FFDU762aZD4wqryyNITkcbYNgaLrgu x8h1FSeZPXP5Lz1NByq6nif/hCqTe5bWBh7LfRITHKvsuHyA4DbPe4pIUT4+VMvbCN5V 4/WMZIpRqIsX+/UWSxgBjP0g3ta0hQqfFNrfsMDfnsHdgF6hEzV7mXB6mPszfL6n8AIx bIr6FBeUh4mAnpV5n93j/J7V1hZagOg62bUIEedFcIR6qAQKPpguH6K5pTS54D+CqlDx QtLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@comstyle.com header.s=default header.b="Z20LO/qk"; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id z20-20020a1709063a1400b00986b1c0b4d2si2418353eje.595.2023.08.18.19.14.18; Fri, 18 Aug 2023 19:14:19 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@comstyle.com header.s=default header.b="Z20LO/qk"; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 48A5B68C6C4; Sat, 19 Aug 2023 05:14:15 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.comstyle.com (speedy.comstyle.com [206.51.28.2]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A1FEE68C2C7 for ; Sat, 19 Aug 2023 05:14:08 +0300 (EEST) Received: from mail.comstyle.com (localhost [127.0.0.1]) by mail.comstyle.com (Postfix) with ESMTP id 4RSMk61PsLz8PbP for ; Fri, 18 Aug 2023 22:14:06 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=comstyle.com; h=date:from :to:subject:message-id:mime-version:content-type; s=default; bh= 3JFXAX6CSvrS9vOin3Y1gK9zSN0=; b=Z20LO/qkphAVdvdiR1E6xL0sIM8xr+7S /726VG13UgwwRHvjRW7ZxhIRAwHzsu3QHEqLNlbXnKgJGiPzyTwc9qUjq9JoEceg azk2rYC4uojXW3zSgF4C+Wf35q/MeUCVfj+MKa6XBeI0y5DEq+1uE5YFrgi7Ocp6 b9dbvr5ADFQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=comstyle.com; h=date:from:to :subject:message-id:mime-version:content-type; q=dns; s=default; b= HxBfo1s7uzcRf0oJb9hh6cajdntJXbQJ2HyctP4QNRsTZPSJVUxXwBp2hkHuJv3d XPtXMI6DavXVT8usvoOEyw4jep+UEVABM3V3/JkrlKkX2rADSCucxRXiCMVmLCGv fehp5yWAyabXjD+RiUOdmcK82gwuxWAPFlVH6muXg9c= Received: from humpty.home.comstyle.com (unknown [IPv6:2001:470:b050:3:b6ca:a725:d758:4b89]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA512) (No client certificate requested) (Authenticated sender: brad) by mail.comstyle.com (Postfix) with ESMTPSA id 4RSMk56Tq3z8PbN for ; Fri, 18 Aug 2023 22:14:05 -0400 (EDT) Date: Fri, 18 Aug 2023 22:14:04 -0400 From: Brad Smith To: ffmpeg-devel@ffmpeg.org Message-ID: MIME-Version: 1.0 Content-Disposition: inline Subject: [FFmpeg-devel] [PATCH v2] lsws/ppc/yuv2rgb_altivec: Fix build in non-VSX environments with Clang 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 6SnabsG4b55W lsws/ppc/yuv2rgb_altivec: Fix build in non-VSX environments with Clang Add a check for the existence of the vec_xl() function. Clang provides the function even with VSX not enabled. v2: test for function if AltiVec is enabled instead of with AltiVec and without VSX --- configure | 8 ++++++++ libswscale/ppc/yuv2rgb_altivec.c | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/configure b/configure index ff6a5c3600..637034e87d 100755 --- a/configure +++ b/configure @@ -2154,6 +2154,7 @@ ARCH_EXT_LIST_PPC=" ldbrx power8 ppc4xx + vec_xl vsx " @@ -2679,6 +2680,7 @@ altivec_deps="ppc" dcbzl_deps="ppc" ldbrx_deps="ppc" ppc4xx_deps="ppc" +vec_xl_deps="altivec" vsx_deps="altivec" power8_deps="vsx" @@ -6221,6 +6223,11 @@ elif enabled ppc; then check_cpp_condition power8 "altivec.h" "defined(_ARCH_PWR8)" fi + if enabled altivec; then + check_cc vec_xl altivec.h "const unsigned char *y1i = { 0 }; + vector unsigned char y0 = vec_xl(0, y1i);" + fi + elif enabled riscv; then enabled rvv && check_inline_asm rvv '".option arch, +v\nvsetivli zero, 0, e8, m1, ta, ma"' @@ -7731,6 +7738,7 @@ if enabled ppc; then echo "POWER8 enabled ${power8-no}" echo "PPC 4xx optimizations ${ppc4xx-no}" echo "dcbzl available ${dcbzl-no}" + echo "vec_xl available ${vec_xl-no}" fi if enabled loongarch; then echo "LSX enabled ${lsx-no}" diff --git a/libswscale/ppc/yuv2rgb_altivec.c b/libswscale/ppc/yuv2rgb_altivec.c index 5e1033a973..8b0a93796f 100644 --- a/libswscale/ppc/yuv2rgb_altivec.c +++ b/libswscale/ppc/yuv2rgb_altivec.c @@ -284,7 +284,7 @@ static inline void cvtyuvtoRGB(SwsContext *c, vector signed short Y, * ------------------------------------------------------------------------------ */ -#if !HAVE_VSX +#if !HAVE_VEC_XL static inline vector unsigned char vec_xl(signed long long offset, const ubyte *addr) { const vector unsigned char *v_addr = (const vector unsigned char *) (addr + offset); @@ -292,7 +292,7 @@ static inline vector unsigned char vec_xl(signed long long offset, const ubyte * return (vector unsigned char) vec_perm(v_addr[0], v_addr[1], align_perm); } -#endif /* !HAVE_VSX */ +#endif /* !HAVE_VEC_XL */ #define DEFCSP420_CVT(name, out_pixels) \ static int altivec_ ## name(SwsContext *c, const unsigned char **in, \