[PATCH] D69979: clang: Guess at some platform FTZ/DAZ default settings

Matt Arsenault via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Nov 10 22:02:46 PST 2019


arsenm added a comment.

In D69979#1738099 <https://reviews.llvm.org/D69979#1738099>, @craig.topper wrote:

> I checked Redhat 7.4 that's on the server I'm using for work. And I had a coworker check his Ubuntu 18.04 system with this program. And both systems printed 1f80 as the value of MXCSR which shows FTZ and DAZ are both 0. Are you seeing something different?
>
>   #include <x86intrin.h>
>   #include <stdio.h>
>  
>   int main() {
>     int csr = _mm_getcsr();
>     printf("%x\n", csr);
>     return 0;
>   }
>


I see the value as 1f80. However the test program I wrote suggests the default is to flush (and what the comments in bug 34994 suggest?):

  In default FP mode
  neg_subnormal + neg_subnormal: -0x0p+0
  neg_subnormal + neg_zero: -0x0p+0
  sqrtf subnormal: 0x0p+0
  sqrtf neg_subnormal: -0x0p+0
  sqrtf neg_zero: -0x0p+0
  
  With denormals disabled
  neg_subnormal + neg_subnormal: -0x0p+0
  neg_subnormal + neg_zero: -0x0p+0
  sqrtf subnormal: 0x0p+0
  sqrtf neg_subnormal: -0x0p+0
  sqrtf neg_zero: -0x0p+0
  
  With denormals enabled
  neg_subnormal + neg_subnormal: -0x1p-126
  neg_subnormal + neg_zero: -0x1p-127
  sqrtf subnormal: 0x1.6a09e6p-64
  sqrtf neg_subnormal: -nan
  sqrtf neg_zero: -0x0p+0
  
  With daz only
  neg_subnormal + neg_subnormal: -0x0p+0
  neg_subnormal + neg_zero: -0x0p+0
  sqrtf subnormal: 0x0p+0
  sqrtf neg_subnormal: -0x0p+0
  sqrtf neg_zero: -0x0p+0
  
  With ftz only
  neg_subnormal + neg_subnormal: -0x1p-126
  neg_subnormal + neg_zero: -0x0p+0
  sqrtf subnormal: 0x1.6a09e6p-64
  sqrtf neg_subnormal: -nan
  sqrtf neg_zero: -0x0p+0


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69979/new/

https://reviews.llvm.org/D69979





More information about the cfe-commits mailing list