From patchwork Tue Oct 24 20:15:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dale Curtis X-Patchwork-Id: 5679 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.161.90 with SMTP id m26csp1036301jah; Tue, 24 Oct 2017 13:23:18 -0700 (PDT) X-Google-Smtp-Source: ABhQp+TYbI/1QoIdz4mxoO6E9aj1W1KfIWQzRmpbg6MaWYyzY416Xgg0eFqXFdUB3rHnvjweZ5F4 X-Received: by 10.223.174.134 with SMTP id y6mr16101192wrc.97.1508876598596; Tue, 24 Oct 2017 13:23:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508876598; cv=none; d=google.com; s=arc-20160816; b=KPpWnMmtnJN2hNApoV6mvKXYDm305CNGErvbhCbOHplFm+yjte84uNqrZXPizlhMn8 ZVWjLi8ZL7RldXGXPrriT3GY8EPxvsIfBneRD4Ubrx80xBcqBS7Zr1pj2gc7s8OxT+z9 zKCwxDWFYZa5dYa/2OV9zIV+4aAz3p0ctCr8H3/JDwoiAeSLABO5C40DoR8bNb5YxvZ9 8AO1QMKNpBdDkQtnUM6i6heqrFF4O780D+0M6/XmEtHK5tkdvs/o1Amfd6RbXQbTa1Un Umw6ecES+wsnnhJdXH8py/Er3LC6RMhNRhD21opA96+1ec3t8Kv1kNulAJ+FraqZq9s5 trrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject:to :message-id:date:from:mime-version:dkim-signature:dkim-signature :delivered-to:arc-authentication-results; bh=uarVoLxrfrzVDGQVEK2j5MHPEW8cMmpaQ0rnBUnqbFQ=; b=o9xErUECnfjH4kecC8hQYHeN/MHL+c1Vu5tEX8NgjjgTs7BO/yFeRkKmOTWxgwvG+l waOXvcSwY+upObash46p94Dnoyl0+mpA3TakIbHvb45tVfs3yQ916vYgn1LtjXHSOzDj ipUbxTtv4aiEuETIEUCaMLIEqVxKk4uuhEdMDFkfoSGu8OYyPLRQx3C2mvHPc+XJc9QB CneqjG20S/zKa/LUloYdaQGyuzclCdiOh+47C7L6UcS7EkbWCO3od5LwdatAh3Sd88iC T62sxWwJt3guDCpv9UVLG23wZexLuR4iH2G9/yfmEP4rARAR+xKNPR/sBRspSlQMGLxH 0NFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@google.com header.s=20161025 header.b=ajlZtVrt; dkim=neutral (body hash did not verify) header.i=@chromium.org header.s=google header.b=lj1TFzjk; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 11si728644wmh.188.2017.10.24.13.23.18; Tue, 24 Oct 2017 13:23:18 -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=@google.com header.s=20161025 header.b=ajlZtVrt; dkim=neutral (body hash did not verify) header.i=@chromium.org header.s=google header.b=lj1TFzjk; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B3A9B689FFD; Tue, 24 Oct 2017 23:23:09 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm0-f50.google.com (mail-wm0-f50.google.com [74.125.82.50]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 29EBE689E82 for ; Tue, 24 Oct 2017 23:23:03 +0300 (EEST) Received: by mail-wm0-f50.google.com with SMTP id q124so17978821wmb.0 for ; Tue, 24 Oct 2017 13:23:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:sender:from:date:message-id:subject:to; bh=kPT5stYxb2UXom+aPda1ll8SpT/JN9IbtB1ePqvzrCk=; b=ajlZtVrtQHa1D+zsiwSNxWJQNvB9JQ8w3/prmk+q+0AqDMM5NORKLrM6iQmdtAqK5a ySy/pME/TfsN1GIL4YezyvDu7E+YgiadFtHp7HG/bxCbRQXuZUzzPMJ9EXZMJc/6hrtI XRaIaKTRyDUVS176B0lb9qjebtMKcNEeKXd9Mk7QunnCPITtFJ8N1RjR17v5tOj0bqNk szSkKPKzcRpHp7kmmJFwZxzEIMJSGDhelSbezwEcWI8z8q5cqYtvvJU/wt2axPqSGWQe zKIMw3y657AJPiSa14MT2UkaJIpnZZkTwW3fI3cjVvxZG4KQDekTkaBK5vxQ6VpWdxKe koaw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:sender:from:date:message-id:subject:to; bh=kPT5stYxb2UXom+aPda1ll8SpT/JN9IbtB1ePqvzrCk=; b=lj1TFzjk/GbRF55Is/fckti57iuuOzqCvsh4Sxy4wd7bfmiLLlaN3Bw66F0X/4NxyQ TUVHrz5FxpO44UR+Hjfm/glfJMCp2ffN8cvz1yBQekflYmUsAGp5ToTMSuJku2BmYqNo ZZJ+2bLsj6+PCvZSBe0Y029R9/z5liefOHsPk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:from:date:message-id:subject :to; bh=kPT5stYxb2UXom+aPda1ll8SpT/JN9IbtB1ePqvzrCk=; b=eLu6MefVicvNU2imPGdF8qJN7eenqIR/GamKKIVbw2317kTrpWHcvHq/ME4Fgw0MQ0 66bl6R2gLHs1pVxFLGYwgmAik6OM8AXLhmZB6rDpTFJnkFzNnGxHNqGQX8XCX3T0PbQq j50g+pSauKJBwLlXdb+eRJVyEokAVmNZwfKs1CH3cw0mcE3GPe9eudnMJ5iuN6TxxXIc eJAHH01tqYKEf6EgFxMKy5k3VSCjtoB+YYDe2yCKJQio6k+EqeBLkyZI69yGsJ/kbCG2 ywRRTBu+ocH8z8qfKsSoD7klLgpEWli+q+CuMjMsVWnWlEFAy/LRYqAC8JuwN40VW8ZU QkJQ== X-Gm-Message-State: AMCzsaVRFmHN9ZPLLO/HfovChzRfyud9Xo27pVWAXgRcWKUp6TzdLEs+ XNFFd7kgAdVR/6sSdiuY1LCpQG4x9uobkXgBN1wtvchKWRA= X-Received: by 10.28.63.150 with SMTP id m144mr101692wma.141.1508876154547; Tue, 24 Oct 2017 13:15:54 -0700 (PDT) MIME-Version: 1.0 Received: by 10.28.51.80 with HTTP; Tue, 24 Oct 2017 13:15:33 -0700 (PDT) From: Dale Curtis Date: Tue, 24 Oct 2017 13:15:33 -0700 X-Google-Sender-Auth: la1n3I930fEeR3zd3o89F50gdbo Message-ID: To: FFmpeg development discussions and patches X-Content-Filtered-By: Mailman/MimeDel 2.1.20 Subject: [FFmpeg-devel] Don't use _tzcnt instrinics with clang for windows w/o BMI. X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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" Technically _tzcnt* intrinsics are only available when the BMI instruction set is present. However the instruction encoding degrades to "rep bsf" on older processors. Clang for Windows debatably restricts the _tzcnt* instrinics behind the __BMI__ architecture define, so check for its presence or exclude the usage of these intrinics when clang is present. See also: https://ffmpeg.org/pipermail/ffmpeg-devel/2015-November/183404.html https://bugs.llvm.org/show_bug.cgi?id=30506 http://lists.llvm.org/pipermail/cfe-dev/2016-October/051034.html Signed-off-by: Dale Curtis From 123a60bdcf99cab6b6e6bd31a463a29bc49598f0 Mon Sep 17 00:00:00 2001 From: Dale Curtis Date: Tue, 24 Oct 2017 13:03:59 -0700 Subject: [PATCH] Don't use _tzcnt instrinics with clang for windows w/o BMI. Technically _tzcnt* intrinsics are only available when the BMI instruction set is present. However the instruction encoding degrades to "rep bsf" on older processors. Clang for Windows debatably restricts the _tzcnt* instrinics behind the __BMI__ architecture define, so check for its presence or exclude the usage of these intrinics when clang is present. See also: https://ffmpeg.org/pipermail/ffmpeg-devel/2015-November/183404.html https://bugs.llvm.org/show_bug.cgi?id=30506 http://lists.llvm.org/pipermail/cfe-dev/2016-October/051034.html Signed-off-by: Dale Curtis --- libavutil/x86/intmath.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavutil/x86/intmath.h b/libavutil/x86/intmath.h index e83971c084..40743fd13e 100644 --- a/libavutil/x86/intmath.h +++ b/libavutil/x86/intmath.h @@ -47,7 +47,8 @@ static av_always_inline av_const int ff_log2_x86(unsigned int v) # endif # define ff_log2_16bit av_log2 -#if defined(__INTEL_COMPILER) || (defined(_MSC_VER) && (_MSC_VER >= 1700)) +#if defined(__INTEL_COMPILER) || (defined(_MSC_VER) && (_MSC_VER >= 1700) && \ + (defined(__BMI__) || !defined(__clang__))) # define ff_ctz(v) _tzcnt_u32(v) # if ARCH_X86_64 -- 2.15.0.rc0.271.g36b669edcc-goog