www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/10/10/04:16:13

To: cigna AT helios DOT phy DOT ohiou DOT edu (Mr. Salty)
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Re: djgpp and the 386SX
Date: Mon, 10 Oct 94 08:39:47 +0200
From: eliz AT is DOT elta DOT co DOT il

>  main()
>  {
>    long a = 10, b = 20, c = 0;
>
>    c = a + b;
>  }
>
> When compiled with borland using "bcc -S -3 tst.c" the output was:
>
>   mov dword ptr [bp-4],large 10
>   mov dword ptr [bp-8],large 20
>   mov dword ptr [bp-12],large 0
>   mov eax,dword ptr [bp-4]
>   add eax,dword ptr [bp-8]
>   mov dword ptr [bp-12],eax
>
> The assembler syntax is different, but it looks like they both use
> 32 bit registers for 32 bit integers. Notice however that Borland C 3.1
> uses bp (16 bits) to hold a *pointer*, while djgpp uses ebp (32 bits).

This fragment may mislead someone to think that BC produces essentually the
same code GCC does.  The truth is, there is nothing farther from the reality
than this conclusion.  The above context shows just about everything BC
can do with 32-bit code, which is use 32-bit registers for add/subtract
instead of add/adc pair of instructions it uses without -3 command-line
switch.  The big loss is the fact it won't place a far pointer into a
register even under -3.  I even think it won't use 32-bit registers for
register variables, even in the above context (but I'm not sure).

	Eli Zaretskii

- Raw text -


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