summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Sanders <daniel.sanders@imgtec.com>2015-08-11 18:40:02 +0000
committerDaniel Sanders <daniel.sanders@imgtec.com>2015-08-11 18:40:02 +0000
commit1f4bd3dd89688ff740430d3daee2138e418280e9 (patch)
tree9333e74541a0d25d454fef7af21c2c328027cf58
parent0e58a9d82b06d6e3cf9762157981f3c824c60def (diff)
downloadbcm5719-llvm-1f4bd3dd89688ff740430d3daee2138e418280e9.tar.gz
bcm5719-llvm-1f4bd3dd89688ff740430d3daee2138e418280e9.zip
[ubsan][mips] Revise r243384 to avoid special casing big-endian mips.
Account for the case when uptr is 32-bit instead of trying to fix this case using the little endian path. llvm-svn: 244646
-rw-r--r--compiler-rt/lib/ubsan/ubsan_value.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/compiler-rt/lib/ubsan/ubsan_value.cc b/compiler-rt/lib/ubsan/ubsan_value.cc
index 4ae385faeb9..79dc4c8e827 100644
--- a/compiler-rt/lib/ubsan/ubsan_value.cc
+++ b/compiler-rt/lib/ubsan/ubsan_value.cc
@@ -83,10 +83,11 @@ FloatMax Value::getFloatValue() const {
#endif
case 32: {
float Value;
-#if defined(__BIG_ENDIAN__) && !defined(__mips__)
- // For big endian the float value is in the second 4 bytes
- // instead of the first 4 bytes.
- internal_memcpy(&Value, ((const char*)&Val)+4, 4);
+#if defined(__BIG_ENDIAN__)
+ // For big endian the float value is in the last 4 bytes.
+ // On some targets we may only have 4 bytes so we count backwards from
+ // the end of Val to account for both the 32-bit and 64-bit cases.
+ internal_memcpy(&Value, ((const char*)(&Val + 1)) - 4, 4);
#else
internal_memcpy(&Value, &Val, 4);
#endif
OpenPOWER on IntegriCloud