binutils-gdb/gdb/testsuite/gdb.arch/altivec-regs.c
Carl Love 5992fb8541 PowerPC, fix test gdb.arch/altivec-regs.exp
The test fails on Power 10 with the RHEL9 distro.  It also fails on
Power 9.

The test set a the breakpoint in main that stops at line:
a = 9; /* start here */.  The test then sets a break point at the same
line where it wants to start the test and does a continue.  GDB does not
stop again on the same line where it is stopped, but rather continues to
the end of the program.

Initialize variable A to zero so the break on main will stop before setting
a break point on line a = 9; /* start here */.

Make the match on the breakpoint number generic.

Patch has been tested on Power 10 with RHEL 9, Power 10 with Ubuntu 22.04,
and Power 9 with Fedora 36 with no regression failures.
2023-03-08 11:14:18 -05:00

47 lines
1.2 KiB
C

#include <altivec.h>
#include <stdio.h>
vector unsigned int
vector_fun (volatile vector unsigned int a, volatile vector unsigned int b)
{
vector unsigned int c;
a = ((vector unsigned int) vec_splat_u8(2));
b = ((vector unsigned int) vec_splat_u8(3));
c = vec_add (a, b);
return c;
}
int
main ()
{
vector unsigned int y;
vector unsigned int x;
vector unsigned int z;
int a = 0;
#ifdef _AIX
/* On AIX, the debugger cannot access vector registers before they
are first used by the inferior. Perform such an access here. */
x = ((vector unsigned int) vec_splat_u8 (0));
#endif
/* This line may look unnecessary but we do need it, because we want to
have a line to do a next over (so that gdb refetches the registers)
and we don't want the code to change any vector registers.
The splat operations below modify the VRs,i
so we don't want to execute them yet. */
a = 9; /* start here */
x = ((vector unsigned int) vec_splat_u8 (-2));
y = ((vector unsigned int) vec_splat_u8 (1));
z = vector_fun (x, y);
x = vec_sld (x,y,2);
x = vec_add (x, ((vector unsigned int){5,6,7,8}));
z = (vector unsigned int) vec_splat_u8 ( -2);
y = vec_add (x, z);
z = (vector unsigned int) vec_cmpeq (x,y);
return 0;
}