Chromium Code Reviews| Index: src/IceInstARM32.cpp |
| diff --git a/src/IceInstARM32.cpp b/src/IceInstARM32.cpp |
| index 075dd4d2c84e1eca9a24b6d6e6901be937feea1d..5a17abe101b46d0aef0fea61449ee6e46aad3cc9 100644 |
| --- a/src/IceInstARM32.cpp |
| +++ b/src/IceInstARM32.cpp |
| @@ -347,7 +347,7 @@ bool OperandARM32FlexFpImm::canHoldImm(Operand *C, uint32_t *ModifiedImm) { |
| static_assert(AllowedBits == 0xFFF80000u, |
| "Invalid mask for f32 modified immediates."); |
| const float F32 = llvm::cast<ConstantFloat>(C)->getValue(); |
| - const uint32_t I32 = *reinterpret_cast<const uint32_t *>(&F32); |
| + const uint32_t I32 = bit_copy<uint32_t>(F32); |
|
John
2016/01/12 18:09:07
this method (bit_copy) is "poorly" named. I though
Jim Stichnoth
2016/01/13 19:30:33
Done.
|
| if (I32 & ~AllowedBits) { |
| // constant has disallowed bits. |
| return false; |
| @@ -376,7 +376,7 @@ bool OperandARM32FlexFpImm::canHoldImm(Operand *C, uint32_t *ModifiedImm) { |
| static_assert(AllowedBits == 0xFFFF0000u, |
| "Invalid mask for f64 modified immediates."); |
| const double F64 = llvm::cast<ConstantDouble>(C)->getValue(); |
| - const uint64_t I64 = *reinterpret_cast<const uint64_t *>(&F64); |
| + const uint64_t I64 = bit_copy<uint64_t>(F64); |
| if (I64 & 0xFFFFFFFFu) { |
| // constant has disallowed bits. |
| return false; |
| @@ -2100,7 +2100,7 @@ float materializeFloatImmediate(uint32_t ModifiedImm) { |
| const uint32_t Ret = ((ModifiedImm & a) ? 0x80000000 : 0) | |
| ((ModifiedImm & b) ? 0x3E000000 : 0x40000000) | |
| ((ModifiedImm & cdefgh) << 19); |
| - return *reinterpret_cast<const float *>(&Ret); |
| + return bit_copy<float>(Ret); |
| } |
| } // end of anonymous namespace |