From patchwork Wed Jun 13 15:02:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 928912 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-479640-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="DiFgMDxE"; 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 415VNg3cmLz9s19 for ; Thu, 14 Jun 2018 01:02:42 +1000 (AEST) 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:mime-version:content-type; q=dns; s= default; b=Cc1VUymqauZ4fBOXwbPr7Xlkfxmy5LEc0t2FgnerqqaLu1UupL+38 rW5OPPmtAENJ9dezy2YC3R3ne9xqk6mwkGdnXZLhzmYVBxFO0/DjTR7L5Qan5qH8 GT9VRlgsWOXdaa7vKWRXgnxSFKouMPgpq/Vs/qUMmMjElG1ffOq5NQ= 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:mime-version:content-type; s= default; bh=Ff6LizEzegSIHwb2UcYEecGTTXw=; b=DiFgMDxE8qRbmogHTWlK 5YOzJYjhsW0FN/xdhH1EFTdqiKVw82x45DzoMrNUu1QUrX+4lrNGCXXzxCC2BqEW 8REVxNo8ZyAb0FsjTK4M09JwqU4pu91oS/8l/3kTpaPCe8L74xs7XnCrbErlT6s+ 4qRhzDbSHTqfnnqXMrZCHug= Received: (qmail 122055 invoked by alias); 13 Jun 2018 15:02: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 120600 invoked by uid 89); 13 Jun 2018 15:02:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 13 Jun 2018 15:02:32 +0000 Received: from relay1.suse.de (charybdis-ext-too.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 17BCAADE1 for ; Wed, 13 Jun 2018 15:02:30 +0000 (UTC) Date: Wed, 13 Jun 2018 17:02:30 +0200 (CEST) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix vectorizable_operation destination vector type Message-ID: User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 This is needed for the ABSU_EXPR changes. It fixes a latent issue in vect_recog_vector_vector_shift_pattern as well. Bootstrapped and tested on x86_64-unknown-linux-gnu, applied. Richard. 2018-06-13 Richard Biener * tree-vect-patterns.c (vect_recog_vector_vector_shift_pattern): Properly set vector type of the intermediate stmt. * tree-vect-stmts.c (vectorizable_operation): The destination var always has vectype_out type. diff --git a/gcc/tree-vect-patterns.c b/gcc/tree-vect-patterns.c index 507c5b94f07..6786ffcd4c6 100644 --- a/gcc/tree-vect-patterns.c +++ b/gcc/tree-vect-patterns.c @@ -2185,6 +2185,11 @@ vect_recog_vector_vector_shift_pattern (vec *stmts, TYPE_PRECISION (TREE_TYPE (oprnd1))); def = vect_recog_temp_ssa_var (TREE_TYPE (rhs1), NULL); def_stmt = gimple_build_assign (def, BIT_AND_EXPR, rhs1, mask); + stmt_vec_info new_stmt_info + = new_stmt_vec_info (def_stmt, vinfo); + set_vinfo_for_stmt (def_stmt, new_stmt_info); + STMT_VINFO_VECTYPE (new_stmt_info) + = get_vectype_for_scalar_type (TREE_TYPE (rhs1)); new_pattern_def_seq (stmt_vinfo, def_stmt); } } diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index da4cb0737ed..9f365e31e49 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -5981,16 +5981,19 @@ vectorizable_operation (gimple *stmt, gimple_stmt_iterator *gsi, dump_printf_loc (MSG_NOTE, vect_location, "transform binary/unary operation.\n"); - /* Handle def. */ - vec_dest = vect_create_destination_var (scalar_dest, vectype); - /* POINTER_DIFF_EXPR has pointer arguments which are vectorized as vectors with unsigned elements, but the result is signed. So, we need to compute the MINUS_EXPR into vectype temporary and VIEW_CONVERT_EXPR it into the final vectype_out result. */ tree vec_cvt_dest = NULL_TREE; if (orig_code == POINTER_DIFF_EXPR) - vec_cvt_dest = vect_create_destination_var (scalar_dest, vectype_out); + { + vec_dest = vect_create_destination_var (scalar_dest, vectype); + vec_cvt_dest = vect_create_destination_var (scalar_dest, vectype_out); + } + /* Handle def. */ + else + vec_dest = vect_create_destination_var (scalar_dest, vectype_out); /* In case the vectorization factor (VF) is bigger than the number of elements that we can fit in a vectype (nunits), we have to generate