From patchwork Tue Aug 13 12:33:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 1146309 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-506808-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="DZ2YD2e9"; 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 467Bvg0KrBz9sN6 for ; Tue, 13 Aug 2019 22:33:16 +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:cc:subject:message-id:mime-version:content-type; q=dns; s=default; b=C/ETCjdvrSJ8clmr2Yv1lKMhA792LK0eGOyGE81h0uB7kEj/NR WeZ6uTqjKsLF+SUbZeTr8bC5MKtZE11M+oSEmJ3uITCd+pH3I2krp17Vdb8Xfq4c K1yYpbTEEqVSUM+ZdLBPQFny3oZAfescFIJUzfSJRYxomCEi1uGowDImY= 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:mime-version:content-type; s= default; bh=MhFKFJIu0CVUPoOzivOh6z9rfmA=; b=DZ2YD2e9n9PjGQNco1lb 2pd+kLoGUa6ZCpJo/16DY37EG6t51yARTA9lPNuHGklK8g85lqCBvFJntu2728YL qfkaS1fYd6cArjEV5UtpB0LB7ihuaXq3sjQ01FVecA6hCO92NXi+v+CeQoVb5xFN EWR+u9sgYad77BzluToiOYU= Received: (qmail 85046 invoked by alias); 13 Aug 2019 12:33:09 -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 84942 invoked by uid 89); 13 Aug 2019 12:33:09 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-10.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mx1.suse.de Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 13 Aug 2019 12:33:07 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 61F4AB62E; Tue, 13 Aug 2019 12:33:05 +0000 (UTC) Date: Tue, 13 Aug 2019 14:33:05 +0200 (CEST) From: Richard Biener To: gcc-patches@gcc.gnu.org cc: ubizjak@gmail.com, hjl.tools@gmail.com Subject: [PATCH][2/2][i386] STV changes, reg-copy as vector Message-ID: User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 The following splits out the change that makes the live-range split / mode change copy pseudos vector mode pseudos. I've tried reproducing the issue I faced with SImode chains but failed likely because we're never using simple moves in the end while for SImode we can end up with (set (subreg:V4SI (reg:SI 42) 0) (subreg:V4SI (reg:SI 41) 0)) which we happily propagate out. So pursuing this patch independently doesn't make much sense. Still the main change is in dimode_scalar_chain::make_vector_copies where 'vreg' is now V2DImode instead of DImode and the change to emit_move_insn (vreg, tmp) hints at the change done to the above problematic insn. The rest of the changes deal with some regs already being in the appropriate vector mode. I realize I might have avoided my original issue by emitting not the above reg-reg move but (set (subreg:V4SI (reg:SI 42) 0) (vec_merge:V4SI (vec_duplicate:V4SI (reg:SI 41)) (const_vec [0 0 0 0]) (const_1))) but I didn't try (the full patch contained a testcase for the issue). Still it seems odd to use DImode pseudos when all uses are wrapped in (subreg:V2DI ...). As (unrelated) change I propose to error with fatal_insn_not_found in case recog doesn't recognize the altered insns which make it easier to spot errors early. Bootstrap / regtest running on x86_64-unknown-linux-gnu ontop of [1/2], OK for trunk if that succeeds? Thanks, Richard. 2019-08-13 Richard Biener * config/i386/i386-features.c (dimode_scalar_chain::replace_with_subreg): Elide the subreg if the reg is already vector. (dimode_scalar_chain::convert_op): Likewise. (dimode_scalar_chain::make_vector_copies): Use a vector-mode pseudo as destination to avoid later passes copy-propagating it out. (dimode_chain::convert_insn): Convert the source of a memory op in case it is not of the appropriate scalar mode. Raise fatal_insn_not_found if the converted insn is not recognized. Index: gcc/config/i386/i386-features.c =================================================================== --- gcc/config/i386/i386-features.c (revision 274328) +++ gcc/config/i386/i386-features.c (working copy) @@ -573,7 +573,8 @@ rtx dimode_scalar_chain::replace_with_subreg (rtx x, rtx reg, rtx new_reg) { if (x == reg) - return gen_rtx_SUBREG (V2DImode, new_reg, 0); + return (GET_MODE (new_reg) == V2DImode + ? new_reg : gen_rtx_SUBREG (V2DImode, new_reg, 0)); const char *fmt = GET_RTX_FORMAT (GET_CODE (x)); int i, j; @@ -627,7 +628,7 @@ void dimode_scalar_chain::make_vector_copies (unsigned regno) { rtx reg = regno_reg_rtx[regno]; - rtx vreg = gen_reg_rtx (DImode); + rtx vreg = gen_reg_rtx (V2DImode); df_ref ref; for (ref = DF_REG_DEF_CHAIN (regno); ref; ref = DF_REF_NEXT_REG (ref)) @@ -641,7 +642,12 @@ dimode_scalar_chain::make_vector_copies gen_rtx_SUBREG (SImode, reg, 0)); emit_move_insn (adjust_address (tmp, SImode, 4), gen_rtx_SUBREG (SImode, reg, 4)); - emit_move_insn (vreg, tmp); + emit_move_insn (vreg, + gen_rtx_VEC_MERGE (V2DImode, + gen_rtx_VEC_DUPLICATE (V2DImode, + tmp), + CONST0_RTX (V2DImode), + GEN_INT (HOST_WIDE_INT_1U))); } else if (TARGET_SSE4_1) { @@ -841,7 +847,8 @@ dimode_scalar_chain::convert_op (rtx *op gcc_assert (!DF_REF_CHAIN (ref)); break; } - *op = gen_rtx_SUBREG (V2DImode, *op, 0); + if (GET_MODE (*op) != V2DImode) + *op = gen_rtx_SUBREG (V2DImode, *op, 0); } else if (CONST_INT_P (*op)) { @@ -931,6 +938,8 @@ dimode_scalar_chain::convert_insn (rtx_i case MEM: if (!REG_P (dst)) convert_op (&src, insn); + else if (GET_MODE (src) != DImode) + src = gen_rtx_SUBREG (DImode, src, 0); break; case REG: @@ -977,7 +986,9 @@ dimode_scalar_chain::convert_insn (rtx_i PATTERN (insn) = def_set; INSN_CODE (insn) = -1; - recog_memoized (insn); + int patt = recog_memoized (insn); + if (patt == -1) + fatal_insn_not_found (insn); df_insn_rescan (insn); }