[LLVMdev] max/min intrinsics
Tim Northover
t.p.northover at gmail.com
Wed Dec 5 13:16:22 PST 2012
Hi,
>> Along these lines, AArch64 has an instruction "FMAXNM". It returns the
>> maximum if neither value is NaN, but returns the number if just one
>> value is NaN. This is in addition to an "FMAX" which propagates NaNs.
>>
>> I suspect you'll just want to consider this as an "oh yes, make sure
>> that the result is NaN if either input is" advisory notice, but I
>> haven't actually thought through the details of implementation yet.
>
> Given the recent fast-math flags commit, what about the inverse? ("I
> guarantee that inputs are not NaNs")
It's certainly a point to consider in general, but I don't think it
would help in our case. I've not looked at the instruction timings for
any of our CPUs, but I can't imagine FMAXNM being any different from
FMAX. If that's right, it doesn't matter whether NaNs are present
computationally; it becomes a question of what semantics you actually
want.
Tim.
More information about the llvm-dev
mailing list