Skip to content

Commit d7b81b5

Browse files
mhdawsonMyles Borins
authored andcommitted
deps: cherry-pick 2e4da65 from v8's 4.8 upstream
Float v8 patch, which has been committed to v8 master and backported to 4.8 and 4.9 in google repos, onto 4.8 v8 in deps to resolve #5089 Original title/commit from google repos for 4.8 is: PPC: [turbofan] Support for CPU models lacking isel. v8/v8@2e4da65 PR-URL: #5293 Fixes: #5089 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: jbergstroem - Johan Bergström <bugs@bergstroem.nu>
1 parent 70c872c commit d7b81b5

File tree

1 file changed

+31
-31
lines changed

1 file changed

+31
-31
lines changed

deps/v8/src/compiler/ppc/code-generator-ppc.cc

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1198,8 +1198,8 @@ void CodeGenerator::AssembleArchBoolean(Instruction* instr,
11981198
PPCOperandConverter i(this, instr);
11991199
Label done;
12001200
ArchOpcode op = instr->arch_opcode();
1201-
bool check_unordered = (op == kPPC_CmpDouble);
12021201
CRegister cr = cr0;
1202+
int reg_value = -1;
12031203

12041204
// Overflow checked for add/sub only.
12051205
DCHECK((condition != kOverflow && condition != kNotOverflow) ||
@@ -1211,44 +1211,44 @@ void CodeGenerator::AssembleArchBoolean(Instruction* instr,
12111211
Register reg = i.OutputRegister(instr->OutputCount() - 1);
12121212

12131213
Condition cond = FlagsConditionToCondition(condition);
1214-
switch (cond) {
1215-
case eq:
1216-
case lt:
1214+
if (op == kPPC_CmpDouble) {
1215+
// check for unordered if necessary
1216+
if (cond == le) {
1217+
reg_value = 0;
12171218
__ li(reg, Operand::Zero());
1218-
__ li(kScratchReg, Operand(1));
1219-
__ isel(cond, reg, kScratchReg, reg, cr);
1220-
break;
1221-
case ne:
1222-
case ge:
1219+
__ bunordered(&done, cr);
1220+
} else if (cond == gt) {
1221+
reg_value = 1;
12231222
__ li(reg, Operand(1));
1224-
__ isel(NegateCondition(cond), reg, r0, reg, cr);
1225-
break;
1226-
case gt:
1227-
if (check_unordered) {
1228-
__ li(reg, Operand(1));
1223+
__ bunordered(&done, cr);
1224+
}
1225+
// Unnecessary for eq/lt & ne/ge since only FU bit will be set.
1226+
}
1227+
1228+
if (CpuFeatures::IsSupported(ISELECT)) {
1229+
switch (cond) {
1230+
case eq:
1231+
case lt:
1232+
case gt:
1233+
if (reg_value != 1) __ li(reg, Operand(1));
12291234
__ li(kScratchReg, Operand::Zero());
1230-
__ bunordered(&done, cr);
12311235
__ isel(cond, reg, reg, kScratchReg, cr);
1232-
} else {
1233-
__ li(reg, Operand::Zero());
1234-
__ li(kScratchReg, Operand(1));
1235-
__ isel(cond, reg, kScratchReg, reg, cr);
1236-
}
1237-
break;
1238-
case le:
1239-
if (check_unordered) {
1240-
__ li(reg, Operand::Zero());
1241-
__ li(kScratchReg, Operand(1));
1242-
__ bunordered(&done, cr);
1243-
__ isel(NegateCondition(cond), reg, r0, kScratchReg, cr);
1244-
} else {
1245-
__ li(reg, Operand(1));
1236+
break;
1237+
case ne:
1238+
case ge:
1239+
case le:
1240+
if (reg_value != 1) __ li(reg, Operand(1));
1241+
// r0 implies logical zero in this form
12461242
__ isel(NegateCondition(cond), reg, r0, reg, cr);
1247-
}
1248-
break;
1243+
break;
12491244
default:
12501245
UNREACHABLE();
12511246
break;
1247+
}
1248+
} else {
1249+
if (reg_value != 0) __ li(reg, Operand::Zero());
1250+
__ b(NegateCondition(cond), &done, cr);
1251+
__ li(reg, Operand(1));
12521252
}
12531253
__ bind(&done);
12541254
}

0 commit comments

Comments
 (0)