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]

Re: store double-cvtd-to-int to memory


(my mail file was clobbered so this may not thread properly.
see here for context:)
http://gcc.gnu.org/ml/gcc/2003-03/msg00802.html

On Fri, Mar 14 rth wrote:
On Fri, Mar 14, 2003 at 10:51:22AM -0800, Dale Johannesen wrote:
> For the case where it goes in a register, however, you do.
> (It looks like this is not so on Alpha?)

Well, Alpha's a bit different.  We can convert to DImode
without memory, but truncating to SImode needs special
care.  Without the above pattern, we'd store the DImode
back to the stack, load with an integer register, then
store the truncated value.

So the match is for an SImode store to memory.

But the concept should be the same.

> So removing op3 from the above pattern results in another pattern
> that combine won't generate, because the original
> fix_truncdfsi2 pattern does have the temp, and needs it.

Um, that's wrong.  Part of what combine does is to discard
clobbers and add them back as needed.  Why isn't that happening?

It's not happening because that mechanism only works on clobbers of registers (or scratch regs), not of memory. Comments make clear this is intentional. Thus, the Alpha case isn't really analogous. I could try to make it work on memory clobbers if it is safe to do that. Are the semantics of memory clobbers equivalent to "scratch memory" for that insn only? Or might there be side effects?

Another approach I thought of is to break the fix_trunc differently
to begin with:

(define_expand "fix_truncdfsi2"
[(set (match_operand:DI 2 "gpc_reg_operand" "")
(unspec:DI [(fix:SI (match_operand:DF 1 "gpc_reg_operand" ""))] 10))
(parallel [
(set (match_operand:SI 0 "gpc_reg_operand" "")
(unspec:SI [(match_dup 2)] 12))
(clobber (match_dup 3))])]


where the first set is the "fctiwz" insn, producing a DF result,
and the second represents store 64 bit value to memory, load back low 32 bits.
Then I try to combine the first set with a store to SI memory, but so far
I haven't found a way to outwit the type checking, which doesn't let me
store a 64 bit value into 32 bits...


There must be some way to do this. Thanks all.


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