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

Unified Diff: src/IceTargetLoweringX86BaseImpl.h

Issue 1909853002: Subzero: Fix srem.i8/urem.i8 lowering for x86-64. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 4 years, 8 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/IceRegAlloc.cpp ('k') | tests_lit/llvm2ice_tests/8bit.pnacl.ll » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceTargetLoweringX86BaseImpl.h
diff --git a/src/IceTargetLoweringX86BaseImpl.h b/src/IceTargetLoweringX86BaseImpl.h
index 0907f874b6dc784d11ca10b81d1c5a5ab41520d1..4927e170598d69eded4aa851733b30ae89b114c8 100644
--- a/src/IceTargetLoweringX86BaseImpl.h
+++ b/src/IceTargetLoweringX86BaseImpl.h
@@ -2308,6 +2308,14 @@ void TargetX86Base<TraitsType>::lowerArithmetic(const InstArithmetic *Instr) {
_mov(T_edx, Ctx->getConstantZero(Ty));
_mov(T, Src0, Eax);
_div(T_edx, Src1, T);
+ if (Ty == IceType_i8) {
+ // Register ah must be moved into one of {al,bl,cl,dl} before it can be
+ // moved into a general 8-bit register.
+ auto *T_AhRcvr = makeReg(Ty);
+ T_AhRcvr->setRegClass(RCX86_IsAhRcvr);
+ _mov(T_AhRcvr, T_edx);
+ T_edx = T_AhRcvr;
+ }
_mov(Dest, T_edx);
} break;
case InstArithmetic::Srem: {
@@ -2377,6 +2385,14 @@ void TargetX86Base<TraitsType>::lowerArithmetic(const InstArithmetic *Instr) {
_mov(T, Src0, Eax);
_cbwdq(T_edx, T);
_idiv(T_edx, Src1, T);
+ if (Ty == IceType_i8) {
+ // Register ah must be moved into one of {al,bl,cl,dl} before it can be
+ // moved into a general 8-bit register.
+ auto *T_AhRcvr = makeReg(Ty);
+ T_AhRcvr->setRegClass(RCX86_IsAhRcvr);
+ _mov(T_AhRcvr, T_edx);
+ T_edx = T_AhRcvr;
+ }
_mov(Dest, T_edx);
} break;
case InstArithmetic::Fadd:
« no previous file with comments | « src/IceRegAlloc.cpp ('k') | tests_lit/llvm2ice_tests/8bit.pnacl.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698