Revert "writer/hlsl: Special case negative zero"

This reverts commit 26b6edc545.

Reason for revert: Seems to be breaking Dawn's tests. Investigation required.

Original change's description:
> writer/hlsl: Special case negative zero
>
> Fixed: tint:960
> Change-Id: I060bc6b7a9ad4d21dd5cadb4b68998c7e54ebaed
> Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/57142
> Kokoro: Kokoro <noreply+kokoro@google.com>
> Commit-Queue: Ben Clayton <bclayton@google.com>
> Auto-Submit: Ben Clayton <bclayton@google.com>
> Reviewed-by: James Price <jrprice@google.com>

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: Ia0b0ec996f2ed6b1599a344c970f155c12314ea9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/57460
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
This commit is contained in:
Ben Clayton
2021-07-08 16:49:33 +00:00
committed by Tint LUCI CQ
parent af89c729ed
commit 5d922d02fc
11 changed files with 7 additions and 147 deletions

View File

@@ -2475,20 +2475,13 @@ bool GeneratorImpl::EmitLiteral(std::ostream& out, ast::Literal* lit) {
if (auto* l = lit->As<ast::BoolLiteral>()) {
out << (l->IsTrue() ? "true" : "false");
} else if (auto* fl = lit->As<ast::FloatLiteral>()) {
bool positive = std::signbit(fl->value()) == 0;
switch (std::fpclassify(fl->value())) {
case FP_INFINITE:
out << (positive ? "asfloat(0x7f800000u)" : "asfloat(0xff800000u)");
break;
case FP_NAN:
out << "asfloat(0x7fc00000u)";
break;
case FP_ZERO:
out << (positive ? "0.0f" : "asfloat(0xff800000u)");
break;
default:
out << FloatToString(fl->value()) << "f";
break;
if (std::isinf(fl->value())) {
out << (fl->value() >= 0 ? "asfloat(0x7f800000u)"
: "asfloat(0xff800000u)");
} else if (std::isnan(fl->value())) {
out << "asfloat(0x7fc00000u)";
} else {
out << FloatToString(fl->value()) << "f";
}
} else if (auto* sl = lit->As<ast::SintLiteral>()) {
out << sl->value();