aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorKazu Hirata <kazu@cs.umass.edu>2002-11-12 14:01:33 +0000
committerKazu Hirata <kazu@gcc.gnu.org>2002-11-12 14:01:33 +0000
commite27051f71bf83b124c2672659ce075c33544b384 (patch)
tree623d9f0068221865a412e4cd652776df27d07bdd /gcc
parent10bb8214f8967b1360b09c2a8e4b2157da334df6 (diff)
downloadgcc-e27051f71bf83b124c2672659ce075c33544b384.zip
gcc-e27051f71bf83b124c2672659ce075c33544b384.tar.gz
gcc-e27051f71bf83b124c2672659ce075c33544b384.tar.bz2
h8300.c (single_one_operand): Correctly compute mask when mode is SImode.
* config/h8300/h8300.c (single_one_operand): Correctly compute mask when mode is SImode. (single_zero_operand): Likewise. * config/h8300/h8300.md (two new anonymous insns): New. From-SVN: r59050
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/config/h8300/h8300.c8
-rw-r--r--gcc/config/h8300/h8300.md37
3 files changed, 50 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 400f34f..f39d76b 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2002-11-12 Kazu Hirata <kazu@cs.umass.edu>
+
+ * config/h8300/h8300.c (single_one_operand): Correctly compute
+ mask when mode is SImode.
+ (single_zero_operand): Likewise.
+ * config/h8300/h8300.md (two new anonymous insns): New.
+
2002-11-12 Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>
* doc/contrib.texi (Contributors): Use GCJ instead of gcj to refer
diff --git a/gcc/config/h8300/h8300.c b/gcc/config/h8300/h8300.c
index 43a0c88..56a06a0 100644
--- a/gcc/config/h8300/h8300.c
+++ b/gcc/config/h8300/h8300.c
@@ -763,7 +763,9 @@ single_one_operand (operand, mode)
/* We really need to do this masking because 0x80 in QImode is
represented as -128 for example. */
unsigned HOST_WIDE_INT mask =
- ((unsigned HOST_WIDE_INT) 1 << GET_MODE_BITSIZE (mode)) - 1;
+ (GET_MODE_BITSIZE (mode) < HOST_BITS_PER_WIDE_INT)
+ ? ((unsigned HOST_WIDE_INT) 1 << GET_MODE_BITSIZE (mode)) - 1
+ : ~0;
unsigned HOST_WIDE_INT value = INTVAL (operand);
if (exact_log2 (value & mask) >= 0)
@@ -786,7 +788,9 @@ single_zero_operand (operand, mode)
/* We really need to do this masking because 0x80 in QImode is
represented as -128 for example. */
unsigned HOST_WIDE_INT mask =
- ((unsigned HOST_WIDE_INT) 1 << GET_MODE_BITSIZE (mode)) - 1;
+ (GET_MODE_BITSIZE (mode) < HOST_BITS_PER_WIDE_INT)
+ ? ((unsigned HOST_WIDE_INT) 1 << GET_MODE_BITSIZE (mode)) - 1
+ : ~0;
unsigned HOST_WIDE_INT value = INTVAL (operand);
if (exact_log2 (~value & mask) >= 0)
diff --git a/gcc/config/h8300/h8300.md b/gcc/config/h8300/h8300.md
index f0b9068..129ff63 100644
--- a/gcc/config/h8300/h8300.md
+++ b/gcc/config/h8300/h8300.md
@@ -599,6 +599,43 @@
[(set_attr "length" "2")
(set_attr "cc" "set_zn")])
+(define_insn ""
+ [(set (cc0)
+ (and:HI (match_operand:HI 0 "register_operand" "r")
+ (match_operand:HI 1 "single_one_operand" "n")))]
+ ""
+ "*
+{
+ operands[1] = GEN_INT (INTVAL (operands[1]) & 0xffff);
+ if (INTVAL (operands[1]) > 128)
+ {
+ operands[1] = GEN_INT (INTVAL (operands[1]) >> 8);
+ return \"btst\\t%V1,%t0\";
+ }
+ return \"btst\\t%V1,%s0\";
+}"
+ [(set_attr "length" "2")
+ (set_attr "cc" "set_zn")])
+
+(define_insn ""
+ [(set (cc0)
+ (and:SI (match_operand:SI 0 "register_operand" "r")
+ (match_operand:SI 1 "single_one_operand" "n")))]
+ "(TARGET_H8300H || TARGET_H8300S)
+ && (INTVAL (operands[1]) & 0xffff) != 0"
+ "*
+{
+ operands[1] = GEN_INT (INTVAL (operands[1]) & 0xffff);
+ if (INTVAL (operands[1]) > 128)
+ {
+ operands[1] = GEN_INT (INTVAL (operands[1]) >> 8);
+ return \"btst\\t%V1,%x0\";
+ }
+ return \"btst\\t%V1,%w0\";
+}"
+ [(set_attr "length" "2")
+ (set_attr "cc" "set_zn")])
+
(define_insn "tstqi"
[(set (cc0) (match_operand:QI 0 "register_operand" "r"))]
""