From patchwork Fri Apr 7 07:36:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 748091 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 3vzrxW234Dz9s7s for ; Fri, 7 Apr 2017 17:36:44 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="yzgf2B7U"; dkim-atps=neutral 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:cc:content-type; q=dns; s=default; b=xgSMH5rmFaCWGLOpnbzV1Oln43+alRmQ+k3SFfzaBDh DPoMTukBRynZlrN+4a78+xUDJhsvQjYy6iyIdeXIfb6Ud3HYgmXq+3MusTd19meS jGe+61D+/wqgKMKMvp31emHimaKeyH8CQmj68sLrh4cYRpFMoM3fxeeZfS+YQ+Ug = 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:cc:content-type; s=default; bh=auvyaJD1Oy7wwVaMw43BuIwAbKA=; b=yzgf2B7U1QAtYGozg kLQFbVkWKzRquWrd4yrEI5sP5myrIv1deWRS25v6a8N/fJNG3uWxv+nUZ9tQRwD+ kQuNdpr59rmEOk5tY/cbzEL43F817chrS9zd+0C341SkgGvbEkmNkxgGfefg2a5i sg0vLeR1H97nxMu3xufTOnCNQ4= Received: (qmail 33525 invoked by alias); 7 Apr 2017 07:36: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 33503 invoked by uid 89); 7 Apr 2017 07:36:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.4 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=4000000, HX-Received:Fri, 2, 9, hello! X-HELO: mail-vk0-f41.google.com Received: from mail-vk0-f41.google.com (HELO mail-vk0-f41.google.com) (209.85.213.41) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 07 Apr 2017 07:36:32 +0000 Received: by mail-vk0-f41.google.com with SMTP id r69so66347233vke.2 for ; Fri, 07 Apr 2017 00:36:33 -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:cc; bh=tY9vmP4XvInJZ8/UZtLH4Kg6AMQvkI41CrpZZf7tiMo=; b=cGOuzUKAVg+HhLWWX1krsxyWEVA7vCeMJSFQ13Ajk3jLvYGBtaiDuzix0dGX8ebtMI 9NmaA5eLxgVBMdM+vDqR7v7HA0FiEZUTWHeEm1V4IjyqyagbKt0d+heF6JElCkE/f2Xt t0q6jVxl0Xa7KmBLN4CLIhdmRHkrx8zbPrsXATWxxm6SwoYEPPlbOP8iVRVL/QDamAb3 sVmHQlLzhHL/1KH8PGO7CiUuDfyrxR19y9gBFn6+4tm/od0yndA+D4oxfyShv4/jhek3 O5C/Xge/kkPrTewRK9a5z8HU6Xhi38et8xiW76OetTiic2qT8z+5uRPAXW8Sf2CEA+pW p1wQ== X-Gm-Message-State: AFeK/H0J8svTmBgknAo6GVaKaGXTQGTbGu8mESFv43aMDsxrPr3Lkemz+phx/vnfHyGUP77NWs60qKxOBlcmFw== X-Received: by 10.31.164.198 with SMTP id n189mr17930118vke.62.1491550591759; Fri, 07 Apr 2017 00:36:31 -0700 (PDT) MIME-Version: 1.0 Received: by 10.103.183.3 with HTTP; Fri, 7 Apr 2017 00:36:31 -0700 (PDT) From: Uros Bizjak Date: Fri, 7 Apr 2017 09:36:31 +0200 Message-ID: Subject: [PATCH, testsuite]: Fix gcc.dg/unroll-7.c FAIL for x32 target To: "gcc-patches@gcc.gnu.org" Cc: Richard Guenther , Jakub Jelinek Hello! Attached patch mitigates: FAIL: gcc.dg/unroll-7.c scan-rtl-dump loop2_unroll "number of iterations: .const_int 999999" testsuite failure for x32 target. Loop analysis determines: Loop 1 is simple: simple exit 3 -> 4 infinite if: (expr_list:REG_DEP_TRUE (ne:SI (and:SI (minus:SI (reg:SI 106 [ _13 ]) (reg:SI 105 [ ivtmp.10 ])) (const_int 3 [0x3])) (const_int 0 [0])) (nil)) number of iterations: (lshiftrt:SI (plus:SI (minus:SI (reg:SI 106 [ _13 ]) (reg:SI 105 [ ivtmp.10 ])) (const_int -4 [0xfffffffffffffffc])) (const_int 2 [0x2])) upper bound: 999999 likely upper bound: 999999 realistic bound: 999999 but it doesn't figure out that with (reg 105) and (reg 106), defined as: (insn 22 19 23 2 (set (reg:SI 105 [ ivtmp.10 ]) (subreg/s/v:SI (reg/v/f:DI 110 [ a ]) 0)) 82 {*movsi_internal} (nil)) (insn 23 22 28 2 (parallel [ (set (reg:SI 106 [ _13 ]) (plus:SI (subreg/s/v:SI (reg/v/f:DI 110 [ a ]) 0) (const_int 4000000 [0x3d0900]))) (clobber (reg:CC 17 flags)) ]) 217 {*addsi_1} (minus:SI (reg:SI 106) ( reg:SI 105)) evaluates to (const_int 4000000). Probably, because subregs are involved. Short of enhancing loop analysis to properly handle subregs, I propose following testsuite patch that avoids particularities of argument passing. 2017-04-07 Uros Bizjak * gcc.dg/unroll-7.c: Declare "a" as pointer to external array. Patch was tested on x86_64 {,-m32,-mx32}. OK for mainline? Uros. diff --git a/gcc/testsuite/gcc.dg/unroll-7.c b/gcc/testsuite/gcc.dg/unroll-7.c index 70b92ba..e76d4fa 100644 --- a/gcc/testsuite/gcc.dg/unroll-7.c +++ b/gcc/testsuite/gcc.dg/unroll-7.c @@ -2,7 +2,9 @@ /* { dg-options "-O2 -fdump-rtl-loop2_unroll -funroll-loops" } */ /* { dg-require-effective-target int32plus } */ -int t(int *a) +extern int *a; + +int t(void) { int i; for (i=0;i<1000000;i++)