[llvm-commits] [llvm-gcc-4.2] r82640 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp

Dale Johannesen dalej at apple.com
Wed Sep 23 15:32:23 PDT 2009


On Sep 23, 2009, at 3:26 PMPDT, Dan Gohman wrote:

> Using an intrinsic to convey "this function need not set errno" seem
> like a very heavy-weight solution. Wouldn't it be better to make use
> of the "readonly" or "readnone" function attributes? A "sqrt" call
> with "readonly" can be known to not set errno.

As far as errno goes, I agree that would be better, but we'd also like  
to recognize it as sqrt for the purpose of generating sqrt  
instructions on appropriate hardware.   Without an intrinsic we'd need  
to do name lookup, I guess, which seems inappropriate for non-C-based  
languages.

> The intention of the "like the libm sqrt functions would" language was
> to support vector forms of these intrinsics, which should behave the
> same way as the scalar forms.
>
> Dan
>
> On Sep 23, 2009, at 2:18 PM, Dale Johannesen wrote:
>
>> While this is certainly necessary given the current IR definition,  
>> I'm
>> not too happy about it, as we will lose something because the
>> optimizers must consider that sqrt might set errno.  What I'd like to
>> do is redefine llvm.sqrt in the IR to mean "same behavior as sqrt
>> except that it doesn't set errno", and likewise for llvm.pow, etc.   
>> It
>> looks like that was the original intent, actually, but that's not  
>> what
>> it says.  Any objections?
>>
>> On Sep 23, 2009, at 11:50 AMPDT, Dale Johannesen wrote:
>>
>>> Author: johannes
>>> Date: Wed Sep 23 13:50:32 2009
>>> New Revision: 82640
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=82640&view=rev
>>> Log:
>>> The result of sqrt(negative) is implementation-defined, but follows
>>> IEEE754 in most current implementations. llvm.sqrt, which has
>>> undefined
>>> behavior for such inputs, is an inappropriate substitute which can
>>> change
>>> the result.
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>




More information about the llvm-commits mailing list