From patchwork Mon Mar 6 21:02:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 735941 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 3vcXKv4nsZz9sN9 for ; Tue, 7 Mar 2017 08:02:24 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="WgCPqI07"; dkim-atps=neutral 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; q=dns; s=default; b=q+TofkoxWP2Eemhlbkr2oTmHGp5To OwiYe0zYZ8RvFAW+mfiT8DqgapgUwX+V1Sj5FYG9kZUHvM7Zh3LMgQBUOvxbJd+K Vsql6zkXEPvqSXRK2kp/DFHxoYUx4hxxq+Tr+DV3c7FMr3QE9ksK6ubtbo+RL9/9 8jqeRa9+DXE5zo= 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; s=default; bh=nREcFdgsxUkZ1xcxJ2LmmgjNK/E=; b=WgC PqI07TSsXZgeQpwAuMlaSXVjqg5DAt5FOS5BrT9iTaFENL42Y8tbtwJ4RA9Ox17e I4U+faABNLiBqsonQSCB0STijA+Q2qXfZM6vCtZ5AgQQgq+V587YzqKy2BDYtmI4 tLHb8ZsMkffkdUwCnv9hzvJYNgyJaSCY9xY3OSo8= Received: (qmail 94988 invoked by alias); 6 Mar 2017 21:02:13 -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 94970 invoked by uid 89); 6 Mar 2017 21:02:12 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.9 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=claims 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; Mon, 06 Mar 2017 21:02:11 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B50B583F47; Mon, 6 Mar 2017 21:02:11 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-117-76.ams2.redhat.com [10.36.117.76]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v26L2A5V009689 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 6 Mar 2017 16:02:11 -0500 Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id v26L27Ww004053; Mon, 6 Mar 2017 22:02:07 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id v26L26Si004052; Mon, 6 Mar 2017 22:02:06 +0100 Date: Mon, 6 Mar 2017 22:02:06 +0100 From: Jakub Jelinek To: Richard Biener Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix MIN_EXPR/MAX_EXPR expansion for vector types (PR rtl-optimization/79901) Message-ID: <20170306210206.GH22703@tucnak> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.7.1 (2016-10-04) X-IsSubscribed: yes Hi! This is the middle-end for the same PR. While supporting min/max for avx512f V8DI generates of course better code, when the backend claims it is not available, we should not ICE on that by trying to expand the vector min/max by expanding comparison and jump. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2017-03-06 Jakub Jelinek PR rtl-optimization/79901 * expr.c (expand_expr_real_2): For vector MIN/MAX, if there is no min/max expander, expand it using expand_vec_cond_expr. Jakub --- gcc/expr.c.jj 2017-03-02 10:15:32.000000000 +0100 +++ gcc/expr.c 2017-03-06 16:07:56.159868534 +0100 @@ -8943,6 +8943,18 @@ expand_expr_real_2 (sepops ops, rtx targ if (temp != 0) return temp; + /* For vector MIN , expand it a VEC_COND_EXPR + and similarly for MAX . */ + if (VECTOR_TYPE_P (type)) + { + tree t0 = make_tree (type, op0); + tree t1 = make_tree (type, op1); + tree comparison = build2 (code == MIN_EXPR ? LE_EXPR : GE_EXPR, + type, t0, t1); + return expand_vec_cond_expr (type, comparison, t0, t1, + original_target); + } + /* At this point, a MEM target is no longer useful; we will get better code without it. */