www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/07/02/08:15:04

From: "Tom St Denis" <tomstdenis AT yahoo DOT com>
Newsgroups: comp.os.msdos.djgpp
References: <5BF60CD649EDD411A04600B0D049F53A544468 AT hydmail02 DOT hyd DOT wilco-int DOT com>
Subject: Re: Accessing registers from C
Lines: 35
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2462.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2462.0000
Message-ID: <0XY%6.75909$Mf5.20934530@news3.rdc1.on.home.com>
Date: Mon, 02 Jul 2001 11:30:04 GMT
NNTP-Posting-Host: 24.112.8.23
X-Complaints-To: abuse AT home DOT net
X-Trace: news3.rdc1.on.home.com 994073404 24.112.8.23 (Mon, 02 Jul 2001 04:30:04 PDT)
NNTP-Posting-Date: Mon, 02 Jul 2001 04:30:04 PDT
Organization: Excite AT Home - The Leader in Broadband http://home.com/faster
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

"Prashant Ramachandra" <rprash AT wilco-int DOT com> wrote in message
news:5BF60CD649EDD411A04600B0D049F53A544468 AT hydmail02 DOT hyd DOT wilco-int DOT com...
> On Monday, July 02, 2001 9:03 AM, Tom St Denis [SMTP:tomstdenis AT yahoo DOT com]
> wrote:
> |
> | > Everytime you use the variable "eax", you're actually accessing
> | > or
> | modifying
> | > the eax register itself.
> |
> | Perhaps, and by doing so you take away chances for GCC to optimize
> | the code.
>
> Yes, but it's useful in certain cases. I posted some code to check the CPU
> type back in 1998. That's the simplest use I can think of. You might want
to
> see that. And the linux kernel uses lots of this, too. Do you think they
> weren't concerned about optimizing ther kernel code?
>
> | You might as well not write in C then.
>
> You won't be using this in every function. So this doesn't justify
anything.

Typically unless your function is an inline [say like a fixed point
multiplication, etc] writting asm statements in C is a bad idea.  It leads
to poor messy code that is hard to maintain.

Ideally all of your .C code is C code and you just have #ifdefs to excluded
functions for which you have assembler equivalents.

Tom


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019