diff options
author | Kazu Hirata <kazu@hxi.com> | 2002-01-04 00:50:50 +0000 |
---|---|---|
committer | Kazu Hirata <kazu@gcc.gnu.org> | 2002-01-04 00:50:50 +0000 |
commit | 187462ace70aaa5dcb2010ffdd15c013be68e68b (patch) | |
tree | e037270aa451595d715ec92415de12319f2ec3b7 | |
parent | 619acae7b9960b1ab3049666115380463f03e5c0 (diff) | |
download | gcc-187462ace70aaa5dcb2010ffdd15c013be68e68b.zip gcc-187462ace70aaa5dcb2010ffdd15c013be68e68b.tar.gz gcc-187462ace70aaa5dcb2010ffdd15c013be68e68b.tar.bz2 |
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
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/config/h8300/h8300.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/execute/20020103-1.c | 28 |
4 files changed, 40 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7a81576..7283a0c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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. diff --git a/gcc/config/h8300/h8300.c b/gcc/config/h8300/h8300.c index 2a0e260..3a5832e 100644 --- a/gcc/config/h8300/h8300.c +++ b/gcc/config/h8300/h8300.c @@ -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) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1838539..ad7b553 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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. diff --git a/gcc/testsuite/gcc.c-torture/execute/20020103-1.c b/gcc/testsuite/gcc.c-torture/execute/20020103-1.c new file mode 100644 index 0000000..c010aea --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020103-1.c @@ -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); +} |