]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
s390.c (s390_O_constraint_str): Limit the range for 'On' to -4G+1..-1.
authorAndreas Krebbel <krebbel1@de.ibm.com>
Wed, 12 Dec 2007 09:15:03 +0000 (09:15 +0000)
committerAndreas Krebbel <krebbel@gcc.gnu.org>
Wed, 12 Dec 2007 09:15:03 +0000 (09:15 +0000)
2007-12-12  Andreas Krebbel  <krebbel1@de.ibm.com>

* config/s390/s390.c (s390_O_constraint_str): Limit the range
for 'On' to -4G+1..-1.
* config/s390/constraints.md: Adjust comment accordingly.

2007-12-12  Andreas Krebbel  <krebbel1@de.ibm.com>

* gcc.target/s390/20071212-1.c: New testcase.

From-SVN: r130787

gcc/ChangeLog
gcc/config/s390/constraints.md
gcc/config/s390/s390.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/s390/20071212-1.c [new file with mode: 0644]

index 111ed014d530113b831178b344b549cb3784e023..cab09cbe997998dde3db5019b1a0c3eeca93d577 100644 (file)
@@ -1,3 +1,9 @@
+2007-12-12  Andreas Krebbel  <krebbel1@de.ibm.com>
+
+       * config/s390/s390.c (s390_O_constraint_str): Limit the range
+       for 'On' to -4G+1..-1.
+       * config/s390/constraints.md: Adjust comment accordingly.
+
 2007-12-11  Nathan Sidwell  <nathan@codesourcery.com>
 
        * config/rs6000/rs6000.c (rs6000_emit_prologue): Use frame_reg_rtx
index cdafa2fad31f1ac190c1da63650d3a6a723d8791..92fd3254ca5ab3d52c1f7dcf858b14d4f95951ce 100644 (file)
@@ -49,7 +49,7 @@
 ;;    O -- Multiple letter constraint followed by 1 parameter.
 ;;         s:  Signed extended immediate value (-2G .. 2G-1).
 ;;         p:  Positive extended immediate value (0 .. 4G-1).
-;;         n:  Negative extended immediate value (-4G .. -1).
+;;         n:  Negative extended immediate value (-4G+1 .. -1).
 ;;         These constraints do not accept any operand if the machine does
 ;;         not provide the extended-immediate facility.
 ;;    P -- Any integer constant that can be loaded without literal pool.
 
 (define_constraint "On"
   "@internal
-   Negative extended immediate value (-4G .. -1).
+   Negative extended immediate value (-4G+1 .. -1).
    This constraint will only match if the machine provides
    the extended-immediate facility."
   (and (match_code "const_int")
index f7d80dbc01c231e4e8483273548d0e613881164c..0b6d63bf01944a8a9232a9ada3e0f22126e77ade 100644 (file)
@@ -2056,8 +2056,7 @@ s390_O_constraint_str (const char c, HOST_WIDE_INT value)
        || s390_single_part (GEN_INT (value), DImode, SImode, 0) == 1;
 
     case 'n':
-      return value == -1
-       || s390_single_part (GEN_INT (value), DImode, SImode, -1) == 1;
+      return s390_single_part (GEN_INT (value - 1), DImode, SImode, -1) == 1;
 
     default:
       gcc_unreachable ();
index e6c5b41ba9ad9e27968d40be74890541a5868b49..85cd1e3d5b47b36a72df748f245a25932d4ff639 100644 (file)
@@ -1,3 +1,7 @@
+2007-12-12  Andreas Krebbel  <krebbel1@de.ibm.com>
+
+       * gcc.target/s390/20071212-1.c: New testcase.
+
 2007-12-11  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/34238
diff --git a/gcc/testsuite/gcc.target/s390/20071212-1.c b/gcc/testsuite/gcc.target/s390/20071212-1.c
new file mode 100644 (file)
index 0000000..e5d05ad
--- /dev/null
@@ -0,0 +1,11 @@
+/* This used to fail due to bug in the On constraint causing a slgfi
+   to be emitted with an immediate not fitting into 32bit.  */
+
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=z9-109" } */
+
+long
+foo (long a)
+{
+  return a - (1ULL << 32);
+}