X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:references:from:message-id:date :mime-version:in-reply-to:content-type; q=dns; s=default; b=pI60 MDqhprhrfjNlc73umqUCG7Aqlw03C6P4fRlQdkVSnyRejEjjUCnOPtPgFcPC0hTq j5ofiZBNW+CuLgs6j80WJzAmR9G0TSq1QgaPlejQ26INEPjKCu4cb7KBDKuA+UDz NvKiZc7mOSICPKavjLNnXAgq9EUG7RNvxy4fYYI= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:references:from:message-id:date :mime-version:in-reply-to:content-type; s=default; bh=BU20Fd4JaG XGjKDK+vLYcIsduQQ=; b=MFiGBpbZhd6GzmjDY0/QI0spJLbWpsGOmOKJG43goL jIiDG4WjhJ5rcS8HLnwkONAGi1jmhME1vTodV+DMdWavogOH15R0vwj+jXTSN0XQ eQgWQU5TwJGvcHK7wO8VY/+3fPuQQHCXvjv35JVLWZVaU+OhdgWg7bBLBAWe+NGx 4= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=H*f:sk:CAOTD34, H*i:sk:CAOTD34 X-HELO: mx1.redhat.com DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 32F8081226 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=eblake AT redhat DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 32F8081226 Subject: Re: bug in lrint [was: FW: Printing long int in C program under cygwin64] To: cygwin AT cygwin DOT com References: <6f28f46906804c6f8f6b4b861e202492 AT CASMBX02 DOT oslo DOT ngi DOT no> From: Eric Blake Openpgp: url=http://people.redhat.com/eblake/eblake.gpg Message-ID: Date: Wed, 24 May 2017 11:57:26 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="WAGAV97574n0UV6uImtO5ivQA9uVXSmjW" X-IsSubscribed: yes --WAGAV97574n0UV6uImtO5ivQA9uVXSmjW Content-Type: multipart/mixed; boundary="aBJou2fKOCLpQusCMPa45nVoePSntoWoL"; protected-headers="v1" From: Eric Blake To: cygwin AT cygwin DOT com Message-ID: Subject: Re: bug in lrint [was: FW: Printing long int in C program under cygwin64] References: <6f28f46906804c6f8f6b4b861e202492 AT CASMBX02 DOT oslo DOT ngi DOT no> In-Reply-To: --aBJou2fKOCLpQusCMPa45nVoePSntoWoL Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 05/24/2017 11:53 AM, Erik Bray wrote: >>> dropping down to assembly; it could very well be that the assembly code >>> is incorrectly truncating things at 32 bits (where it is just fine for >>> 32-bit Cygwin, but wrong for 64-bit): >>> >>> long lrint (double x) >>> { >>> long retval =3D 0L; >>> #if defined(_AMD64_) || defined(__x86_64__) || defined(_X86_) || >>> defined(__i386__) >>> __asm__ __volatile__ ("fistpl %0" : "=3Dm" (retval) : "t" (x) : "st"= ); > Actually, I take it back. gdb/objdump (and presumably binutils in > general) was being deceptive to me about the nature of that mov > instruction. And in fact the fistpl should be fistpq. That fixes it. Is fistpq right on 32-bit, or is this a case where we need different assembly for 32-bit (fistpl) vs. 64-bit (fistql) to match the size of long that we are converting to? --=20 Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org --aBJou2fKOCLpQusCMPa45nVoePSntoWoL-- --WAGAV97574n0UV6uImtO5ivQA9uVXSmjW Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJZJbt2AAoJEKeha0olJ0Nqx70H/jeyZ5MOh7tIAcMtqmSLOs3Q h6lAOjJ/wt+0Ea6ZTj9l0+/N4MHMg+E3aDt2/L+e3wk7uyxfCbhG5cXKBZDnltGK t4Ni3M12J7Qxi04VaBh317lY7N+gc+pi+OUkoaBEhF5Alrxhvm3JriDm7suNZJWh Pr8XGle/j/JVfQmbBgRQGBpxEqtsMHnPU/Bw55SdDgBTlEdVPcrO/u0HTdUKSXyZ YibY6Rx3Q9sycKmA88MWWgAShAvHHJHFlDEEN6Vg2z1pXbCesP1TQT1+n9xwAnC0 8FET7XiXNXIk2eN1kB+TtSIjlWeZ41+kXCP2ATwqdB3P7aWv9/4D2uKuXIxu6nE= =blvd -----END PGP SIGNATURE----- --WAGAV97574n0UV6uImtO5ivQA9uVXSmjW--