fix alignment

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32337 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola 2006-12-07 22:38:06 +00:00
parent 555d8d6f4b
commit 1c411dee4f
3 changed files with 16 additions and 4 deletions

View File

@ -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()) {

12
test/CodeGen/ARM/align.ll Normal file
View File

@ -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

View File

@ -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