DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 60MLHGM02304869
Authentication-Results: delorie.com; dmarc=pass (p=none dis=none) header.from=cygwin.com
Authentication-Results: delorie.com; spf=pass smtp.mailfrom=cygwin.com
DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 60MLHGM02304869
Authentication-Results: delorie.com;
	dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=aRwAlX7i
X-Recipient: archive-cygwin@delorie.com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 923D74BC8980
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
	s=default; t=1769116633;
	bh=mgv0uiEKKMkJgUrsveBXN9HgS+DzAIKJs/NMVDMDBZ8=;
	h=Date:To:Cc:In-Reply-To:References:Subject:List-Id:
	 List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe:
	 From:Reply-To:From;
	b=aRwAlX7iVPOGC5QyF0qpYrhC1OdDs7L4gjG8pFiF6Rckvz7aAg/I5WDpG5lORWHnf
	 TB6jXTxH7MRHKw1igB0YKdFLImD5Hlo+NKd5Dm9Z3InR7tac99y3Ix7foNNYxSegm5
	 VKrhrmEnBu8mU7cSkWcJhEgfdJRlgomX+BvpyerU=
X-Original-To: cygwin@cygwin.com
Delivered-To: cygwin@cygwin.com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3D0E14BA9001
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 3D0E14BA9001
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1769116583; cv=none;
 b=fD77YCIcVrbs6nY4fTtPhnEKvtlcpu+EcnFsqz9yIPFinbOHctyoUQ317QyQaPWNMWhZknIatVeATKzmBlUiK8H8LDVd5ymseP+I8S0dAsaqEMKd5VzVc27DOJoAHU0WpE/zHE+qu4eTSQinBPllV0azqSp6xTK8hU7KgPLOW+g=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
 t=1769116583; c=relaxed/simple;
 bh=y7Z567IMS1Hy9yjuH19puqgCnVDidxQgCzytPwIGhSI=;
 h=DKIM-Signature:Date:From:To:Message-ID:Subject:MIME-Version;
 b=yEO27mM+6Pn5ZmW/L5IEpcXSUbns7hSoWFzBGVtDvQDlnUOYfmiRb1cyNj+amO7trlAxnkT+PTUtzcG8/ACNXiv6UtL4j1sQu8uWXR+OqS3yg5n1CeYN+SOS8vwgkn6diPll4UXFPh2G8o20YBGzsujl4OnK2oAbIxqX1m/Nxo0=
ARC-Authentication-Results: i=1; server2.sourceware.org
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3D0E14BA9001
Date: Thu, 22 Jan 2026 13:16:20 -0800 (PST)
To: cygwin@cygwin.com
Cc: Brian Inglis <Brian.Inglis@SystematicSW.ab.ca>
Message-ID: <1378376827.694910.1769116580142@connect.xfinity.com>
In-Reply-To: <7bf7bd13-ecad-4247-818c-31383967188e@SystematicSW.ab.ca>
References: <226987210.591128.1768766440723@connect.xfinity.com>
 <cc290097-2b7c-a067-981d-f0c3b6f5ee85@wisemo.com>
 <1534416783.678540.1769056874631@connect.xfinity.com>
 <1610598307.678632.1769057166805@connect.xfinity.com>
 <7bf7bd13-ecad-4247-818c-31383967188e@SystematicSW.ab.ca>
Subject: Re: Log2 seems inefficient
MIME-Version: 1.0
X-Priority: 3
Importance: Normal
X-Mailer: Open-Xchange Mailer v7.10.6-Rev83
X-Originating-IP: ::ffff:50.47.202.14
X-Originating-Port: 20302
X-Originating-Client: open-xchange-appsuite
X-CMAE-Envelope: MS4xfBR+W3LqKEyB40kDKlLr15awQ3TDuASQu1cbu+uB/hBHdFPPDF6gm0ybTMyBfU2LAeXL6s/Tepd+lqJxR3tj7u+77uYF37b0iZjn+236iTAtjTc6EDMe
 x2/KFG1Yh/Unrug3Rlsa4Z65kvSl4B+YqZhGxOnKCFUHhTK79k2YKtjUV9HYdcEFAvBzH/0FAV0v6RC71SCEqm2hIebh5BGM2ohyKgHO7ZzpJvqqiSDzWgdf
 vDD1OwbDbhntYiTVJkxSDRv3dLEyfLoXbkB4FroV+bA=
X-BeenThere: cygwin@cygwin.com
X-Mailman-Version: 2.1.30
Precedence: list
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-request@cygwin.com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=subscribe>
From: KENNON J CONRAD via Cygwin <cygwin@cygwin.com>
Reply-To: KENNON J CONRAD <kennonconrad@comcast.net>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: cygwin-bounces~archive-cygwin=delorie.com@cygwin.com
Sender: "Cygwin" <cygwin-bounces~archive-cygwin=delorie.com@cygwin.com>

Thank you Brain!  Your suggestion to #undef log2 worked perfectly for getting the assembly to call log2 instead of log and eliminates the divide and no longer requires the use of xmm7 to hold the constant log(2).

Unfortunately, 100,000,000 log calculations using log2 is taking 0.700 seconds on my i7-4790k vs. 0.583 when using log and dividing by log(2). So the assembly code now looks good but the time for the log calculations is 20% higher.  I also tried cr_log2 and found the time for the loop using that function is 65% higher (likely with better accuracy).  So it seems to turn out that log2 is even more inefficient speedwise than I thought, given that using log2 is even slower than the the seemingly inefficient use of log divided by log(2) in place of log2.  At this point, it seems the best option speedwise for a 64 bit log may be to rescale surrounding code to support direct use of the log function (no divide by log(2) instead of using the log2 function.

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple
