ppc: [liftoff] implement fp copysign

Change-Id: Ic1fb152ced8535982f4e918df691e5c6e4cfaa68
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3063506
Reviewed-by: Milad Fa <mfarazma@redhat.com>
Commit-Queue: Junliang Yan <junyan@redhat.com>
Cr-Commit-Position: refs/heads/master@{#76025}
This commit is contained in:
Junliang Yan 2021-07-30 12:31:53 -04:00 committed by V8 LUCI CQ
parent 74bdb34967
commit 121df413a3
5 changed files with 105 additions and 82 deletions

View File

@ -1620,6 +1620,12 @@ void Assembler::fmul(const DoubleRegister frt, const DoubleRegister fra,
rc);
}
void Assembler::fcpsgn(const DoubleRegister frt, const DoubleRegister fra,
const DoubleRegister frc, RCBit rc) {
emit(EXT4 | FCPSGN | frt.code() * B21 | fra.code() * B16 | frc.code() * B6 |
rc);
}
void Assembler::fdiv(const DoubleRegister frt, const DoubleRegister fra,
const DoubleRegister frb, RCBit rc) {
a_form(EXT4 | FDIV, frt, fra, frb, rc);

View File

@ -1055,6 +1055,8 @@ class Assembler : public AssemblerBase {
void fmsub(const DoubleRegister frt, const DoubleRegister fra,
const DoubleRegister frc, const DoubleRegister frb,
RCBit rc = LeaveRC);
void fcpsgn(const DoubleRegister frt, const DoubleRegister fra,
const DoubleRegister frc, RCBit rc = LeaveRC);
// Vector instructions
void mfvsrd(const Register ra, const Simd128Register r);

View File

@ -1302,6 +1302,10 @@ void Decoder::DecodeExt4(Instruction* instr) {
Format(instr, "fneg'. 'Dt, 'Db");
break;
}
case FCPSGN: {
Format(instr, "fcpsgn'. 'Dt, 'Da, 'Db");
break;
}
case MCRFS: {
Format(instr, "mcrfs ?,?");
break;

View File

@ -3677,6 +3677,16 @@ void Simulator::ExecuteGeneric(Instruction* instr) {
set_d_register_from_double(frt, frt_val);
return;
}
case FCPSGN: {
int frt = instr->RTValue();
int frb = instr->RBValue();
int fra = instr->RAValue();
double frb_val = get_double_from_d_register(frb);
double fra_val = get_double_from_d_register(fra);
double frt_val = std::copysign(fra_val, frb_val);
set_d_register_from_double(frt, frt_val);
return;
}
case FMR: {
int frt = instr->RTValue();
int frb = instr->RBValue();

View File

@ -784,9 +784,6 @@ void LiftoffAssembler::FillStackSlotsWithZero(int start, int size) {
bailout(kUnsupportedArchitecture, "i64 shiftop: " #name); \
}
UNIMPLEMENTED_FP_BINOP(f32_copysign)
UNIMPLEMENTED_FP_BINOP(f64_copysign)
#undef UNIMPLEMENTED_I32_BINOP
#undef UNIMPLEMENTED_I32_BINOP_I
#undef UNIMPLEMENTED_I64_BINOP
@ -868,6 +865,10 @@ UNOP_LIST(EMIT_UNOP_FUNCTION)
// V(name, instr, dtype, stype1, stype2, dcast, scast1, scast2, rcast,
// return_val, return_type)
#define BINOP_LIST(V) \
V(f32_copysign, fcpsgn, DoubleRegister, DoubleRegister, DoubleRegister, , , \
, ROUND_F64_TO_F32, , void) \
V(f64_copysign, fcpsgn, DoubleRegister, DoubleRegister, DoubleRegister, , , \
, USE, , void) \
V(f32_min, MinF64, DoubleRegister, DoubleRegister, DoubleRegister, , , , \
USE, , void) \
V(f32_max, MaxF64, DoubleRegister, DoubleRegister, DoubleRegister, , , , \