From 852a20a2ec631fb2ecc42831a24874e31c600ae3 Mon Sep 17 00:00:00 2001
From: clc5q <clc5q@git.zephyr-software.com>
Date: Tue, 18 Mar 2014 22:50:46 +0000
Subject: [PATCH] Give operands of subword moves the MEDS type NUMERIC.

---
 SMPInstr.cpp | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/SMPInstr.cpp b/SMPInstr.cpp
index e7fdc011..7738f696 100644
--- a/SMPInstr.cpp
+++ b/SMPInstr.cpp
@@ -6561,6 +6561,16 @@ bool SMPInstr::InferOperatorType(SMPRegTransfer *CurrRT) {
 			}
 #endif
 			if ((UNINIT == RightType) && (UNINIT == LeftType)) {
+				unsigned short TempSignMask;
+				if (this->MDIsReducedWidthMove() && (!this->MDIsSignedLoad(TempSignMask))) {
+					CurrDef = this->SetDefType(DefOp, NUMERIC); // e.g. mov al,cl cannot be a POINTER
+					updated = true;
+					if (!CurrRT->HasRightSubTree()) {
+						CurrUse = this->SetUseType(UseOp, NUMERIC);
+					}
+					assert(UNINIT == OperType);
+					CurrRT->SetOperatorType(NUMERIC, this);
+				}
 				break;
 			}
 			else if (UNINIT == OperType) {
@@ -6583,6 +6593,7 @@ bool SMPInstr::InferOperatorType(SMPRegTransfer *CurrRT) {
 					CurrRT->SetOperatorType(LeftType, this);
 					updated = true;
 					UpdatedOperType = true;
+					OperType = LeftType;
 				}
 				// Speed up type propagation by passing the RightType/OperType to the Def
 				//  on this iteration.
@@ -6675,6 +6686,7 @@ bool SMPInstr::InferOperatorType(SMPRegTransfer *CurrRT) {
 					}
 					CurrUse = this->SetUseType(UseOp, OperType);
 					updated = true;
+					RightType = OperType;
 				}
 				break;
 			}
-- 
GitLab