From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,10444cff97404845 X-Google-Attributes: gid103376,public From: Samuel Tardieu Subject: Re: C like op= proposal Date: 1999/08/17 Message-ID: <87emh2l218.fsf@antinea.enst.fr>#1/1 X-Deja-AN: 513876507 References: <37B7D172.DCE02FFA@Maths.UniNe.CH> Mail-Copies-To: sam@ada.eu.org To: Gautier Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@enst.enst.fr X-Trace: enst.enst.fr 934912883 23370 137.194.160.145 (17 Aug 1999 18:01:23 GMT) Organization: TELECOM Paris User-Agent: Gnus/5.070084 (Pterodactyl Gnus v0.84) XEmacs/21.2(beta3) (Aglaia) Mime-Version: 1.0 NNTP-Posting-Date: 17 Aug 1999 18:01:23 GMT Newsgroups: comp.lang.ada Date: 1999-08-17T18:01:23+00:00 List-Id: >>>>> "Gautier" == Gautier writes: Gautier> a(b(c,d+e(f,g)).h(i,j)) := a(b(c,d+e(f,g)).h(i,j)) + 1; Gautier> which can be horribily long and unlikely to be catched by the Gautier> optimizer -> 2x too slow (at least: the extra code makes a Gautier> penalty for processor cache). Where did you get the impression that the optimizer would miss this? For example, using GNAT, the following expression generates: (ix86 code) t__pXb: movl t__jXb,%edx | decl %edx | movl t__iXb,%eax | decl %eax | leal (%eax,%eax,4),%eax | sall $3,%eax | leal (%eax,%edx,4),%edx | movl t__gXb,%ecx | decl %ecx | Address computation movl t__fXb,%eax | decl %eax | leal (%eax,%eax,4),%eax | sall $3,%eax | movl t__eXb(%eax,%ecx,4),%eax | addl t__dXb,%eax | imull $400,%eax,%eax | leal -400(%edx,%eax),%eax | imull $4000,t__cXb,%edx | movl t__bXb-4000(%eax,%edx),%eax | decl %eax | incl t__aXb(,%eax,4) <--- Increment done here! ret The code used to generate this was: (-O3 -fomit-frame-pointer -gnatp) package T is pragma Elaborate_Body; end T; package body T is pragma Warnings (Off); -- Uninitialized variables type Two_Ints is array (Integer range <>, Integer range <>) of Integer; type Rec is record H : Two_Ints (1 .. 10, 1 .. 10); end record; type Two_Recs is array (Integer range <>, Integer range <>) of Rec; A : array (1 .. 10) of Integer; B : Two_Recs (1 .. 10, 1 .. 10); C : Integer; D : Integer; E : Two_Ints (1 .. 10, 1 .. 10); F : Integer; G : Integer; I : Integer; J : Integer; procedure P is begin a(b(c,d+e(f,g)).h(i,j)) := a(b(c,d+e(f,g)).h(i,j)) + 1; end P; end T;