[Dwarf-Discuss] Representing the location of smaller values in vector registers

Wim Lewis wiml at omnigroup.com
Wed Mar 9 11:46:48 PST 2016


On Mar 4, 2016, at 2:00 PM, Robinson, Paul <Paul_Robinson at playstation.sony.com> wrote:
> I tried a CU with an int variable instead of float, and enough other
> stuff to keep it from being optimized away completely.
> gcc produced DW_OP_reg3, while Clang produced "DW_OP_reg3; DW_OP_piece 4"
> for the same variable.
> 
> DW_OP_piece is really meant for assembling partial values in different
> places, not subdividing a register.


The introduction to the "piece" opcodes says that subdividing a register is part of their intended use (as Jakub Jelinek says, you have a similar situation if you're storing "char"s in a wider register):

> 2.6.1.2 Composite Location Descriptions
> 
> A composite location description describes an object or value which may be contained in part of a register or stored in more than one location. [....] There may be one or more composition operations in a single composite location description.  

Using a single composition operation to describe a value which is located in part of a register is explicitly an intended case for the piece operators. DW_OP_piece can be used to specify a value shorter than an entire register when "the placement of the piece within that register is defined by the ABI"; DW_OP_bit_piece can be used "when the piece to be assembled into a value [...] is not at the start of a register".

So it seems to me that Clang's output (reg; piece) is correct; I think GCC's is also reasonable, since the ABI defines how to store a float32 in a 128-bit register. 




More information about the Dwarf-Discuss mailing list