From patchwork Wed Oct 24 14:25:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Schmidt X-Patchwork-Id: 988691 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-488213-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="okdNCOWY"; 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 42gCH71s7Xz9s47 for ; Thu, 25 Oct 2018 01:26:08 +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 :subject:to:cc:references:from:date:mime-version:in-reply-to :content-type:content-transfer-encoding:message-id; q=dns; s= default; b=aCTeVbzwY1IRandGxGEz8M3ZaKPSyox/+/XfttCL5xEuSjXD6LnPQ /6UPM41ud4svShEiI5vh5HL9sBTHSmfq4YcpkSiPHGjYUUnqCZJOB1TzLNm+9OnR Et9SgNfS8YLeAYW0+c6RV92pAjVnhVj4AZE7OeLY2rii1XENgBR9lI= 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 :subject:to:cc:references:from:date:mime-version:in-reply-to :content-type:content-transfer-encoding:message-id; s=default; bh=Qutw8J1/RyWDLKREQdrERbQECpA=; b=okdNCOWY1HPeimEnMdsek3JWD6cU oB1XoJJTIKSjw7EOpHS7Qz3m4kcdo4s1li5ha1KRlnZu3hhiKAyX6RSi6/eScMXh aobK4GF2AcwE4amIihNnGxzvPe4L8xYqLFwBbxaAHOLfRpatPIJXMy416qMLayu6 QUlvSNND9735OHo= Received: (qmail 120423 invoked by alias); 24 Oct 2018 14:26:01 -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 117346 invoked by uid 89); 24 Oct 2018 14:25:54 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-10.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, KHOP_DYNAMIC, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=segher's, Segher's, seghers, Seghers X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0a-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.156.1) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 24 Oct 2018 14:25:53 +0000 Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w9OEOLkc005410 for ; Wed, 24 Oct 2018 10:25:51 -0400 Received: from e33.co.us.ibm.com (e33.co.us.ibm.com [32.97.110.151]) by mx0a-001b2d01.pphosted.com with ESMTP id 2nasagc6ba-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 24 Oct 2018 10:25:49 -0400 Received: from localhost by e33.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 24 Oct 2018 08:25:29 -0600 Received: from b03cxnp08025.gho.boulder.ibm.com (9.17.130.17) by e33.co.us.ibm.com (192.168.1.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 24 Oct 2018 08:25:26 -0600 Received: from b03ledav006.gho.boulder.ibm.com (b03ledav006.gho.boulder.ibm.com [9.17.130.237]) by b03cxnp08025.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w9OEPP6g14417976 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 24 Oct 2018 14:25:25 GMT Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C362BC6057; Wed, 24 Oct 2018 14:25:25 +0000 (GMT) Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8CE98C6055; Wed, 24 Oct 2018 14:25:25 +0000 (GMT) Received: from bigmac.rchland.ibm.com (unknown [9.10.86.17]) by b03ledav006.gho.boulder.ibm.com (Postfix) with ESMTP; Wed, 24 Oct 2018 14:25:25 +0000 (GMT) Subject: [PATCH, rs6000, v2] Fix uses of vec_sel in intrinsic headers To: Segher Boessenkool Cc: GCC Patches References: <20181022234958.GD5205@gate.crashing.org> From: Bill Schmidt Date: Wed, 24 Oct 2018 09:25:25 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20181022234958.GD5205@gate.crashing.org> x-cbid: 18102414-0036-0000-0000-00000A50A739 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009927; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000268; SDB=6.01107323; UDB=6.00573505; IPR=6.00887408; MB=3.00023888; MTD=3.00000008; XFM=3.00000015; UTC=2018-10-24 14:25:27 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18102414-0037-0000-0000-000049661683 Message-Id: <463d71a5-fcfa-89a8-cc2a-08422c55f49f@linux.ibm.com> Hi, This patch addresses Segher's findings, and also replaces usages of the deprecated function vec_vcmpgtfp with the equivalent vec_cmpgt. Bootstrapped and tested on powerpc64le-linux-gnu with no regressions. Also tested in a Clang environment with no regressions. Is this ok for trunk? Thanks! Bill 2018-10-24 Bill Schmidt Jinsong Ji * config/rs6000/emmintrin.h (_mm_sll_epi64): Remove wrong cast. * config/rs6000/xmmintrin.h (_mm_min_ps): Change m's type to __vector __bool int. Use vec_cmpgt in preference to deprecated function vec_vcmpgtfp. (_mm_max_ps): Likewise. On 10/22/18 6:49 PM, Segher Boessenkool wrote: > Hi Bill, > > On Mon, Oct 22, 2018 at 01:29:15PM -0500, Bill Schmidt wrote: >> The vec_sel intrinsic is overloaded for multiple types. There are a >> couple of cases in our intrinsic compatibility headers where the types >> used don't match any allowable type signature. GCC is able to correctly >> infer which matching built-in function is meant, but not all compilers >> can. For compatibility, cast the third parameter correctly in the >> source code. >> --- gcc/config/rs6000/emmintrin.h (revision 265389) >> +++ gcc/config/rs6000/emmintrin.h (working copy) >> @@ -1766,7 +1766,7 @@ _mm_sll_epi64 (__m128i __A, __m128i __B) >> shmask = lshift < shmax; >> result = vec_vsld ((__v2du) __A, lshift); >> result = (__v2du) vec_sel ((__v2df) shmask, (__v2df) result, >> - (__v2df) shmask); >> + (vector unsigned long long) shmask); > shmask already is a proper type, just delete the cast? (And then fit this > on one line). > >> --- gcc/config/rs6000/xmmintrin.h (revision 265389) >> +++ gcc/config/rs6000/xmmintrin.h (working copy) >> @@ -458,7 +458,7 @@ extern __inline __m128 __attribute__((__gnu_inline >> _mm_min_ps (__m128 __A, __m128 __B) >> { >> __m128 m = (__m128) vec_vcmpgtfp ((__v4sf) __B, (__v4sf) __A); >> - return vec_sel (__B, __A, m); >> + return vec_sel (__B, __A, (vector unsigned int)m); > m should not be type __m128, but maybe __v4si? The cast of the vec_vcmpgtfp > result can go away as well then, maybe. > > > Segher > Index: gcc/config/rs6000/emmintrin.h =================================================================== --- gcc/config/rs6000/emmintrin.h (revision 265389) +++ gcc/config/rs6000/emmintrin.h (working copy) @@ -1765,8 +1765,7 @@ _mm_sll_epi64 (__m128i __A, __m128i __B) lshift = (__v2du) vec_splat ((__v2du)__B, 0); shmask = lshift < shmax; result = vec_vsld ((__v2du) __A, lshift); - result = (__v2du) vec_sel ((__v2df) shmask, (__v2df) result, - (__v2df) shmask); + result = (__v2du) vec_sel ((__v2df) shmask, (__v2df) result, shmask); return (__m128i) result; } Index: gcc/config/rs6000/xmmintrin.h =================================================================== --- gcc/config/rs6000/xmmintrin.h (revision 265389) +++ gcc/config/rs6000/xmmintrin.h (working copy) @@ -457,7 +457,7 @@ _mm_max_ss (__m128 __A, __m128 __B) extern __inline __m128 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _mm_min_ps (__m128 __A, __m128 __B) { - __m128 m = (__m128) vec_vcmpgtfp ((__v4sf) __B, (__v4sf) __A); + __vector __bool int m = vec_cmpgt ((__v4sf) __B, (__v4sf) __A); return vec_sel (__B, __A, m); } @@ -464,7 +464,7 @@ _mm_min_ps (__m128 __A, __m128 __B) extern __inline __m128 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _mm_max_ps (__m128 __A, __m128 __B) { - __m128 m = (__m128) vec_vcmpgtfp ((__v4sf) __A, (__v4sf) __B); + __vector __bool int m = vec_cmpgt ((__v4sf) __A, (__v4sf) __B); return vec_sel (__B, __A, m); }