authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-02-06 20:38:57-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-02-06 20:38:57-07:00
logeb82fdf96c3392ec9eabacbaa98c976f9ccd264e
treeb8d80ee2a26d70616eb1d47f4c833f408f322a50
parent65b6faa0485253b284f7a63601dc7d0f5858515a

Sema: panic instead of lowering to unavailable compiler-rt functions

Once the relevant compiler_rt functions are implemented, these panics can be removed.

1 files changed, 28 insertions(+), 2 deletions(-)

src/value.zig+28-2
......@@ -1423,8 +1423,10 @@ pub const Value = extern union {
14231423 .float_16 => @rem(self.castTag(.float_16).?.data, 1) != 0,
14241424 .float_32 => @rem(self.castTag(.float_32).?.data, 1) != 0,
14251425 .float_64 => @rem(self.castTag(.float_64).?.data, 1) != 0,
1426 .float_80 => @rem(self.castTag(.float_80).?.data, 1) != 0,
1427 .float_128 => @rem(self.castTag(.float_128).?.data, 1) != 0,
1426 //.float_80 => @rem(self.castTag(.float_80).?.data, 1) != 0,
1427 .float_80 => @panic("TODO implement __remx in compiler-rt"),
1428 //.float_128 => @rem(self.castTag(.float_128).?.data, 1) != 0,
1429 .float_128 => @panic("TODO implement fmodl in compiler-rt"),
14281430
14291431 else => unreachable,
14301432 };
......@@ -2819,11 +2821,17 @@ pub const Value = extern union {
28192821 return Value.Tag.float_64.create(arena, @rem(lhs_val, rhs_val));
28202822 },
28212823 80 => {
2824 if (true) {
2825 @panic("TODO implement compiler_rt __remx");
2826 }
28222827 const lhs_val = lhs.toFloat(f80);
28232828 const rhs_val = rhs.toFloat(f80);
28242829 return Value.Tag.float_80.create(arena, @rem(lhs_val, rhs_val));
28252830 },
28262831 128 => {
2832 if (true) {
2833 @panic("TODO implement compiler_rt fmodl");
2834 }
28272835 const lhs_val = lhs.toFloat(f128);
28282836 const rhs_val = rhs.toFloat(f128);
28292837 return Value.Tag.float_128.create(arena, @rem(lhs_val, rhs_val));
......@@ -2850,11 +2858,17 @@ pub const Value = extern union {
28502858 return Value.Tag.float_64.create(arena, @mod(lhs_val, rhs_val));
28512859 },
28522860 80 => {
2861 if (true) {
2862 @panic("TODO implement compiler_rt __modx");
2863 }
28532864 const lhs_val = lhs.toFloat(f80);
28542865 const rhs_val = rhs.toFloat(f80);
28552866 return Value.Tag.float_80.create(arena, @mod(lhs_val, rhs_val));
28562867 },
28572868 128 => {
2869 if (true) {
2870 @panic("TODO implement compiler_rt fmodl");
2871 }
28582872 const lhs_val = lhs.toFloat(f128);
28592873 const rhs_val = rhs.toFloat(f128);
28602874 return Value.Tag.float_128.create(arena, @mod(lhs_val, rhs_val));
......@@ -3113,6 +3127,9 @@ pub const Value = extern union {
31133127 return Value.Tag.float_64.create(arena, lhs_val / rhs_val);
31143128 },
31153129 80 => {
3130 if (true) {
3131 @panic("TODO implement compiler_rt __divxf3");
3132 }
31163133 const lhs_val = lhs.toFloat(f80);
31173134 const rhs_val = rhs.toFloat(f80);
31183135 return Value.Tag.float_80.create(arena, lhs_val / rhs_val);
......@@ -3150,6 +3167,9 @@ pub const Value = extern union {
31503167 return Value.Tag.float_64.create(arena, @divFloor(lhs_val, rhs_val));
31513168 },
31523169 80 => {
3170 if (true) {
3171 @panic("TODO implement compiler_rt __floorx");
3172 }
31533173 const lhs_val = lhs.toFloat(f80);
31543174 const rhs_val = rhs.toFloat(f80);
31553175 return Value.Tag.float_80.create(arena, @divFloor(lhs_val, rhs_val));
......@@ -3187,6 +3207,9 @@ pub const Value = extern union {
31873207 return Value.Tag.float_64.create(arena, @divTrunc(lhs_val, rhs_val));
31883208 },
31893209 80 => {
3210 if (true) {
3211 @panic("TODO implement compiler_rt __truncx");
3212 }
31903213 const lhs_val = lhs.toFloat(f80);
31913214 const rhs_val = rhs.toFloat(f80);
31923215 return Value.Tag.float_80.create(arena, @divTrunc(lhs_val, rhs_val));
......@@ -3224,6 +3247,9 @@ pub const Value = extern union {
32243247 return Value.Tag.float_64.create(arena, lhs_val * rhs_val);
32253248 },
32263249 80 => {
3250 if (true) {
3251 @panic("TODO implement compiler_rt __mulxf3");
3252 }
32273253 const lhs_val = lhs.toFloat(f80);
32283254 const rhs_val = rhs.toFloat(f80);
32293255 return Value.Tag.float_80.create(arena, lhs_val * rhs_val);