public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* store double-cvtd-to-int to memory
@ 2003-03-13  3:20 Dale Johannesen
  2003-03-13 22:37 ` Richard Henderson
  2003-03-13 22:52 ` Richard Henderson
  0 siblings, 2 replies; 19+ messages in thread
From: Dale Johannesen @ 2003-03-13  3:20 UTC (permalink / raw)
  To: David Edelsohn, gcc; +Cc: Dale Johannesen

I'm trying to get PPC to generate a more efficient sequence for the
case where you want to put the result of double-to-int conversion in
memory, and don't need it in a register.  The normal code looks
like cvt in FP reg, store to temp mem, load to int reg, store to
the real location.   There is an instruction to do it directly,
though, without going through temp mem.  I thought getting
combine to do it looked right, and wrote this pattern, which is
just fix_truncdfsi2 with the result fed into a store:

   [(set (match_operand:SI 0 "memory_operand" "=m")
         (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
    (clobber (match_operand:DI 2 "gpc_reg_operand" "=f"))
    (clobber (match_operand:DI 3 "memory_operand" "=o"))]

where op3 is a stack temp.
Unfortunately combine refuses to generate this pattern; it is afraid
the two parallel memory_operands might conflict (which we can see they
don't), and doesn't even attempt to do alias checking.  So what is Plan 
B?
Putting alias checking into combine seems like a big hammer (for that
matter, I don't think there's enough alias info in the stack-temp to
get this right anyway).  Is there an alternative general approach?

^ permalink raw reply	[flat|nested] 19+ messages in thread
* Re: store double-cvtd-to-int to memory
@ 2003-03-23 22:18 Dale Johannesen
  0 siblings, 0 replies; 19+ messages in thread
From: Dale Johannesen @ 2003-03-23 22:18 UTC (permalink / raw)
  To: Richard Henderson, gcc; +Cc: Dale Johannesen, Geoff Keating

(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.

^ permalink raw reply	[flat|nested] 19+ messages in thread
* Re: Name of front-end
@ 2003-12-08 16:55 Richard Kenner
  2003-12-08 17:03 ` Robert Dewar
  2003-12-08 18:37 ` Dale Johannesen
  0 siblings, 2 replies; 19+ messages in thread
From: Richard Kenner @ 2003-12-08 16:55 UTC (permalink / raw)
  To: pkoning; +Cc: gcc

    FWIW, some IBM 360 PL/1 manuals I just looked at do not mark or claim
    "PL/1" as trademark.  

But certainly some did.  And contemporary lore was that they trademarked PL/2,
PL/3, etc ...

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2003-12-09  0:00 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-13  3:20 store double-cvtd-to-int to memory Dale Johannesen
2003-03-13 22:37 ` Richard Henderson
2003-03-14 19:15   ` Dale Johannesen
2003-03-14 19:52     ` David Edelsohn
2003-03-14 20:00       ` Geoff Keating
2003-03-14 20:10         ` Dale Johannesen
2003-03-14 21:24     ` Richard Henderson
2003-03-13 22:52 ` Richard Henderson
2003-03-23 22:18 Dale Johannesen
2003-12-08 16:55 Name of front-end Richard Kenner
2003-12-08 17:03 ` Robert Dewar
2003-12-08 17:40   ` Andrew Haley
2003-12-08 23:44     ` Robert Dewar
2003-12-08 23:51       ` Laurent GUERBY
2003-12-09  1:32         ` Robert Dewar
2003-12-09  0:00       ` Daniel Berlin
2003-12-08 18:37 ` Dale Johannesen
     [not found]   ` <dalej@apple.com>
2003-12-08 19:15     ` Felix Lee
2003-12-08 20:06   ` [GCC] " Trevor Jenkins

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).