This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch,AVR]: Add %T/%t to print_operand. Add built-in to permute bits.


2011/11/28 Georg-Johann Lay <avr@gjlay.de>:
> This adds two built-in functions that facilitate moving bits.
>
> The two built-ins work the same way; there is a 16-bit version and a 8-bit version.
>
> The first operand specifies a mapping to apply to the second operand:
> The n-th nibble of the mapping specifies the image of the n-th bit.
>
> Typical use case for these built-ins is adjusting input and output values to
> non-contiguous port layouts.
>
> The patch also introduces new %-codes to help printing operands for BLD and BST
> which is useful in other places, too.
>
> For example
>
> char reverse (char x)
> {
> Â Âreturn __builtin_avr_map8 (0x01234567, x);
> }
>
> leads to
>
> reverse:
> Â Â Â Âmov __tmp_reg__,r24
> Â Â Â Âinc __zero_reg__
> 0: Â Â Âror r0
> Â Â Â Ârol r24
> Â Â Â Âlsl __zero_reg__
> Â Â Â Âbrne 0b
> Â Â Â Âret
>
>
> Ok for trunk?
>
> Johann
>
> Â Â Â Â* doc/extend.texi (AVR Built-in Functions): Add documentation for
> Â Â Â Â__builtin_avr_map8 and __builtin_avr_map16.
>
> Â Â Â Â* config/avr/avr.md: Document new %t and %T asm output codes.
> Â Â Â Â(define_c_enum "unspec"): Add UNSPEC_MAP_BITS.
> Â Â Â Â(adjust_len): Add map_bits.
> Â Â Â Â(map_bitsqi, map_bitshi): New insns.
> Â Â Â Â* config/avr/avr-protos.h (avr_out_map_bits): New.
> Â Â Â Â* config/avr/avr.c (print_operand): Implement %t and %T.
> Â Â Â Â(adjust_insn_length): Handle ADJUST_LEN_MAP_BITS.
> Â Â Â Â(avr_double_int_push_digit): New function.
> Â Â Â Â(avr_map, avr_revert_map, avr_swap_map, avr_id_map): New functions.
> Â Â Â Â(avr_sig_map, avr_map_hamming_byte): New functions.
> Â Â Â Â(avr_out_swap_bits, avr_out_revert_bits, avr_move_bits,
> Â Â Â Âavr_out_map_bits): New functions.
> Â Â Â Â(enum avr_builtin_id): Add AVR_BUILTIN_MAP8, AVR_BUILTIN_MAP16.
> Â Â Â Â(avr_init_builtins): Populate __builtin_avr_map8, __builtin_avr_map16.
> Â Â Â Â(bdesc_2arg): Add __builtin_avr_map8, __builtin_avr_map16 ...
> Â Â Â Â(avr_expand_builtin): ...and expand them.
> Â Â Â Â* config/avr/avr-c.c (avr_cpu_cpp_builtins): New built-in defines:
> Â Â Â Â__BUILTIN_AVR_MAP8, __BUILTIN_AVR_MAP16.
>
>

Approved.

Denis.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]