This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][RFC] Introduce BIT_FIELD_INSERT
- From: Eric Botcazou <ebotcazou at adacore dot com>
- To: Richard Biener <rguenther at suse dot de>
- Cc: gcc-patches at gcc dot gnu dot org, Michael Matz <matz at suse dot de>
- Date: Thu, 19 May 2016 17:21:35 +0200
- Subject: Re: [PATCH][RFC] Introduce BIT_FIELD_INSERT
- Authentication-results: sourceware.org; auth=none
- References: <alpine dot LSU dot 2 dot 11 dot 1605131239490 dot 18037 at t29 dot fhfr dot qr> <alpine dot LSU dot 2 dot 20 dot 1605171718400 dot 13156 at wotan dot suse dot de> <alpine dot LSU dot 2 dot 11 dot 1605191521480 dot 18037 at t29 dot fhfr dot qr>
> Index: trunk/gcc/tree.def
> ===================================================================
> *** trunk.orig/gcc/tree.def 2016-05-17 17:19:41.783958489 +0200
> --- trunk/gcc/tree.def 2016-05-19 10:23:35.779141973 +0200
> *************** DEFTREECODE (ADDR_EXPR, "addr_expr", tcc
> *** 852,857 ****
> --- 852,871 ----
> descriptor of type ptr_mode. */
> DEFTREECODE (FDESC_EXPR, "fdesc_expr", tcc_expression, 2)
>
> + /* Given a word, a value and a bit position within the word,
> + produce the value that results if replacing the parts of word
> + starting at the bit position with value.
> + Operand 0 is a tree for the word of integral or vector type;
> + Operand 1 is a tree for the value of integral or vector element type;
> + Operand 2 is a tree giving the constant position of the first
> referenced bit; + The number of bits replaced is given by the precision
> of the value + type if that is integral or by its size if it is
> non-integral. + ??? The reason to make the size of the replacement
> implicit is to not + have a quaternary operation.
> + The replaced bits shall be fully inside the word. If the word is of
> + vector type the replaced bits shall be aligned with its elements. */
> + DEFTREECODE (BIT_INSERT_EXPR, "bit_field_insert", tcc_expression, 3)
> +
"word" is ambiguous (what is a word of vector type?). What's allowed as
operand #0 exactly? If that's anything, I'd call it a value too, possibly
with a qualifier, for example:
/* Given a container value, a replacement value and a bit position within
the container, produce the value that results from replacing the part of
the container starting at the bit position with the replacement value.
Operand 0 is a tree for the container value of integral or vector type;
Operand 1 is a tree for the replacement value of another integral or
vector element type;
Operand 2 is a tree giving the constant bit position;
The number of bits replaced is given by the precision of the type of the
replacement value if it is integral or by its size if it is non-integral.
??? The reason to make the size of the replacement implicit is to avoid
introducing a quaternary operation.
The replaced bits shall be fully inside the container. If the container
is of vector type, then these bits shall be aligned with its elements. */
DEFTREECODE (BIT_INSERT_EXPR, "bit_field_insert", tcc_expression, 3)
--
Eric Botcazou