From owner-freebsd-hackers@FreeBSD.ORG Sat Nov 23 22:28:40 2013 Return-Path: Delivered-To: hackers@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C361BF5D; Sat, 23 Nov 2013 22:28:40 +0000 (UTC) Received: from nuanti.com (nuanti.com [207.192.69.172]) (using TLSv1.1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 7FA542EB3; Sat, 23 Nov 2013 22:28:40 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by nuanti.com (Postfix) with ESMTP id A336C29880; Sat, 23 Nov 2013 22:20:18 +0000 (GMT) Received: from nuanti.com ([127.0.0.1]) by localhost (nuanti.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3uDYN0zB9D2N; Sat, 23 Nov 2013 22:20:17 +0000 (GMT) Message-ID: <52912A1E.5090105@nuanti.com> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuanti.com; s=default; t=1385245217; bh=Bj/kSrEsnCPSpDMW7B1FNRmTLpu00zJzR1IfEFnD0yU=; h=Date:From:To:CC:Subject:References:In-Reply-To:From; b=iH2ouH8xibkvLMPaqvQ41c9LV3KM9D4pc2OG4ggaWOGLNIs5+hNzwAR3JlSEHtKxq DkGb4R3IRfGzVYsewwc5WERcq5rHKG007PZu7LT4QknUSJ9xF1qmaNoOa2yxLrCtO2 KzTHOL381cV7QSxxcRz3UDL6mU0xY2IsoaWgpvw0= Date: Sat, 23 Nov 2013 22:20:14 +0000 From: Alp Toker User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.1.1 MIME-Version: 1.0 To: Dimitry Andric , =?ISO-8859-1?Q?=22C=2E_Bergstr=F6?= =?ISO-8859-1?Q?m=22?= Subject: Re: SSE2 intrinsics: gcc46 vs. clang contradiction References: <20131101124645.GA73456@regency.nsu.ru> <20131101154320.GA11359@regency.nsu.ru> <52742115.9010404@pathscale.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Mailman-Approved-At: Sun, 24 Nov 2013 03:36:27 +0000 Cc: Alexey Dokuchaev , hackers@FreeBSD.org, cfe-commits@cs.uiuc.edu X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Nov 2013 22:28:40 -0000 Thanks Dimitry, I've confirmed your fix is correct. Landed in r195558. Alp. On 02/11/2013 00:07, Dimitry Andric wrote: > On 01 Nov 2013, at 22:45, C. Bergström wrote: >> On 11/ 1/13 10:43 PM, Alexey Dokuchaev wrote: >>> On Fri, Nov 01, 2013 at 07:46:45PM +0700, Alexey Dokuchaev wrote: >>>> What adds to confusion, in their manual [1] Intel spells them differently >>>> themselves: first, in the table, it says: >>>> >>>> _mm_movpi64_epi64 Move MOVDQ2Q >>>> ^^^^^ >>>> >>>> Then later, when they describe what it does, it says: >>>> >>>> __m128i _mm_movpi64_pi64(__m64 a) >>>> ^^^^ >>>> Moves the 64 bits of a to the lower 64 bits of the result, zeroing the >>>> upper bits. >>> Microsoft (http://msdn.microsoft.com/en-us/library/has3d153(v=vs.90).aspx) >>> defines these two: >>> >>> _mm_movepi64_pi64 MOVDQ2Q Move >>> _mm_movpi64_epi64 MOVQ2DQ Move >>> >>> That is: >>> >>> __m64 _mm_movepi64_pi64 (__m128i a); >>> MOVDQ2Q >>> r0 := a0 ; >>> >>> __m128i _mm_movpi64_epi64 (__m64 a); >>> MOVDQ2Q >>> r0 := a0 ; r1 := 0X0 ; >>> >>> Cf. Intel's: >>> >>> _mm_movepi64_pi64 Move MOVDQ2Q >>> _mm_movpi64_epi64 Move MOVDQ2Q >>> >>> __m64 _mm_movepi64_pi64(__m128i a) >>> Returns the lower 64 bits of a as an __m64 type: R0 := a0 >>> >>> __m128i _mm_movpi64_pi64(__m64 a) >>> Moves the 64 bits of a to the lower 64 bits >>> of the result, zeroing the upper bits: R0 := a0, R1 = 0X0 >>> >>> Assuming that both documents correctly assign instructions to function >>> names (bonus clue: it also makes them symmetrical), then _mm_movpi64_pi64 >>> is indeed a typo and Clang's header is wrong, while GCC's is correct: it >>> should read _mm_movpi64_epi64(), not _mm_movpi64_pi64(). >> Why isn't this being asked on the clang or llvm mailing list? Wouldn't this impact upstream as well? > Indeed, so redirecting to the cfe-commits list. It looks like this incorrect function name has been in emmintrin.h since clang r61443 (by andersca). Basically, we need the typo fixed as follows: > > Index: tools/clang/lib/Headers/emmintrin.h > =================================================================== > --- tools/clang/lib/Headers/emmintrin.h (revision 193039) > +++ tools/clang/lib/Headers/emmintrin.h (working copy) > @@ -1366,7 +1366,7 @@ _mm_movepi64_pi64(__m128i __a) > } > > static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) > -_mm_movpi64_pi64(__m64 __a) > +_mm_movpi64_epi64(__m64 __a) > { > return (__m128i){ (long long)__a, 0 }; > } > > Is this OK? > > -Dimitry > > > > _______________________________________________ > cfe-commits mailing list > cfe-commits@cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits -- http://www.nuanti.com the browser experts