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

Unified Diff: src/IceTargetLoweringX8632.cpp

Issue 1148023003: Subzero: Use setcc for most fcmp conditions, instead of control flow. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Add an assert Created 5 years, 7 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 | tests_lit/llvm2ice_tests/fp.pnacl.ll » ('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 478a6b6ba58deed4720fe2b88d4383dadf913951..0896c47521218182a6ba81bba2d0a7fecc849be0 100644
--- a/src/IceTargetLoweringX8632.cpp
+++ b/src/IceTargetLoweringX8632.cpp
@@ -2702,14 +2702,15 @@ void TargetX8632::lowerFcmp(const InstFcmp *Inst) {
// FakeUse(a) /* only if C1 != Br_None */
// mov a, !<default> /* only if C1 != Br_None */
// label: /* only if C1 != Br_None */
+ //
+ // setcc lowering when C1 != Br_None && C2 == Br_None:
+ // ucomiss b, c /* but swap b,c order if SwapOperands==true */
+ // setcc a, C1
InstFcmp::FCond Condition = Inst->getCondition();
size_t Index = static_cast<size_t>(Condition);
assert(Index < TableFcmpSize);
- if (TableFcmp[Index].SwapScalarOperands) {
- Operand *Tmp = Src0;
- Src0 = Src1;
- Src1 = Tmp;
- }
+ if (TableFcmp[Index].SwapScalarOperands)
+ std::swap(Src0, Src1);
bool HasC1 = (TableFcmp[Index].C1 != CondX86::Br_None);
bool HasC2 = (TableFcmp[Index].C2 != CondX86::Br_None);
if (HasC1) {
@@ -2718,6 +2719,11 @@ void TargetX8632::lowerFcmp(const InstFcmp *Inst) {
Variable *T = nullptr;
_mov(T, Src0);
_ucomiss(T, Src1RM);
+ if (!HasC2) {
+ assert(TableFcmp[Index].Default);
+ _setcc(Dest, TableFcmp[Index].C1);
+ return;
+ }
}
Constant *Default = Ctx->getConstantInt32(TableFcmp[Index].Default);
_mov(Dest, Default);
« no previous file with comments | « no previous file | tests_lit/llvm2ice_tests/fp.pnacl.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698