Subject: Re: Toolchain for pc532. Progress!
To: None <simonb@wasabisystems.com>
From: Ian Dall <Ian.Dall@dsto.defence.gov.au>
List: port-pc532
Date: 06/18/2002 11:24:26
Simon Burge <simonb@wasabisystems.com> writes:

  > Ian Dall wrote:

  > Related to this, I've been playing around with gcc-current and
  > have two test cases failing that are worrying.  Also, using
  > "-fomit-frame-pointer" causes lots of execution failures (but not
  > every time).  The two failures are:

  >  1) An "unrecognizable insn" error for
  >     testsuite/gcc.c-torture/compile/900313-1.c

I tried this with and without "-fomit-frame-pointer" and with optimization
levels from 0 to 3 and I had no problems.

  >  2) An execution failure for gcc.c-torture/execute/20020201-1.c -O0
  >     Basically:

  > 	unsigned char cx = 7;
  > 	unsigned char cy;

  > 	cy = cx / 6;

Ah, this looks a bit harder. I reworked the descriptiom of the deib,
deiw and deid instructions quite a lot a year or so ago, so this may
be my bug. Interestingly, these instructions work differently with
register operands vs memory operands, which is why the hi and qi
versions require register operands for the first operand but the si
version does not. My guess is that is why it goes away with
optimisation. Also, it works fine for the integer case.

Note my comment in ns32k.md:

;; Part word variants. These seem to never be used at the moment (gcc
;; 2.7.2.2). The code generation prefers to zero extend hi's and qi's
;; and use signed div and mod. Keep these insns incase that changes.

It follows that these insn's ( udivmodqi, udivmodhi4,
udivmoddihi4_internal, udivmoddihi4 etc) have never been tested (up
til now). They are also not essential. They also may result in fairly
poor code, even if it is correct.  Using two registers to store a
16bit or 32bit quantitiy is not very economical. I always intended to
revisit when/if the compiler actually started using them, but I never
noticed it had!

Note I also commented:

;; divmod should have an advantage when both div and mod are needed. However,
;; divmod uses two registers, so maybe the compiler knows best.

Simply commenting them out until they work would be a viable way to proceed.

I am trying that. It is compiling as I write this.

-- 
Dr Ian Dall				      <Ian.Dall@dsto.defence.gov.au>
Head, Information Exploitation Group 
Information Technology Division		       Phone: +61 8 8259 5419
Defence Science and Technology Organisation      Fax: +61 8 8259 5619
P.O. Box 1500 Edinburgh, SA 5111, Australia