This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Ten minutes to compile a simple c++ function


I just checked and the same thing happens under current CVS on i686. 

Forwarding to gcc-bugs ...

---------- FWD from gcc@gcc.gnu.org ---- 

I posted this earlier but had little response, I have tidied up the
example code and tried the same code with gcc version 2.96 20000612
(experimental) sh-elf with the same results. The compiler takes an
excessive time to compile the function below, I have placed the timings
at the end. 

with the following cmdline: 

sh-elf-gcc -c mux.cc 

The same file compiles fine with: 

sh-elf-gcc -c -xc mux.cc 

splitting the OR into 2 parts also fixes the problem also the same file
compiles fine with "sh-coff-gcc version 2.95.2 19991024 (release)"

I hope this helps someone. 

Robert <robert.melchers@drives.eurotherm.co.uk>

/* --- Start of file mux.cc --- */ 

#ifndef __cplusplus 
typedef char bool; /* needed for 'c' build */ 
#endif /* !__cplusplus */ 

bool in0 ; 
bool in1 ; 
bool in2 ; 
bool in3 ; 
bool in4 ; 
bool in5 ; 
bool in6 ; 
bool in7 ; 
bool in8 ; 
bool in9 ; 
bool in10; 
bool in11; 
bool in12; 
bool in13; 
bool in14; 
bool in15; 
unsigned int output; 

void mux(void) 
{ 
output = 
(in0 ? 0x0001 : 0) | 
(in1 ? 0x0002 : 0) | 
(in2 ? 0x0004 : 0) | 
(in3 ? 0x0008 : 0) | 
(in4 ? 0x0010 : 0) | 
(in5 ? 0x0020 : 0) | 
(in6 ? 0x0040 : 0) | 
(in7 ? 0x0080 : 0) | 
(in8 ? 0x0100 : 0) | 
(in9 ? 0x0200 : 0) | 
(in10 ? 0x0400 : 0) | 
(in11 ? 0x0800 : 0) | 
(in12 ? 0x1000 : 0) | 
(in13 ? 0x2000 : 0) | 
(in14 ? 0x4000 : 0) | 
(in15 ? 0x8000 : 0) ; 
} 

/* --- END OF FILE --- */ 

Times for c++ compile 
--------------------- 

//d/605plus/code/app_fb/fb_mux [1072] ../../_tools/gtime.exe -v
sh-elf-gcc -c mux.cc 
Command being timed: "sh-elf-gcc -c mux.cc" 
User time (seconds): 208.42 
System time (seconds): 0.17 
Percent of CPU this job got: 92% 
Elapsed (wall clock) time (h:mm:ss or m:ss): 3:44.95 
Average shared text size (kbytes): 0 
Average unshared data size (kbytes): 0 
Average stack size (kbytes): 0 
Average total size (kbytes): 0 
Maximum resident set size (kbytes): 0 
Average resident set size (kbytes): 0 
Major (requiring I/O) page faults: 0 
Minor (reclaiming a frame) page faults: 0 
Voluntary context switches: 0 
Involuntary context switches: 0 
Swaps: 0 
File system inputs: 0 
File system outputs: 0 
Socket messages sent: 0 
Socket messages received: 0 
Signals delivered: 3 
Page size (bytes): 4096 
Exit status: 0 

Times for c compile 
-------------------- 

//d/605plus/code/app_fb/fb_mux [1072] ../../_tools/gtime.exe -v
sh-elf-gcc -c -xc mux.cc 
Command being timed: "sh-elf-gcc -c -xc mux.cc" 
User time (seconds): 0.19 
System time (seconds): 0.17 
Percent of CPU this job got: 74% 
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:00.48 
Average shared text size (kbytes): 0 
Average unshared data size (kbytes): 0 
Average stack size (kbytes): 0 
Average total size (kbytes): 0 
Maximum resident set size (kbytes): 0 
Average resident set size (kbytes): 0 
Major (requiring I/O) page faults: 0 
Minor (reclaiming a frame) page faults: 0 
Voluntary context switches: 0 
Involuntary context switches: 0 
Swaps: 0 
File system inputs: 0 
File system outputs: 0 
Socket messages sent: 0 
Socket messages received: 0 
Signals delivered: 3 
Page size (bytes): 4096 
Exit status: 0 


__________________________________________________
Do You Yahoo!?
Yahoo! Photos -- now, 100 FREE prints!
http://photos.yahoo.com

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]