From patchwork Thu Mar 21 21:15:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Schmidt X-Patchwork-Id: 1060478 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-498271-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="HBA9LpUt"; 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 44QKMs27WYz9sR1 for ; Fri, 22 Mar 2019 08:16:07 +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:cc :from:subject:date:mime-version:message-id:content-type :content-transfer-encoding; q=dns; s=default; b=DCIaBhjB7ht4jA3m l7k/fpgFvk6e96lPqCFlPjHfVGaQVtcpxGogLGiqKsdZGLoKyzFC1KrVA7csSAWS zlozEq2YsIB6z8nAu4KgYOL6okP8mJ0uxJiqajNmBAEjiqSKnVj5X8RSORR/CfjX Cn6qjPac+Y01bKaQjGKjeqIzCwQ= 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:cc :from:subject:date:mime-version:message-id:content-type :content-transfer-encoding; s=default; bh=0L9RC8AOMncki2mpXUF8Ez B47G8=; b=HBA9LpUtINPPJq39Sl3Wjlxyxp0kfwd6tjlQQJsZeHSGNlImdWyXVB 92zq6YqRyxuAQ6Rh1lU6Z10ZJHQlX7UA89F55Xtqm4ENZNDJ9L3xrmLc6xxbvRom TPLjyHnmyvO3F9THJHVSCIcr6yTLg90ZeSff/Rgz5Rzuj/+CzuA3I= Received: (qmail 116135 invoked by alias); 21 Mar 2019 21:15:58 -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 115884 invoked by uid 89); 21 Mar 2019 21:15:41 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.2 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, HTML_MESSAGE, KHOP_DYNAMIC, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.1 spammy=rs6000, H*c:alternative 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, 21 Mar 2019 21:15:22 +0000 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x2LLEgCT093880 for ; Thu, 21 Mar 2019 17:15:14 -0400 Received: from e15.ny.us.ibm.com (e15.ny.us.ibm.com [129.33.205.205]) by mx0b-001b2d01.pphosted.com with ESMTP id 2rcg006kah-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 21 Mar 2019 17:15:13 -0400 Received: from localhost by e15.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 21 Mar 2019 21:15:10 -0000 Received: from b01cxnp23034.gho.pok.ibm.com (9.57.198.29) by e15.ny.us.ibm.com (146.89.104.202) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 21 Mar 2019 21:15:09 -0000 Received: from b01ledav005.gho.pok.ibm.com (b01ledav005.gho.pok.ibm.com [9.57.199.110]) by b01cxnp23034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x2LLFAwo14024948 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 21 Mar 2019 21:15:10 GMT Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B1E15AE05C; Thu, 21 Mar 2019 21:15:10 +0000 (GMT) Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 55707AE060; Thu, 21 Mar 2019 21:15:10 +0000 (GMT) Received: from BigMac.local (unknown [9.85.163.72]) by b01ledav005.gho.pok.ibm.com (Postfix) with ESMTP; Thu, 21 Mar 2019 21:15:10 +0000 (GMT) To: GCC Patches Cc: Segher Boessenkool From: Bill Schmidt Subject: [PATCH] rs6000: Fix typo in mmintrin.h Date: Thu, 21 Mar 2019 16:15:09 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.5.3 MIME-Version: 1.0 x-cbid: 19032121-0068-0000-0000-000003A94A97 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00010790; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000281; SDB=6.01177713; UDB=6.00616110; IPR=6.00958410; MB=3.00026098; MTD=3.00000008; XFM=3.00000015; UTC=2019-03-21 21:15:10 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19032121-0069-0000-0000-000047E52C38 Message-Id: <347759d1-423b-2905-1a59-92e0a7e3cb59@linux.ibm.com> Hi, It was recently pointed out that there's a pasto in mmintrin.h for the _mm_sub_pi32 function, so that it performs an addition rather than a subtraction. This won't do. This patch corrects the problem, and adds a test case to verify it. Installed and tested on powerpc64le-unknown-linux-gnu with no regressions. Is this ok for trunk, and backport to GCC 8? Thanks! Bill [gcc] 2019-03-21 Bill Schmidt * config/rs6000/mmintrin.h (_mm_sub_pi32): Fix typo. [gcc/testsuite] 2019-03-21 Bill Schmidt * gcc.target/powerpc/mmx-psubd-2.c: Test _m_psubd. Index: gcc/config/rs6000/mmintrin.h =================================================================== --- gcc/config/rs6000/mmintrin.h (revision 269843) +++ gcc/config/rs6000/mmintrin.h (working copy) @@ -597,7 +597,7 @@ _mm_sub_pi32 (__m64 __m1, __m64 __m2) extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _m_psubd (__m64 __m1, __m64 __m2) { - return _mm_add_pi32 (__m1, __m2); + return _mm_sub_pi32 (__m1, __m2); } extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) Index: gcc/testsuite/gcc.target/powerpc/mmx-psubd-2.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/mmx-psubd-2.c (revision 269843) +++ gcc/testsuite/gcc.target/powerpc/mmx-psubd-2.c (working copy) @@ -22,20 +22,28 @@ test (__m64 s1, __m64 s2) return _mm_sub_pi32 (s1, s2); } +static __m64 +__attribute__((noinline, unused)) +test_alias (__m64 s1, __m64 s2) +{ + return _m_psubd (s1, s2); +} + static void TEST (void) { __m64_union u, s1, s2; - __m64_union e; + __m64_union e, v; int i; s1.as_m64 = _mm_setr_pi32 (30, 90); s2.as_m64 = _mm_setr_pi32 (76, -100); u.as_m64 = test (s1.as_m64, s2.as_m64); - + v.as_m64 = test_alias (s1.as_m64, s2.as_m64); + for (i = 0; i < 2; i++) e.as_int[i] = s1.as_int[i] - s2.as_int[i]; - if (u.as_m64 != e.as_m64) + if (u.as_m64 != e.as_m64 || u.as_m64 != v.as_m64) abort (); }