info-vax@ucbvax.ARPA (12/03/84)
From: Steven.Hobbs@CMU-CS-A.ARPA (C410SH51) > Isn't > > MovL foo,baz(r0) > > equivalent to (i.e., at least as good as) > > PushAB baz[r0] > MovL foo,@(sp)+ > > ? There is a big difference between these two code sequences. The PushAB baz[r0] uses the PC as a base register in order to generate a position-independent reference to baz. The first code sequence cannot be used by BLISS since BLISS generates position-independent code. > And isn't > > DecB baz[r0] > BEql ... > > equivalent to (i.e., at least as good as) > > CvtBL baz[r0],r1 > DecL r1 > MovB r1,baz[r0] > TstL r1 > BEql ... > > (other than r1 getting clobbered)? These two code sequences differ in the setting of the negative and overflow indicators in the situtation where the addressed element of baz contains -128. Since the code you show seems to only use the zero indicator then it should be possible for BLISS to use your suggested code sequence. However, BLISS does not differentiate NEQ comparisions from LEQ comparisions and generates code assuming it needs a 32 bit value for a comparison. Note that BLISS generates the first code sequence if you write: baz[.i] = .baz[.i] - 1; if .baz[.i] NEQ 0 THEN ... while you get the second code sequence if you write: IF (baz[.i] = .baz[.i] - 1) NEQ 0 THEN ... In the first BLISS source sequence the program tests the 8 bit value .baz[.i] while the second source sequence is defined to test the 32 bit value (.baz[.i] - 1).