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]

Re: changing fp insns to parallels...


> > The insns might look like this:
> > (parallel [
> >   (set (reg <output fp reg>) <some operation>)
> >   (use (reg %rsp))
> >   (use (const_int 0))])
> > The reg stack pass will then change last use to hold actual size of stack
> > (position of reg-stack pointer)
> > and change the middle use to (set (reg %rsp) (plus (reg %rsp) (const_int 1))
> > to generate push and -1 to generate pop.
> 
> I think this will likely cause print_operand to be more than gross.
> I'd want to see a coherent plan before I'd believe otherwise.

Huh? Since the fp stack operand is implicit in the assembler instruction,
there is no need to handle it in print_operand.

> I don't think there exists any sane representation that doesn't
> require changes elsewhere in the compiler.  
> 
> My favorite representation at the moment is to expose the
> extra-architectual fp stack pointer to the compiler, and use a
> new rtx `indreg' to indicate indirection on a register as opposed
> to a memory.  Pushes and pops are easiest to represent as
> PRE_INC/POST_DEC.

To describe the operation exactly, we don't need a new kind of rtl,
we could just use a BLKmode register to represent the stack as a whole.

> So we'd have 
> 
> 	(set (indreg:SF (pre_inc (reg fpsp)))		flds (%eax)
> 	     (mem:SF (reg:SI eax)))

	(parallel [(set (subreg:SF (reg:BLK fpstack) 0)
			(mem:SF (reg:SI eax)))])
		   (set (zero_extract:BLK (reg:BLK fpstack)
					  (const_int 560) (const_int 80))
			(zero_extract:BLK (reg:BLK fpstack)
					  (const_int 560) (const_int 0)))

> 	(parallel [(set (cc0)
> 			(compare:CC (indreg:SF (reg fpsp))
> 				    (indreg:SF (plus (reg fpsp) 1))))
> 		   (set (reg fpsp)
> 			(plus (reg fpsp) 2))])

	(parallel [(set (cc0)
			(compare:CC (subreg:SF (reg:BLK fpstack) 0)
				    (subreg:SF (zero_extract:XF (reg:BLK fpstack) (const_int 80) (const_int 80)))))
		   (set (zero_extract:BLK (reg:BLK fpstack)
					  (const_int 480) (const_int 160))
			(zero_extract:BLK (reg:BLK fpstack)
					  (const_int 480) (const_int 0)))

Or if we pretend the elements of the stack are 96 bit wide we could do:

	(parallel [(set (cc0)
			(compare:CC (subreg:SF (reg:BLK fpstack) 0)
				    (subreg:SF (reg:BLK fpstack) 3)))
		   (set (zero_extract:BLK (reg:BLK fpstack)
					  (const_int 576) (const_int 0))
			(zero_extract:BLK (reg:BLK fpstack)
					  (const_int 576) (const_int 192)))


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