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

Unified Diff: src/IceTargetLoweringX8632.cpp

Issue 647223004: emitIAS for movsx and movzx. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: rebase Created 6 years, 2 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 | « src/IceInstX8632.cpp ('k') | src/assembler_ia32.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceTargetLoweringX8632.cpp
diff --git a/src/IceTargetLoweringX8632.cpp b/src/IceTargetLoweringX8632.cpp
index dfb1fdad838bbb69b04783ac87273b3612ff8589..403d8d1e3b1597f12a0578d03bdf62b596d85dc1 100644
--- a/src/IceTargetLoweringX8632.cpp
+++ b/src/IceTargetLoweringX8632.cpp
@@ -2018,8 +2018,16 @@ void TargetX8632::lowerCast(const InstCast *Inst) {
} else if (Src0RM->getType() == IceType_i1) {
// t = Src0RM; t &= 1; Dest = t
Constant *One = Ctx->getConstantInt32(IceType_i32, 1);
- Variable *T = makeReg(IceType_i32);
- _movzx(T, Src0RM);
+ Type DestTy = Dest->getType();
+ Variable *T;
+ if (DestTy == IceType_i8) {
+ T = makeReg(DestTy);
+ _mov(T, Src0RM);
+ } else {
+ // Use 32-bit for both 16-bit and 32-bit, since 32-bit ops are shorter.
+ T = makeReg(IceType_i32);
+ _movzx(T, Src0RM);
+ }
_and(T, One);
_mov(Dest, T);
} else {
« no previous file with comments | « src/IceInstX8632.cpp ('k') | src/assembler_ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698