[llvm] r220341 - Add minnum / maxnum intrinsics
Matt Arsenault
arsenm2 at gmail.com
Wed Oct 22 11:35:32 PDT 2014
> On Oct 22, 2014, at 6:19 AM, Pasi Parviainen <pasi.parviainen at iki.fi> wrote:
>
> On 22.10.2014 2:00, Matt Arsenault wrote:
>> Author: arsenm
>> Date: Tue Oct 21 18:00:20 2014
>> New Revision: 220341
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=220341&view=rev
>> Log:
>> Add minnum / maxnum intrinsics
>>
>> These are named following the IEEE-754 names for these
>> functions, rather than the libm fmin / fmax to avoid
>> possible ambiguities. Some languages may implement something
>> resembling fmin / fmax which return NaN if either operand is
>> to propagate errors. These implement the IEEE-754 semantics
>> of returning the other operand if either is a NaN representing
>> missing data.
>>
>> Added:
>> llvm/trunk/test/Transforms/InstCombine/maxnum.ll
>> llvm/trunk/test/Transforms/InstCombine/minnum.ll
>> Modified:
>> llvm/trunk/docs/LangRef.rst
>> llvm/trunk/include/llvm/IR/Intrinsics.td
>> llvm/trunk/include/llvm/IR/PatternMatch.h
>> llvm/trunk/include/llvm/Target/TargetSelectionDAG.td
>> llvm/trunk/include/llvm/Transforms/Utils/VectorUtils.h
>> llvm/trunk/lib/Analysis/ConstantFolding.cpp
>> llvm/trunk/lib/Analysis/TargetTransformInfo.cpp
>> llvm/trunk/lib/Analysis/ValueTracking.cpp
>> llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp
>> llvm/trunk/lib/Transforms/Vectorize/BBVectorize.cpp
>> llvm/trunk/test/Transforms/LoopVectorize/intrinsic.ll
>> llvm/trunk/test/Transforms/SimplifyCFG/speculate-math.ll
>>
>> Modified: llvm/trunk/docs/LangRef.rst
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.rst?rev=220341&r1=220340&r2=220341&view=diff
>> ==============================================================================
>> --- llvm/trunk/docs/LangRef.rst (original)
>> +++ llvm/trunk/docs/LangRef.rst Tue Oct 21 18:00:20 2014
>> @@ -8028,9 +8028,9 @@ all types however.
>>
>> declare float @llvm.fabs.f32(float %Val)
>> declare double @llvm.fabs.f64(double %Val)
>> - declare x86_fp80 @llvm.fabs.f80(x86_fp80 %Val)
>> + declare x86_fp80 @llvm.fabs.f80(x86_fp80 %Val)
>> declare fp128 @llvm.fabs.f128(fp128 %Val)
>> - declare ppc_fp128 @llvm.fabs.ppcf128(ppc_fp128 %Val)
>> + declare ppc_fp128 @llvm.fabs.ppcf128(ppc_fp128 %Val)
>>
>> Overview:
>> """""""""
>> @@ -8050,6 +8050,89 @@ Semantics:
>> This function returns the same values as the libm ``fabs`` functions
>> would, and handles error conditions in the same way.
>>
>> +'``llvm.minnum.*``' Intrinsic
>> +^^^^^^^^^^^^^^^^^^^^^^^^^^^
>> +
>> +Syntax:
>> +"""""""
>> +
>> +This is an overloaded intrinsic. You can use ``llvm.minnum`` on any
>> +floating point or vector of floating point type. Not all targets support
>> +all types however.
>> +
>> +::
>> +
>> + declare float @llvm.minnum.f32(float %Val)
>> + declare double @llvm.minnum.f64(double %Val)
>> + declare x86_fp80 @llvm.minnum.f80(x86_fp80 %Val)
>> + declare fp128 @llvm.minnum.f128(fp128 %Val)
>> + declare ppc_fp128 @llvm.minnum.ppcf128(ppc_fp128 %Val)
>> +
>> +Overview:
>> +"""""""""
>> +
>> +The '``llvm.minnum.*``' intrinsics return the minimum of the two
>> +arguments.
>> +
>
> Syntax section implies that intrinsic only takes one argument, but overview section is talking about two arguments.
Fixed in r220402
>
>> +
>> +Arguments:
>> +""""""""""
>> +
>> +The arguments and return value are floating point numbers of the same
>> +type.
>> +
>> +Semantics:
>> +""""""""""
>> +
>> +Follows the IEEE-754 semantics for minNum, which also match for libm's
>> +fmin.
>> +
>> +If either operand is a NaN, returns the other non-NaN operand. Returns
>> +NaN only if both operands are NaN. If the operands compare equal,
>> +returns a value that compares equal to both operands. This means that
>> +fmin(+/-0.0, +/-0.0) could return either -0.0 or 0.0.
>> +
>> +'``llvm.maxnum.*``' Intrinsic
>> +^^^^^^^^^^^^^^^^^^^^^^^^^^^
>> +
>> +Syntax:
>> +"""""""
>> +
>> +This is an overloaded intrinsic. You can use ``llvm.maxnum`` on any
>> +floating point or vector of floating point type. Not all targets support
>> +all types however.
>> +
>> +::
>> +
>> + declare float @llvm.maxnum.f32(float %Val)
>> + declare double @llvm.maxnum.f64(double %Val)
>> + declare x86_fp80 @llvm.maxnum.f80(x86_fp80 %Val)
>> + declare fp128 @llvm.maxnum.f128(fp128 %Val)
>> + declare ppc_fp128 @llvm.maxnum.ppcf128(ppc_fp128 %Val)
>> +
>> +Overview:
>> +"""""""""
>> +
>> +The '``llvm.maxnum.*``' intrinsics return the maximum of the two
>> +arguments.
>> +
>
> Same here.
>
> Pasi
>
>> +
>> +Arguments:
>> +""""""""""
>> +
>> +The arguments and return value are floating point numbers of the same
>> +type.
>> +
>> +Semantics:
>> +""""""""""
>> +Follows the IEEE-754 semantics for maxNum, which also match for libm's
>> +fmax.
>> +
>> +If either operand is a NaN, returns the other non-NaN operand. Returns
>> +NaN only if both operands are NaN. If the operands compare equal,
>> +returns a value that compares equal to both operands. This means that
>> +fmax(+/-0.0, +/-0.0) could return either -0.0 or 0.0.
>> +
>> '``llvm.copysign.*``' Intrinsic
>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>
>>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141022/71d4a0eb/attachment.html>
More information about the llvm-commits
mailing list