public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: modification to inline asm
@ 2000-06-09 15:25 Mike Stump
  0 siblings, 0 replies; 3+ messages in thread
From: Mike Stump @ 2000-06-09 15:25 UTC (permalink / raw)
  To: Dylan_S_Cuthbert, gcc

> From: Dylan_S_Cuthbert@hq.scei.sony.co.jp
> To: gcc@gcc.gnu.org
> Date: Fri, 9 Jun 2000 23:12:03 +0900

> I'm brand new to this list so I'm not sure where this should go, but
> I have a request for a very useful addition to the inline assembler
> feature of gcc.

This goes in the wrong direction I feel.  Instead, add support to
expose more of the assembly to the compiler, and have the compiler
generate the `more optimal' code.  I think you'll win better that way.
You can then have the full power of the optimizer to optimize.

If you want a concrete example, show me what you wanted to do (and
annotate it some so I can grasp what you want and why it is better.

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

* Re: modification to inline asm
@ 2000-06-09  8:00 Michael Sokolov
  0 siblings, 0 replies; 3+ messages in thread
From: Michael Sokolov @ 2000-06-09  8:00 UTC (permalink / raw)
  To: Dylan_S_Cuthbert, gcc

Dylan_S_Cuthbert@hq.scei.sony.co.jp wrote:

> I'm brand new to this list so I'm not sure where this should go, but I have a
> request for a very useful addition to the inline assembler feature of gcc.
>
> I've already made the change in a copy of the gcc source I have and it seems to
> work fine.
>
> It is regarding the "which_alternative" variable in recog.c - all I've done is
> made it useable from within an asm() statement as a %% command.

Please make it a patch against the current CVS source and post it to
gcc-patches@gcc.gnu.org with a ChangeLog entry.

--
Michael Sokolov		Harhan Engineering Laboratory
Public Service Agent	International Free Computing Task Force
			International Engineering and Science Task Force
			615 N GOOD LATIMER EXPY STE #4
			DALLAS TX 75204-5852 USA

Phone: +1-214-824-7693 (Harhan Eng Lab office)
E-mail: msokolov@ivan.Harhan.ORG (ARPA TCP/SMTP) (UUCP coming soon)

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

* modification to inline asm
@ 2000-06-09  7:14 Dylan_S_Cuthbert
  0 siblings, 0 replies; 3+ messages in thread
From: Dylan_S_Cuthbert @ 2000-06-09  7:14 UTC (permalink / raw)
  To: gcc

Hi there,

I'm brand new to this list so I'm not sure where this should go, but I have a
request for a very useful addition to the inline assembler feature of gcc.

I've already made the change in a copy of the gcc source I have and it seems to
work fine.

It is regarding the "which_alternative" variable in recog.c - all I've done is
made it useable from within an asm() statement as a %% command.

For example:

asm
(
     "    .if %A0                  \n"
     "    load_to_cop2_from_memory %0         \n"
     "    .else                          \n"
     "    move_to_cop2_from_register %0  \n"
     "    .endif                         \n"
     : : "m,r" (variable)
);

%An is converted to 0 (false) or 1 (true) with the equation "which_alternative
== n"

This very minor change can cause fairly major speed increases in low-level core
routines, especially on RISC+COP machines where latency cycles very high... I
want the value put into COP2 with as few instructions as possible.

Best Regards
Dylan Cuthbert
Sony Computer Entertainment Inc.
(all views and comments, however sadistic, are solely mine and have nothing to
do with any company I have ever worked for)

Implementation details:

1. I added a simple "if" check to the '%' case in final.c to do the comparision
and output of zero or 1 which was simple enough. (just search for '%')
2. However, the value which_alternative is overwritten by the output of
instructions to load up the values/registers etc so I needed (and this is the
bit that needs confirming and maybe a cleaner hack) to put "check_asm_operands(
body )" immediately after the "decode_asm_operands( body, ops, NULL_PTR,
NULL_PTR, NULL_PTR )" in final_scan_insn.
3. I know 'A' is quite probably a bad choice but I leave that for you folks with
more knowledge of what letters are useable to decide upon.  I thought %@ would
be more sensible (as @ is used in RTL to do a similar thing), but @ seems to be
used.



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

end of thread, other threads:[~2000-06-09 15:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-06-09 15:25 modification to inline asm Mike Stump
  -- strict thread matches above, loose matches on Subject: below --
2000-06-09  8:00 Michael Sokolov
2000-06-09  7:14 Dylan_S_Cuthbert

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