[squeak-dev] x86 sarl curiosity...

Martin Beck martin.beck at hpi.uni-potsdam.de
Wed Jan 21 19:06:18 UTC 2009

Hi Eliot,

Eliot Miranda wrote:
> Hi All,
>     anyone know the x86/IA32 really well?  If so, read on.  Otherwise save
> yourself the yawn.
> (my emphasis added).  But neither the Bochs simulator nor my Intel Core Duo
> set the flags when doing sarl $1, %eax when %eax contains -1.  Have I
> misread, or is the manual wrong?
I cannot confirm this. Using this simple C-Program:

int calc(int i) {
  return i >> 1;

int main() {
  printf("%i\n", calc(-1));

my GCC 4.3.2 generates a sarl %eax instruction as the assembler output
shows. Debugging it with Kdbg shows a change of the flags after the
instruction. In fact, CF and SF are set as (more or less) expected. I
also have a Intel Core 2 Duo.


More information about the Squeak-dev mailing list