From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13643 invoked by alias); 10 Aug 2016 12:19:31 -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 13588 invoked by uid 89); 10 Aug 2016 12:19:31 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1899, Pack, HContent-Transfer-Encoding:7Bit X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 10 Aug 2016 12:19:27 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 500BF812F2; Wed, 10 Aug 2016 14:19:24 +0200 (CEST) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4Qd7WWpLm-Qy; Wed, 10 Aug 2016 14:19:24 +0200 (CEST) Received: from arcturus.home (ADijon-653-1-242-83.w83-196.abo.wanadoo.fr [83.196.17.83]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id 007C8812F1; Wed, 10 Aug 2016 14:19:24 +0200 (CEST) From: Eric Botcazou To: Bernd Edlinger Cc: Richard Biener , "gcc-patches@gcc.gnu.org" , Jeff Law , Jakub Jelinek Subject: Re: AW: [PATCH] Fix unaligned access when predictive commoning (PR 71083) Date: Wed, 10 Aug 2016 12:19:00 -0000 Message-ID: <113142642.78Fd9MK2D0@arcturus.home> User-Agent: KMail/4.14.10 (Linux/3.16.7-35-desktop; KDE/4.14.9; x86_64; ; ) In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-SW-Source: 2016-08/txt/msg00807.txt.bz2 > I tried to translate the c-test case to an equivalent ada test case with > my not-so-fluent Ada speak... > > So here is a test case that *actually* hits the if ((boff % BITS_PER_UNIT) > != 0) code path. I see, well done then. > Before my patch there was an unaligned SImode access, and with > the patch we have 3 QImode accesses here. > > cat pr71083_pkg.ads > package Pr71083_pkg is > type Nibble is mod 2**4; > type Int24 is mod 2**24; > type StructA is record > a : Nibble; > b : Int24; > end record; > pragma Pack(StructA); > type StructB is record > a : Nibble; > b : StructA; > end record; > pragma Pack(StructB); > type ArrayOfStructB is array(0..100) of StructB; > procedure Foo (X : in out ArrayOfStructB); > end Pr71083_pkg; > > cat pr71083_pkg.adb > -- { dg-do compile } > -- { dg-options "-O3" } > package body Pr71083_pkg is > procedure Foo (X : in out ArrayOfStructB) is > begin > for K in 0..99 loop > X (K+1).b.b := X (K).b.b; > end loop; > end Foo; > end Pr71083_pkg; > > cat pr71083.adb > -- { dg-do run } > -- { dg-options "-O3" } > with Pr71083_pkg; > use Pr71083_pkg; > procedure Pr71083 is > Test : ArrayOfStructB; > begin > Test (0).b.b := 9999; > Foo (Test); > if Test (100).b.b /= 9999 then > raise Program_Error; > end if; > end; > > > I was not sure which name to choose, > so I used the same convention as in the c-torture. > How do you like that? Worst convention ever. :-) Either opt57 or loop_optimization23 at your convenience (you can add a reference to the PR in a comment). > I would like to add that to the gnat.dg because > it seems that there is zero testing for the predictive > commoning in the gnat.dg test suite. Very likely so. The renamed testcase is OK for mainline, but please replace "Eric's" with "the" in the patch or copy-and-paste the explanation. -- Eric Botcazou