From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30347 invoked by alias); 31 May 2011 15:29:00 -0000 Received: (qmail 30338 invoked by uid 22791); 31 May 2011 15:29:00 -0000 X-SWARE-Spam-Status: No, hits=0.3 required=5.0 tests=AWL,BAYES_00,SARE_SUB_OBFU_Q0,TW_VN X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 31 May 2011 15:28:46 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=EU1-MAIL.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1QRQs9-0001MC-CL from Olivier_Maury@mentor.com for gcc-help@gcc.gnu.org; Tue, 31 May 2011 08:28:45 -0700 Received: from [137.202.253.146] ([137.202.253.146]) by EU1-MAIL.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.1830); Tue, 31 May 2011 16:28:44 +0100 Message-ID: <4DE5092B.8020404@mentor.com> Date: Tue, 31 May 2011 20:15:00 -0000 From: Olivier Maury User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110414 Lightning/1.0b2 Thunderbird/3.1.10 MIME-Version: 1.0 To: gcc-help@gcc.gnu.org Subject: Gcc bug with mfpmath=sse and movntq ? Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2011-05/txt/msg00457.txt.bz2 Hi, I'm still doing some experiments using the movntq instruction on a 32 bits OS with gcc 4.5.1 Using the following code I have a NAN and I don't understand what I'm doing wrong : #include #include #include typedef struct { double data1; } ty_data; static ty_data s_data; void *strange_fnc() { double in; long long unsigned int *vin = (long long unsigned int *)∈ unsigned long long i; double *data; double coeff = 1.; data = &(s_data.data1); for (i = 0; i < 10; ++i) { in = (double)i * coeff; /* <-- that instruction generates a x87 instruction !? */ __builtin_ia32_movntq((long long unsigned int*)(data), *vin); #ifdef FORCE_EMMS __builtin_ia32_emms(); #endif } __builtin_ia32_emms(); return NULL; } int main(int argc, char **argv) { memset(&s_data, 0, sizeof(ty_data)); strange_fnc(); printf("1- %e\n", s_data.data1); return 0; } <380> gcc -g -O simple.c -mfpmath=sse -msse -msse2 -msse3 -malign-double -DFORCE_EMMS <381> ./a.out 1- 9.000000e+00 <382> gcc -g -O simple.c -mfpmath=sse -msse -msse2 -msse3 -malign-double <383> ./a.out 1- nan <387> gcc -g -O simple.c -mfpmath=sse -msse -msse2 -msse3 -malign-double -mno-80387 1- 4.446591e-323 Since I ask gcc to explicitly use the sse registers I don't understand why it generates a x87 instruction for the type cast ! What am I missing ? Is it a bug ? Thanks for your help. Olivier