On Wed, 2024-04-10 at 16:25 +0200, Stefan Franke wrote: > > Thank you for the detailed explanation. > It still doesn't fit together, since if the compiler knows that it's unsigned, why does it emit code for sign extension on the m68k target? > > Well. Since there are enough explanations and my expectations are simply wrong consider this as closed. > > By the way, on targets that can do widening multiplication the sign extensions are omitted. E.g. on SH -- https://godbolt.org/z/7hr4njEx8 _foo: mulu.w r4,r5 sts macl,r1 sts macl,r0 shll r1 rts subc r1,r1 Best regards, Oleg Endo