]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Work around buggy gas not properly sign-extending a 64bit value on a 32bit host
authorJan-Benedict Glaw <jbglaw@gcc.gnu.org>
Fri, 20 Sep 2013 19:00:02 +0000 (19:00 +0000)
committerJan-Benedict Glaw <jbglaw@gcc.gnu.org>
Fri, 20 Sep 2013 19:00:02 +0000 (19:00 +0000)
PR target/56875
2013-09-20  Martin Husemann  <martin@NetBSD.org>
    Jan-Benedict Glaw  <jbglaw@lug-owl.de>

gcc/
* config/vax/vax.c (vax_output_int_move): Use D format specifier.
* config/vax/vax.md (ashldi3, <unnamed>): Ditto.

gcc/testsuite/
* gcc.target/vax/vax.exp: New.
* gcc.target/vax/pr56875.c: Ditto.

From-SVN: r202796

gcc/ChangeLog
gcc/config/vax/vax.c
gcc/config/vax/vax.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/vax/pr56875.c [new file with mode: 0644]
gcc/testsuite/gcc.target/vax/vax.exp [new file with mode: 0644]

index 31f26b191dee4c86a75a7414f6725df5488337f0..d4f56a4773bbba884391756382a36be4cc21cb0f 100644 (file)
@@ -1,3 +1,9 @@
+2013-09-20  Martin Husemann  <martin@NetBSD.org>
+
+       PR target/56875
+       * config/vax/vax.c (vax_output_int_move): Use D format specifier.
+       * config/vax/vax.md (ashldi3, <unnamed>): Ditto.
+
 2013-09-20  Richard Biener  <rguenther@suse.de>
 
        PR middle-end/58484
index 53189a7e7d656dd21a15e34f52e68220488c8a23..6b643d1af5de720f0ba4b538c0639fb3c06380d0 100644 (file)
@@ -1187,7 +1187,7 @@ vax_output_int_move (rtx insn ATTRIBUTE_UNUSED, rtx *operands,
                {
                  operands[1] = GEN_INT (lval);
                  operands[2] = GEN_INT (n);
-                 return "ashq %2,%1,%0";
+                 return "ashq %2,%D1,%0";
                }
 #if HOST_BITS_PER_WIDE_INT == 32
            }
@@ -1199,7 +1199,7 @@ vax_output_int_move (rtx insn ATTRIBUTE_UNUSED, rtx *operands,
            {
              operands[1] = GEN_INT (hval >> n);
              operands[2] = GEN_INT (n + 32);
-             return "ashq %2,%1,%0";
+             return "ashq %2,%D1,%0";
 #endif
            }
        }
index eadde18ad43a2dcd95e1324f55dd53454186968d..2c05d007dae4e7295c888cc89723d14674475d1d 100644 (file)
        (ashift:DI (match_operand:DI 1 "general_operand" "g")
                   (match_operand:QI 2 "general_operand" "g")))]
   ""
-  "ashq %2,%1,%0")
+  "ashq %2,%D1,%0")
 
 (define_insn ""
   [(set (match_operand:DI 0 "nonimmediate_operand" "=g")
        (ashiftrt:DI (match_operand:DI 1 "general_operand" "g")
                     (neg:QI (match_operand:QI 2 "general_operand" "g"))))]
   ""
-  "ashq %2,%1,%0")
+  "ashq %2,%D1,%0")
 
 ;; We used to have expand_shift handle logical right shifts by using extzv,
 ;; but this make it very difficult to do lshrdi3.  Since the VAX is the
index e7acce4d80543d697b5069983ab2b897e0beb7b5..cef626ab314e3a59149684cf503b39a65ad7648b 100644 (file)
@@ -1,3 +1,9 @@
+2013-09-20  Jan-Benedict Glaw  <jbglaw@lug-owl.de>
+
+       PR target/56875
+       * gcc.target/vax/vax.exp: New.
+       * gcc.target/vax/pr56875.c: Ditto.
+
 2013-09-20  Richard Biener  <rguenther@suse.de>
 
        PR middle-end/58484
diff --git a/gcc/testsuite/gcc.target/vax/pr56875.c b/gcc/testsuite/gcc.target/vax/pr56875.c
new file mode 100644 (file)
index 0000000..f409afe
--- /dev/null
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-O0" } */
+/* { dg-final { scan-assembler     "ashq .*,\\\$0xffffffffffffffff," } } */
+/* { dg-final { scan-assembler-not "ashq .*,\\\$-1," } } */
+
+void
+a (void)
+{
+       unsigned long i = 1;
+       unsigned long long v;
+
+       v = ~ (unsigned long long) 0 << i;
+}
diff --git a/gcc/testsuite/gcc.target/vax/vax.exp b/gcc/testsuite/gcc.target/vax/vax.exp
new file mode 100644 (file)
index 0000000..2aec4ee
--- /dev/null
@@ -0,0 +1,41 @@
+# Copyright (C) 2013 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3.  If not see
+# <http://www.gnu.org/licenses/>.
+
+# GCC testsuite that uses the `dg.exp' driver.
+
+# Exit immediately if this isn't a VAX target.
+if ![istarget vax-*-*] then {
+  return
+}
+
+# Load support procs.
+load_lib gcc-dg.exp
+
+# If a testcase doesn't have special options, use these.
+global DEFAULT_CFLAGS
+if ![info exists DEFAULT_CFLAGS] then {
+    set DEFAULT_CFLAGS " -ansi -pedantic-errors"
+}
+
+# Initialize `dg'.
+dg-init
+
+# Main loop.
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] \
+       "" $DEFAULT_CFLAGS
+
+# All done.
+dg-finish