This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Include SSE state in i386 fenv_t (bug 16064)
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: "Joseph S. Myers" <joseph at codesourcery dot com>
- Cc: GNU C Library <libc-alpha at sourceware dot org>
- Date: Fri, 9 May 2014 08:02:17 -0700
- Subject: Re: Include SSE state in i386 fenv_t (bug 16064)
- Authentication-results: sourceware.org; auth=none
- References: <Pine dot LNX dot 4 dot 64 dot 1405082300140 dot 12485 at digraph dot polyomino dot org dot uk> <CAMe9rOo6x37VNp161KzF1pTEMFs++uEVgHfO=+8O9wdmg6sHTg at mail dot gmail dot com> <Pine dot LNX dot 4 dot 64 dot 1405091210550 dot 8692 at digraph dot polyomino dot org dot uk>
On Fri, May 9, 2014 at 5:17 AM, Joseph S. Myers <joseph@codesourcery.com> wrote:
> On Thu, 8 May 2014, H.J. Lu wrote:
>
>> > @@ -63,7 +66,7 @@ __fesetenv (const fenv_t *envp)
>> > & (FE_ALL_EXCEPT | FE_TOWARDZERO));
>> > temp.__status_word &= ~FE_ALL_EXCEPT;
>> > temp.__status_word |= envp->__status_word & FE_ALL_EXCEPT;
>> > - temp.__eip = envp->__eip;
>> > + temp.__eip = 0;
>> > temp.__cs_selector = envp->__cs_selector;
>> > temp.__opcode = envp->__opcode;
>>
>> Should we also set __cs_selector/__opcode/__data_offset/__data_selector
>> to 0?
>
> Not as part of this patch (the change there was simply to avoid setting
> __eip to a value that now represents MXCSR and so is completely logically
> unrelated to __eip).
>
> I don't think any of those fields you list are particularly meaningfully
> part of the C floating-point environment, so they could reasonably all be
> set to 0 - but any such change should be done in sync for the i386 and
> x86_64 implementations. The point of this patch is to fix an actual bug,
> visible to ordinary C code, arising from a case where the i386
> implementation misses functionality present in the x86_64 version.
>
There are 4 unused short int fields in fenv_t. Can we use 2 of them
for mxcsr instead of re-using __eip?
--
H.J.