From 7691132c9150044474afd3634f69a48bd558ea42 Mon Sep 17 00:00:00 2001 From: Jan-Benedict Glaw Date: Fri, 20 Sep 2013 19:00:02 +0000 Subject: [PATCH] Work around buggy gas not properly sign-extending a 64bit value on a 32bit host PR target/56875 2013-09-20 Martin Husemann Jan-Benedict Glaw gcc/ * config/vax/vax.c (vax_output_int_move): Use D format specifier. * config/vax/vax.md (ashldi3, ): Ditto. gcc/testsuite/ * gcc.target/vax/vax.exp: New. * gcc.target/vax/pr56875.c: Ditto. From-SVN: r202796 --- gcc/ChangeLog | 6 ++++ gcc/config/vax/vax.c | 4 +-- gcc/config/vax/vax.md | 4 +-- gcc/testsuite/ChangeLog | 6 ++++ gcc/testsuite/gcc.target/vax/pr56875.c | 13 ++++++++ gcc/testsuite/gcc.target/vax/vax.exp | 41 ++++++++++++++++++++++++++ 6 files changed, 70 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/gcc.target/vax/pr56875.c create mode 100644 gcc/testsuite/gcc.target/vax/vax.exp diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 31f26b191de..d4f56a4773b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2013-09-20 Martin Husemann + + PR target/56875 + * config/vax/vax.c (vax_output_int_move): Use D format specifier. + * config/vax/vax.md (ashldi3, ): Ditto. + 2013-09-20 Richard Biener PR middle-end/58484 diff --git a/gcc/config/vax/vax.c b/gcc/config/vax/vax.c index 53189a7e7d6..6b643d1af5d 100644 --- a/gcc/config/vax/vax.c +++ b/gcc/config/vax/vax.c @@ -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 } } diff --git a/gcc/config/vax/vax.md b/gcc/config/vax/vax.md index eadde18ad43..2c05d007dae 100644 --- a/gcc/config/vax/vax.md +++ b/gcc/config/vax/vax.md @@ -697,14 +697,14 @@ (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 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e7acce4d805..cef626ab314 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2013-09-20 Jan-Benedict Glaw + + PR target/56875 + * gcc.target/vax/vax.exp: New. + * gcc.target/vax/pr56875.c: Ditto. + 2013-09-20 Richard Biener 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 index 00000000000..f409afe88e7 --- /dev/null +++ b/gcc/testsuite/gcc.target/vax/pr56875.c @@ -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 index 00000000000..2aec4eec192 --- /dev/null +++ b/gcc/testsuite/gcc.target/vax/vax.exp @@ -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 +# . + +# 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 -- 2.30.2