[cfe-dev] identifying return type for llvm.umul.with.overflow.i32

David Chisnall David.Chisnall at cl.cam.ac.uk
Tue Apr 9 05:54:19 PDT 2013


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

On 9 Apr 2013, at 13:24, Pankaj Gode <godepankaj at yahoo.com> wrote:

> 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 <myarch>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
> 
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev





More information about the cfe-dev mailing list