From patchwork Sat Feb 2 00:07:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 1035262 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-495170-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.b="Qv+kfGp3"; 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 43rvSW0Y8hz9sBZ for ; Sat, 2 Feb 2019 11:08: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:subject:message-id:reply-to:mime-version:content-type; q=dns; s=default; b=d2qfFRFioc8GLRi+BvkJ6ZKyMB01ghDnN1TZUl+/TSr Y3722qywzoYLCJiUpRGdB7flG1TRZ0qzvXDEy9pZMIBpuDNqLAYFjOSH8TzHUG34 y+0w+SslFaikKtHJsQPnKgVe2H39A4a0I37WBz0/FcvgB4cEB6wi/oUV6dVr0vcg = 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:subject:message-id:reply-to:mime-version:content-type; s=default; bh=79kyt+ZFXlkzeuZpyEwes32/FhU=; b=Qv+kfGp3Zw6th62Md xCyVR+sHbaThW8b8UcJPI0MQVjCCENLPG8fyN8O3QExcjSXRee4VsVc+I6OnzS5j sddCcsI8bFkr20T7CWukdeKxzknqNn2DSqdDllhje85GT6azH+ixlRZZzn+7ERd1 nUuQhQj1QpZ8psES1M7vY7kNIg= Received: (qmail 65678 invoked by alias); 2 Feb 2019 00:07: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 65670 invoked by uid 89); 2 Feb 2019 00:07:58 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.9 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=xn X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 02 Feb 2019 00:07:57 +0000 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3DB507F086 for ; Sat, 2 Feb 2019 00:07:56 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-116-106.ams2.redhat.com [10.36.116.106]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D7FE3608C8 for ; Sat, 2 Feb 2019 00:07:55 +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 x1207ruZ011798 for ; Sat, 2 Feb 2019 01:07:53 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id x1207rGB011797 for gcc-patches@gcc.gnu.org; Sat, 2 Feb 2019 01:07:53 +0100 Date: Sat, 2 Feb 2019 01:07:52 +0100 From: Jakub Jelinek To: gcc-patches@gcc.gnu.org Subject: [committed] Fix omp declare simd ICE (PR middle-end/87887) Message-ID: <20190202000752.GY2135@tucnak> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-IsSubscribed: yes Hi! We can't create a vector type with aggregate elements. In the past we used to reject BLKmode aggregates, but accepted (and ICEd on) [QHSD]Imode aggregates. On the other side, as the FIXME says, we should accept any argument type if it is uniform (linear should be only integers or pointers or references and we do already accept those). From what I can see, aarch64 will not already let aggregates through (but, it could be changed to ignore uniform argument types). Bootstrapped/regtested on x86_64-linux and i686-linux, committed to trunk. 2019-02-02 Jakub Jelinek PR middle-end/87887 * config/i386/i386.c (ix86_simd_clone_compute_vecsize_and_simdlen): Punt with warning on aggregate return or argument types. Ignore type/mode checking for uniform arguments. * gcc.dg/gomp/pr87887-1.c: New test. * gcc.dg/gomp/pr87887-2.c: New test. Jakub --- gcc/config/i386/i386.c.jj 2019-01-30 08:50:26.824223494 +0100 +++ gcc/config/i386/i386.c 2019-02-01 23:14:10.450518093 +0100 @@ -50433,7 +50433,9 @@ ix86_simd_clone_compute_vecsize_and_simd case E_DFmode: /* case E_SCmode: */ /* case E_DCmode: */ - break; + if (!AGGREGATE_TYPE_P (ret_type)) + break; + /* FALLTHRU */ default: warning_at (DECL_SOURCE_LOCATION (node->decl), 0, "unsupported return type %qT for simd", ret_type); @@ -50444,7 +50446,6 @@ ix86_simd_clone_compute_vecsize_and_simd int i; for (t = DECL_ARGUMENTS (node->decl), i = 0; t; t = DECL_CHAIN (t), i++) - /* FIXME: Shouldn't we allow such arguments if they are uniform? */ switch (TYPE_MODE (TREE_TYPE (t))) { case E_QImode: @@ -50455,8 +50456,12 @@ ix86_simd_clone_compute_vecsize_and_simd case E_DFmode: /* case E_SCmode: */ /* case E_DCmode: */ - break; + if (!AGGREGATE_TYPE_P (TREE_TYPE (t))) + break; + /* FALLTHRU */ default: + if (clonei->args[i].arg_type == SIMD_CLONE_ARG_TYPE_UNIFORM) + break; warning_at (DECL_SOURCE_LOCATION (node->decl), 0, "unsupported argument type %qT for simd", TREE_TYPE (t)); return 0; --- gcc/testsuite/gcc.dg/gomp/pr87887-1.c.jj 2019-02-01 20:55:11.383755787 +0100 +++ gcc/testsuite/gcc.dg/gomp/pr87887-1.c 2019-02-01 23:15:07.376587238 +0100 @@ -0,0 +1,26 @@ +/* PR middle-end/87887 */ +/* { dg-do compile } */ +/* { dg-require-effective-target vect_simd_clones } */ +/* { dg-additional-options "-w" } */ + +struct S { int n; }; +#pragma omp declare simd +struct S +foo (int x) +{ + return (struct S) { x }; +} + +#pragma omp declare simd +int +bar (struct S x) +{ + return x.n; +} + +#pragma omp declare simd uniform (x) +int +baz (int w, struct S x, int y) +{ + return w + x.n + y; +} --- gcc/testsuite/gcc.dg/gomp/pr87887-2.c.jj 2019-02-01 20:55:18.618636600 +0100 +++ gcc/testsuite/gcc.dg/gomp/pr87887-2.c 2019-02-01 23:15:14.118476995 +0100 @@ -0,0 +1,25 @@ +/* PR middle-end/87887 */ +/* { dg-do compile { target i?86-*-* x86_64-*-* } } */ +/* { dg-require-effective-target vect_simd_clones } */ + +struct S { int n; }; +#pragma omp declare simd +struct S +foo (int x) /* { dg-warning "unsupported return type 'struct S' for simd" } */ +{ + return (struct S) { x }; +} + +#pragma omp declare simd +int +bar (struct S x) /* { dg-warning "unsupported argument type 'struct S' for simd" } */ +{ + return x.n; +} + +#pragma omp declare simd uniform (x) +int +baz (int w, struct S x, int y) +{ + return w + x.n + y; +}