Thanks Roger. I tried it: it is the better spelling, but on arm it needs a cost of its own first, and I would rather not put that in this patch.
arm_rtx_costs has no SMUL_HIGHPART case, so the insn prices at one instruction where the truncate nest it replaces prices at six (4 against 24 in the combine dump for x / 7). The unsigned high part keeps the nest, since arm_rtx_costs_internal's TRUNCATE arm tests ASHIFTRT and every arm high-part pattern is written with LSHIFTRT. With the two spellings priced differently expand starts preferring the signed division algorithm for unsigned divisions: on a bcmrpi_defconfig ARMv6 kernel 63 of the 1697 UMULL sites became signed SMMUL sequences and .text moved from -96 bytes to +32. Giving SMUL_HIGHPART an extending-multiply price fixes the 1621-file torture corpus (-20 bytes at -mcpu=arm1176jzf-s, nothing grows) but not the kernel. So I would like to keep the truncate form here and do the rtx code in a follow-up that prices the high-part multiply for both signs. Does that seem reasonable? It also fixes PR target/49526, whose testcase is the mul_high function in smmul-1.c; I will add the PR to the ChangeLog when this is committed. Dominic
