From patchwork Wed Oct 4 13:35:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Lyon X-Patchwork-Id: 821307 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-463454-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="EJ+ZhnIT"; 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 3y6cNZ6DB1z9t2l for ; Thu, 5 Oct 2017 00:35:41 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; q= dns; s=default; b=F2PlinPlbIoGrEDFGZZA3/OeCHn7IXVG04FDePBf3YuZzQ lTWojYEmRQ4GSfbupvJaQRLjrKcOBRnqhJAxY+mqANdWq1NW3AOhkbHOAJOOjtXS b+kzkAT3LQnqTzSef4LMtjCtfU/IT4nCeV/Nf8nNp9cthIaESLhoieFuuKU/I= 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 :mime-version:from:date:message-id:subject:to:content-type; s= default; bh=UHso6iuzvGBYZs300Y9CLzqq9/U=; b=EJ+ZhnITCWvsw0etx7TU jv9VPg4tEYtuocWM7iVAFrD7paldAICkv3DzXQLGuwt4a9givsw7CLcceQ+KZYBY 20M+CG+WV/PfjEwgDbGZE1fcHC8t+VWedXZiL7dO8eVgk7/42em8q8xJ+2IiHbSi bEUr8p8tyQsNtGOib2HdSGw= Received: (qmail 19446 invoked by alias); 4 Oct 2017 13:35:34 -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 19427 invoked by uid 89); 4 Oct 2017 13:35:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy=H*r:sk:mail-ua, Hx-spam-relays-external:sk:mail-ua, HX-HELO:sk:mail-ua, H*RU:sk:mail-ua X-HELO: mail-ua0-f175.google.com Received: from mail-ua0-f175.google.com (HELO mail-ua0-f175.google.com) (209.85.217.175) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 04 Oct 2017 13:35:32 +0000 Received: by mail-ua0-f175.google.com with SMTP id v12so7154648uaf.5 for ; Wed, 04 Oct 2017 06:35:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=LzGNsi/xAFt63WWYIY74hg6rvvy96IjkvM0Idqm/UMQ=; b=TWE2zYnwDcfMUfahz1IR5+wKPJNQyhmUuja3W2C2otYT/BlWxXeBQbGBZrmG2U0NL6 hv3/H29Z1eLfvxGEABkpb9GWcqrLgS6MyWjUxeah5AoadK6CDN01UzGqEHE2U1+GFv/R aYGIL++qYHuwa7TJDMNxIMH3p45+gWV/GAqYCniCRSF4KEYv//qGyXcp2hr0ZlqP4SKq JWQASjNZHocoSDQ5GliYLJrba5doYhMm8RlJUNWR2gwuYHy16MySBOESTNrKqTicpPNj K+beH2BKSNjKtsxDEIgr6YYI76YhG/64berm+o0Vya048tIRBW5CdSh4ReWKd/h0/I4N q+ew== X-Gm-Message-State: AMCzsaU0z2GqDQ+7dNQEFGdYSl+/5M2AI6ijNcJVQ7V3wQCOvqoPUDB8 jWB1t2M1IJ/TYC9Wu07+JrUrJEOeIXUaXtP6wUS8rsNgL8w= X-Google-Smtp-Source: AOwi7QDvWJ+Z97VWoPTszoR2HrbnuHUf91EQ6AAiMktdZLIacyAp58FBKz8pv39HY5vmd0e61YNORfOn+RamOCnkHUg= X-Received: by 10.176.4.71 with SMTP id 65mr6228760uav.82.1507124129896; Wed, 04 Oct 2017 06:35:29 -0700 (PDT) MIME-Version: 1.0 Received: by 10.103.120.3 with HTTP; Wed, 4 Oct 2017 06:35:29 -0700 (PDT) From: Christophe Lyon Date: Wed, 4 Oct 2017 15:35:29 +0200 Message-ID: Subject: [AArch64] Backport to gcc-7 PR71727 fix -mstrict-align To: "gcc-patches@gcc.gnu.org" X-IsSubscribed: yes Hi, I've recently committed a follow-up fix for PR71727 for -mstrict-align on aarch64 (r253242). I think it would be appropriate to apply it to gcc-7-branch. The patch from trunk applies cleanly to gcc-7-branch. Although the original bug was reported against 4.9.4, 5.3.1, 6.1.0, Naveen's patch was not backported to these branches, so it's not appropriate to backport my patch there. OK? Thanks, Christophe 2017-09-20 Christophe Lyon PR target/71727 gcc/ * config/aarch64/aarch64.c (aarch64_builtin_support_vector_misalignment): Always return false when misalignment is unknown. gcc/testsuite/ * gcc.target/aarch64/pr71727-2.c: New test. diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 799989a..7cc67ec 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -11757,19 +11757,9 @@ aarch64_builtin_support_vector_misalignment (machine_mode mode, if (optab_handler (movmisalign_optab, mode) == CODE_FOR_nothing) return false; + /* Misalignment factor is unknown at compile time. */ if (misalignment == -1) - { - /* Misalignment factor is unknown at compile time but we know - it's word aligned. */ - if (aarch64_simd_vector_alignment_reachable (type, is_packed)) - { - int element_size = TREE_INT_CST_LOW (TYPE_SIZE (type)); - - if (element_size != 64) - return true; - } - return false; - } + return false; } return default_builtin_support_vector_misalignment (mode, type, misalignment, is_packed); diff --git a/gcc/testsuite/gcc.target/aarch64/pr71727-2.c b/gcc/testsuite/gcc.target/aarch64/pr71727-2.c new file mode 100644 index 0000000..2bc803a --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/pr71727-2.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-mstrict-align -O3" } */ + +unsigned char foo(const unsigned char *buffer, unsigned int length) +{ + unsigned char sum; + unsigned int count; + + for (sum = 0, count = 0; count < length; count++) { + sum = (unsigned char) (sum + *(buffer + count)); + } + + return sum; +} + +/* { dg-final { scan-assembler-times "and\tw\[0-9\]+, w\[0-9\]+, 15" 1 } } */