From patchwork Sat Jan 25 23:55:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 1229309 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-518262-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha1 header.s=default header.b=DoGuNOBq; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Qi6BLxhd; 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 484tFM5k49z9sPn for ; Sun, 26 Jan 2020 10:56:05 +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:date :from:to:cc:subject:message-id:reply-to:mime-version :content-type:content-transfer-encoding; q=dns; s=default; b=KVK f+5P1fo+3d6oWBpoHqyV1niMNaAg8gUfXe4wk2xc7SxjCXYGniS5XWEIXsEyjTaw 13VUd8KB7AvoAZWgdlqzTvuQ+8WmF4bM+2XzoZ0L7T7D47ycaaw+GgRrrI4qzE6m 2QWwKj6ObGKoKlqCYt8TDY713I00ajk/jydDA52E= 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:date :from:to:cc:subject:message-id:reply-to:mime-version :content-type:content-transfer-encoding; s=default; bh=mpxoKyNdI 9GMAripA8Jxl1+Ixyg=; b=DoGuNOBqnFAMOMMAyFZPxJio2S4oJgr/ZT+3mW4PM ZYz1hFMsqMfhlxh7iHX090gl32qTt1JYnPGh0E2s1pWuAxqaxO959wKnut4wuVxh 6DQjdiX8CS374GYiukrZoLW9y7Lip1mtpPgFB8G1OtYYC/zpScOhtjPQLk5+kO76 jQ= Received: (qmail 79640 invoked by alias); 25 Jan 2020 23:55: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 79632 invoked by uid 89); 25 Jan 2020 23:55:58 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-7.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy=UD:sse.md.jj, sse.md.jj, ssemdjj X-HELO: us-smtp-1.mimecast.com Received: from us-smtp-delivery-1.mimecast.com (HELO us-smtp-1.mimecast.com) (207.211.31.120) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 25 Jan 2020 23:55:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579996555; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=fNGsjmhXpnLTF4meet9kxoqtgxOSYryIRP/b9i4EzBM=; b=Qi6BLxhdRtQ6Y0Wzcn5gTWZvRcHJyRJWhpp7exJO4gtYoV0fHDnY75t+l1QDluf/83b512 MQZwhIiP1UVwGk+Scegyo3vOKky0zhT/LuF9wTYACFKtd8vlkZOoNjrZxYkfguyZ+lqW+h NHawd54pLlgr1Tb9Z7Vlg4XYfYXJvo8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-193-pDQguk7oNhCDkvbLyFFq_w-1; Sat, 25 Jan 2020 18:55:53 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 522EB8010C2; Sat, 25 Jan 2020 23:55:52 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-116-51.ams2.redhat.com [10.36.116.51]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D94A55D9CA; Sat, 25 Jan 2020 23:55:51 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id 00PNtnPQ015933; Sun, 26 Jan 2020 00:55:50 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id 00PNtmca015931; Sun, 26 Jan 2020 00:55:48 +0100 Date: Sun, 26 Jan 2020 00:55:48 +0100 From: Jakub Jelinek To: Uros Bizjak Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] i386: Fix up *avx_vperm_broadcast_v4df [PR93430] Message-ID: <20200125235548.GH17695@tucnak> Reply-To: Jakub Jelinek MIME-Version: 1.0 User-Agent: Mutt/1.11.3 (2019-02-01) X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-IsSubscribed: yes Hi! Apparently my recent patch which moved the *avx_vperm_broadcast* and *vpermil* patterns before vpermpd broke the following testcase, the define_insn_and_split matched always but the splitter condition only split it if not -mavx2 for V4DFmode, basically relying on the vpermpd pattern to come first. The following patch fixes it by moving that part of SPLIT-CONDITION into CONDITION, so that when it is not met, we just don't match the pattern and thus match the later vpermpd pattern in that case. Except, for { 0, 0, 0, 0 } permutation, there is actually no reason to do that, vbroadcastsd from memory seems to be slightly cheaper than vpermpd $0. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2020-01-26 Jakub Jelinek PR target/93430 * config/i386/sse.md (*avx_vperm_broadcast_): Disallow for TARGET_AVX2 and V4DFmode not in the split condition, but in the pattern condition, though allow { 0, 0, 0, 0 } broadcast always. * gcc.dg/pr93430.c: New test. * gcc.target/i386/avx2-pr93430.c: New test. Jakub --- gcc/config/i386/sse.md.jj 2020-01-24 22:49:19.000000000 +0100 +++ gcc/config/i386/sse.md 2020-01-25 18:32:02.100439737 +0100 @@ -19912,9 +19912,10 @@ (define_insn_and_split "*avx_vperm_broad (match_operand:VF_256 1 "nonimmediate_operand" "m,o,?v") (match_parallel 2 "avx_vbroadcast_operand" [(match_operand 3 "const_int_operand" "C,n,n")])))] - "TARGET_AVX" + "TARGET_AVX + && (mode != V4DFmode || !TARGET_AVX2 || operands[3] == const0_rtx)" "#" - "&& reload_completed && (mode != V4DFmode || !TARGET_AVX2)" + "&& reload_completed" [(set (match_dup 0) (vec_duplicate:VF_256 (match_dup 1)))] { rtx op0 = operands[0], op1 = operands[1]; --- gcc/testsuite/gcc.dg/pr93430.c.jj 2020-01-25 18:39:33.455584367 +0100 +++ gcc/testsuite/gcc.dg/pr93430.c 2020-01-25 18:38:03.725950223 +0100 @@ -0,0 +1,33 @@ +/* PR target/93430 */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ +/* { dg-additional-options "-mavx -mno-avx2" { target avx } } */ + +typedef double V __attribute__((vector_size (4 * sizeof (double)))); +typedef long long VI __attribute__((vector_size (4 * sizeof (long long)))); + +#if __SIZEOF_DOUBLE__ == __SIZEOF_LONG_LONG__ +void +foo (V *x, V *y) +{ + y[0] = __builtin_shuffle (x[0], x[0], (VI) { 0, 0, 0, 0 }); +} + +void +bar (V *x, V *y) +{ + y[0] = __builtin_shuffle (x[0], x[0], (VI) { 1, 1, 1, 1 }); +} + +void +baz (V *x, V *y) +{ + y[0] = __builtin_shuffle (x[0], x[0], (VI) { 2, 2, 2, 2 }); +} + +void +qux (V *x, V *y) +{ + y[0] = __builtin_shuffle (x[0], x[0], (VI) { 3, 3, 3, 3 }); +} +#endif --- gcc/testsuite/gcc.target/i386/avx2-pr93430.c.jj 2020-01-25 18:39:55.282252126 +0100 +++ gcc/testsuite/gcc.target/i386/avx2-pr93430.c 2020-01-25 18:40:35.080646319 +0100 @@ -0,0 +1,5 @@ +/* PR target/93430 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -mavx2" } */ + +#include "../../gcc.dg/pr93430.c"