From patchwork Mon Oct 15 08:08:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Krebbel X-Patchwork-Id: 983954 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-487528-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="qPIWcmAs"; 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 42YWPH3v2zz9s47 for ; Mon, 15 Oct 2018 19:11:45 +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:from :to:subject:date:message-id; q=dns; s=default; b=NOGhIC3nNj0QVrO 1HYlfr2pnkAZYgHc5E4krFQ4/fVOMy5w+riZLjSH0nqWhg68Jr+XisW+OY0o6pmt /u8xOsInEy6yLXra2oXgcZbXio3LfYddc4NUExEIVN3LZKNjLb46ZSUNT+739afM XnMsKUXUbZNSkd6MHrtEzdilZzx8= 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:message-id; s=default; bh=TdyT1A5SAMFc0yzoWyPGs QCaF0s=; b=qPIWcmAsmStbPtqzjJaxFoG2M6RcFm+VC6KHb8DdmGqoGqlzMPJvB 5OmVEyUvgc6r94a7BX+WcKygoz7wpYktqbpzLMBnwgq2sH+dMc81MyQQLAk7PVMW yFjIlNRJBUmnPFE5adYMomAltGeqTc3KR/ZqUZxLvqHJu1YCU7kHEU= Received: (qmail 51841 invoked by alias); 15 Oct 2018 08:11:35 -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 123077 invoked by uid 89); 15 Oct 2018 08:08:09 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KHOP_DYNAMIC, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=Force, krebbel@linux.ibm.com, krebbellinuxibmcom, krebbel 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; Mon, 15 Oct 2018 08:08:07 +0000 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w9F84OLb026674 for ; Mon, 15 Oct 2018 04:08:05 -0400 Received: from e06smtp04.uk.ibm.com (e06smtp04.uk.ibm.com [195.75.94.100]) by mx0a-001b2d01.pphosted.com with ESMTP id 2n4nq3bpyg-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 15 Oct 2018 04:08:05 -0400 Received: from localhost by e06smtp04.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 15 Oct 2018 09:08:03 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp04.uk.ibm.com (192.168.101.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Mon, 15 Oct 2018 09:08:02 +0100 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w9F881IS56361126 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Mon, 15 Oct 2018 08:08:01 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A324211C050 for ; Mon, 15 Oct 2018 11:07:31 +0100 (BST) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 87F2311C052 for ; Mon, 15 Oct 2018 11:07:31 +0100 (BST) Received: from nelson.boeblingen.de.ibm.com (unknown [9.152.222.184]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTPS for ; Mon, 15 Oct 2018 11:07:31 +0100 (BST) From: Andreas Krebbel To: gcc-patches@gcc.gnu.org Subject: [Committed] S/390: Fix problem with vec_init expander Date: Mon, 15 Oct 2018 10:08:00 +0200 x-cbid: 18101508-0016-0000-0000-00000213195F X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18101508-0017-0000-0000-0000326AA32A Message-Id: <1539590880-22961-1-git-send-email-krebbel@linux.ibm.com> X-IsSubscribed: yes gcc/ChangeLog: 2018-10-15 Andreas Krebbel * config/s390/s390.c (s390_expand_vec_init): Force vector element into reg if it isn't a general operand. gcc/testsuite/ChangeLog: 2018-10-15 Andreas Krebbel * g++.dg/vec-init-1.C: New test. --- gcc/config/s390/s390.c | 11 ++++++++--- gcc/testsuite/g++.dg/vec-init-1.C | 26 ++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/g++.dg/vec-init-1.C diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index 71039fe..ab22c2c 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -6627,11 +6627,16 @@ s390_expand_vec_init (rtx target, rtx vals) return; } + /* Use vector replicate instructions. vlrep/vrepi/vrep */ if (all_same) { - emit_insn (gen_rtx_SET (target, - gen_rtx_VEC_DUPLICATE (mode, - XVECEXP (vals, 0, 0)))); + rtx elem = XVECEXP (vals, 0, 0); + + /* vec_splats accepts general_operand as source. */ + if (!general_operand (elem, GET_MODE (elem))) + elem = force_reg (inner_mode, elem); + + emit_insn (gen_rtx_SET (target, gen_rtx_VEC_DUPLICATE (mode, elem))); return; } diff --git a/gcc/testsuite/g++.dg/vec-init-1.C b/gcc/testsuite/g++.dg/vec-init-1.C new file mode 100644 index 0000000..f35d39c --- /dev/null +++ b/gcc/testsuite/g++.dg/vec-init-1.C @@ -0,0 +1,26 @@ +/* On S/390 this ends up calling the vec_init RTL expander with a + parallel of two symbol_refs. */ + +/* { dg-do compile } */ +/* { dg-options "-O3 -fPIC" } */ + + +struct test +{ + struct base + { + int key; + }; + struct derived : public base + { + int key; + }; + + derived core; + derived &dRef; + base &bRef; + + test() : dRef (core), bRef (core) {} +}; + +test test;