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:
parent
74bdb34967
commit
121df413a3
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
|
@ -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
|
||||
@ -867,85 +864,89 @@ 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_min, MinF64, DoubleRegister, DoubleRegister, DoubleRegister, , , , \
|
||||
USE, , void) \
|
||||
V(f32_max, MaxF64, DoubleRegister, DoubleRegister, DoubleRegister, , , , \
|
||||
USE, , void) \
|
||||
V(f64_min, MinF64, DoubleRegister, DoubleRegister, DoubleRegister, , , , \
|
||||
USE, , void) \
|
||||
V(f64_max, MaxF64, DoubleRegister, DoubleRegister, DoubleRegister, , , , \
|
||||
USE, , void) \
|
||||
V(i64_sub, SubS64, LiftoffRegister, LiftoffRegister, LiftoffRegister, \
|
||||
LFR_TO_REG, LFR_TO_REG, LFR_TO_REG, USE, , void) \
|
||||
V(i64_add, AddS64, LiftoffRegister, LiftoffRegister, LiftoffRegister, \
|
||||
LFR_TO_REG, LFR_TO_REG, LFR_TO_REG, USE, , void) \
|
||||
V(i64_addi, AddS64, LiftoffRegister, LiftoffRegister, int64_t, LFR_TO_REG, \
|
||||
LFR_TO_REG, Operand, USE, , void) \
|
||||
V(i32_sub, SubS32, Register, Register, Register, , , , USE, , void) \
|
||||
V(i32_add, AddS32, Register, Register, Register, , , , USE, , void) \
|
||||
V(i32_addi, AddS32, Register, Register, int32_t, , , Operand, USE, , void) \
|
||||
V(i32_subi, SubS32, Register, Register, int32_t, , , Operand, USE, , void) \
|
||||
V(i32_mul, MulS32, Register, Register, Register, , , , USE, , void) \
|
||||
V(i64_mul, MulS64, LiftoffRegister, LiftoffRegister, LiftoffRegister, \
|
||||
LFR_TO_REG, LFR_TO_REG, LFR_TO_REG, USE, , void) \
|
||||
V(i32_andi, AndU32, Register, Register, int32_t, , , Operand, USE, , void) \
|
||||
V(i32_ori, OrU32, Register, Register, int32_t, , , Operand, USE, , void) \
|
||||
V(i32_xori, XorU32, Register, Register, int32_t, , , Operand, USE, , void) \
|
||||
V(i32_and, AndU32, Register, Register, Register, , , , USE, , void) \
|
||||
V(i32_or, OrU32, Register, Register, Register, , , , USE, , void) \
|
||||
V(i32_xor, XorU32, Register, Register, Register, , , , USE, , void) \
|
||||
V(i64_and, AndU64, LiftoffRegister, LiftoffRegister, LiftoffRegister, \
|
||||
LFR_TO_REG, LFR_TO_REG, LFR_TO_REG, USE, , void) \
|
||||
V(i64_or, OrU64, LiftoffRegister, LiftoffRegister, LiftoffRegister, \
|
||||
LFR_TO_REG, LFR_TO_REG, LFR_TO_REG, USE, , void) \
|
||||
V(i64_xor, XorU64, LiftoffRegister, LiftoffRegister, LiftoffRegister, \
|
||||
LFR_TO_REG, LFR_TO_REG, LFR_TO_REG, USE, , void) \
|
||||
V(i64_andi, AndU64, LiftoffRegister, LiftoffRegister, int32_t, LFR_TO_REG, \
|
||||
LFR_TO_REG, Operand, USE, , void) \
|
||||
V(i64_ori, OrU64, LiftoffRegister, LiftoffRegister, int32_t, LFR_TO_REG, \
|
||||
LFR_TO_REG, Operand, USE, , void) \
|
||||
V(i64_xori, XorU64, LiftoffRegister, LiftoffRegister, int32_t, LFR_TO_REG, \
|
||||
LFR_TO_REG, Operand, USE, , void) \
|
||||
V(i32_shli, ShiftLeftU32, Register, Register, int32_t, , , \
|
||||
INT32_AND_WITH_1F, USE, , void) \
|
||||
V(i32_sari, ShiftRightS32, Register, Register, int32_t, , , \
|
||||
INT32_AND_WITH_1F, USE, , void) \
|
||||
V(i32_shri, ShiftRightU32, Register, Register, int32_t, , , \
|
||||
INT32_AND_WITH_1F, USE, , void) \
|
||||
V(i32_shl, ShiftLeftU32, Register, Register, Register, , , \
|
||||
REGISTER_AND_WITH_1F, USE, , void) \
|
||||
V(i32_sar, ShiftRightS32, Register, Register, Register, , , \
|
||||
REGISTER_AND_WITH_1F, USE, , void) \
|
||||
V(i32_shr, ShiftRightU32, Register, Register, Register, , , \
|
||||
REGISTER_AND_WITH_1F, USE, , void) \
|
||||
V(i64_shl, ShiftLeftU64, LiftoffRegister, LiftoffRegister, Register, \
|
||||
LFR_TO_REG, LFR_TO_REG, , USE, , void) \
|
||||
V(i64_sar, ShiftRightS64, LiftoffRegister, LiftoffRegister, Register, \
|
||||
LFR_TO_REG, LFR_TO_REG, , USE, , void) \
|
||||
V(i64_shr, ShiftRightU64, LiftoffRegister, LiftoffRegister, Register, \
|
||||
LFR_TO_REG, LFR_TO_REG, , USE, , void) \
|
||||
V(i64_shli, ShiftLeftU64, LiftoffRegister, LiftoffRegister, int32_t, \
|
||||
LFR_TO_REG, LFR_TO_REG, Operand, USE, , void) \
|
||||
V(i64_sari, ShiftRightS64, LiftoffRegister, LiftoffRegister, int32_t, \
|
||||
LFR_TO_REG, LFR_TO_REG, Operand, USE, , void) \
|
||||
V(i64_shri, ShiftRightU64, LiftoffRegister, LiftoffRegister, int32_t, \
|
||||
LFR_TO_REG, LFR_TO_REG, Operand, USE, , void) \
|
||||
V(f64_add, AddF64, DoubleRegister, DoubleRegister, DoubleRegister, , , , \
|
||||
USE, , void) \
|
||||
V(f64_sub, SubF64, DoubleRegister, DoubleRegister, DoubleRegister, , , , \
|
||||
USE, , void) \
|
||||
V(f64_mul, MulF64, DoubleRegister, DoubleRegister, DoubleRegister, , , , \
|
||||
USE, , void) \
|
||||
V(f64_div, DivF64, DoubleRegister, DoubleRegister, DoubleRegister, , , , \
|
||||
USE, , void) \
|
||||
V(f32_add, AddF32, DoubleRegister, DoubleRegister, DoubleRegister, , , , \
|
||||
USE, , void) \
|
||||
V(f32_sub, SubF32, DoubleRegister, DoubleRegister, DoubleRegister, , , , \
|
||||
USE, , void) \
|
||||
V(f32_mul, MulF32, DoubleRegister, DoubleRegister, DoubleRegister, , , , \
|
||||
USE, , void) \
|
||||
V(f32_div, DivF32, DoubleRegister, DoubleRegister, DoubleRegister, , , , \
|
||||
#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, , , , \
|
||||
USE, , void) \
|
||||
V(f64_min, MinF64, DoubleRegister, DoubleRegister, DoubleRegister, , , , \
|
||||
USE, , void) \
|
||||
V(f64_max, MaxF64, DoubleRegister, DoubleRegister, DoubleRegister, , , , \
|
||||
USE, , void) \
|
||||
V(i64_sub, SubS64, LiftoffRegister, LiftoffRegister, LiftoffRegister, \
|
||||
LFR_TO_REG, LFR_TO_REG, LFR_TO_REG, USE, , void) \
|
||||
V(i64_add, AddS64, LiftoffRegister, LiftoffRegister, LiftoffRegister, \
|
||||
LFR_TO_REG, LFR_TO_REG, LFR_TO_REG, USE, , void) \
|
||||
V(i64_addi, AddS64, LiftoffRegister, LiftoffRegister, int64_t, LFR_TO_REG, \
|
||||
LFR_TO_REG, Operand, USE, , void) \
|
||||
V(i32_sub, SubS32, Register, Register, Register, , , , USE, , void) \
|
||||
V(i32_add, AddS32, Register, Register, Register, , , , USE, , void) \
|
||||
V(i32_addi, AddS32, Register, Register, int32_t, , , Operand, USE, , void) \
|
||||
V(i32_subi, SubS32, Register, Register, int32_t, , , Operand, USE, , void) \
|
||||
V(i32_mul, MulS32, Register, Register, Register, , , , USE, , void) \
|
||||
V(i64_mul, MulS64, LiftoffRegister, LiftoffRegister, LiftoffRegister, \
|
||||
LFR_TO_REG, LFR_TO_REG, LFR_TO_REG, USE, , void) \
|
||||
V(i32_andi, AndU32, Register, Register, int32_t, , , Operand, USE, , void) \
|
||||
V(i32_ori, OrU32, Register, Register, int32_t, , , Operand, USE, , void) \
|
||||
V(i32_xori, XorU32, Register, Register, int32_t, , , Operand, USE, , void) \
|
||||
V(i32_and, AndU32, Register, Register, Register, , , , USE, , void) \
|
||||
V(i32_or, OrU32, Register, Register, Register, , , , USE, , void) \
|
||||
V(i32_xor, XorU32, Register, Register, Register, , , , USE, , void) \
|
||||
V(i64_and, AndU64, LiftoffRegister, LiftoffRegister, LiftoffRegister, \
|
||||
LFR_TO_REG, LFR_TO_REG, LFR_TO_REG, USE, , void) \
|
||||
V(i64_or, OrU64, LiftoffRegister, LiftoffRegister, LiftoffRegister, \
|
||||
LFR_TO_REG, LFR_TO_REG, LFR_TO_REG, USE, , void) \
|
||||
V(i64_xor, XorU64, LiftoffRegister, LiftoffRegister, LiftoffRegister, \
|
||||
LFR_TO_REG, LFR_TO_REG, LFR_TO_REG, USE, , void) \
|
||||
V(i64_andi, AndU64, LiftoffRegister, LiftoffRegister, int32_t, LFR_TO_REG, \
|
||||
LFR_TO_REG, Operand, USE, , void) \
|
||||
V(i64_ori, OrU64, LiftoffRegister, LiftoffRegister, int32_t, LFR_TO_REG, \
|
||||
LFR_TO_REG, Operand, USE, , void) \
|
||||
V(i64_xori, XorU64, LiftoffRegister, LiftoffRegister, int32_t, LFR_TO_REG, \
|
||||
LFR_TO_REG, Operand, USE, , void) \
|
||||
V(i32_shli, ShiftLeftU32, Register, Register, int32_t, , , \
|
||||
INT32_AND_WITH_1F, USE, , void) \
|
||||
V(i32_sari, ShiftRightS32, Register, Register, int32_t, , , \
|
||||
INT32_AND_WITH_1F, USE, , void) \
|
||||
V(i32_shri, ShiftRightU32, Register, Register, int32_t, , , \
|
||||
INT32_AND_WITH_1F, USE, , void) \
|
||||
V(i32_shl, ShiftLeftU32, Register, Register, Register, , , \
|
||||
REGISTER_AND_WITH_1F, USE, , void) \
|
||||
V(i32_sar, ShiftRightS32, Register, Register, Register, , , \
|
||||
REGISTER_AND_WITH_1F, USE, , void) \
|
||||
V(i32_shr, ShiftRightU32, Register, Register, Register, , , \
|
||||
REGISTER_AND_WITH_1F, USE, , void) \
|
||||
V(i64_shl, ShiftLeftU64, LiftoffRegister, LiftoffRegister, Register, \
|
||||
LFR_TO_REG, LFR_TO_REG, , USE, , void) \
|
||||
V(i64_sar, ShiftRightS64, LiftoffRegister, LiftoffRegister, Register, \
|
||||
LFR_TO_REG, LFR_TO_REG, , USE, , void) \
|
||||
V(i64_shr, ShiftRightU64, LiftoffRegister, LiftoffRegister, Register, \
|
||||
LFR_TO_REG, LFR_TO_REG, , USE, , void) \
|
||||
V(i64_shli, ShiftLeftU64, LiftoffRegister, LiftoffRegister, int32_t, \
|
||||
LFR_TO_REG, LFR_TO_REG, Operand, USE, , void) \
|
||||
V(i64_sari, ShiftRightS64, LiftoffRegister, LiftoffRegister, int32_t, \
|
||||
LFR_TO_REG, LFR_TO_REG, Operand, USE, , void) \
|
||||
V(i64_shri, ShiftRightU64, LiftoffRegister, LiftoffRegister, int32_t, \
|
||||
LFR_TO_REG, LFR_TO_REG, Operand, USE, , void) \
|
||||
V(f64_add, AddF64, DoubleRegister, DoubleRegister, DoubleRegister, , , , \
|
||||
USE, , void) \
|
||||
V(f64_sub, SubF64, DoubleRegister, DoubleRegister, DoubleRegister, , , , \
|
||||
USE, , void) \
|
||||
V(f64_mul, MulF64, DoubleRegister, DoubleRegister, DoubleRegister, , , , \
|
||||
USE, , void) \
|
||||
V(f64_div, DivF64, DoubleRegister, DoubleRegister, DoubleRegister, , , , \
|
||||
USE, , void) \
|
||||
V(f32_add, AddF32, DoubleRegister, DoubleRegister, DoubleRegister, , , , \
|
||||
USE, , void) \
|
||||
V(f32_sub, SubF32, DoubleRegister, DoubleRegister, DoubleRegister, , , , \
|
||||
USE, , void) \
|
||||
V(f32_mul, MulF32, DoubleRegister, DoubleRegister, DoubleRegister, , , , \
|
||||
USE, , void) \
|
||||
V(f32_div, DivF32, DoubleRegister, DoubleRegister, DoubleRegister, , , , \
|
||||
USE, , void)
|
||||
|
||||
#define EMIT_BINOP_FUNCTION(name, instr, dtype, stype1, stype2, dcast, scast1, \
|
||||
|
Loading…
Reference in New Issue
Block a user