чт, 12 сент. 2024 г. в 17:32, Georg-Johann Lay <a...@gjlay.de>: > > This patch reworks avr_out_compare: > > Use new convenient helper functions that may be useful in > other output functions, too. > > Generalized some special cases that only work for EQ and NE > comparisons. For example, with the patch > > ;; R24:SI == -1 (unused after) > adiw r26,1 > sbci r25,hi8(-1) > sbci r24,lo8(-1) > > ;; R18:SI == -1 > cpi r18,-1 > cpc r19,r18 > cpc r20,r18 > cpc r21,r18 > > Without the patch, we had: > > ;; R24:SI == -1 (unused after) > cpi r24,-1 > sbci r25,-1 > sbci r26,-1 > sbci r27,-1 > > ;; R18:SI == -1 > cpi r18,-1 > ldi r24,-1 > cpc r19,r24 > cpc r20,r24 > cpc r21,r24 > > Ok for trunk?
Please, apply. Denis > > This patch requires "Tweak 32-bit comparisons". > > https://gcc.gnu.org/pipermail/gcc-patches/2024-September/662738.html > > Johann > > -- > > AVR: Rework avr_out_compare. > > 16-bit comparisons like R25:24 == -1 are currently performed like > cpi R24, -1 > cpc R25, R24 > Similar is possible for wider modes. ADIW can be used like SBIW when > the compare code is EQ or NE because such comparisons are just about > (propagating) the Z flag. The patch adds helper functions like avr_byte() > that may be useful in other functions than avr_out_compare(). > > gcc/ > * config/avr/avr.cc (avr_chunk, avr_byte, avr_word) > (avr_int8, avr_uint8, avr_int16): New helper functions. > (avr_out_compare): Overhaul.