geode optimizations
Hi, Im sorry that this is not 100% specific to gcc, however this mailing list is the last place where I think this knowledge may lie. I have written some image processing routines in assembly language making extensive use of MMX, and now I want to start optimizing it, however I cant for the life of me find any documentation such as the Intel/AMD optimization manuals for pentium/athlon/opertron cores. I cant even find much useful information from mailing lists such as this one, where i was hoping to find it. Anyway, Im no expert in the matter, however I do understand the concepts of instruction pairing and pipelining. I know that the geode lx core, which is what we have for robocup, is non-superscalar. From what I understand the core has two pipelines, the one to the Integer unit and the other to the fpu/MMX/3d Now unit. Does this more or less mean that instruction pairing has no effect? Is it still worth scheduling instructions in a pattern, such as the 4 - 1 - 1 the intel optimization manual suggests for its cores? I saw that gcc 4.3 added geode support, and Im hoping someone will have some better knowledge of the subject. Can anyone give me any pointers as to what i should be trying to optimize, or better yet links to documentation or hard benchmarks? Thanks in advance.
Re: GCC and the Visual Basic programmer....
On Tue, Feb 17, 2009 at 8:38 AM, Farlie A wrote: > In terms of Visual Basic code, there is of course no 'free' compiler for VB > code written prior > to VB.NET., and again the EULA for the runtime support would prevent use of > the Vendor's > runtime on 'free' systems.. > Should there be a way of using Visual Basic style code without using the > vendors runtime? > I take it you are aware of the mono project?
Re: Preprocessor for assembler macros?
you could run cpp on it by itself, or I suspect gcc -S tmp.s will also work, im in a rush though cant test this. On Sun, Mar 8, 2009 at 9:31 PM, Philipp Marek wrote: > Hello everybody, > > I already asked that on gcc-help@ but got no answer, so I'm trying again here. > > > I'm looking for a way to get inbetween the assembler macro processor and the > assembler. > I'd like to get the assembler sources mostly as-is, but with the macros used > therein already expanded. > > I've already taken a look at the "-a" command line option, but this does > assembling as well - so I'd have to filter the real assembler from there, and > try this way. > > Is there something easier? > > > Thank you for all answers. > > > Regards, > > Phil > > -- > Versioning your /etc, /home or even your whole installation? > Try fsvs (fsvs.tigris.org)! > -- Carl
Re: Preprocessor for assembler macros?
gcc -S tmp.S for some reason prints to stdout, so gcc -S tmp.S > tmp.s is what you need On Mon, Mar 9, 2009 at 4:41 AM, Carl wrote: > you could run cpp on it by itself, or I suspect gcc -S tmp.s will also > work, im in a rush though cant test this. > > On Sun, Mar 8, 2009 at 9:31 PM, Philipp Marek wrote: >> Hello everybody, >> >> I already asked that on gcc-help@ but got no answer, so I'm trying again >> here. >> >> >> I'm looking for a way to get inbetween the assembler macro processor and the >> assembler. >> I'd like to get the assembler sources mostly as-is, but with the macros used >> therein already expanded. >> >> I've already taken a look at the "-a" command line option, but this does >> assembling as well - so I'd have to filter the real assembler from there, and >> try this way. >> >> Is there something easier? >> >> >> Thank you for all answers. >> >> >> Regards, >> >> Phil >> >> -- >> Versioning your /etc, /home or even your whole installation? >> Try fsvs (fsvs.tigris.org)! >> > > > > -- > Carl > -- Carl
gcc 3.4.3 bug C++/inlines/thumb
I'm running into a bug with gcc 3.4.3: I've got syscall code for user-land to our kernel that trashes r14/lr. The code is inlined, and works find in ARM mode. When compiling in thumb, gcc does not preserve lr. With an older gcc 3.3.3, the code was not inlined, but generated correctly. L4_INLINE void * L4_KernelInterface (L4_Word_t *ApiVersion, L4_Word_t *ApiFlags, L4_Word_t *KernelId) { register L4_Word_t base_address asm ("r0"); register L4_Word_t _ApiVersion asm ("r1"); register L4_Word_t _ApiFlagsasm ("r2"); register L4_Word_t _KernelIdasm ("r3"); __asm__ __volatile__ ( "mov lr, pc\n" "mov pc, %[trap_kip]\n" : "=r" (base_address), "=r" (_ApiVersion), "=r" (_ApiFlags), "=r" (_KernelId) : [trap_kip] "r" (L4_TRAP_KIP) : "lr", "memory" ); if (ApiVersion) *ApiVersion = _ApiVersion; if (ApiFlags) *ApiFlags = _ApiFlags; if (KernelId) *KernelId = _KernelId; return (void *)base_address; } --- inline asm marked at '*' 00051bac <__L4_Init>: 51bac: 204cmov r0, #76 51bae: 4240neg r0, r0 * 51bb0: 46femov lr, pc * 51bb2: 4687mov pc, r0 51bb4: 2298mov r2, #152 51bb6: 0052lsl r2, r2, #1 51bb8: 1883add r3, r0, r2 51bba: 681bldr r3, [r3, #0] ... --- Reading specs from /home/extra/opt/tools/3.4.3-elf/bin/../lib/gcc/arm-elf/3.4.3/specs Configured with: ../gcc-3.4.3/configure --prefix=/opt/tools/3.4.3-elf --target=arm-elf --with-float=soft --with-arch=armv5te --enable-cxx-flags=-march=armv5te --enable-languages=c,c++ : (reconfigured) ../gcc-3.4.3/configure --prefix=/opt/tools/3.4.3-elf --target=arm-elf --with-float=soft --enable-languages=c,c++ Thread model: single gcc version 3.4.3 thanks, Carl van Schaik _ Get your e-mail, your way - get MSN Hotmail Plus! http://join.msn.com/?pgmarket=en-xe&DI=1054&XAPID=1816
Re: memcpy to an unaligned address
On 8/4/05, Shaun Jackman <[EMAIL PROTECTED]> wrote: > Are you using an x86 host and an arm target? > Actually no, my major concern at the time was the large quantity of legacy code with packed structures that we have on an embedded linux x86 system. I was just testing that we didn't have an issue there with the structure access. > Did it produce an open code memcpy, and was it correct? > I couldn't see any problems with the generated code - with no optimisation memcpy was called as a normal function, under optimisation the memcpy was replaced with the same code as the s->b = n line produced. > Interesting. Can you post an assembler snippet of this? > I created an executable and made it report the alignment - I used your test case and declared a variable of the packed structure then did printf("Address of a = %p\n", &test.a); printf("Address of b = %p\n", &test.b); with interesting differences between gcc 3 and 4. On further consideration i'd also add printf("Address of test = %p\n", &test); just to see if it showed up anything interesting. If I had more time I'd investigate where gcc 4 is putting this variable in memory, I have a small concern that it may be leaving padding bytes on the stack to align the structure, I'm not sure it's a big issue though (it definitely isn't to me anyway since we're using 2.95.3 and the unmentionable 2.96 ;o) ). Not sure any of this helps with the memcpy alignment issue though.
Question on visible scope in template declaration
Hello list, The following code is rejected by GCC but accepted by Clang: template auto f(T v) -> decltype(g(v)); int g(int) { return 0; } template auto f(T v) -> decltype(g(v)) { return g(v) + 1; } int main() { return f(0); } Error message at http://ideone.com/Vn79Hm. Basically the problem comes down to which is the visible scope in that trailing return type decltype(g(v)), where GCC uses the point of declaration but Clang uses the point of definition. g is a dependent name here, and the standard says "template definition context" should be used; but I am not very sure about the wording. I suspect this to be a GCC bug, but not sure, so asking here first. -- Carl Lei (XeCycle) Department of Physics and Astronomy, SJTU
Re: Question on visible scope in template declaration
在 12/15/15 11:09, Andrew Pinski 写道: On Mon, Dec 14, 2015 at 7:01 PM, Carl Lei wrote: Hello list, The following code is rejected by GCC but accepted by Clang: template auto f(T v) -> decltype(g(v)); int g(int) { return 0; } template auto f(T v) -> decltype(g(v)) { return g(v) + 1; } int main() { return f(0); } Error message at http://ideone.com/Vn79Hm. Basically the problem comes down to which is the visible scope in that trailing return type decltype(g(v)), where GCC uses the point of declaration but Clang uses the point of definition. g is a dependent name here, and the standard says "template definition context" should be used; but I am not very sure about the wording. I suspect this to be a GCC bug, but not sure, so asking here first. There is also argument dependent lookup. Yes, I am aware of that, and I worked around this problem by adding an empty struct as a tag for ADL to my function signatures. But whether g should be found in the first phase before ADL is another question. -- Carl Lei (XeCycle) Department of Physics and Astronomy, SJTU
Re: PATCH for Re: Release notes for GCC 7?
suggested additions: get and insert the latest libtool, which includes files: libtool.m4 ltgcc.m4 lt~obsolete.m4 ltoptions.m4 ltsugar.m4 ltversion.m4, all way-old currently in gcc-7 get latest autoconf. 2.64 in use, latest is 2.69 get latest texinfo.tex, not one 5 years old GNU is supposed to be a unified system, but it's not even up-to-date with its own software. I'm trying to debug a libtool bug but I am forced to downgrade autoconf... getting too hard to bother. It's not too late to fix it in gcc-7... On Mon, Mar 13, 2017 at 1:31 AM, Richard Biener wrote: > On Sun, Mar 12, 2017 at 11:45 PM, Gerald Pfeifer wrote: >> On Wed, 24 Aug 2016, Richard Biener wrote: >>> We've been creating those lazily over the last decade. We can change >>> that, an entry for releasing.html is appreciated then so we don't forget. >> >> And here we go, in time for the release of GCC 7 / branching of GCC 8. >> >> (Except, this time I went ahead and already created gcc-8/changes.html >> so that you guys don't have to worry about that. ;-) >> >> Note, I added this to branching.html, not releasing.html, not the least >> since branching.html already had the creation of other web pages for the >> new release series and that also seems the more appropriate point time- >> wise. Agreed? > > Yes. > > Thanks, > Richard. > >> Gerald >> >> >> Index: branching.html >> === >> RCS file: /cvs/gcc/wwwdocs/htdocs/branching.html,v >> retrieving revision 1.32 >> diff -u -r1.32 branching.html >> --- branching.html 28 Jun 2014 10:34:16 - 1.32 >> +++ branching.html 12 Mar 2017 22:37:59 - >> @@ -7,6 +7,8 @@ >> >> This page documents the procedure for making a new release branch. >> >> +Preparations >> + >> >> Execute the following commands, substituting appropriate version >> numbers: >> @@ -38,15 +40,25 @@ >> for the next major release in the wwwdocs repository and >> populate it with initial copies of changes.html and >> criteria.html. >> + >> >> -Add index.html and buildstat.html pages >> -to the directory corresponding to the newly created release branch. >> -Update the toplevel buildstat.html accordingly. >> +Web Site Updates >> + >> + >> +Add index.html and changes.html pages >> +based on the previous release branch to the directory corresponding to >> +the newly created release branch. >> + >> +Add buildstat.html and update the toplevel >> +buildstat.html accordingly. >> >> Update the toplevel index.html page to show the new active >> release branch, the current release series, and active development >> (mainline). Update the version and development stage for mainline. >> + >> >> + >> Update maintainer-scripts/crontab on the mainline by >> adding an entry to make snapshots of the new branch and adjusting the >> version number of the mainline snapshots. >> @@ -67,7 +79,11 @@ >> Send them >> to the translation project if no snapshot of this version was sent >> during development stage 3 or 4. >> + >> >> +Bugzilla Updates >> + >> + >> Create new versions in Bugzilla corresponding to the new mainline >> version. This can be accomplished by choosing "products", choosing "gcc", >> and editing the versions. Please do not delete old >> @@ -85,7 +101,6 @@ >> Ask Daniel Berlin to adjust all PRs with the just-branched version >> in their summary to also contain the new version corresponding to >> mainline. >> - >> >> >>
Re: Support Library Requirements for GCC 7.1
On Tue, May 2, 2017 at 5:02 PM, Paul Smith wrote: > On Tue, 2017-05-02 at 18:17 -0500, Joel Sherrill wrote: >> With gcc 6.3.0, we have this in our build recipe: >> >> %define mpfr_version 2.4.2 >> %define mpc_version0.8.1 >> %define gmp_version4.3.2 > > Best thing to do is look at the contrib/download_prerequisites script > that comes with the GCC source code. > > The 7.1 version says: > > gmp='gmp-6.1.0.tar.bz2' > mpfr='mpfr-3.1.4.tar.bz2' > mpc='mpc-1.0.3.tar.gz' > isl='isl-0.16.1.tar.bz2' > > In general, it's better to just run that script, if possible. "it's better to just run that script" One would think. But 7.1 is outdated. latest gmp is 6.1.2 latest mpfr os 3.1.5 latest isl is 0.18
Re: Exhaustive Instructions for Toolchain Generation
toolchain problems? If you really want to learn , try linuxfromscratch.org and http://trac.clfs.org/ Cross linux from scratch You complained about too much documentation, and here's some more.
Re: dead code remover under gcc -O and higher(Is there a flag to do this)
line 12 , you say "void A( );" say instead: void A(){}; That solved it for me, using gcc7.2 On Sun, Dec 3, 2017 at 4:56 PM, chengjian (D) wrote: > I have written a simple code like this > > ```c > #include > #include > > //#define CONFIG_TARGET_X86_64 > > #ifdef CONFIG_TARGET_X86_64 > static void A( ) > { > printf("A\n"); > } > #else > void A( ); > #endif > > static void B( ) > { > printf("B\n"); > } > > > static int xx( ) > { > #ifdef CONFIG_TARGET_X86_64 > return 1; > #else > return 0; > #endif > } > > int main(void) > { > if (xx( )) /* define CONFIG_TARGET_X86_64 */ > A( ); > else > B( ); > } > ``` > > If we don't define the CONFIG_TARGET_X86_64, xx( ) will always return FALSE, > so functiopn A which is only declared, but not implemented will never be > called(dead code). > > compile it with gcc -O0 > > ```cpp > /tmp/cctSpgGk.o: In function `main': > 1.c:(.text+0x34): undefined reference to `A' > collect2: error: ld returned 1 exit status > ``` > > But it can be compiled by -O1 or higher. > > use GCC V6.1.0. > > I can declare A as weak: > > ```cpp > void A (void) __attribute__ ((weak)); > ``` > > Then the linker will ignore the undefined symbol reference, but a call to > this function will lead to a crash > > > So my question is : > It seems that one of the optimization options in the -O1 option eliminates > the dead code, I have seen the optimize doccument about GCC > > https://gcc.gnu.org/onlinedocs/gcc-6.4.0/gcc/Optimize-Options.html > > but I can't find it. > > So if I just want to compile this code under the -O0 option, Is it possible > ? Are there some optimization flags help me to do this? > > Thanks. >
Re: gdb 8.x - g++ 7.x compatibility
On Fri, Feb 2, 2018 at 7:17 PM, Roman Popov wrote: > Hello, > I'm trying to switch from g++ 5.4 to g++ 7.2. > GDB 8.0.1 however does not understand RTTI generated by g++7.2, so my > Python scripts for GDB are not working. > > Here is a code example: > > struct base { virtual ~base(){} }; > > template< int IVAL, unsigned UVAL, unsigned long long ULLVAL> > struct derived : base { > int x = IVAL + + UVAL + ULLVAL; > }; > > int main() > { > base * o = new derived<1,2,3>{}; > return 0; > } > > When compiled with g++5.4 I can read value of x in debugger. > When compiled with g++7.2 gdb reports: > warning: RTTI symbol not found for class 'derived<1, 2u, 3ull>' > > Problem here is that type name saved in debug information is > *derived<1, 2, 3>*, not *derived<1, 2u, 3ull>* > > Do you plan to fix this anytime soon? > > Thanks, > Roman > try gdb 8.1 and gcc 7.3 and iterate. see if fixed, repost.
Re: 【GCC version can not be changed】
On Sat, May 5, 2018 at 5:13 AM, 夏晗 wrote: > root@Xia-Ubuntu:/usr/bin# gcc -v > 使用内建 specs。 > COLLECT_GCC=gcc > 目标:x86_64-pc-linux-gnu > 配置为:../configure -enable-checking=release -enable-languages=c,c++ > -disable-multilib > 线程模型:posix > gcc 版本 6.2.0 (GCC) > I have tried many methods like 'ln' and priority changing, but 'gcc -v' > still maintain at '6.2.0'. perhaps which -a gcc will provide a clue
gcc internals question, e.g. -fdump-translation-unit
I need a way to extract from gcc, each time gcc runs, the following information: A) When a call to any function F is encountered, I require the full path of the file wherein F is defined. B) When the conversion of any pointer of type STRICT->funcptr (structure member of type pointer to function(of any return type)) to a function call is encountered, I require the full pathname of the file wherein STRUCT is defined. I have looked at things like the -fdump-translation-unit flag, and have managed to perform task 'A" by laborious parsing and analysis of the output but I am looking for a simpler way. I can't do "B", at all. Can I do this by use of some other, or new, or undocumented flag for gcc. If so, then in particular, how will I interpret the output from that flag? Or do I need to patch gcc itself? Where would be the right place to start - what file or function?
DWARF question about size of a variable
GCC developers: Is there dwarf information that gives the size of a variable? I have a test case which when run on Intel gdb can print the size of an optimized out variable. However on PowerPC, gdb says the size information for the variable is optimized out. Is there some DWARF information that I can print on the Intel binary that shows the size information for the variable even though the variable is optimized out? Then by comparison on PowerPC I would expect the DWARF information would either say the size of the variable is optimized out or there is no information available. Here is the test program for the test. #include "../lib/attributes.h" int #ifdef NOCLONE __attribute__((noinline,weak)) ATTRIBUTE_NOCLONE #else __attribute__((noinline,weak)) #endif f1 (int i) { char a[i + 1]; a[0] = 5; return a[0]; } int main (void) { volatile int j; int i = 5; asm volatile ("" : "=r" (i) : "0" (i)); j = f1 (i); return 0; } So when the above test program is compiled with -03 and run on Intel we have the following: (gdb) break f1 Breakpoint 1 at 0x1150: file /.../gdb/testsuite/gdb.base/vla-optimized-out.c, line 30. (gdb) r Starting program: /.../gdb/testsuite/outputs/gdb.base/vla-optimized-out/vla-optimized-out-o3 [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". Breakpoint 1, f1 (i=5) at /.../gdb/testsuite/gdb.base/vla-optimized-out.c:30 30 { (gdb) p a $1 = (gdb) p sizeof( a) $2 = 6 <- the variable is optimized out but apparently the size info is still accessible When I compile and run the same program on PowerPC: (gdb) break f1 Breakpoint 1 at 0x16e0: file /.../gdb/testsuite/gdb.base/vla-optimized-out.c, line 33. (gdb) r Starting program: /home/carll/GDB/build-current/.../vla-optimized-out-3 [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib64/libthread_db.so.1". Breakpoint 1, f1 (i=5) at /.../gdb/testsuite/gdb.base/vla-optimized-out.c:33 33return a[0]; (gdb) p a $1 = (gdb) p sizeof (a) $2 = <- the variable is optimized out and the size is not available. Anyway, I am looking for some DWARF info on Intel and PowerPC which will show why Intel can display the size of the variable but PowerPC can not. Thanks for you help. Carl Love
Re: Article suggestion (note for admin)
We have many STDs. stdio stdlib libstdc++ On Tue, Nov 7, 2023 at 7:57 AM Dwayne Jacobs < d.jac...@backgroundchecksmailing.org> wrote: > Hi GCC Team, > > I wanted to follow up once more regarding the latest STD statistics in the > US. > > As I mentioned previously, I believe the data could be a useful resource > for your audience. > > You can find the full report here: > https://backgroundchecks.org/which-states-have-the-most-stds.html > > If you're the person who updates your page, would you be open to including > our updated report? > > Let me know your thoughts, > > Dwayne Jacobs > Director of Public Outreach > BackgroundChecks.org > d.jac...@backgroundchecksmailing.org > > > If you don't think this resource would be helpful, just reply with > “unsubscribe." >
Re: Using gcc as a sort of scripting language.
On Sat, Dec 28, 2024 at 2:48 PM Florian Weimer wrote: > [...] > > > Still it would be a nice touch if we could do > > #!/usr/bin/gcc -f > #include > int main() > { > puts("Hello, world"); > return 0; > } > re previously mentioned "root" >>> cat d #include int main(void) { puts("Hello, world, you can ignore all that particle physics if you like.\n"); return 0; } >>> root -b https://root.cern | | (c) 1995-2024, The ROOT Team; conception: R. Brun, F. Rademakers | | Built for linuxx8664gcc on Dec 15 2024, 18:15:13 | | From tags/6-34-02@6-34-02| | With c++ (GCC) 14.2.1 20241214 | | Try '.help'/'.?', '.demo', '.license', '.credits', '.quit'/'.q' | -- Hello, world, you can ignore all that particle physics if you like. (batch mode)
Re: Using gcc as a sort of scripting language.
>>> cat e #!/bin/sh # # root -l -b < int main(void) { puts("Hello, world, you can ignore all that particle physics if you like."); printf("By the way, log(2025) is %lf\n",log(2025.)); printf("Here I have suppressed the banner\n"); return 0; } DOIT >>> ./e Hello, world, you can ignore all that particle physics if you like. By the way, log(2025) is 7.613325 Here I have suppressed the banner
Re: Using gcc as a sort of scripting language.
Does "root" do what you want? https://root.cern/ https://root.cern/primer/#learn-c-at-the-root-prompt Includes a c++ interpreter (which includes all of C) that interprets C as you go, then at your option, compile a just-interpreted function, dynamically link it, and use the compiled version of that function in further interpreted commands. I think this (root) is under-appreciated or unknown by C community. On Sat, Dec 28, 2024 at 3:49 AM Basile Starynkevitch < bas...@starynkevitch.net> wrote: > Hello all, > > Paul Markfort suggested > > > > This is just a suggestion to make it easier for Linux/Unix users to > > use the Gnu compilers instead of having to use a scripting language > > for short little utilities. > > > > I know someone has created and released a binary C interpreter for > > this purpose. > > But why would you want to install another program, if you could > > essentially use the tools you already have. > > > > I think gcc (and all the compilers) should support the "#!" in source > > files to make something similar easily possible. > > > I agree with that suggestion. > > On Linux, there are limitations given by execve(2) system call. > I observe that Clang/LLVM people might disagree with it. > > One of the issues is that we could want several C files compiled into > one shared library. > > Another of the issues is that we could want to specify different code > generation or optimizations. Perhaps the second non comment line could > be some #pragma. > > GCC allows the standard input to be used. > > Maybe a possibility might be to have a /usr/bin/gcc-stdin executable? > > Observe that tinycc (a quick non-optimizing open source C compiler) > already has the wanted feature > https://en.wikipedia.org/wiki/Tiny_C_Compiler > > > TCC-DOC(1)Tiny C Compiler > > TCC-DOC(1) > > > > NAME > >tcc - Tiny C Compiler > > > > SYNOPSIS > >usage: tcc [options] [infile1 infile2...] [-run infile > > args...] > > > > DESCRIPTION > >TCC options are a very much like gcc options. The main > > difference is that TCC can also execute directly the > >resulting program and give it runtime arguments. > > > >Here are some examples to understand the logic: > > > >"tcc -run a.c" > >Compile a.c and execute it directly > > > >"tcc -run a.c arg1" > >Compile a.c and execute it directly. arg1 is given as > > first argument to the main() of a.c. > > > >"tcc a.c -run b.c arg1" > >Compile a.c and b.c, link them together and execute them. > > arg1 is given as first argument to the main() > >of the resulting program. > > > > > Best wishes for 2025. > > PS my open source project is a GPL inference engine on > https://github.com/RefPerSys/RefPerSys/ > > > -- > Basile STARYNKEVITCH > 8 rue de la Faïencerie > 92340 Bourg-la-Reine, France > http://starynkevitch.net/Basile & https://github.com/bstarynk > >