Work around buggy gas not properly sign-extending a 64bit value on a 32bit host

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
This commit is contained in:
Jan-Benedict Glaw 2013-09-20 19:00:02 +00:00
parent bd599dea43
commit 7691132c91
6 changed files with 70 additions and 4 deletions

View 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

View 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
}
}

View File

@ -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

View 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

View File

@ -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;
}

View File

@ -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