Prev: Elaboration query
Next: Dhrystone
From: Georg Bauhaus on 23 Jul 2010 10:54 On 23.07.10 16:17, Ada novice wrote: > Hi, > Thanks for your kind help. As I mentioned earlier, I use > > -gnatVa -O3 -gnatn -funroll-loops -gnatf -gnato -O3 may already trigger inlining an loop unrolling. The GNAT Guides, including GCC docs, explain this. They have been installed with GNAT on your computer. The versions installed with your compiler should match the software installed, perhaps more than any other version of these same docs you find on the net. Last time I checked the sections on optimization in the GNAT docs recommend -O2 -funroll-loops IIRC. One thing you could do---after showing that your program is correct---is remove numeric overflow checking (-gnato). Or turn off all checks (-gnatp). The program is no standard Ada program then, but since your program is correct... :-) Another thing is playing with object sizes. Lots of risk and disappointment ahead, though! Sometimes a definition of a type can be altered such that its representation uses only 32 bits on some 64 bit computer, which may or may not be good for your program. > and so the -O3 is already there though the .ago file doesn't state it. > I have tried to put all of your options at once so as to have: > > -gnatVa -O3 -gnatn -funroll-loops -gnatf -gnato -fpeel-loops -ftracer - > funswitch-loops -fweb -frename-registers -mfpmath=sse -msse3 Does your program use floating point types? Georg
From: Robert A Duff on 23 Jul 2010 11:16 Georg Bauhaus <rm.dash-bauhaus(a)futureapps.de> writes: > On 23.07.10 16:17, Ada novice wrote: >> Hi, >> Thanks for your kind help. As I mentioned earlier, I use >> >> -gnatVa -O3 -gnatn -funroll-loops -gnatf -gnato If you want speed, then you don't want -gnatVa. > One thing you could do---after showing that your program > is correct---is remove numeric overflow checking > (-gnato). To clarify: -gnato turns overflow checking ON -- it's off by default. >...Or turn off all checks (-gnatp). The program is no > standard Ada program then, but since your program is correct... :-) It's still a standard Ada program. - Bob
From: Georg Bauhaus on 23 Jul 2010 11:22 On 23.07.10 17:16, Robert A Duff wrote: >> ...Or turn off all checks (-gnatp). The program is no >> standard Ada program then, but since your program is correct... :-) > > It's still a standard Ada program. Without -gnato?
From: sjw on 23 Jul 2010 12:51 On Jul 23, 4:22 pm, Georg Bauhaus <rm.dash-bauh...(a)futureapps.de> wrote: > On 23.07.10 17:16, Robert A Duff wrote: > > >> ...Or turn off all checks (-gnatp). The program is no > >> standard Ada program then, but since your program is correct... :-) > > > It's still a standard Ada program. > > Without -gnato? -gnato is one of the things you have to do to make GNAT a conforming Ada compiler.
From: Robert A Duff on 23 Jul 2010 14:03
sjw <simon.j.wright(a)mac.com> writes: > On Jul 23, 4:22�pm, Georg Bauhaus <rm.dash-bauh...(a)futureapps.de> > wrote: >> On 23.07.10 17:16, Robert A Duff wrote: >> >> >> ...Or turn off all checks (-gnatp). �The program is no >> >> standard Ada program then, but since your program is correct... :-) >> >> > It's still a standard Ada program. >> >> Without -gnato? Sure. How could compiler switches affect some property ("standardness") of the text of an Ada program? > -gnato is one of the things you have to do to make GNAT a conforming > Ada compiler. Well, not really. If you don't say -gnato, then GNAT is implicitly assuming "pragma Suppress(Overflow_Check);". That's a standard feature of Ada, and the compiler writer gets to decide how source text is represented. If you don't want that text as part of your program, say "-gnato". Similarly, if you say "-gnatn", GNAT is implicitly including "pragma Suppress(All_Checks);" as part of your program text. I realize this argument is a bit of a cheat. And I think overflow checks should be turned on by default. But I don't think it's a conformance issue, formally speaking -- GNAT conforms with or without -gnatn or -gnato. Without -gnatE (dynamic elaboration checks), on the other hand, GNAT is nonconforming, because it rejects some legal programs, and you can't play the above "source representation" game. I think it's good that it's nonconforming in this case, because the default behavior (static elaboration checks) is better than the standard way, and it doesn't harm portability. - Bob |