From owner-svn-src-all@freebsd.org Thu Oct 15 07:20:48 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 516F2A15AF4; Thu, 15 Oct 2015 07:20:48 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EB9AB196D; Thu, 15 Oct 2015 07:20:47 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id t9F7KdRB037426 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Thu, 15 Oct 2015 10:20:40 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua t9F7KdRB037426 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id t9F7KdjB037425; Thu, 15 Oct 2015 10:20:39 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 15 Oct 2015 10:20:39 +0300 From: Konstantin Belousov To: Garrett Cooper Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r289332 - head/tools/regression/lib/msun Message-ID: <20151015072039.GY2257@kib.kiev.ua> References: <201510142022.t9EKMC1C088993@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201510142022.t9EKMC1C088993@repo.freebsd.org> User-Agent: Mutt/1.5.24 (2015-08-30) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Oct 2015 07:20:48 -0000 On Wed, Oct 14, 2015 at 08:22:12PM +0000, Garrett Cooper wrote: > Author: ngie > Date: Wed Oct 14 20:22:12 2015 > New Revision: 289332 > URL: https://svnweb.freebsd.org/changeset/base/289332 > > Log: > Fix test-fenv:test_dfl_env when run on some amd64 CPUs > > Compare the fields that the AMD [1] and Intel [2] specs say will be > set once fnstenv returns. > > Not all amd64 capable processors zero out the env.__x87.__other field > (example: AMD Opteron 6308). The AMD64/x64 specs aren't explicit on what the > env.__x87.__other field will contain after fnstenv is executed, so the values > in env.__x87.__other could be filled with arbitrary data depending on how the > CPU-specific implementation of fnstenv. No Intel or AMD CPU write to __other field at all. > > 1. http://support.amd.com/TechDocs/26569_APM_v5.pdf > 2. http://www.intel.com/Assets/en_US/PDF/manual/253666.pdf > > Discussed with: kib, Anton Rang > Reviewed by: Daniel O'Connor (earlier patch; pre-generalization) > MFC after: 1 week > Sponsored by: EMC / Isilon Storage Division > Reported by: Bill Morchin > > Modified: > head/tools/regression/lib/msun/test-fenv.c > > Modified: head/tools/regression/lib/msun/test-fenv.c > ============================================================================== > --- head/tools/regression/lib/msun/test-fenv.c Wed Oct 14 19:30:04 2015 (r289331) > +++ head/tools/regression/lib/msun/test-fenv.c Wed Oct 14 20:22:12 2015 (r289332) > @@ -133,8 +133,35 @@ test_dfl_env(void) > fenv_t env; > > fegetenv(&env); > + > +#ifdef __amd64__ > + /* > + * Compare the fields that the AMD [1] and Intel [2] specs say will be > + * set once fnstenv returns. > + * > + * Not all amd64 capable processors implement the fnstenv instruction > + * by zero'ing out the env.__x87.__other field (example: AMD Opteron > + * 6308). The AMD64/x64 specs aren't explicit on what the > + * env.__x87.__other field will contain after fnstenv is executed, so > + * the values in env.__x87.__other could be filled with arbitrary > + * data depending on how the CPU implements fnstenv. > + * > + * 1. http://support.amd.com/TechDocs/26569_APM_v5.pdf > + * 2. http://www.intel.com/Assets/en_US/PDF/manual/253666.pdf > + */ > + assert(memcmp(&env.__mxcsr, &FE_DFL_ENV->__mxcsr, > + sizeof(env.__mxcsr)) == 0); > + assert(memcmp(&env.__x87.__control, &FE_DFL_ENV->__x87.__control, > + sizeof(env.__x87.__control)) == 0); > + assert(memcmp(&env.__x87.__status, &FE_DFL_ENV->__x87.__status, > + sizeof(env.__x87.__status)) == 0); > + assert(memcmp(&env.__x87.__tag, &FE_DFL_ENV->__x87.__tag, > + sizeof(env.__x87.__tag)) == 0); > +#else > assert(memcmp(&env, FE_DFL_ENV, sizeof(env)) == 0); > #endif > + > +#endif > assert(fetestexcept(FE_ALL_EXCEPT) == 0); > } >