This is the mail archive of the 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]
Other format: [Raw text]

Re: Comments in assember output

On Thu, 30 Nov 2006, Artur Krzysztof Szostak wrote:

I don't think there is any simple way to do this without using the -g

Note that the -g option does not affect code generation in any way.
You can use -O3 with or without -g, and you will get the same code.

Will the -g -O3 option truly give me code that executed at the same speed as -O3? I was not aware of that. In that case -g is fine. But even with -g I am not getting the result I want. I guess it is time for a specific example: Lets say I have the fillowing code in test.cxx

float func(float a, float b)
	return a * b;


Something like
cas$ g++ -c -g -O3 -Wa,-ahl=cas.s cas.c
cas$ sed -n /func/,40p cas.s
  12                    .globl _Z4funcff
  13                            .type   _Z4funcff, @function
  14                    _Z4funcff:
  15                    .LFB3:
  16                            .file 1 "cas.c"
   1:cas.c         **** float func(float a, float b)
   2:cas.c         **** {
  17                            .loc 1 2 0
  18                    .LVL0:
  19 0000 55                    pushl   %ebp
  20                    .LCFI0:
  21 0001 89E5                  movl    %esp, %ebp
  22                    .LCFI1:
  23 0003 D9450C                flds    12(%ebp)
   3:cas.c         ****         return a * b;
  24                            .loc 1 3 0
  25                    .LBB2:
  26 0006 D84D08                fmuls   8(%ebp)
   4:cas.c         **** }
  27                            .loc 1 4 0
  28 0009 5D                    popl    %ebp
  29 000a C3                    ret
  32                            .size   _Z4funcff, .-_Z4funcff
 215 0012 66756E63              .string "func"
 233 0006 66756E63              .string "func"



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