aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorGeoffrey Keating <geoffk@redhat.com>2000-12-27 11:01:03 +0000
committerGeoffrey Keating <geoffk@gcc.gnu.org>2000-12-27 11:01:03 +0000
commit6cbadf36b260041a608d34e6f839aef9403d68c1 (patch)
treea229cef40f7ce29a6095c6b03a87a41e7ce71a71 /gcc
parentb370937715f4a2553b2e15fed5cd97b7617704c6 (diff)
downloadgcc-6cbadf36b260041a608d34e6f839aef9403d68c1.zip
gcc-6cbadf36b260041a608d34e6f839aef9403d68c1.tar.gz
gcc-6cbadf36b260041a608d34e6f839aef9403d68c1.tar.bz2
[multiple changes]
2000-12-27 Geoffrey Keating <geoffk@redhat.com> * config/rs6000/rs6000.md (define_attr "length"): Correct calculation. 2000-12-26 Geoffrey Keating <geoffk@redhat.com> * gcc.c-torture/compile/20001226-1.c: New test. From-SVN: r38495
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/config/rs6000/rs6000.md8
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20001226-1.c26
4 files changed, 40 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b93316c..ad406bd 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2000-12-27 Geoffrey Keating <geoffk@redhat.com>
+
+ * config/rs6000/rs6000.md (define_attr "length"): Correct
+ calculation.
+
2000-12-26 Kazu Hirata <kazu@hxi.com>
* config/h8300/h8300.c: Fix a comment typo.
diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index a2be5ff..9df70cf 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -41,12 +41,14 @@
(const_string "integer"))
;; Length (in bytes).
+; '(pc)' in the following doesn't include the instruction itself; it is
+; calculated as if the instruction had zero size.
(define_attr "length" ""
(if_then_else (eq_attr "type" "branch")
- (if_then_else (and (ge (minus (pc) (match_dup 0))
+ (if_then_else (and (ge (minus (match_dup 0) (pc))
(const_int -32768))
- (lt (minus (pc) (match_dup 0))
- (const_int 32767)))
+ (lt (minus (match_dup 0) (pc))
+ (const_int 32764)))
(const_int 4)
(const_int 8))
(const_int 4)))
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index ae0a892..af37582 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2000-12-26 Geoffrey Keating <geoffk@redhat.com>
+
+ * gcc.c-torture/compile/20001226-1.c: New test.
+
2000-12-22 Joseph S. Myers <jsm28@cam.ac.uk>
* gcc.c-torture/compile/20001222-1.c: New test.
diff --git a/gcc/testsuite/gcc.c-torture/compile/20001226-1.c b/gcc/testsuite/gcc.c-torture/compile/20001226-1.c
new file mode 100644
index 0000000..54dacf7
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20001226-1.c
@@ -0,0 +1,26 @@
+/* This testcase exposed two branch shortening bugs on powerpc. */
+
+#define C(a,b) \
+ if (a > b) goto gt; \
+ if (a < b) goto lt;
+
+#define C4(x,b) C((x)[0], b) C((x)[1],b) C((x)[2],b) C((x)[3],b)
+#define C16(x,y) C4(x, (y)[0]) C4(x, (y)[1]) C4(x, (y)[2]) C4(x, (y)[3])
+
+#define C64(x,y) C16(x,y) C16(x+4,y) C16(x+8,y) C16(x+12,y)
+#define C256(x,y) C64(x,y) C64(x,y+4) C64(x,y+8) C64(x,y+12)
+
+#define C1024(x,y) C256(x,y) C256(x+16,y) C256(x+32,y) C256(x+48,y)
+#define C4096(x,y) C1024(x,y) C1024(x,y+16) C1024(x,y+32) C1024(x,y+48)
+
+unsigned foo(int x[64], int y[64])
+{
+ C4096(x,y);
+
+ return 0x01234567;
+ gt:
+ return 0x12345678;
+ lt:
+ return 0xF0123456;
+}
+