identifying return type for llvm.umul.with.overflow.i32

Hi All,

For a piece of code I get ‘overflow’ intrinsic generated by clang.

//C++ code

jap = new just_another[i];

//clang generated code.
%1 = call { i32, i1 } @llvm.umul.with.overflow.i32(i32 %0, i32 28), !dbg !46

The ‘return type’ for this intrinsic is ‘{i32, i1}’. Unfortunately, the architecture description does not allow me to have a ‘such aggregate type’ as ‘return type’ for a function.

For ‘non-supported return types’, we return them as ‘indirect’, which results in generating this as a function argument. Such cases are handled in ABIInfo class, in overridden function ‘classifyReturnType()’.

I am not sure about handling such ‘return types’ for intrinsic call. What should be the classification of such return type ?

Thanks & Regards,

Pankaj

This intrinsic it intended to encapsulate a multiply operation that sets an overflow flag. Your back end should probably expand it with some custom logic. If you don't have such an instruction in your architecture, then you may either emulate it (e.g. by doing a 64-bit multiply and checking the high bits are non-zero), or (as a quick hack to get things basically working, not for production) use a normal multiply and always set the i1 to 0 (and generate incorrect results in cases where overflow does happen).

David