summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoruros <uros@138bc75d-0d04-0410-961f-82ee72b054a4>2012-04-02 10:04:10 +0000
committeruros <uros@138bc75d-0d04-0410-961f-82ee72b054a4>2012-04-02 10:04:10 +0000
commit8bbbe2b5ba0429b6ab31f689178faa26be4e2d70 (patch)
tree25a87d90e52dfd9812287295b22efbecb3a3a3a1
parent7a19298b2c3ca86a08b5151667cf3fec2c97f4af (diff)
downloadgcc-8bbbe2b5ba0429b6ab31f689178faa26be4e2d70.tar.gz
Partially revert:
2012-03-29 Richard Guenther <rguenther@suse.de> * rtl.h (extended_count): Remove. * combine.c (extended_count): Remove. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@186077 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/combine.c25
-rw-r--r--gcc/rtl.h1
3 files changed, 34 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ea1bd80ed05..e5abe458bf6 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2012-04-02 Uros Bizjak <ubizjak@gmail.com>
+
+ Partially revert:
+ 2012-03-29 Richard Guenther <rguenther@suse.de>
+
+ * rtl.h (extended_count): Remove.
+ * combine.c (extended_count): Remove.
+
2012-04-02 Dodji Seketeli <dodji@redhat.com>
PR c++/40942
diff --git a/gcc/combine.c b/gcc/combine.c
index de3afccb446..7eaaf476c6e 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -9674,6 +9674,31 @@ reg_num_sign_bit_copies_for_combine (const_rtx x, enum machine_mode mode,
return NULL;
}
+/* Return the number of "extended" bits there are in X, when interpreted
+ as a quantity in MODE whose signedness is indicated by UNSIGNEDP. For
+ unsigned quantities, this is the number of high-order zero bits.
+ For signed quantities, this is the number of copies of the sign bit
+ minus 1. In both case, this function returns the number of "spare"
+ bits. For example, if two quantities for which this function returns
+ at least 1 are added, the addition is known not to overflow.
+
+ This function will always return 0 unless called during combine, which
+ implies that it must be called from a define_split. */
+
+unsigned int
+extended_count (const_rtx x, enum machine_mode mode, int unsignedp)
+{
+ if (nonzero_sign_valid == 0)
+ return 0;
+
+ return (unsignedp
+ ? (HWI_COMPUTABLE_MODE_P (mode)
+ ? (unsigned int) (GET_MODE_PRECISION (mode) - 1
+ - floor_log2 (nonzero_bits (x, mode)))
+ : 0)
+ : num_sign_bit_copies (x, mode) - 1);
+}
+
/* This function is called from `simplify_shift_const' to merge two
outer operations. Specifically, we have already found that we need
to perform operation *POP0 with constant *PCONST0 at the outermost
diff --git a/gcc/rtl.h b/gcc/rtl.h
index bfb0cf99803..30931b74df7 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -2455,6 +2455,7 @@ extern bool validate_subreg (enum machine_mode, enum machine_mode,
const_rtx, unsigned int);
/* In combine.c */
+extern unsigned int extended_count (const_rtx, enum machine_mode, int);
extern rtx remove_death (unsigned int, rtx);
extern void dump_combine_stats (FILE *);
extern void dump_combine_total_stats (FILE *);