Bug in 4.2 cc code generator (result type of assignment)

Guy Harris guy at sun.uucp
Thu Sep 18 06:23:19 AEST 1986


Fixed - in part - in 4.3.  The code it generates for the first loop, for
comparison; it's the same as in 4.2:

L19:
	cvtbl	*-12(fp),r0
	bicl2	$-256,r0
	cvtlb	r0,-13(fp)
	incl	-12(fp)
	cmpb	-13(fp),-5(fp)
	jeql	L20

And the code for the second loop:

L24:
	movl	-12(fp),r0
	incl	-12(fp)
	cvtbl	(r0),r0
	bicl2	$-256,r0
	cvtlb	r0,-13(fp)
	cmpb	-13(fp),-5(fp)
	jeql	L25

Well, at least it's correct this time, but it's *still* less efficient; moving
the pointer into "r0" first is pointless.  Turning on the optimizer doesn't
help; it does collapse the "cvtbl" and "bicl2" into a "movzbl", but it
doesn't figure out that

	movl	-12(fp),r0
	incl	-12(fp)
	movzbl	(r0),r0

is better done as

	movzbl	*-12(fp),r0
	incl	-12(fp)
-- 
	Guy Harris
	{ihnp4, decvax, seismo, decwrl, ...}!sun!guy
	guy at sun.com (or guy at sun.arpa)



More information about the Comp.lang.c mailing list