On Apr 8, 2009, at 12:43 AM, Duncan Sands wrote:> Hi Micah, > >> There seems to be some math library functions that are already built >> into llvm as intrinsic(pow, exp, etc...) but there are lots that >> are not >> built in yet. Is there currently work going on that is implementing >> these? I do not want to duplicate work so I want to see what is out >> there. > > another approach is to get rid of the llvm intrinsics, because they > don't buy you anything that you can't get with function attributes > and a list of libcalls.FWIW, the reason pow, exp, and others were added as intrinsics was to allow them to be overloaded with vector types, and to allow them to be legalized (split, scalarized, etc.). Dan
Villmow, Micah
2009-Apr-14 15:39 UTC
[LLVMdev] Math Library Intrinsics as native intrinsics
Dan, I have a large list of functions(60+) that I want to be legalized. I have currently been adding them in the same manner as pow/exp etc... These functions come in both scalar and vector versions of up to 16 elements as the 1.0 spec requires. Is this something that I could Merge back into the tree or is another approach required? Some of the thoughts we were having as not to clutter the llvm namespace was to add a math namespace and the intrinsic would go there instead. i.e. llvm.math.fpow, llvm.math.fpowi, llvm.math.fpowr, etc... Any ideas? Thanks, Micah -----Original Message----- From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of Dan Gohman Sent: Monday, April 13, 2009 6:30 PM To: LLVM Developers Mailing List Subject: Re: [LLVMdev] Math Library Intrinsics as native intrinsics On Apr 8, 2009, at 12:43 AM, Duncan Sands wrote:> Hi Micah, > >> There seems to be some math library functions that are already built >> into llvm as intrinsic(pow, exp, etc...) but there are lots that >> are not >> built in yet. Is there currently work going on that is implementing >> these? I do not want to duplicate work so I want to see what is out >> there. > > another approach is to get rid of the llvm intrinsics, because they > don't buy you anything that you can't get with function attributes > and a list of libcalls.FWIW, the reason pow, exp, and others were added as intrinsics was to allow them to be overloaded with vector types, and to allow them to be legalized (split, scalarized, etc.). Dan _______________________________________________ LLVM Developers mailing list LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
There's at least one other LLVM user which would find these useful, and probably more, so it may be appropriate to merge this into the main tree. I'm interested to hear if anyone else has an opinion here. An llvm.math namespace seems like a good idea. Instead of using "fpow" though, I'd prefer to just use names like "pow". For consistency, the ISD namespace operators could be renamed to MATH_POW and similar. The text in LangRef.html that describes the semantics of llvm.pow needs improvement. Here's an attempt at an improved description of error handling for LLVM intrinsic math functions: The @llvm.math intrinsics use floating-point exceptions according to IEEE rules for the corresponding math functions. LLVM IR does not currently define the initial state of the floating-point status or control flags, or an interface for querying or setting them. The value of errno after a call to an @llvm.math intrinsic is undefined. What do you think? Dan On Apr 14, 2009, at 8:39 AM, Villmow, Micah wrote:> Dan, > I have a large list of functions(60+) that I want to be legalized. I > have currently been adding them in the same manner as pow/exp etc... > These functions come in both scalar and vector versions of up to 16 > elements as the 1.0 spec requires. Is this something that I could > Merge back into the tree or is another approach required? > Some of the thoughts we were having as not to clutter the llvm > namespace > was to add a math namespace and the intrinsic would go there instead. > i.e. llvm.math.fpow, llvm.math.fpowi, llvm.math.fpowr, etc... > > Any ideas? > > Thanks, > Micah > > -----Original Message----- > From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] > On Behalf Of Dan Gohman > Sent: Monday, April 13, 2009 6:30 PM > To: LLVM Developers Mailing List > Subject: Re: [LLVMdev] Math Library Intrinsics as native intrinsics > > > On Apr 8, 2009, at 12:43 AM, Duncan Sands wrote: > >> Hi Micah, >> >>> There seems to be some math library functions that are already built >>> into llvm as intrinsic(pow, exp, etc...) but there are lots that >>> are not >>> built in yet. Is there currently work going on that is implementing >>> these? I do not want to duplicate work so I want to see what is out >>> there. >> >> another approach is to get rid of the llvm intrinsics, because they >> don't buy you anything that you can't get with function attributes >> and a list of libcalls. > > FWIW, the reason pow, exp, and others were added as intrinsics was to > allow them to be overloaded with vector types, and to allow them > to be legalized (split, scalarized, etc.). > > Dan > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Apparently Analagous Threads
- [LLVMdev] Math Library Intrinsics as native intrinsics
- [LLVMdev] Math Library Intrinsics as native intrinsics
- [LLVMdev] Math Library Intrinsics as native intrinsics
- [LLVMdev] Math Library Intrinsics as native intrinsics
- [LLVMdev] [NVPTX] We need an LLVM CUDA math library, after all