From patchwork Sat Dec 3 17:23:21 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?J=C3=A9r=C3=A9mie_Detrey?= X-Patchwork-Id: 129101 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 2964BB6F6B for ; Sun, 4 Dec 2011 04:23:28 +1100 (EST) Received: (qmail 13087 invoked by alias); 3 Dec 2011 17:23:26 -0000 Received: (qmail 13077 invoked by uid 22791); 3 Dec 2011 17:23:25 -0000 X-SWARE-Spam-Status: No, hits=-6.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, TW_AV X-Spam-Check-By: sourceware.org Received: from mail4-relais-sop.national.inria.fr (HELO mail4-relais-sop.national.inria.fr) (192.134.164.105) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 03 Dec 2011 17:23:11 +0000 Received: from ip-135.net-89-2-248.rev.numericable.fr (HELO bacon.didje.org) ([89.2.248.135]) by mail4-relais-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 03 Dec 2011 18:23:09 +0100 Date: Sat, 3 Dec 2011 18:23:21 +0100 From: =?iso-8859-1?Q?J=E9r=E9mie?= Detrey To: gcc-patches@gcc.gnu.org Subject: Wrong parameter type for _mm256_insert_epi64 in avxintrin.h Message-ID: <20111203172321.GA19985@bacon.didje.org> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Dear all, Attached is a patch which fixes bug target/51393: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51393 Also attached, avx_bug.c is a minimal example to reproduce the bug (requires an AVX-capable CPU): $ gcc -O3 -mavx avx_bug.c $ ./a.out 0x80000000 in = 0x0000000080000000 out = 0xffffffff80000000 The correct output should be: $ ./a.out 0x80000000 in = 0x0000000080000000 out = 0x0000000080000000 As explained in the bug report, it's just a matter of the second parameter of _mm256_insert_epi64 being declared as int where it should be long long (avxintrin.h:762). A simple typo, trivially fixed by the attached patch. Thanks a lot! Cheers, Jérémie. 2011-12-03 Jérémie Detrey PR target/51393 * config/i386/avxintrin.h (_mm256_insert_epi64): Declare second parameter as long long. Index: gcc/config/i386/avxintrin.h =================================================================== --- gcc/config/i386/avxintrin.h (revision 181965) +++ gcc/config/i386/avxintrin.h (working copy) @@ -759,7 +759,7 @@ _mm256_insert_epi8 (__m256i __X, int __D #ifdef __x86_64__ extern __inline __m256i __attribute__((__gnu_inline__, __always_inline__, __artificial__)) -_mm256_insert_epi64 (__m256i __X, int __D, int const __N) +_mm256_insert_epi64 (__m256i __X, long long __D, int const __N) { __m128i __Y = _mm256_extractf128_si256 (__X, __N >> 1); __Y = _mm_insert_epi64 (__Y, __D, __N % 2);