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

x86 optimization and rtx_cost question


Maybe I'm confused - can someone clarify for me?

In the processor_costs structure in i386.c, almost everything is defined
in "units" of "fast instructions", or an integer register-to-register
add.  Except the cost of loading an integer register from memory in QI,
HI, and SI modes is defined in terms of the cost of a
register-to-register move =2.

But in rtl.h

	#define COSTS_N_INSNS(N) ((N) * 4)

(why, BTW?  it can't possibly go back to 8080 when "fast" took 4 clocks,
or??)


I haven't found a place where this is a problem; ix86_cost->int_load
seems to be only used in MEMORY_MOVE_COST macro, which is only used to
compare with REGISTER_MOVE_COST.

But

Suppose we find in a program the following istruction, where both vars
are ints:

	var_a += var_b;

Assume that we already have good reasons for assigning a hard register
(say %eax) to var_a.

How can we decide whether to issue ...

	movl	var_b, %edx
	addl	%edx, %eax

... or ...

	addl	var_b, %eax


... if rtx_cost for MOV instructions and ADD instructions are measured
in different units?

On some processors the micro instructions issued will be same, but it
simply isn't true that these sequences are equivalent on all x86
processors. (ignore code size)



Please include a direct reply, I currently do not subscribe to this
mailing list

Thanks

-- 
Tom Crispin
Centaur Technology
512-493-8625
crispin@centtech.com


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