Yes. Since the MUL instructions are optional, I would rather follow the m68k example and declare a capability in cpuinfo.pas and check if this capability exists for the selected subarch. taddnode.use_mul_helper can be overridden to perform this check. See attached patch.
Note that the generated code does not check for overflow, this still needs to be implemented. Test example:
program test;
procedure vTaskDelay(xTicksToDelay: uint32); external;
var
a, b, c: uint32;
begin
for a := $FFFF to $7FFFFF do
for b := $FFF0 to $7FFFFF do
begin
c := a * b;
writeln(a, ' x ', b, ' = ', c);
vTaskDelay(100);
end;
repeat until false;
end.
# [12] c := a * b;
l32r a2,.Lj13
l32i a3,a2,0
l32r a2,.Lj14
l32i a2,a2,0
mull a2,a2,a3
l32r a3,.Lj15
s32i a2,a3,0
.Ll5:
And the output with overflow checking enabled:
65535 x 65535 = 4294836225
65535 x 65536 = 4294901760
65535 x 65537 = 4294967295
65535 x 65538 = 65534
65535 x 65539 = 131069
65535 x 65540 = 196604