Re: Bug in divmodhi4(), plus poor inperformant code
> On Dec 4, 2018, at 8:19 PM, Stefan Kanthak wrote: > > "Paul Koning" wrote: > >> Yes, that's a rather nasty cut & paste error I made. > > I suspected that. > Replacing >!(den & (1L<<31)) > with >(signed short) den >= 0 > avoids this type of error: there's no need for a constant here! > > JFTR: of course the 1L should be just a 1, without suffix. > >> But if the 31 is changed to a 15, is the code correct? >> I would think so. > > Almost. It's the standard algorithm, and it's correct except > for den == 0, where the current implementation returns 0 as > quotient or the numerator as remainder, while my fix yields an > endless loop (as could be expected for "undefined behaviour"). I submitted a patch that just changes that one line. This file is a copy of udivmodsi4.c so I figured I'd aim for the same logic except for the word length changes, and the 31 instead of 15 was a missed edit for that. The other changes could be left for later, or a handwritten assembly routine used instead as some other targets do. Thanks! paul
Re: Bug in divmodhi4(), plus poor inperformant code
On Wed, Dec 05, 2018 at 02:19:14AM +0100, Stefan Kanthak wrote: > "Paul Koning" wrote: > > > Yes, that's a rather nasty cut & paste error I made. > > I suspected that. > Replacing > !(den & (1L<<31)) > with > (signed short) den >= 0 > avoids this type of error: there's no need for a constant here! > > JFTR: of course the 1L should be just a 1, without suffix. "int" can be 16 bits only, I think? If you change to 15 you can remove the L, sure. > > But if the 31 is changed to a 15, is the code correct? > > I would think so. I think so, too. > > For optimization I'd think that an assembly language > > version would make more sense, and a few targets do that. > > Moving 2 of 3 conditions from the loop is not an optimisation, > but a necessity! The compiler can optimise things quite well. > In other words: why test 3 conditions in every pass of the > loop when you need to test only 1 condition inside the loop, > and the other 2 outside/before the loop? Maybe the code is easier to read this way. Maybe it doesn't matter for performance. Maybe no one cared, this routine is for correctness anyway, any target that cares for performance will do an asm version, or (partly) inline this even. Send a patch if you want to see it changed :-) Segher
Regarding projects and begineer guide.
Dear sir/mam I am durgesh kumar from ABES engineering collenge,ghaziabad,uttar pradesh,india. I am currently in 2nd year of my graduation(Btech CSE ) I want to contribute in some of your prestigious project. So i request you to please provide me some of your top priority project and a begineer guide. I hope you will concern my request.
Re: Bug in divmodhi4(), plus poor inperformant code
> On Dec 5, 2018, at 11:23 AM, Segher Boessenkool > wrote: > > On Wed, Dec 05, 2018 at 02:19:14AM +0100, Stefan Kanthak wrote: >> "Paul Koning" wrote: >> >>> Yes, that's a rather nasty cut & paste error I made. >> >> I suspected that. >> Replacing >>!(den & (1L<<31)) >> with >>(signed short) den >= 0 >> avoids this type of error: there's no need for a constant here! >> >> JFTR: of course the 1L should be just a 1, without suffix. > > "int" can be 16 bits only, I think? If you change to 15 you can remove > the L, sure. "int" on pdp11 is either 16 or 32 bits depending on switches, but "short int" is always 16. I changed it to be 1U << 15 which seems more appropriate if int is 16 bits. paul
Re: Regarding projects and begineer guide.
On Wed, 2018-12-05 at 22:48 +0530, Durgesh Kumar wrote: > Dear sir/mam > I am durgesh kumar from ABES engineering collenge,ghaziabad,uttar > pradesh,india. > > I am currently in 2nd year of my graduation(Btech CSE ) > > I want to contribute in some of your prestigious project. So i > request you > to please provide me some of your top priority project and a begineer > guide. > > I hope you will concern my request. I'd recommend starting with something small, in an area that interests you. We're currently in feature freeze for gcc 9, so bugfixing is our main focus right now. FWIW, here's an unofficial beginner's guide I wrote to document my own experiences learning GCC: https://dmalcolm.fedorapeople.org/gcc/newbies-guide/ You might want to also look at this: https://gcc.gnu.org/ml/gcc/2018-11/msg00184.html Hope this is helpful Dave
LTO Test Case Help
Hi, I'm trying to write a testcase to reproduce duplicate clone symbols such as in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88297 I started with a testcase that is known to have constprop clones and split it into two object files: bash-4.2# cat /gcc/src/gcc/testsuite/gcc.dg/lto/independent-cloneids-lto_0.c /* { dg-require-effective-target lto } */ /* { dg-lto-options {{-O3 -fipa-cp -fipa-cp-clone}} } */ /* { dg-lto-do run } */ #include extern int foo (int arg); extern int bar (int arg); int __attribute__ ((noinline)) foo (int arg) { return 7 * arg; } int __attribute__ ((noinline)) bar (int arg) { return arg * arg; } int main (void) { printf("%d\n", bar (3)); printf("%d\n", bar (4)); printf("%d\n", foo (5)); printf("%d\n", foo (6)); return 0; } bash-4.2# cat /gcc/src/gcc/testsuite/gcc.dg/lto/independent-cloneids-lto_1.c int __attribute__ ((noinline)) foo (int arg) { return 7 * arg; } int __attribute__ ((noinline)) bar (int arg) { return arg * arg; } but now decide_whether_version_node does not call decide_about_value and I don't know enough about ipa/lattices to figure out what's missing. Any help would be appreciated. - Michael signature.asc Description: OpenPGP digital signature
Re: Regarding projects and begineer guide.
On 12/5/18, David Malcolm wrote: > On Wed, 2018-12-05 at 22:48 +0530, Durgesh Kumar wrote: >> Dear sir/mam >> I am durgesh kumar from ABES engineering collenge,ghaziabad,uttar >> pradesh,india. >> >> I am currently in 2nd year of my graduation(Btech CSE ) >> >> I want to contribute in some of your prestigious project. So i >> request you >> to please provide me some of your top priority project and a begineer >> guide. >> >> I hope you will concern my request. > > I'd recommend starting with something small, in an area that interests > you. We're currently in feature freeze for gcc 9, so bugfixing is our > main focus right now. And we have many bugs that could use attention, too! For newcomers, I would recommend checking bugs tagged with the "easyhack" keyword on bugzilla: https://gcc.gnu.org/wiki/EasyHacks https://gcc.gnu.org/bugzilla/buglist.cgi?keywords=easyhack&list_id=223372&resolution=--- > > FWIW, here's an unofficial beginner's guide I wrote to document my own > experiences learning GCC: > https://dmalcolm.fedorapeople.org/gcc/newbies-guide/ > > You might want to also look at this: > https://gcc.gnu.org/ml/gcc/2018-11/msg00184.html > > Hope this is helpful > Dave > >
Re: Regarding projects and begineer guide.
Thanks, I'll check them out. On Thu 6 Dec, 2018, 1:51 AM Eric Gallager, wrote: > On 12/5/18, David Malcolm wrote: > > On Wed, 2018-12-05 at 22:48 +0530, Durgesh Kumar wrote: > >> Dear sir/mam > >> I am durgesh kumar from ABES engineering collenge,ghaziabad,uttar > >> pradesh,india. > >> > >> I am currently in 2nd year of my graduation(Btech CSE ) > >> > >> I want to contribute in some of your prestigious project. So i > >> request you > >> to please provide me some of your top priority project and a begineer > >> guide. > >> > >> I hope you will concern my request. > > > > I'd recommend starting with something small, in an area that interests > > you. We're currently in feature freeze for gcc 9, so bugfixing is our > > main focus right now. > > And we have many bugs that could use attention, too! For newcomers, I > would recommend checking bugs tagged with the "easyhack" keyword on > bugzilla: > > https://gcc.gnu.org/wiki/EasyHacks > > > https://gcc.gnu.org/bugzilla/buglist.cgi?keywords=easyhack&list_id=223372&resolution=--- > > > > > FWIW, here's an unofficial beginner's guide I wrote to document my own > > experiences learning GCC: > > https://dmalcolm.fedorapeople.org/gcc/newbies-guide/ > > > > You might want to also look at this: > > https://gcc.gnu.org/ml/gcc/2018-11/msg00184.html > > > > Hope this is helpful > > Dave > > > > >