From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12650 invoked by alias); 1 Sep 2009 15:54:10 -0000 Received: (qmail 12631 invoked by uid 22791); 1 Sep 2009 15:54:09 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from sunsite.ms.mff.cuni.cz (HELO sunsite.mff.cuni.cz) (195.113.15.26) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 01 Sep 2009 15:54:02 +0000 Received: from sunsite.mff.cuni.cz (localhost [127.0.0.1]) by sunsite.mff.cuni.cz (8.14.3/8.14.3) with ESMTP id n81FTYqi027346; Tue, 1 Sep 2009 17:29:34 +0200 Received: (from jakub@localhost) by sunsite.mff.cuni.cz (8.14.3/8.14.3/Submit) id n81FTY0x027345; Tue, 1 Sep 2009 17:29:34 +0200 Date: Tue, 01 Sep 2009 15:54:00 -0000 From: Jakub Jelinek To: Ulrich Drepper Cc: Glibc hackers Subject: [PATCH] Fix x86_64 bits/mathinline.h for -m32 compilation Message-ID: <20090901152934.GB3611@sunsite.ms.mff.cuni.cz> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.19 (2009-01-05) Mailing-List: contact libc-hacker-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-hacker-owner@sourceware.org X-SW-Source: 2009-09/txt/msg00000.txt.bz2 Hi! With the latest bits/mathinline.h, echo '#include ' | gcc -S -xc - -o - -std=c99 -O2 -m32 doesn't compile: /usr/include/bits/mathinline.h:39: error: impossible constraint in 'asm' /usr/include/bits/mathinline.h:46: error: impossible constraint in 'asm' The problem is that SSE{,2} assembly and "x" constraint is used even in 32-bit code. Here is an untested fix: 2009-09-01 Jakub Jelinek * sysdeps/x86_64/fpu/bits/mathinline.h: Include bits/wordsize.h. (__signbitf, __signbit): Only use SSE inline asm for 64-bit. diff --git a/sysdeps/x86_64/fpu/bits/mathinline.h b/sysdeps/x86_64/fpu/bits/mathinline.h index ece0f02..dc58f67 100644 --- a/sysdeps/x86_64/fpu/bits/mathinline.h +++ b/sysdeps/x86_64/fpu/bits/mathinline.h @@ -22,6 +22,8 @@ # error "Never use directly; include instead." #endif +#include + #ifndef __extern_inline # define __MATH_INLINE __inline #else @@ -35,16 +37,26 @@ __MATH_INLINE int __NTH (__signbitf (float __x)) { +#if __WORDSIZE == 32 + __extension__ union { float __f; int __i; } __u = { __f: __x }; + return __u.__i < 0; +#else int __m; __asm ("pmovmskb %1, %0" : "=r" (__m) : "x" (__x)); return __m & 0x8; +#endif } __MATH_INLINE int __NTH (__signbit (double __x)) { +#if __WORDSIZE == 32 + __extension__ union { double __d; int __i[2]; } __u = { __d: __x }; + return __u.__i[1] < 0; +#else int __m; __asm ("pmovmskb %1, %0" : "=r" (__m) : "x" (__x)); return __m & 0x80; +#endif } __MATH_INLINE int __NTH (__signbitl (long double __x)) Jakub