From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 98528 invoked by alias); 9 Dec 2017 23:18:11 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 98514 invoked by uid 89); 9 Dec 2017 23:18:10 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.0 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,GIT_PATCH_3,KAM_ASCII_DIVIDERS,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-wm0-f47.google.com Received: from mail-wm0-f47.google.com (HELO mail-wm0-f47.google.com) (74.125.82.47) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 09 Dec 2017 23:18:09 +0000 Received: by mail-wm0-f47.google.com with SMTP id b199so4731755wme.1 for ; Sat, 09 Dec 2017 15:18:08 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:mail-followup-to:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=6Rl1SrkbrQkzAPjLFH2JUn51EqgBntf7ElE2xWNhYYI=; b=iqzWmXBWtXn+G+rYDIWxZNnoQqHU3pAR6TQL1z/fX6AmMb5MXLiF4Vi5tXYI2xACkE 9FMoS3dLp17q4su7a1cs6Ag9rWao8gWJFAzY+EE9J00q53WAGEf6aqpQV+XdFFV7TTuV Q+3qYBN6QQaTNHz4Uh1cbgcSxxr/iwdVMMhtB7Aq5xOW8aGiofFyjVtPlIm6fgIbA80L lXZsyLAcsBjU8BQP+pJPcWU7t6U7Rjn4MaepvIa1r4cJQh80wfimH+tmZHQ28e8LcxBH 4mViru340S0W6qQFBRFANZxBe4Wki7Xp5jnXozIGWNSe/vrForKyheFPKuVIk+s4vsc6 Heew== X-Gm-Message-State: AKGB3mIJ6J/G4uH9j+i+u3m0alMlnuSy3n5+4dECuWKXWbKQe4RsyfdK Efl0tnPinOfhmkQpL4DwciISpYbOPss= X-Google-Smtp-Source: AGs4zMavlHloQ9OCZsF75FwhObsN/uiPHrVgSvYMkK7Pbim8eskBYjJIaOSne0ziZM8UbN+0K1QbDw== X-Received: by 10.28.211.211 with SMTP id k202mr7577652wmg.113.1512861487038; Sat, 09 Dec 2017 15:18:07 -0800 (PST) Received: from localhost ([2.25.234.120]) by smtp.gmail.com with ESMTPSA id 30sm11523078wrl.22.2017.12.09.15.18.05 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 09 Dec 2017 15:18:06 -0800 (PST) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Subject: [06/13] Check whether a vector of QIs can store all indices References: <87indfmrgt.fsf@linaro.org> Date: Sat, 09 Dec 2017 23:18:00 -0000 In-Reply-To: <87indfmrgt.fsf@linaro.org> (Richard Sandiford's message of "Sat, 09 Dec 2017 23:06:26 +0000") Message-ID: <87r2s3lccy.fsf@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2017-12/txt/msg00559.txt.bz2 The patch to remove the vec_perm_const optab checked whether replacing a constant permute with a variable permute is safe, or whether it might truncate the indices. This patch adds a corresponding check for whether variable permutes can be lowered to QImode-based permutes. 2017-12-09 Richard Sandiford gcc/ * optabs-query.c (can_vec_perm_var_p): Check whether lowering to qimode could truncate the indices. * optabs.c (expand_vec_perm_var): Likewise. Index: gcc/optabs-query.c =================================================================== --- gcc/optabs-query.c 2017-12-09 22:47:21.534314227 +0000 +++ gcc/optabs-query.c 2017-12-09 22:47:25.861316866 +0000 @@ -378,7 +378,8 @@ can_vec_perm_var_p (machine_mode mode) /* We allow fallback to a QI vector mode, and adjust the mask. */ machine_mode qimode; - if (!qimode_for_vec_perm (mode).exists (&qimode)) + if (!qimode_for_vec_perm (mode).exists (&qimode) + || GET_MODE_NUNITS (qimode) > GET_MODE_MASK (QImode) + 1) return false; if (direct_optab_handler (vec_perm_optab, qimode) == CODE_FOR_nothing) Index: gcc/optabs.c =================================================================== --- gcc/optabs.c 2017-12-09 22:47:23.878315657 +0000 +++ gcc/optabs.c 2017-12-09 22:47:25.861316866 +0000 @@ -5595,7 +5595,8 @@ expand_vec_perm_var (machine_mode mode, /* As a special case to aid several targets, lower the element-based permutation to a byte-based permutation and try again. */ machine_mode qimode; - if (!qimode_for_vec_perm (mode).exists (&qimode)) + if (!qimode_for_vec_perm (mode).exists (&qimode) + || GET_MODE_NUNITS (qimode) > GET_MODE_MASK (QImode) + 1) return NULL_RTX; icode = direct_optab_handler (vec_perm_optab, qimode); if (icode == CODE_FOR_nothing)