Commit 253f4004 authored by Tobias Tebbi's avatar Tobias Tebbi Committed by V8 LUCI CQ

[turboshaft] add support for missing Float64 unary operations

Bug: v8:12783, chromium:1364943
Change-Id: Ia972708e0679cf68e32d8e3c2cf103ab11aac2b8
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3899087Reviewed-by: 's avatarDarius Mercadier <dmercadier@chromium.org>
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Auto-Submit: Tobias Tebbi <tebbi@chromium.org>
Commit-Queue: Darius Mercadier <dmercadier@chromium.org>
Cr-Commit-Position: refs/heads/main@{#83298}
parent 6b8e0b33
...@@ -334,6 +334,18 @@ class AssemblerInterface : public Superclass { ...@@ -334,6 +334,18 @@ class AssemblerInterface : public Superclass {
FloatRepresentation::Float64()) FloatRepresentation::Float64())
DECL_SINGLE_REP_UNARY(Float64Tanh, FloatUnary, Tanh, DECL_SINGLE_REP_UNARY(Float64Tanh, FloatUnary, Tanh,
FloatRepresentation::Float64()) FloatRepresentation::Float64())
DECL_SINGLE_REP_UNARY(Float64Log2, FloatUnary, Log2,
FloatRepresentation::Float64())
DECL_SINGLE_REP_UNARY(Float64Log10, FloatUnary, Log10,
FloatRepresentation::Float64())
DECL_SINGLE_REP_UNARY(Float64Log1p, FloatUnary, Log1p,
FloatRepresentation::Float64())
DECL_SINGLE_REP_UNARY(Float64Atan, FloatUnary, Atan,
FloatRepresentation::Float64())
DECL_SINGLE_REP_UNARY(Float64Atanh, FloatUnary, Atanh,
FloatRepresentation::Float64())
DECL_SINGLE_REP_UNARY(Float64Cbrt, FloatUnary, Cbrt,
FloatRepresentation::Float64())
DECL_MULTI_REP_UNARY(WordReverseBytes, WordUnary, WordRepresentation, DECL_MULTI_REP_UNARY(WordReverseBytes, WordUnary, WordRepresentation,
ReverseBytes) ReverseBytes)
......
...@@ -460,6 +460,12 @@ OpIndex GraphBuilder::Process( ...@@ -460,6 +460,12 @@ OpIndex GraphBuilder::Process(
UNARY_CASE(Float64Acosh, Float64Acosh) UNARY_CASE(Float64Acosh, Float64Acosh)
UNARY_CASE(Float64Tan, Float64Tan) UNARY_CASE(Float64Tan, Float64Tan)
UNARY_CASE(Float64Tanh, Float64Tanh) UNARY_CASE(Float64Tanh, Float64Tanh)
UNARY_CASE(Float64Log2, Float64Log2)
UNARY_CASE(Float64Log10, Float64Log10)
UNARY_CASE(Float64Log1p, Float64Log1p)
UNARY_CASE(Float64Atan, Float64Atan)
UNARY_CASE(Float64Atanh, Float64Atanh)
UNARY_CASE(Float64Cbrt, Float64Cbrt)
#undef UNARY_CASE #undef UNARY_CASE
#define CHANGE_CASE(opcode, kind, from, to) \ #define CHANGE_CASE(opcode, kind, from, to) \
......
...@@ -70,8 +70,16 @@ std::ostream& operator<<(std::ostream& os, FloatUnaryOp::Kind kind) { ...@@ -70,8 +70,16 @@ std::ostream& operator<<(std::ostream& os, FloatUnaryOp::Kind kind) {
return os << "RoundTiesEven"; return os << "RoundTiesEven";
case FloatUnaryOp::Kind::kLog: case FloatUnaryOp::Kind::kLog:
return os << "Log"; return os << "Log";
case FloatUnaryOp::Kind::kLog2:
return os << "Log2";
case FloatUnaryOp::Kind::kLog10:
return os << "Log10";
case FloatUnaryOp::Kind::kLog1p:
return os << "Log1p";
case FloatUnaryOp::Kind::kSqrt: case FloatUnaryOp::Kind::kSqrt:
return os << "Sqrt"; return os << "Sqrt";
case FloatUnaryOp::Kind::kCbrt:
return os << "Cbrt";
case FloatUnaryOp::Kind::kExp: case FloatUnaryOp::Kind::kExp:
return os << "Exp"; return os << "Exp";
case FloatUnaryOp::Kind::kExpm1: case FloatUnaryOp::Kind::kExpm1:
...@@ -96,6 +104,10 @@ std::ostream& operator<<(std::ostream& os, FloatUnaryOp::Kind kind) { ...@@ -96,6 +104,10 @@ std::ostream& operator<<(std::ostream& os, FloatUnaryOp::Kind kind) {
return os << "Tan"; return os << "Tan";
case FloatUnaryOp::Kind::kTanh: case FloatUnaryOp::Kind::kTanh:
return os << "Tanh"; return os << "Tanh";
case FloatUnaryOp::Kind::kAtan:
return os << "Atan";
case FloatUnaryOp::Kind::kAtanh:
return os << "Atanh";
} }
} }
......
...@@ -744,7 +744,11 @@ struct FloatUnaryOp : FixedArityOperationT<1, FloatUnaryOp> { ...@@ -744,7 +744,11 @@ struct FloatUnaryOp : FixedArityOperationT<1, FloatUnaryOp> {
kRoundToZero, // round towards 0 kRoundToZero, // round towards 0
kRoundTiesEven, // break ties by rounding towards the next even number kRoundTiesEven, // break ties by rounding towards the next even number
kLog, kLog,
kLog2,
kLog10,
kLog1p,
kSqrt, kSqrt,
kCbrt,
kExp, kExp,
kExpm1, kExpm1,
kSin, kSin,
...@@ -757,6 +761,8 @@ struct FloatUnaryOp : FixedArityOperationT<1, FloatUnaryOp> { ...@@ -757,6 +761,8 @@ struct FloatUnaryOp : FixedArityOperationT<1, FloatUnaryOp> {
kAcosh, kAcosh,
kTan, kTan,
kTanh, kTanh,
kAtan,
kAtanh,
}; };
Kind kind; Kind kind;
FloatRepresentation rep; FloatRepresentation rep;
......
...@@ -453,6 +453,30 @@ Node* ScheduleBuilder::ProcessOperation(const FloatUnaryOp& op) { ...@@ -453,6 +453,30 @@ Node* ScheduleBuilder::ProcessOperation(const FloatUnaryOp& op) {
DCHECK_EQ(op.rep, FloatRepresentation::Float64()); DCHECK_EQ(op.rep, FloatRepresentation::Float64());
o = machine.Float64Tanh(); o = machine.Float64Tanh();
break; break;
case FloatUnaryOp::Kind::kLog2:
DCHECK_EQ(op.rep, FloatRepresentation::Float64());
o = machine.Float64Log2();
break;
case FloatUnaryOp::Kind::kLog10:
DCHECK_EQ(op.rep, FloatRepresentation::Float64());
o = machine.Float64Log10();
break;
case FloatUnaryOp::Kind::kLog1p:
DCHECK_EQ(op.rep, FloatRepresentation::Float64());
o = machine.Float64Log1p();
break;
case FloatUnaryOp::Kind::kAtan:
DCHECK_EQ(op.rep, FloatRepresentation::Float64());
o = machine.Float64Atan();
break;
case FloatUnaryOp::Kind::kAtanh:
DCHECK_EQ(op.rep, FloatRepresentation::Float64());
o = machine.Float64Atanh();
break;
case FloatUnaryOp::Kind::kCbrt:
DCHECK_EQ(op.rep, FloatRepresentation::Float64());
o = machine.Float64Cbrt();
break;
} }
return AddNode(o, {GetNode(op.input())}); return AddNode(o, {GetNode(op.input())});
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment