aboutsummaryrefslogtreecommitdiff
path: root/lib/Target/Sparc
diff options
context:
space:
mode:
authorJim Laskey <jlaskey@mac.com>2005-08-17 19:34:49 +0000
committerJim Laskey <jlaskey@mac.com>2005-08-17 19:34:49 +0000
commitcb6682fa44e13262bdef7dd22b4ba90f8c2e7b97 (patch)
tree7007ebf49e8bf80c2f04c0df03980f65ddd88077 /lib/Target/Sparc
parent8482dd894d7d64134f999d8e62bc9adf5cb239a9 (diff)
Culling out use of unions for converting FP to bits and vice versa.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22838 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/Sparc')
-rw-r--r--lib/Target/Sparc/SparcAsmPrinter.cpp16
1 files changed, 3 insertions, 13 deletions
diff --git a/lib/Target/Sparc/SparcAsmPrinter.cpp b/lib/Target/Sparc/SparcAsmPrinter.cpp
index c8852cca99..4e908a1b95 100644
--- a/lib/Target/Sparc/SparcAsmPrinter.cpp
+++ b/lib/Target/Sparc/SparcAsmPrinter.cpp
@@ -247,22 +247,12 @@ void V8Printer::emitGlobalConstant(const Constant *CV) {
switch (CFP->getType()->getTypeID()) {
default: assert(0 && "Unknown floating point type!");
case Type::FloatTyID: {
- union FU { // Abide by C TBAA rules
- float FVal;
- unsigned UVal;
- } U;
- U.FVal = Val;
- O << ".long\t" << U.UVal << "\t! float " << Val << "\n";
+ O << ".long\t" << FloatToBits(Val) << "\t! float " << Val << "\n";
return;
}
case Type::DoubleTyID: {
- union DU { // Abide by C TBAA rules
- double FVal;
- uint64_t UVal;
- } U;
- U.FVal = Val;
- O << ".word\t0x" << std::hex << (U.UVal >> 32) << std::dec << "\t! double " << Val << "\n";
- O << ".word\t0x" << std::hex << (U.UVal & 0xffffffffUL) << std::dec << "\t! double " << Val << "\n";
+ O << ".word\t0x" << std::hex << (DoubleToBits(Val) >> 32) << std::dec << "\t! double " << Val << "\n";
+ O << ".word\t0x" << std::hex << (DoubleToBits(Val) & 0xffffffffUL) << std::dec << "\t! double " << Val << "\n";
return;
}
}