h8300.c (output_logical_op): Use 'not.w' instead of 'neg.w' when xoring with 0x0000ffff or 0xffff0000.

* config/h8300/h8300.c (output_logical_op): Use 'not.w' instead
	of 'neg.w' when xoring with 0x0000ffff or 0xffff0000.

From-SVN: r48524
This commit is contained in:
Kazu Hirata 2002-01-04 00:50:50 +00:00 committed by Kazu Hirata
parent 619acae7b9
commit 187462ace7
4 changed files with 40 additions and 3 deletions

View File

@ -1,3 +1,8 @@
2002-01-03 Kazu Hirata <kazu@hxi.com>
* config/h8300/h8300.c (output_logical_op): Use 'not.w' instead
of 'neg.w' when xoring with 0x0000ffff or 0xffff0000.
2002-01-03 Neil Booth <neil@daikokuya.demon.co.uk>
* cpperror.c: Update comments and copyright.

View File

@ -1681,7 +1681,7 @@ output_logical_op (mode, code, operands)
/* First, see if we can finish with one insn.
If code is either AND or XOR, we exclude two special cases,
0xffffff00 and 0xffff00ff, because insns like sub.w or neg.w
0xffffff00 and 0xffff00ff, because insns like sub.w or not.w
can do a better job. */
if ((TARGET_H8300H || TARGET_H8300S)
&& ((det & 0x0000ffff) != 0)
@ -1704,7 +1704,7 @@ output_logical_op (mode, code, operands)
&& ((det & 0x0000ffff) == 0x0000ffff)
&& code != IOR)
output_asm_insn ((code == AND)
? "sub.w\t%f0,%f0" : "neg.w\t%f0",
? "sub.w\t%f0,%f0" : "not.w\t%f0",
operands);
else if ((TARGET_H8300H || TARGET_H8300S)
&& ((det & 0x000000ff) != 0)
@ -1731,7 +1731,7 @@ output_logical_op (mode, code, operands)
&& ((det & 0xffff0000) == 0xffff0000)
&& code != IOR)
output_asm_insn ((code == AND)
? "sub.w\t%e0,%e0" : "neg.w\t%e0",
? "sub.w\t%e0,%e0" : "not.w\t%e0",
operands);
else if (TARGET_H8300H || TARGET_H8300S)
{

View File

@ -1,3 +1,7 @@
2002-01-03 Kazu Hirata <kazu@hxi.com>
* gcc.c-torture/execute/20020103-1.c: New test.
2002-01-03 Jakub Jelinek <jakub@redhat.com>
* g++.dg/other/debug2.C: New test.

View File

@ -0,0 +1,28 @@
/* On h8300 port, the following used to be broken with -mh or -ms. */
extern void abort (void);
extern void exit (int);
unsigned long
foo (unsigned long a)
{
return a ^ 0x0000ffff;
}
unsigned long
bar (unsigned long a)
{
return a ^ 0xffff0000;
}
int
main ()
{
if (foo (0) != 0x0000ffff)
abort ();
if (bar (0) != 0xffff0000)
abort ();
exit (0);
}