2017-07-14 18:16 GMT+04:00 Georg-Johann Lay <a...@gjlay.de>: > Hi, this patch restores some of the divmod handling. > > It addresses two issues: > > 1) rtx_costs might be called with code = LSHIFTRT for a mul_highpart. This > is the case when outer_code = TRUNCATE. This patch uses a new function to > compute the costs for that case (also used for code = TRUNCATE). > > 2) Due to PR81444, the middle-end is calling the cost functions with strange > RTXes like > > (truncate:HI (lshiftrt:PSI (mult:PSI (zero_extend:PSI (reg:TI 42)) > (zero_extend:PSI (reg:TI 42))) > (const_int 16 [0x10]))) > > i.e. completely messed up modes. The correct RTX would be > > (truncate:HI (lshiftrt:SI (mult:SI (zero_extend:SI (reg:HI 42)) > (zero_extend:SI (reg:HI 42))) > (const_int 16 [0x10]))) > > The is worked around by also considering PSImode in the cost computation. > > FYI, I am currently also just reg-testing a fix for PR81444, cf. > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81444#c1 > > Ok to apply the patch below (trunk and v7)? > > Johann > > PR 80929 > * config/avr/avr.c (avr_mul_highpart_cost): New static function. > (avr_rtx_costs_1) [TRUNCATE]: Use it to compute mul_highpart cost. > [LSHIFTRT, outer_code = TRUNCATE]: Same.
Approved. Please apply.