[Sparc] Implement writeNopData. Emit actual NOP instruction instead of just filling with zeroes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202572 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Venkatraman Govindaraju 2014-03-01 05:45:09 +00:00
parent e0c7e3d139
commit 5ddaa6dcf4
2 changed files with 19 additions and 3 deletions

View File

@ -200,9 +200,14 @@ namespace {
} }
bool writeNopData(uint64_t Count, MCObjectWriter *OW) const { bool writeNopData(uint64_t Count, MCObjectWriter *OW) const {
// FIXME: Zero fill for now. // Cannot emit NOP with size not multiple of 32 bits.
for (uint64_t i = 0; i != Count; ++i) if (Count % 4 != 0)
OW->Write8(0); return false;
uint64_t NumNops = Count / 4;
for (uint64_t i = 0; i != NumNops; ++i)
OW->Write32(0x01000000);
return true; return true;
} }

View File

@ -0,0 +1,11 @@
! RUN: llvm-mc %s -arch=sparc -filetype=obj | llvm-readobj -s -sd | FileCheck %s
! RUN: llvm-mc %s -arch=sparcv9 -filetype=obj | llvm-readobj -s -sd | FileCheck %s
! CHECK: 0000: BA1F401D 01000000 01000000 01000000
! CHECK: 0010: BA1F401D
foo:
xor %i5, %i5, %i5
.align 16
xor %i5, %i5, %i5