🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Robert E. Brown Thu, 12 Nov 1992 14:13
missing optimization
#1378
Author: Robert E. Brown
Date: Thu, 12 Nov 1992 14:13
99 lines
3084 bytes
I'm using GCC version 2.3.1 on a Next computer, configured with
"./configure next".

When MISSING_OPTIMIZATION is not defined, the GCC optimizes away code that
calls first_computation, third_computation, and fourth_computation().  When
the macro MISSING_OPTIMIZATION is defined, all the extra code is not optimized
away, even though GCC realizes that (1 % 0) evaluates to 1.


% cat wow2.c
============

void
foo()
{
    long temp;
    
    temp = 1;
    
#ifdef MISSING_OPTIMIZATION
    temp = temp % 33;
#else
    temp = temp + 0;
#endif
    
    
    if (temp == 0)
	first_computation();
    else if (temp == 1)
	second_computation();
    else if (temp == 32)
	third_computation();
    else
	fourth_computation();
}


% gcc -v -S -O wow2.c
=====================

Reading specs from /usr/local/lib/gcc-lib/next/2.3.1/specs
gcc version 2.3.1
 /usr/local/lib/gcc-lib/next/2.3.1/cpp -lang-c -v -undef -D__GNUC__=2 -Dmc68000 -Dm68k -DNeXT -Dunix -D__MACH__ -D__ARCHITECTURE__="m68k" -D__mc68000__ -D__m68k__ -D__NeXT__ -D__unix__ -D__MACH__ -D__ARCHITECTURE__="m68k" -D__mc68000 -D__m68k -D__NeXT -D__unix -D__MACH__ -D__ARCHITECTURE__="m68k" -D__OPTIMIZE__ wow2.c /usr/tmp/cc011547.i
GNU CPP version 2.3.1 (68k, MIT syntax)
 /usr/local/lib/gcc-lib/next/2.3.1/cc1 /usr/tmp/cc011547.i -quiet -dumpbase wow2.c -O -version -o wow2.s
GNU C version 2.3.1 (68k, MIT syntax) compiled by GNU C version 2.3.1.


% cat wow2.s
============

#NO_APP
.text
	.align 1
.globl _foo
_foo:
	link a6,#0
	jbsr _second_computation
	unlk a6
	rts


% gcc -v -S -O wow2.c -DMISSING_OPTIMIZATION
============================================

Reading specs from /usr/local/lib/gcc-lib/next/2.3.1/specs
gcc version 2.3.1
 /usr/local/lib/gcc-lib/next/2.3.1/cpp -lang-c -v -DMISSING_OPTIMIZATION -undef -D__GNUC__=2 -Dmc68000 -Dm68k -DNeXT -Dunix -D__MACH__ -D__ARCHITECTURE__="m68k" -D__mc68000__ -D__m68k__ -D__NeXT__ -D__unix__ -D__MACH__ -D__ARCHITECTURE__="m68k" -D__mc68000 -D__m68k -D__NeXT -D__unix -D__MACH__ -D__ARCHITECTURE__="m68k" -D__OPTIMIZE__ wow2.c /usr/tmp/cc011551.i
GNU CPP version 2.3.1 (68k, MIT syntax)
 /usr/local/lib/gcc-lib/next/2.3.1/cc1 /usr/tmp/cc011551.i -quiet -dumpbase wow2.c -O -version -o wow2.s
GNU C version 2.3.1 (68k, MIT syntax) compiled by GNU C version 2.3.1.


% cat wow2.s
============

#NO_APP
.text
	.align 1
.globl _foo
_foo:
	link a6,#0
	moveq #1,d0
	moveq #1,d1
	cmpl d0,d1
	jne L4
	jbsr _second_computation
	jra L3
L4:
	moveq #32,d1
	cmpl d0,d1
	jne L6
	jbsr _third_computation
	jra L3
L6:
	jbsr _fourth_computation
L3:
	unlk a6
	rts
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads