aboutsummaryrefslogtreecommitdiff
path: root/src/stage1/analyze.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-01-29 03:45:15 -0500
committerGitHub <noreply@github.com>2022-01-29 03:45:15 -0500
commit225910f9341fbc725ff5e0d2c653e29bc2f21cb8 (patch)
treeeac47d40ae555398c46e4ccdff9cace12eeabd3b /src/stage1/analyze.cpp
parent63ee6e662582ee75ac804eb1a4dbdf4457b8f2d0 (diff)
parenta0a71709bc2104c708f045fbb42c6247aff136ac (diff)
downloadzig-225910f9341fbc725ff5e0d2c653e29bc2f21cb8.tar.gz
zig-225910f9341fbc725ff5e0d2c653e29bc2f21cb8.zip
Merge pull request #10639 from Vexu/f80
Add f80
Diffstat (limited to 'src/stage1/analyze.cpp')
-rw-r--r--src/stage1/analyze.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/stage1/analyze.cpp b/src/stage1/analyze.cpp
index ff68198fc3..09fd41e24d 100644
--- a/src/stage1/analyze.cpp
+++ b/src/stage1/analyze.cpp
@@ -5647,6 +5647,9 @@ static uint32_t hash_combine_const_val(uint32_t hash_val, ZigValue *const_val) {
case 16: return hash_combine(hash_val, &const_val->data.x_f16);
case 32: return hash_combine(hash_val, &const_val->data.x_f32);
case 64: return hash_combine(hash_val, &const_val->data.x_f64);
+ case 80:
+ hash_val = hash_combine(hash_val, &const_val->data.x_f80.signExp);
+ return hash_combine(hash_val, &const_val->data.x_f80.signif);
case 128: return hash_combine(hash_val, &const_val->data.x_f128);
default: zig_unreachable();
}
@@ -6325,6 +6328,7 @@ void init_const_float(ZigValue *const_val, ZigType *type, double value) {
case 64:
const_val->data.x_f64 = value;
break;
+ case 80:
case 128:
// if we need this, we should add a function that accepts a float128_t param
zig_unreachable();
@@ -7218,6 +7222,8 @@ bool const_values_equal(CodeGen *g, ZigValue *a, ZigValue *b) {
return a->data.x_f32 == b->data.x_f32;
case 64:
return a->data.x_f64 == b->data.x_f64;
+ case 80:
+ return extF80M_eq(&a->data.x_f80, &b->data.x_f80);
case 128:
return f128M_eq(&a->data.x_f128, &b->data.x_f128);
default:
@@ -7470,6 +7476,13 @@ void render_const_value(CodeGen *g, Buf *buf, ZigValue *const_val) {
case 64:
buf_appendf(buf, "%f", const_val->data.x_f64);
return;
+ case 80: {
+ float64_t f64_value = extF80M_to_f64(&const_val->data.x_f80);
+ double double_value;
+ memcpy(&double_value, &f64_value, sizeof(double));
+ buf_appendf(buf, "%f", double_value);
+ return;
+ }
case 128:
{
const size_t extra_len = 100;