Re: [RFA][2/5] New port: Cell BE SPU (valops.c fix)

Ulrich Weigand
2006-11-22T22:13:19Z

Daniel Jacobowitz wrote:

> Does the same thing happen for struct { char w, x, y, z; }?

For some reason I seem unable to convince GCC to place such
a struct into a register.

However, when attempting to manipulate a register directly
using its type structure, I'm seeing the same problem:

(gdb) print $r3
$1 = {uint128 = 0x00000001000000000000000000000000, v4_float = {1.40129846e-45, 0, 0, 0}, v4_int32 = {1, 0, 0, 0},
v8_int16 = {0, 1, 0, 0, 0, 0, 0, 0}, v16_int8 = "\000\000\000\001", '\0' <repeats 11 times>}
(gdb) print $r3.v4_int32
$2 = {1, 0, 0, 0}
(gdb) print $r3.v4_int32[2]
$3 = 0
(gdb) set variable $r3.v4_int32[2] = 5
(gdb) print $r3.v4_int32
$4 = {5, 0, 0, 0}

For registers without special conversion function, value_assign
performs a read-modify-write cycle: it reads the old contents
of the register(s), modify the bits denoted by value_offset,
value_bitsize and value_bitpos, and writes the full register
contents back.

Maybe we need to do a similar cycle of REGISTER_TO_VALUE,
modify selected bits, VALUE_TO_REGISTER for the registers with
special conversion function?

As an aside, what is this code in value_assign supposed to do:

/* Locate the first register that falls in the value that
needs to be transfered. Compute the offset of the
value in that register. */
{
int offset;
for (reg_offset = value_reg, offset = 0;
offset + register_size (current_gdbarch, reg_offset) <= value_offset (toval);
reg_offset++);
byte_offset = value_offset (toval) - offset;
}

It seems clearly broken (offset remains constant 0), but I'm not
quite sure what the intent was.

Bye,
Ulrich

--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com