public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/32044]  New: udivdi3 counterproductive, unwarranted use
@ 2007-05-22 16:20 malitzke at metronets dot com
  2007-05-22 16:27 ` [Bug c/32044] " malitzke at metronets dot com
                   ` (72 more replies)
  0 siblings, 73 replies; 74+ messages in thread
From: malitzke at metronets dot com @ 2007-05-22 16:20 UTC (permalink / raw)
  To: gcc-bugs

First I am herewith re-afirming my formal request for Mr. Pinsk to refrain from
having anything to do with my submissions.

Now to the heart of the matter:

According to my (admittedly second hand (Fifth Edition of "C A Reference
Manual"
by Samuel P. Harbison III & Guy L. Stelle Jr) reading; GCC, by not providing a 
means to disable the use of libgcc (including udivdi3) is not in strict 
conformance with the C standard for free-standing use through C99. __udivdi3 is
a reserved identifier 
and hence non-conforming.

The irony is that, besides, being non-conforming and prejudicing free standing 
applications that aim for maximum portability, it is highly counterproductive 
in its own right.

Also, the forced and silent use of libgcc (lld does not show it being used) 
violates one of the fundamental principles of both UNIX and C. Namely that 
the user (certainly root) is to be in full and absolute command of the system 
without hidden reinterpretation of his commands or MS type questions.  As a 
practical matter the use of __builtin_expect could be taken as signal to 
allow only reordering of instructions (to avoid pipeline stalls and 
reloading of caches) are to be avoided in the marked unlikely cases. Any 
fundamental changes like exchanging a while and a subtraction for a
non-hardware 
divide should no occur

If anybody at GCC wants to know what others (including L. Torvalds and A.
Morton) think; checking Google on udivdi3 might be instructive.

What follows are the result of tests using current versions of gcc-4.3 and
4.2.1. 
I believe the results speak for themselves. Besides the data for x86 I also 
have quite similar data for powerpc G4,  which I will make available as a
follow on.

        Program

#define NSEC_PER_SEC  1000000000UL      
int rmg(void);

int main(void)
{
        /* int sec; */
        return rmg();
}

int rmg(void)
{
static unsigned long long nsec = 0;
static int sec = 0;
    while (sec < 1 ) { 
        nsec++;
        while (__builtin_expect(nsec >= NSEC_PER_SEC, 0)) {
                nsec -= NSEC_PER_SEC;
                ++sec;
        }
    }   
        return sec;
}


        gcc_43 -O0

-rwxr-xr-x 1 root root  8478 2007-05-22 08:23 rmgg_O0
-rw-r--r-- 1 root root  1238 2007-05-22 08:18 rmgg_O0.s

real    0m27.613s
user    0m27.607s
sys     0m0.003s


        gcc_43 -O1

-rwxr-xr-x 1 root root 12586 2007-05-22 08:25 rmgg_O1
-rw-r--r-- 1 root root  1572 2007-05-22 08:25 rmgg_O1.s

real    0m12.776s
user    0m12.775s
sys     0m0.003s

        gcc_43 -O2

-rwxr-xr-x 1 root root 12586 2007-05-22 08:27 rmgg_O2
-rw-r--r-- 1 root root  1874 2007-05-22 08:27 rmgg_O2.s

real    0m16.415s
user    0m16.414s
sys     0m0.004s

        gcc_43 -Os

-rwxr-xr-x 1 root root 12586 2007-05-22 08:29 rmgg_Os
-rw-r--r-- 1 root root  1925 2007-05-22 08:29 rmgg_Os.s

real    2m8.817s
user    2m8.831s
sys     0m0.003s



        Program

#define NSEC_PER_SEC  1000000000UL      
int rmg(void);

int main(void)
{
        /* int sec; */
        return rmg();
}

int rmg(void)
{
static unsigned long long nsec = 0;
static int sec = 0;
    while (sec < 1 ) { 
        nsec++;
        while (__builtin_expect(nsec >= NSEC_PER_SEC, 0)) {
                nsec -= NSEC_PER_SEC;
                ++sec;
        }
    }   
        return sec;
}

        gcc_42 -O0

-rwxr-xr-x 1 root root 8471 2007-05-21 16:46 rmgg_O0
-rw-r--r-- 1 root root 1236 2007-05-21 16:41 rmgg_O0.s
time ./rmgg_O0

real    0m27.678s
user    0m27.680s
sys     0m0.002s
Script done on Mon 21 May 2007 04:53:29 PM EDT



        gcc_42 -O1 

-rwxr-xr-x 1 root root 8471 2007-05-21 16:41 rmgg_O1
-rw-r--r-- 1 root root 1572 2007-05-22 09:39 rmgg_O1.s

Script started on Mon 21 May 2007 04:56:20 PM EDT
time ./rmgg_O1

real    0m12.771s
user    0m12.767s
sys     0m0.003s
Script done on Mon 21 May 2007 04:56:55 PM EDT



        gcc_42 -O2

-rwxr-xr-x 1 root root 8471 2007-05-21 16:41 rmgg_O2
-rw-r--r-- 1 root root 1262 2007-05-21 17:41 rmgg_O2.s
Script started on Mon 21 May 2007 04:57:14 PM EDT
time ./rmgg_O2

real    0m12.532s
user    0m12.531s
sys     0m0.003s
Script done on Mon 21 May 2007 04:58:18 PM EDT



        gcc -Os

-rwxr-xr-x 1 root root 8471 2007-05-21 16:41 rmgg_Os
-rw-r--r-- 1 root root 1017 2007-05-21 16:40 rmgg_Os.s
Script started on Mon 21 May 2007 04:58:30 PM EDT
time ./rmgg_O2

real    0m12.571s
user    0m12.562s
sys     0m0.004s
Script done on Mon 21 May 2007 04:59:11 PM EDT


-- 
           Summary: udivdi3 counterproductive, unwarranted use
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: malitzke at metronets dot com
 GCC build triplet: i686-pc-linux.gnu
  GCC host triplet: i686-pc-linux.gnu
GCC target triplet: i686-pc-linux.gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32044


^ permalink raw reply	[flat|nested] 74+ messages in thread

end of thread, other threads:[~2009-05-26 10:18 UTC | newest]

Thread overview: 74+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-22 16:20 [Bug c/32044] New: udivdi3 counterproductive, unwarranted use malitzke at metronets dot com
2007-05-22 16:27 ` [Bug c/32044] " malitzke at metronets dot com
2007-05-22 16:37 ` malitzke at metronets dot com
2007-05-22 20:11 ` spark at gcc dot gnu dot org
2007-05-22 21:04 ` [Bug middle-end/32044] " pinskia at gcc dot gnu dot org
2007-05-22 22:18 ` ian at airs dot com
2007-05-23  0:06 ` malitzke at metronets dot com
2007-05-23  1:09 ` malitzke at metronets dot com
2007-05-23 10:17 ` rguenth at gcc dot gnu dot org
2007-05-23 12:15 ` manu at gcc dot gnu dot org
2007-05-23 12:18 ` malitzke at metronets dot com
2007-05-23 13:51 ` malitzke at metronets dot com
2007-05-23 14:13 ` rguenth at gcc dot gnu dot org
2007-05-24 13:09 ` malitzke at metronets dot com
2007-05-24 15:27 ` manu at gcc dot gnu dot org
2007-05-24 15:37 ` manu at gcc dot gnu dot org
2007-06-17  6:39 ` rakdver at gcc dot gnu dot org
2007-10-12 13:44 ` rguenth at gcc dot gnu dot org
2007-11-08 13:47 ` [Bug middle-end/32044] [4.3 regression] " manu at gcc dot gnu dot org
2007-11-08 14:22 ` manu at gcc dot gnu dot org
2007-11-08 14:47 ` rakdver at kam dot mff dot cuni dot cz
2007-11-09 16:26 ` bunk at stusta dot de
2007-11-09 16:33 ` rguenther at suse dot de
2007-11-09 17:09 ` bunk at stusta dot de
2007-11-09 17:11 ` rguenther at suse dot de
2007-11-10  7:41 ` bunk at stusta dot de
2007-11-19  6:06 ` pinskia at gcc dot gnu dot org
2007-11-20 21:19 ` ismail at pardus dot org dot tr
2007-11-27  5:51 ` mmitchel at gcc dot gnu dot org
2007-11-27  5:56 ` ismail at pardus dot org dot tr
2007-11-27  9:43 ` rguenth at gcc dot gnu dot org
2007-11-27 18:59 ` mark at codesourcery dot com
2007-11-27 19:16 ` bunk at stusta dot de
2007-11-27 19:31 ` bunk at stusta dot de
2007-11-27 19:42 ` rakdver at kam dot mff dot cuni dot cz
2007-11-27 19:44 ` jakub at gcc dot gnu dot org
2007-11-27 19:46 ` mark at codesourcery dot com
2007-12-26  1:29 ` pinskia at gcc dot gnu dot org
2008-01-02 23:30 ` mmitchel at gcc dot gnu dot org
2008-01-04  5:01 ` fche at redhat dot com
2008-01-04  7:03 ` mark at codesourcery dot com
2008-01-15  5:39 ` stevenyi at 163 dot com
2008-01-15  5:47 ` ismail at pardus dot org dot tr
2008-01-15  8:23 ` pinskia at gcc dot gnu dot org
2008-03-15  0:41 ` [Bug middle-end/32044] [4.3/4.4 " jsm28 at gcc dot gnu dot org
2008-06-06 14:58 ` rguenth at gcc dot gnu dot org
2008-08-27 22:04 ` jsm28 at gcc dot gnu dot org
2008-12-10 11:29 ` steven at gcc dot gnu dot org
2008-12-10 11:44 ` steven at gcc dot gnu dot org
2008-12-10 11:48 ` [Bug middle-end/32044] [4.3/4.4 Regression] " rguenth at gcc dot gnu dot org
2008-12-10 11:49 ` [Bug middle-end/32044] [4.3/4.4 regression] " steven at gcc dot gnu dot org
2008-12-10 12:32 ` [Bug middle-end/32044] [4.3/4.4 Regression] " steven at gcc dot gnu dot org
2008-12-10 15:50 ` [Bug tree-optimization/32044] [4.3/4.4 Regression] final value replacement too aggressive for e.g. targets with no native div/mod insns dsilvers at digital-scurf dot org
2008-12-10 17:13 ` mmitchel at gcc dot gnu dot org
2008-12-10 18:16 ` rakdver at kam dot mff dot cuni dot cz
2008-12-10 18:24 ` rakdver at kam dot mff dot cuni dot cz
2008-12-10 21:29 ` steven at gcc dot gnu dot org
2008-12-10 21:35 ` rakdver at gcc dot gnu dot org
2008-12-10 21:45 ` steven at gcc dot gnu dot org
2008-12-10 22:03 ` rakdver at kam dot mff dot cuni dot cz
2008-12-10 22:56 ` rakdver at gcc dot gnu dot org
2008-12-11  0:16 ` mmitchel at gcc dot gnu dot org
2008-12-11  0:29 ` steven at gcc dot gnu dot org
2008-12-11  0:30 ` rakdver at kam dot mff dot cuni dot cz
2008-12-11  0:43 ` mmitchel at gcc dot gnu dot org
2008-12-11  7:05 ` steven at gcc dot gnu dot org
2008-12-11 17:38 ` mmitchel at gcc dot gnu dot org
2008-12-12 20:35 ` rakdver at gcc dot gnu dot org
2008-12-12 20:43 ` rakdver at gcc dot gnu dot org
2009-01-24 10:20 ` rguenth at gcc dot gnu dot org
2009-02-03 16:32 ` [Bug tree-optimization/32044] [4.3 " bonzini at gnu dot org
2009-04-22 15:15 ` rguenth at gcc dot gnu dot org
2009-05-26 10:17 ` rguenth at gcc dot gnu dot org
2009-05-26 10:18 ` rguenth at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).