[Mesa-dev] [RFC PATCH] mesa: Replace _mesa_round_to_even() with roundeven().

Ilia Mirkin imirkin at alum.mit.edu
Wed Mar 11 16:12:34 PDT 2015


On Wed, Mar 11, 2015 at 7:06 PM, Matt Turner <mattst88 at gmail.com> wrote:
> On Wed, Mar 11, 2015 at 4:04 PM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
>> On Wed, Mar 11, 2015 at 6:51 PM, Matt Turner <mattst88 at gmail.com> wrote:
>>> On Wed, Mar 11, 2015 at 3:13 PM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
>>>> On Wed, Mar 11, 2015 at 6:09 PM, Matt Turner <mattst88 at gmail.com> wrote:
>>>>> glibc uses roundsd/roundss in rint/f guarded by a runtime check. The
>>>>> SSE code here just allows those instructions to be inlined.
>>>>
>>>> OK, as long as glibc would end up using the same rounding mode settings,
>>>>
>>>> Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>
>>>
>>> Okay, so slight difference. It doesn't use the same rounding mode
>>> settings, since rint() rounds in the current rounding direction it
>>> uses rounds* with imm8=0x4 (current rounding direction) whereas we're
>>> using rounds* with imm8=0x8 (round to nearest). We're assuming the
>>> current rounding mode is to nearest, since that's the default and if
>>> it weren't other things would go badly.
>>>
>>> I don't know if your R-b stands in that case?
>>
>> Is it possible to determine the current rounding format in a
>> moderately cheap manner? If so, it may be nice to stick that into an
>> assert.
>
> The difficulty is that MSVC (surprise! surprise!) doesn't support
> fegetround()/fesetround().
>
> Otherwise, yes.

Good enough for an assert... I don't particularly care about MSVC :)


More information about the mesa-dev mailing list