diff options
author | Dale Johannesen <dalej@apple.com> | 2009-01-21 20:32:55 +0000 |
---|---|---|
committer | Dale Johannesen <dalej@apple.com> | 2009-01-21 20:32:55 +0000 |
commit | c6858814e070857f406f20d3fd92240c1326948d (patch) | |
tree | c375538be19d22248ae0381a2ad38889c37fee8d /include/llvm/Support/MathExtras.h | |
parent | 5b51c24091f65512746abd7b99d3adcf8e5a4255 (diff) | |
download | external_llvm-c6858814e070857f406f20d3fd92240c1326948d.zip external_llvm-c6858814e070857f406f20d3fd92240c1326948d.tar.gz external_llvm-c6858814e070857f406f20d3fd92240c1326948d.tar.bz2 |
Do not use host floating point types when emitting
ASCII IR; loading and storing these can change the
bits of NaNs on some hosts. Remove or add warnings
at a few other places using host floating point;
this is a bad thing to do in general.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62712 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Support/MathExtras.h')
-rw-r--r-- | include/llvm/Support/MathExtras.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/include/llvm/Support/MathExtras.h b/include/llvm/Support/MathExtras.h index 8a89d85..d55fb80 100644 --- a/include/llvm/Support/MathExtras.h +++ b/include/llvm/Support/MathExtras.h @@ -361,7 +361,9 @@ inline float BitsToFloat(uint32_t Bits) { } /// DoubleToBits - This function takes a double and returns the bit -/// equivalent 64-bit integer. +/// equivalent 64-bit integer. Note that copying doubles around +/// changes the bits of NaNs on some hosts, notably x86, so this +/// routine cannot be used if these bits are needed. inline uint64_t DoubleToBits(double Double) { union { uint64_t L; @@ -372,7 +374,9 @@ inline uint64_t DoubleToBits(double Double) { } /// FloatToBits - This function takes a float and returns the bit -/// equivalent 32-bit integer. +/// equivalent 32-bit integer. Note that copying floats around +/// changes the bits of NaNs on some hosts, notably x86, so this +/// routine cannot be used if these bits are needed. inline uint32_t FloatToBits(float Float) { union { uint32_t I; |