diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2021-04-20 13:28:03 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-20 13:28:03 -0400 |
| commit | 1e06a74348d11e4eef456a067dc5065c1e8b1ee9 (patch) | |
| tree | 10c881f0f0d7eb8c1d8fdf459cc739466d4fa500 /src/stage1/ir.cpp | |
| parent | 2ca26ffde7342f7b676507452df75fbec545f650 (diff) | |
| parent | bd4421befee2157018dad88b31b684f9a5af73c2 (diff) | |
| download | zig-1e06a74348d11e4eef456a067dc5065c1e8b1ee9.tar.gz zig-1e06a74348d11e4eef456a067dc5065c1e8b1ee9.zip | |
Merge pull request #8542 from LemonBoy/floating-point-is-hard-my-dude
Floating point is hard my dude
Diffstat (limited to 'src/stage1/ir.cpp')
| -rw-r--r-- | src/stage1/ir.cpp | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/stage1/ir.cpp b/src/stage1/ir.cpp index 71a233c964..942b6028d9 100644 --- a/src/stage1/ir.cpp +++ b/src/stage1/ir.cpp @@ -11363,11 +11363,8 @@ static void float_negate(ZigValue *out_val, ZigValue *op) { } else if (op->type->id == ZigTypeIdFloat) { switch (op->type->data.floating.bit_count) { case 16: - { - const float16_t zero = zig_double_to_f16(0); - out_val->data.x_f16 = f16_sub(zero, op->data.x_f16); - return; - } + out_val->data.x_f16 = f16_neg(op->data.x_f16); + return; case 32: out_val->data.x_f32 = -op->data.x_f32; return; @@ -11375,9 +11372,7 @@ static void float_negate(ZigValue *out_val, ZigValue *op) { out_val->data.x_f64 = -op->data.x_f64; return; case 128: - float128_t zero_f128; - ui32_to_f128M(0, &zero_f128); - f128M_sub(&zero_f128, &op->data.x_f128, &out_val->data.x_f128); + f128M_neg(&op->data.x_f128, &out_val->data.x_f128); return; default: zig_unreachable(); |
