From patchwork Mon Mar 11 13:31:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Krebbel X-Patchwork-Id: 1054438 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-497691-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="BsdteUMg"; 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 44HzXc74C4z9sMx for ; Tue, 12 Mar 2019 00:31:40 +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=K6qAVQi0MV1nIvj 0IYqiLV07uPnRTR/syIcfM3lrdDb2hOCVZC77KybfdiFBb+2zXQ9/OsGpAjYJzCG jZV94OUpR+RlJUSkOB+KGsD3B7Rn7Q8oGhK1Cn289jh37n8QaXAGbr2P0lbPSOMl QSI15Vpr/9SqGMUAVj4r1QEUeP44= 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=Si36NLAsiLt9XLUfzkhRe C9dshA=; b=BsdteUMgCHqP9NL1IrfencJWNgnCdNptSyjlfzaNjXx/Pc/uuo+bX Y2TJGtjxQOJ+6hMvRGZt5INIWqt/NRd/KZk7ZgFolcZCg6srCSphp+yQdl9XiNoA PPK41j2B6Uw24N8c5lOKD4V/1RTBtnhdFPoF/40kCjneht0u64dxqg= Received: (qmail 18571 invoked by alias); 11 Mar 2019 13:31:33 -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 18563 invoked by uid 89); 11 Mar 2019 13:31:33 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-13.6 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.1 spammy=HX-Languages-Length:2644, xexp, memory_operand, XEXP 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; Mon, 11 Mar 2019 13:31:32 +0000 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x2BDUnet039509 for ; Mon, 11 Mar 2019 09:31:30 -0400 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 2r5r5hht02-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 11 Mar 2019 09:31:29 -0400 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 11 Mar 2019 13:31:27 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp02.uk.ibm.com (192.168.101.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Mon, 11 Mar 2019 13:31:25 -0000 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x2BDVONn31588512 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Mon, 11 Mar 2019 13:31:24 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B25B142047 for ; Mon, 11 Mar 2019 13:31:24 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 626174204D for ; Mon, 11 Mar 2019 13:31:24 +0000 (GMT) Received: from nelson.boeblingen.de.ibm.com (unknown [9.152.97.34]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTPS for ; Mon, 11 Mar 2019 13:31:24 +0000 (GMT) From: Andreas Krebbel To: gcc-patches@gcc.gnu.org Subject: [Committed] S/390: Fix immediate vector operands for some builtins. Date: Mon, 11 Mar 2019 14:31:23 +0100 x-cbid: 19031113-0008-0000-0000-000002CB4898 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19031113-0009-0000-0000-000022376339 Message-Id: <1552311083-4216-1-git-send-email-krebbel@linux.ibm.com> X-IsSubscribed: yes This fixes a problem with vec_add/sub_u128 builtins. The s390_expand_builtin backend function is supposed to convert the operand to TImode *AND* load it into a vector register. The current implementation did only the conversion and gave up then. Will be applied to GCC 8 branch after a while. gcc/ChangeLog: 2019-03-11 Andreas Krebbel * config/s390/s390.c (s390_expand_builtin): Do the copy_to_reg not only on the else branch. gcc/testsuite/ChangeLog: 2019-03-11 Andreas Krebbel * gcc.target/s390/zvector/vec-addc-u128.c: New test. --- gcc/config/s390/s390.c | 14 ++++++++++---- gcc/testsuite/gcc.target/s390/zvector/vec-addc-u128.c | 10 ++++++++++ 2 files changed, 20 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/gcc.target/s390/zvector/vec-addc-u128.c diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index fce463f..b80d5e8 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -928,6 +928,8 @@ s390_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED, continue; } + /* A memory operand is rejected by the memory_operand predicate. + Try making the address legal by copying it into a register. */ if (MEM_P (op[arity]) && insn_op->predicate == memory_operand && (GET_MODE (XEXP (op[arity], 0)) == Pmode @@ -951,10 +953,14 @@ s390_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED, { op[arity] = tmp_rtx; } - else if (GET_MODE (op[arity]) == insn_op->mode - || GET_MODE (op[arity]) == VOIDmode - || (insn_op->predicate == address_operand - && GET_MODE (op[arity]) == Pmode)) + + /* The predicate rejects the operand although the mode is fine. + Copy the operand to register. */ + if (!insn_op->predicate (op[arity], insn_op->mode) + && (GET_MODE (op[arity]) == insn_op->mode + || GET_MODE (op[arity]) == VOIDmode + || (insn_op->predicate == address_operand + && GET_MODE (op[arity]) == Pmode))) { /* An address_operand usually has VOIDmode in the expander so we cannot use this. */ diff --git a/gcc/testsuite/gcc.target/s390/zvector/vec-addc-u128.c b/gcc/testsuite/gcc.target/s390/zvector/vec-addc-u128.c new file mode 100644 index 0000000..3ab0c71 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/zvector/vec-addc-u128.c @@ -0,0 +1,10 @@ +/* { dg-do compile { target { s390*-*-* } } } */ +/* { dg-options "-O3 -mzarch -march=z13 -mzvector -fno-asynchronous-unwind-tables" } */ + +#include + +vector unsigned char test(void) +{ + vector unsigned char a = { 0 }; + return __builtin_s390_vec_addc_u128 (a, a); +}