From patchwork Tue Jun 15 08:30:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 1492039 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=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=x3jZSNZd; dkim-atps=neutral Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4G41jg2G50z9sW6 for ; Tue, 15 Jun 2021 18:30:46 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 25BC53989028 for ; Tue, 15 Jun 2021 08:30:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 25BC53989028 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1623745843; bh=WbXw7xsenQWoGkjW37m56YBKUzk7DIjaSN9K4W4l0Nk=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=x3jZSNZd/46yAy11PbYW7pif2bvKxcPZJI1YiEuqHKcu5+in47xyeTEtQ9LtDs+TS 9XTaXRP9FHeot8/SkhHMpEoV6kQIzv9mp4tKHk5th09proyTaLzaAUk+ZECFL/b7uq SGLo19u0Yw83FgSGouJupGrGoUlL/hYmmM7KEOoo= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id 7F5493989028 for ; Tue, 15 Jun 2021 08:30:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7F5493989028 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-601-YkxF3cpcPQmo9rxiu5I00Q-1; Tue, 15 Jun 2021 04:30:19 -0400 X-MC-Unique: YkxF3cpcPQmo9rxiu5I00Q-1 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id E92BCA40C2; Tue, 15 Jun 2021 08:30:17 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-112-7.ams2.redhat.com [10.36.112.7]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5716B60871; Tue, 15 Jun 2021 08:30:17 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.16.1/8.16.1) with ESMTPS id 15F8UEHx3048613 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 15 Jun 2021 10:30:15 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.16.1/8.16.1/Submit) id 15F8UDnv3048612; Tue, 15 Jun 2021 10:30:13 +0200 Date: Tue, 15 Jun 2021 10:30:13 +0200 To: Richard Biener , Jeff Law , Eric Botcazou Subject: [PATCH] expr: Fix up VEC_PACK_TRUNC_EXPR expansion [PR101046] Message-ID: <20210615083013.GL7746@tucnak> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-5.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jakub Jelinek via Gcc-patches From: Jakub Jelinek Reply-To: Jakub Jelinek Cc: gcc-patches@gcc.gnu.org Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" Hi! The following testcase ICEs, because we have a mode mismatch. VEC_PACK_TRUNC_EXPR's operands have different modes from the result (same vector mode size but twice as large element), but we were passing non-NULL subtarget with the mode of the result to the expansion of its arguments, so the VEC_PERM_EXPR in one of the operands which had V8SImode operands and result had V16HImode target. Fixed by clearing the subtarget if we are changing mode. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2021-06-15 Jakub Jelinek PR target/101046 * expr.c (expand_expr_real_2) : Clear subtarget when changing mode. * gcc.target/i386/pr101046.c: New test. Jakub --- gcc/expr.c.jj 2021-05-21 21:09:08.000000000 +0200 +++ gcc/expr.c 2021-06-14 11:02:28.821342367 +0200 @@ -9998,6 +9998,7 @@ expand_expr_real_2 (sepops ops, rtx targ case VEC_PACK_SAT_EXPR: case VEC_PACK_FIX_TRUNC_EXPR: mode = TYPE_MODE (TREE_TYPE (treeop0)); + subtarget = NULL_RTX; goto binop; case VEC_PACK_TRUNC_EXPR: @@ -10021,6 +10022,7 @@ expand_expr_real_2 (sepops ops, rtx targ return eops[0].value; } mode = TYPE_MODE (TREE_TYPE (treeop0)); + subtarget = NULL_RTX; goto binop; case VEC_PACK_FLOAT_EXPR: --- gcc/testsuite/gcc.target/i386/pr101046.c.jj 2021-06-14 11:10:18.661701929 +0200 +++ gcc/testsuite/gcc.target/i386/pr101046.c 2021-06-14 11:09:26.439439991 +0200 @@ -0,0 +1,15 @@ +/* PR target/101046 */ +/* { dg-do compile } */ +/* { dg-options "-ftree-ter -mavx512bw -mavx512vl" } */ + +typedef unsigned short __attribute__((__vector_size__(16))) U; +typedef unsigned int __attribute__((__vector_size__(16))) V; +typedef unsigned int __attribute__((__vector_size__(32))) W; + +U +foo (void) +{ + return __builtin_convertvector (__builtin_shufflevector ((V){}, (W){}, + 0, 0, 1, 0, + 5, 5, 0, 2), U); +}