This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[H8 PATCH] : BNOT, BSET and BCLR in QImode


Hi,

We have built H8 toolchain using binutils-2.17.90, gcc-4.3-20070302 and
newlib-1.15.0 sources. During our internal testing we found that the
BNOT, BSET and BCLR instructions are not generated properly for QI mode
in case of H8 Targets.

For example, the following test case prints "test is false",
which is wrong.
Command line options: h8300-elf-g++ test.cpp -msx

Test case:
===========================================================
#include<stdio.h>
int main ()
{
  bool test = true;
  if (test == false)
    {
      printf ("test is false");
      return -1;
    }
  else
    {
      printf ("test is true");
      return 0;
    }
}
===========================================================

Also, the BSET and BCLR instructions are not generated when we try to
set or clear a particular bit in a structure. This is illustrated in
the test case in the patch.
Command line options: h8300-elf-gcc 20071123-1.c -msx -S

Attached is the patch to fix the above mentioned problems.
No new regressions.

Changelog:

2007-11-23  Sushil Kothawade  <Sushil.Kothawade@kpitcummins.com>
	    Deepen Mantri  <Deepen.Mantri@kpitcummins.com>

	* gcc/config/h8300/h8300.h: Implemented new constraints Y0 and
	Y2 for generating bit instructions.
	* gcc/config/h8300/h8300.md (*andqi3_2): Added new constraint
	Y0 to generate bclr instruction.
	(andqi3_1): Modified the constraints to generate bclr
	instruction.
	(iorqi3_1): Modified the constraints to generate bset
	instruction.
	(xorqi3_1): Modified the constraints to generate bnot
	instruction.
	* gcc.c-torture/execute/20071123-1.c: New test.


NOTE: Attached patch is a fix for QI mode instructions only.

Regards,
Sushil Kothawade

KPIT Cummins InfoSystems Ltd.
Pune, India
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Free download of GNU based tool-chains for Renesas' SH, H8, R8C, M16C
and M32C Series. The following site also offers free technical support
to its users. Visit http://www.kpitgnutools.com for details.
Latest versions of KPIT GNU tools were released on October 1, 2007.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Attachment: bit_h8.patch
Description: bit_h8.patch


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]