[H8300] : BCLR Instruction is not being generated for H8 target

Arati Dikey AratiD@kpit.com
Tue Jan 21 07:42:00 GMT 2003


Hi,

The BCLR instruction does not get generated for current CVS head. Following is my test program.

#if __H8300S__
#define PBIT   (*(char *)0xFFFFFFA0) /* FLASH Address*/
#define PINT   (*(int *)0xFFFF80A0) /* FLASH Address*/
#define PLONG   (*(long int *)0xFFFF80A0) /* FLASH Address*/
#elif __H8300H__
#define PBIT   (*(char *)0xFFFFA0) /* FLASH Address*/
#define PINT   (*(int *)0xFF80A0) /* FLASH Address*/
#define PLONG   (*(long int *)0xFF80A0) /* FLASH Address*/
#else
#define PBIT   (*(char *)0xFFA0) /* FLASH Address*/
#define PINT   (*(int *)0xFF80) /* FLASH Address*/
#define PLONG   (*(long int *)0xFF80) /* FLASH Address*/
#endif

void foo()
{
	PBIT |= 0x40 ;
	PBIT &= 0xFB ;
}

h8300-coff-gcc -S -ms h8test.c

results in following h8test.s

;	GCC For the Hitachi H8/300
;	By Hitachi America Ltd and Cygnus Support

	.h8300s
	.file	"h8test.c"
	.section .text
	.align 1
	.global _foo
_foo:
	mov.l	er6,@-er7
	mov.l	er7,er6
	bset	#6,@-96:8
	mov.b	#-5,r2l
	mov.b	@-96:8,r3l
	and	r3l,r2l
	mov.b	r2l,@-96:8
	mov.l	@er7+,er6
	rts
	.end
	.ident	"GCC: (GNU) 3.3 20030113 (prerelease)"


My analysis :
This happens because the foll. condition fails in single_zero_operand operand[2] (h8300.c)
if (GET_CODE (operand) == CONST_INT)
The GET_CODE returns REG instead of CONST_INT. I could trace this down to foll. code in expr.c

case INTEGER_CST:
      temp = immed_double_const (TREE_INT_CST_LOW (exp),
				 TREE_INT_CST_HIGH (exp), mode);

      /* ??? If overflow is set, fold will have done an incomplete job,
	 which can result in (plus xx (const_int 0)), which can get
	 simplified by validate_replace_rtx during virtual register
	 instantiation, which can result in unrecognizable insns.
	 Avoid this by forcing all overflows into registers.  */
	 
      if (TREE_CONSTANT_OVERFLOW (exp)
	  && modifier != EXPAND_INITIALIZER)
	temp = force_reg (mode, temp);
  
      return temp;

Here, exp->common.static_flag, exp->common.public_flag and exp->common.const_flag are set to 1.
This causes the if loop to be entered.
	
Any help regarding this would be appreciated.

Regards,
Arati Dikey

-----------------------------------------------------------------------------
Free download of GNUSH and GNUH8 tool chains for Hitachi's SH and H8 Series.
The following site also offers free support to European customers.
Read more at http://www.kpit.com/products/support.htm
Latest versions of GNUSH and GNUH8 are released on January 1, 2003.
-----------------------------------------------------------------------------





More information about the Gcc-bugs mailing list