diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2006-12-07 22:38:06 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2006-12-07 22:38:06 +0000 |
commit | 1c411dee4f406e33d70666898f62ab9ba23bb73d (patch) | |
tree | 4948c0cb7be4c6c37671fb48ded96b553e251885 | |
parent | 555d8d6f4b0693309cd70efbf51b7abf804df5e4 (diff) | |
download | external_llvm-1c411dee4f406e33d70666898f62ab9ba23bb73d.zip external_llvm-1c411dee4f406e33d70666898f62ab9ba23bb73d.tar.gz external_llvm-1c411dee4f406e33d70666898f62ab9ba23bb73d.tar.bz2 |
fix alignment
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32337 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Target/ARM/ARMAsmPrinter.cpp | 6 | ||||
-rw-r--r-- | test/CodeGen/ARM/align.ll | 12 | ||||
-rw-r--r-- | test/CodeGen/ARM/constants.ll | 2 |
3 files changed, 16 insertions, 4 deletions
diff --git a/lib/Target/ARM/ARMAsmPrinter.cpp b/lib/Target/ARM/ARMAsmPrinter.cpp index e57a768..a00e361 100644 --- a/lib/Target/ARM/ARMAsmPrinter.cpp +++ b/lib/Target/ARM/ARMAsmPrinter.cpp @@ -292,7 +292,7 @@ bool ARMAsmPrinter::doFinalization(Module &M) { std::string name = Mang->getValueName(I); Constant *C = I->getInitializer(); unsigned Size = TD->getTypeSize(C->getType()); - unsigned Align = TD->getTypeAlignment(C->getType()); + unsigned Align = Log2_32(TD->getTypeAlignment(C->getType())); if (C->isNullValue() && !I->hasSection() && @@ -302,8 +302,8 @@ bool ARMAsmPrinter::doFinalization(Module &M) { if (I->hasInternalLinkage()) O << "\t.local " << name << "\n"; - O << "\t.comm " << name << "," << TD->getTypeSize(C->getType()) - << "," << (unsigned)TD->getTypeAlignment(C->getType()); + O << "\t.comm " << name << "," << Size + << "," << (unsigned)Align; O << "\n"; } else { switch (I->getLinkage()) { diff --git a/test/CodeGen/ARM/align.ll b/test/CodeGen/ARM/align.ll new file mode 100644 index 0000000..bad7c6b --- /dev/null +++ b/test/CodeGen/ARM/align.ll @@ -0,0 +1,12 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep align.*1 | wc | grep 1 && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep align.*2 | wc | grep 2 && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep align.*3 | wc | grep 2 + +%a = global bool true +%b = global sbyte 1 +%c = global short 2 +%d = global int 3 +%e = global long 4 +%f = global float 5.0 +%g = global double 6.0 diff --git a/test/CodeGen/ARM/constants.ll b/test/CodeGen/ARM/constants.ll index 0d69f53..21ff390 100644 --- a/test/CodeGen/ARM/constants.ll +++ b/test/CodeGen/ARM/constants.ll @@ -5,7 +5,7 @@ ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep ".word.*257" | wc -l | grep 1 && ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "mov r0, #-1073741761" | wc -l | grep 1 && ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "mov r0, #1008" | wc -l | grep 1 && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "\.comm.*a,4,4" | wc -l | grep 1 +; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "\.comm.*a,4,2" | wc -l | grep 1 %a = internal global int 0 |