From patchwork Thu Oct 25 18:41:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul A. Clarke" X-Patchwork-Id: 989302 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-488311-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=us.ibm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="wyDv3B7g"; dkim-atps=neutral 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 42gwvM4Sv2z9sDQ for ; Fri, 26 Oct 2018 05:41:33 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:date:mime-version:message-id:content-type :content-transfer-encoding; q=dns; s=default; b=Az26aPi47j+jA7rZ 7D7SZoDWm08QyIuzyKu4w8KIzp0LK1RI3zv7wMF1R6HKeVYdPUn9wwAGmgGF83Ox fSsVR2AOq/5WKOUi9JQrEAwT+Ep9OwIyNGfIxqJhf+Id7NN7o1JTNiQ88Th23T9c RJCvsZ0foyUr/2Hg/luE88aE4zg= 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:to :from:subject:date:mime-version:message-id:content-type :content-transfer-encoding; s=default; bh=rAkGI41Md4XEhCHXcKM3+z Ul/GQ=; b=wyDv3B7gZ6U/bb1yZoFyx4Dl7Gx6TJJrB7Wevm7XSATEulA97XC2b7 LcWx7Tx011H3N/V99uMWrU+ZncWDGMJ9h2u+VadIPZQWXRfpggagOuwD0PyNIMjw p6mCAQSi97tKIg7y+NHXLue89ae7yiECKZk0ZY0ELbQkYLmUOenro= Received: (qmail 29684 invoked by alias); 25 Oct 2018 18:41:27 -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 29646 invoked by uid 89); 25 Oct 2018 18:41:22 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-20.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_2, GIT_PATCH_3, KHOP_DYNAMIC, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=bigendian, big-endian X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0b-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.158.5) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 25 Oct 2018 18:41:21 +0000 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w9PIYQEo005075 for ; Thu, 25 Oct 2018 14:41:20 -0400 Received: from e13.ny.us.ibm.com (e13.ny.us.ibm.com [129.33.205.203]) by mx0b-001b2d01.pphosted.com with ESMTP id 2nbg61sg3f-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 25 Oct 2018 14:41:19 -0400 Received: from localhost by e13.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 25 Oct 2018 14:41:19 -0400 Received: from b01cxnp22035.gho.pok.ibm.com (9.57.198.25) by e13.ny.us.ibm.com (146.89.104.200) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 25 Oct 2018 14:41:17 -0400 Received: from b01ledav004.gho.pok.ibm.com (b01ledav004.gho.pok.ibm.com [9.57.199.109]) by b01cxnp22035.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w9PIfG2H44695626 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 25 Oct 2018 18:41:16 GMT Received: from b01ledav004.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4CB37112063; Thu, 25 Oct 2018 18:41:16 +0000 (GMT) Received: from b01ledav004.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 12C5B112062; Thu, 25 Oct 2018 18:41:16 +0000 (GMT) Received: from oc3272150783.ibm.com (unknown [9.85.157.195]) by b01ledav004.gho.pok.ibm.com (Postfix) with ESMTPS; Thu, 25 Oct 2018 18:41:15 +0000 (GMT) To: gcc-patches@gcc.gnu.org, Segher Boessenkool From: Paul Clarke Subject: [PATCH, rs6000] Fix _mm_extract_pi16 for big-endian Date: Thu, 25 Oct 2018 13:41:15 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 x-cbid: 18102518-0064-0000-0000-000003665236 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009934; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000268; SDB=6.01107887; UDB=6.00573844; IPR=6.00887970; MB=3.00023908; MTD=3.00000008; XFM=3.00000015; UTC=2018-10-25 18:41:18 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18102518-0065-0000-0000-00003B1ACC3B Message-Id: <739c13db-ae01-5547-7597-1accf0208814@us.ibm.com> For compatibility implementation of x86 vector intrinsic, _mm_extract_pi16, adjust shift value for big-endian mode. Bootstrapped and tested on Linux POWER8 LE, POWER8 BE (64 & 32), and POWER7. OK for trunk? gcc/ChangeLog: 2018-10-25 Paul A. Clarke * config/rs6000/xmmintrin.h: Fix _mm_extract_pi16 for big-endian. diff --git a/trunk/gcc/config/rs6000/xmmintrin.h b/trunk/gcc/config/rs6000/xmmintrin.h --- a/trunk/gcc/config/rs6000/xmmintrin.h (revision 265238) +++ b/trunk/gcc/config/rs6000/xmmintrin.h (working copy) @@ -1386,9 +1385,12 @@ extern __inline int __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _mm_extract_pi16 (__m64 const __A, int const __N) { - const int shiftr = (__N & 3) * 16; + unsigned int shiftr = __N & 3; +#ifdef __BIG_ENDIAN__ + shiftr = 3 - shiftr; +#endif - return ((__A >> shiftr) & 0xffff); + return ((__A >> (shiftr * 16)) & 0xffff); } extern __inline int __attribute__((__gnu_inline__, __always_inline__, __artificial__))