From patchwork Mon Dec 5 21:35:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allan Sandfeld Jensen X-Patchwork-Id: 702887 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3tXdNx2fcQz9s9Y for ; Tue, 6 Dec 2016 08:36:17 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="QyCg06BM"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:references:in-reply-to:mime-version :content-type:message-id; q=dns; s=default; b=IP+1BK/Fu9aruHaIMH WSY4JByySedtbeLE85RLLX/aNJXaTdlgjeLgUUyQFoxmGHLum5T+4LxcPvObEJDf kU43BhXZKgA8exNA+NG3QG08XUgeNPcbLtXdHnIbCC/v3N15o3z4RRcr0s0OzVjC q0Du9NV2OBevbjiwEvzVBg7Uc= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:references:in-reply-to:mime-version :content-type:message-id; s=default; bh=zvuX4FsrdTsS8PxIJBo/o+Sj 4j4=; b=QyCg06BML448eyIVCzffAxMYEzVt72PgO+60L6TX7jcVFy6NmZO4GcUF knibJ4aOWhrw9MyrsI+FfUhvICPYEKO2vSfDYKKQG8sOhZ6ozWsFJpywKApeGUEN mLBLWtuOse0voquqV6msDiLUX+uzsa5jFFZGlUbMThdO+8LWVGU= Received: (qmail 103825 invoked by alias); 5 Dec 2016 21:36:08 -0000 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 Received: (qmail 103814 invoked by uid 89); 5 Dec 2016 21:36:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.3 required=5.0 tests=BAYES_05, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE autolearn=no version=3.3.2 spammy=H*c:Multipart, H*c:HounHHry, H*r:sk:mailrel, Jensen X-HELO: mailrelay9.public.one.com Received: from mailrelay9.public.one.com (HELO mailrelay9.public.one.com) (195.47.247.20) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 05 Dec 2016 21:35:57 +0000 X-HalOne-Cookie: 22481d0ad7fc618a3015ec35898ef4563608c924 X-HalOne-ID: cc9c79a0-bb32-11e6-af58-b82a72d03b9b Received: from princessluna.localnet (unknown [93.230.136.152]) by smtpfilter2.public.one.com (Halon) with ESMTPSA id cc9c79a0-bb32-11e6-af58-b82a72d03b9b; Mon, 05 Dec 2016 21:35:54 +0000 (UTC) From: Allan Sandfeld Jensen To: gcc-patches@gcc.gnu.org Subject: Re: [Patch][i386] PR 70118: Fix ubsan warning on SSE2 loadl_epi64 and storel_epi64 Date: Mon, 5 Dec 2016 22:35:53 +0100 User-Agent: KMail/1.13.7 (Linux/4.8.0-7.1-liquorix-amd64; KDE/4.14.26; x86_64; ; ) References: <201611262310.59348.linux@carewolf.com> In-Reply-To: <201611262310.59348.linux@carewolf.com> MIME-Version: 1.0 Message-Id: <201612052235.53339.linux@carewolf.com> X-IsSubscribed: yes Trying again, this time with changelog. gcc/ 2016-11-30 Allan Sandfeld Jensen PR target/70118 * gcc/config/i386/mmintrin.h (__m64_u): New type * gcc/config/i386/emmintrin.h (_mm_loadl_epi64, _mm_storel_epi64): Make the allowed unaligned memory access explicit. Index: gcc/config/i386/emmintrin.h =================================================================== --- gcc/config/i386/emmintrin.h (revision 242892) +++ gcc/config/i386/emmintrin.h (working copy) @@ -703,9 +703,9 @@ } extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__)) -_mm_loadl_epi64 (__m128i const *__P) +_mm_loadl_epi64 (__m128i_u const *__P) { - return _mm_set_epi64 ((__m64)0LL, *(__m64 *)__P); + return _mm_set_epi64 ((__m64)0LL, *(__m64_u *)__P); } extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) @@ -721,9 +721,9 @@ } extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) -_mm_storel_epi64 (__m128i *__P, __m128i __B) +_mm_storel_epi64 (__m128i_u *__P, __m128i __B) { - *(long long *)__P = ((__v2di)__B)[0]; + *(__m64_u *)__P = (__m64) ((__v2di)__B)[0]; } extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) Index: gcc/config/i386/mmintrin.h =================================================================== --- gcc/config/i386/mmintrin.h (revision 242892) +++ gcc/config/i386/mmintrin.h (working copy) @@ -37,6 +37,9 @@ vector types, and their scalar components. */ typedef int __m64 __attribute__ ((__vector_size__ (8), __may_alias__)); +/* Unaligned version of the same type */ +typedef int __m64_u __attribute__ ((__vector_size__ (8), __may_alias__, __aligned__ (1))); + /* Internal data types for implementing the intrinsics. */ typedef int __v2si __attribute__ ((__vector_size__ (8))); typedef short __v4hi __attribute__ ((__vector_size__ (8)));