Revert "writer/hlsl: Special case negative zero"

This reverts commit efceb83536.

Reason for revert: Possibly broke tint -> dawn roll (again)

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

TBR=bclayton@google.com,jrprice@google.com,bclayton@chromium.org,noreply+kokoro@google.com,tint-scoped@luci-project-accounts.iam.gserviceaccount.com

Change-Id: Ic3042dabbd5a399851185714a6dd5e33ba8a5fc6
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/59023
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
This commit is contained in:
Ben Clayton
2021-07-20 20:35:41 +00:00
committed by Tint LUCI CQ
parent f6660aa125
commit 33afd6ce97
11 changed files with 7 additions and 147 deletions

View File

@@ -2502,20 +2502,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());
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(0x80000000u)");
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();