From patchwork Sat Dec 9 23:18:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 121296 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp1162913qgn; Sat, 9 Dec 2017 15:18:22 -0800 (PST) X-Google-Smtp-Source: AGs4zMYgwLdZjlhskF8wNJI2qb1TSVnqK8dJUUDr6sxI9Ug/93O3SjcwKgDyMJU3uGx6EnkJ+Cx2 X-Received: by 10.98.182.16 with SMTP id j16mr2861272pff.47.1512861502434; Sat, 09 Dec 2017 15:18:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512861502; cv=none; d=google.com; s=arc-20160816; b=Cemhi5I93UoMiJ3Fs8/I0UsgJJY0e+nzQoaItOfcgmFVULlrcxDh29zUMYX2kgo9om j3emDTNdYxAWu6okTpvo5O4adcpe8YNMv6nHIrz6FUxL7kJxzlnVPqztePEZcdhufz7q 3K/PxPFAuz5Z9pFPQ85eON6BHWjNPFMNhOs/OHF3yr/hR8glEHoJvMPm68gR1IhKcbI+ +JqIfBtq3Qd+C5dzzRthJ57oJzN7gyNZCbenA/tlrrW6Ljv/kB/KsEnKGRPGfdpxc1DH IeIXiHIx7+4iBXv+NYI9d/3wHpR8usKKiU7eolC+gccK6oK6v+BQOf7LyZFbt3UCX35u V5DQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:message-id:in-reply-to:date:references :subject:mail-followup-to:to:from:delivered-to:sender:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :mailing-list:dkim-signature:domainkey-signature :arc-authentication-results; bh=6Rl1SrkbrQkzAPjLFH2JUn51EqgBntf7ElE2xWNhYYI=; b=KG8yFnUiQlmOuP+S/54Gx40WTDvpnf+LmMqikLFUqZ7dZ2DOPofH4cLYvceJ9s/qeb dY+aFcVp2ExNj16Dk046gBvsjRoiqjiGYXhj6r185maiL5sKcsbmMkJfc8LBhPziBVK7 j2FC55M+jg5768zkpePq1QG0kjplwQSk38uMAIKbbv5fV2vqrgluUuPRaiQeDwmcbNI9 HEm0b7FKdYuil7A4lipX38263eW1C0mE0ijb+qUituge5Z60TZRamUDiLN+OAfPSsG0p fXJyfF14nWaBCDgIU5jtdd4IS/tucug6TnY5dOVpRTL5JRLaPsFdxIPrzf763jkzBvDo GhAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=DOWjXw3J; spf=pass (google.com: domain of gcc-patches-return-468856-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-468856-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id i185si7699155pgc.294.2017.12.09.15.18.22 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 09 Dec 2017 15:18:22 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-468856-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=DOWjXw3J; spf=pass (google.com: domain of gcc-patches-return-468856-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-468856-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=default; b=KjwXYZZop2yDo/kMf31aAiCCGu1ft /VY1pe0uL9nQBpK5ykZQFNkw9Hbgluu/H9x7c+JiApvIBndMmMDbwpdz0U84UZ0L PqR9BE6amHWX3k38jm1ehQ7HBmde4tO0hpJuH13HGlMKCZHJqie1VJ9iYYhOweQm 79NkE+CFyE+99M= 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:from :to:subject:references:date:in-reply-to:message-id:mime-version :content-type; s=default; bh=GhYWFc6OsLZgBPXiY59xGqCKUjc=; b=DOW jXw3J52xuHZ3ly4VgKqeAqwKvTuFyOshBtbd0Fe3LpywVHggwm9ubErHPlKq8LVv 3qz33HAT6EUEjcuwjy9SfV8wjgIvoiFvA/cCMDdlVcjuNxlVOVfssLig81HEqUiQ yKWYdOXWqiUlOzwkRFc/HsmdrsQ8AY0Pe4faDsEU= 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-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 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-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:05 +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 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)