forked from suyu/suyu
glasm: Properly clamp Fp64 on GLASM
This commit is contained in:
parent
deda89372f
commit
3f00a2ad3f
1 changed files with 6 additions and 6 deletions
|
@ -36,11 +36,11 @@ void Compare(EmitContext& ctx, IR::Inst& inst, InputType lhs, InputType rhs, std
|
||||||
|
|
||||||
template <typename InputType>
|
template <typename InputType>
|
||||||
void Clamp(EmitContext& ctx, Register ret, InputType value, InputType min_value,
|
void Clamp(EmitContext& ctx, Register ret, InputType value, InputType min_value,
|
||||||
InputType max_value) {
|
InputType max_value, std::string_view type) {
|
||||||
// Call MAX first to properly clamp nan to min_value instead
|
// Call MAX first to properly clamp nan to min_value instead
|
||||||
ctx.Add("MAX.F {}.x,{},{};"
|
ctx.Add("MAX.{} {}.x,{},{};"
|
||||||
"MIN.F {}.x,{},{};",
|
"MIN.{} {}.x,{}.x,{};",
|
||||||
ret, min_value, value, ret, ret, max_value);
|
type, ret, min_value, value, type, ret, ret, max_value);
|
||||||
}
|
}
|
||||||
} // Anonymous namespace
|
} // Anonymous namespace
|
||||||
|
|
||||||
|
@ -180,12 +180,12 @@ void EmitFPClamp16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register
|
||||||
|
|
||||||
void EmitFPClamp32(EmitContext& ctx, IR::Inst& inst, ScalarF32 value, ScalarF32 min_value,
|
void EmitFPClamp32(EmitContext& ctx, IR::Inst& inst, ScalarF32 value, ScalarF32 min_value,
|
||||||
ScalarF32 max_value) {
|
ScalarF32 max_value) {
|
||||||
Clamp(ctx, ctx.reg_alloc.Define(inst), value, min_value, max_value);
|
Clamp(ctx, ctx.reg_alloc.Define(inst), value, min_value, max_value, "F");
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmitFPClamp64(EmitContext& ctx, IR::Inst& inst, ScalarF64 value, ScalarF64 min_value,
|
void EmitFPClamp64(EmitContext& ctx, IR::Inst& inst, ScalarF64 value, ScalarF64 min_value,
|
||||||
ScalarF64 max_value) {
|
ScalarF64 max_value) {
|
||||||
Clamp(ctx, ctx.reg_alloc.LongDefine(inst), value, min_value, max_value);
|
Clamp(ctx, ctx.reg_alloc.LongDefine(inst), value, min_value, max_value, "F64");
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmitFPRoundEven16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register value) {
|
void EmitFPRoundEven16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] Register value) {
|
||||||
|
|
Loading…
Reference in a new issue