Hi! VAX GAS has a glitch when generating a 64bit value from a small negative integer, which isn't properly sign-extended. (I'll see if this can be fixed without breaking other cases.)
However, GCC should work around this by simply using the already prepared formatting operand code 'D'. The patch also introduces a new vax.exp fragment (under gcc.target). Ok? diff --git a/gcc/config/vax/vax.c b/gcc/config/vax/vax.c index 53189a7..6b643d1 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 eadde18..2c05d00 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/gcc.target/vax/pr56875.c b/gcc/testsuite/gcc.target/vax/pr56875.c new file mode 100644 index 0000000..f409afe --- /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 0000000..2aec4ee --- /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 +# <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 MfG, JBG -- Jan-Benedict Glaw jbg...@lug-owl.de +49-172-7608481 Signature of: Lauf nicht vor Deinem Glück davon: the second : Es könnte hinter Dir stehen!
signature.asc
Description: Digital signature