https://bugs.kde.org/show_bug.cgi?id=391164

            Bug ID: 391164
           Summary: constraint bug in tests/ppc64/test_isa_2_07_part1.c
                    for mtfprwa
           Product: valgrind
           Version: 3.13.0
          Platform: Other
                OS: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: jsew...@acm.org
          Reporter: m...@klomp.org
  Target Milestone: ---

Building on Fedora rawhide with gcc 8 and binutils 2.30 produces the following
error:

gcc -DHAVE_CONFIG_H -I. -I../../..  -I../../.. -I../../../include
-I../../../coregrind -I../../../include -I../../../VEX/pub -I../../../VEX/pub
-DVGA_ppc64le=1 -DVGO_linux=1 -DVGP_ppc64le_linux=1
-DVGPV_ppc64le_linux_vanilla=1   -Winline -Wall -Wshadow -Wno-long-long -g
-fno-stack-protector   -m64  -Winline -Wall -O -g -mregnames -DHAS_ISA_2_07
-m64 -mcpu=power8  -MT test_isa_2_07_part1-test_isa_2_07_part1.o -MD -MP -MF
.deps/test_isa_2_07_part1-test_isa_2_07_part1.Tpo -c -o
test_isa_2_07_part1-test_isa_2_07_part1.o `test -f 'test_isa_2_07_part1.c' ||
echo './'`test_isa_2_07_part1.c
/tmp/ccWcWDpE.s: Assembler messages:
/tmp/ccWcWDpE.s:376: Warning: invalid register expression
/tmp/ccWcWDpE.s:376: Error: operand out of range (32 is not between 0 and 31)
make[5]: *** [Makefile:1140: test_isa_2_07_part1-test_isa_2_07_part1.o] Error 1

This is caused by:

  static vector unsigned long long vec_out
  static void test_mtfprwa (void)
  {
     __asm__ __volatile__ ("mtfprwa %x0,%1" : "=ws" (vec_out) : "r" (r14));
  };

Quoting Peter Bergner:
"This is a constraint bug.  The mtfprwa instruction is actually an
extended mnemonic for mtvsrwa which does allow a VSX register as
the dest reg.  However, mtfprwa is defined to write only an FPR reg,
so it should be using either the %f or %d constraint."

Changing the constraint from "ws" (VSX vector register to hold scalar double
values or NO_REGS) to "d" (Floating point register (containing 64-bit value))
fixes the build issue and still makes the testcase pass.

diff --git a/none/tests/ppc64/test_isa_2_07_part1.c
b/none/tests/ppc64/test_isa_2_07_part1.c
index 73a563ca5..201fa8855 100644
--- a/none/tests/ppc64/test_isa_2_07_part1.c
+++ b/none/tests/ppc64/test_isa_2_07_part1.c
@@ -406,7 +406,7 @@ static void test_mtvsrwz (void)

 static void test_mtfprwa (void)
 {
-   __asm__ __volatile__ ("mtfprwa %x0,%1" : "=ws" (vec_out) : "r" (r14));
+   __asm__ __volatile__ ("mtfprwa %x0,%1" : "=d" (vec_out) : "r" (r14));
 };

 static test_t tests_move_ops_spe[] = {

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to