Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(702)

Unified Diff: src/PNaClTranslator.cpp

Issue 848473002: Add instruction alignment tests to unit tests. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Reconcile with LLVM changes. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | unittest/IceParseInstsTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/PNaClTranslator.cpp
diff --git a/src/PNaClTranslator.cpp b/src/PNaClTranslator.cpp
index 482844f56412748855ad9f4ca8a7d08765fffe37..beb4e22922f56d7001f6622b8887ed8cc5406925 100644
--- a/src/PNaClTranslator.cpp
+++ b/src/PNaClTranslator.cpp
@@ -1174,18 +1174,18 @@ private:
}
// Extracts the corresponding Alignment to use, given the AlignPower
- // (i.e. 2**AlignPower, or 0 if AlignPower == 0). InstName is the
+ // (i.e. 2**(AlignPower-1), or 0 if AlignPower == 0). InstName is the
// name of the instruction the alignment appears in.
void extractAlignment(const char *InstName, uint32_t AlignPower,
uint32_t &Alignment) {
- if (AlignPower <= AlignPowerLimit) {
+ if (AlignPower <= AlignPowerLimit + 1) {
Alignment = (1 << AlignPower) >> 1;
return;
}
std::string Buffer;
raw_string_ostream StrBuf(Buffer);
StrBuf << InstName << " alignment greater than 2**" << AlignPowerLimit
- << ". Found: 2**" << AlignPower;
+ << ". Found: 2**" << (AlignPower - 1);
Error(StrBuf.str());
// Error recover with value that is always acceptable.
Alignment = 1;
« no previous file with comments | « no previous file | unittest/IceParseInstsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698