diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-11-23 21:31:31 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-11-23 21:31:31 -0800 |
commit | 4ff5b9b84573e764bf5fa7e815e2950baf5de4bd (patch) | |
tree | fdf3acc27657992d413996ea36c4149dbc342cce /lib/Target/CppBackend/CPPBackend.cpp | |
parent | 4a051cb4ea767d49e690136fc4ec8ffe648d7c8c (diff) |
handle all unaligned double stores
Diffstat (limited to 'lib/Target/CppBackend/CPPBackend.cpp')
-rw-r--r-- | lib/Target/CppBackend/CPPBackend.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/lib/Target/CppBackend/CPPBackend.cpp b/lib/Target/CppBackend/CPPBackend.cpp index 47bda5e676..f1ec13cff7 100644 --- a/lib/Target/CppBackend/CPPBackend.cpp +++ b/lib/Target/CppBackend/CPPBackend.cpp @@ -1506,9 +1506,29 @@ std::string CppWriter::generateInstruction(const Instruction *I) { std::string PS = getOpName(P); switch (Bytes) { case 8: { + text = "HEAPF64[tempDoublePtr>>3]=" + VS + ';'; switch (Alignment) { case 4: { - text = "HEAPF64[tempDoublePtr>>3]=" + VS + ";HEAP32[" + PS + ">>2]=HEAP32[tempDoublePtr>>2];HEAP32[" + PS + "+4>>2]=HEAP32[tempDoublePtr+4>>2];"; + text = "HEAP32[" + PS + ">>2]=HEAP32[tempDoublePtr>>2];" + + "HEAP32[" + PS + "+4>>2]=HEAP32[tempDoublePtr+4>>2];"; + break; + } + case 2: { + text = "HEAP16[" + PS + ">>1]=HEAP32[tempDoublePtr>>1];" + + "HEAP16[" + PS + "+2>>1]=HEAP32[tempDoublePtr+2>>1];" + + "HEAP16[" + PS + "+4>>1]=HEAP32[tempDoublePtr+4>>1];" + + "HEAP16[" + PS + "+6>>1]=HEAP32[tempDoublePtr+6>>1];"; + break; + } + case 1: { + text = "HEAP8[" + PS + "]=HEAP32[tempDoublePtr];" + + "HEAP8[" + PS + "+1]=HEAP32[tempDoublePtr+1];" + + "HEAP8[" + PS + "+2]=HEAP32[tempDoublePtr+2];" + + "HEAP8[" + PS + "+3]=HEAP32[tempDoublePtr+3];" + + "HEAP8[" + PS + "+4]=HEAP32[tempDoublePtr+4];" + + "HEAP8[" + PS + "+5]=HEAP32[tempDoublePtr+5];" + + "HEAP8[" + PS + "+6]=HEAP32[tempDoublePtr+6];" + + "HEAP8[" + PS + "+7]=HEAP32[tempDoublePtr+7];"; break; } default: assert(0 && "bad 8 store"); |