mirror of
https://github.com/roc-lang/roc.git
synced 2025-07-24 06:55:15 +00:00
remove F128
This commit is contained in:
parent
6f2e14cf18
commit
d287eafa3a
15 changed files with 7 additions and 73 deletions
|
@ -73,7 +73,6 @@ pub enum DecWidth {
|
|||
pub enum FloatWidth {
|
||||
F32,
|
||||
F64,
|
||||
F128,
|
||||
}
|
||||
|
||||
impl FloatWidth {
|
||||
|
@ -86,7 +85,6 @@ impl FloatWidth {
|
|||
match self {
|
||||
F32 => 4,
|
||||
F64 => 8,
|
||||
F128 => 16,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -99,7 +97,7 @@ impl FloatWidth {
|
|||
// the compiler is targeting (e.g. what the Roc code will be compiled to).
|
||||
match self {
|
||||
F32 => 4,
|
||||
F64 | F128 => match target_info.architecture {
|
||||
F64 => match target_info.architecture {
|
||||
X86_64 | Aarch64 | Wasm32 => 8,
|
||||
X86_32 | Aarch32 => 4,
|
||||
},
|
||||
|
@ -225,7 +223,6 @@ impl Index<FloatWidth> for IntrinsicName {
|
|||
match index {
|
||||
FloatWidth::F32 => self.options[1],
|
||||
FloatWidth::F64 => self.options[2],
|
||||
FloatWidth::F128 => self.options[3],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -256,7 +253,6 @@ macro_rules! float_intrinsic {
|
|||
|
||||
output.options[1] = concat!($name, ".f32");
|
||||
output.options[2] = concat!($name, ".f64");
|
||||
output.options[3] = concat!($name, ".f128");
|
||||
|
||||
output
|
||||
}};
|
||||
|
|
|
@ -709,7 +709,6 @@ fn float_with_precision<'a, 'ctx, 'env>(
|
|||
match float_width {
|
||||
FloatWidth::F64 => env.context.f64_type().const_float(value).into(),
|
||||
FloatWidth::F32 => env.context.f32_type().const_float(value).into(),
|
||||
FloatWidth::F128 => todo!("F128 is not implemented"),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3034,7 +3033,6 @@ fn build_switch_ir<'a, 'ctx, 'env>(
|
|||
let int_type = match float_width {
|
||||
FloatWidth::F32 => env.context.i32_type(),
|
||||
FloatWidth::F64 => env.context.i64_type(),
|
||||
FloatWidth::F128 => env.context.i128_type(),
|
||||
};
|
||||
|
||||
builder
|
||||
|
|
|
@ -111,7 +111,6 @@ fn build_eq_builtin<'a, 'ctx, 'env>(
|
|||
use FloatWidth::*;
|
||||
|
||||
let name = match float_width {
|
||||
F128 => "eq_f128",
|
||||
F64 => "eq_f64",
|
||||
F32 => "eq_f32",
|
||||
};
|
||||
|
@ -276,7 +275,6 @@ fn build_neq_builtin<'a, 'ctx, 'env>(
|
|||
use FloatWidth::*;
|
||||
|
||||
let name = match float_width {
|
||||
F128 => "neq_f128",
|
||||
F64 => "neq_f64",
|
||||
F32 => "neq_f32",
|
||||
};
|
||||
|
|
|
@ -202,7 +202,6 @@ pub fn float_type_from_float_width<'a, 'ctx, 'env>(
|
|||
use FloatWidth::*;
|
||||
|
||||
match float_width {
|
||||
F128 => todo!("F128 is not implemented"),
|
||||
F64 => env.context.f64_type(),
|
||||
F32 => env.context.f32_type(),
|
||||
}
|
||||
|
|
|
@ -34,7 +34,6 @@ fn add_float_intrinsic<'ctx, F>(
|
|||
|
||||
check!(FloatWidth::F32, ctx.f32_type());
|
||||
check!(FloatWidth::F64, ctx.f64_type());
|
||||
// check!(IntWidth::F128, ctx.i128_type());
|
||||
}
|
||||
|
||||
fn add_int_intrinsic<'ctx, F>(
|
||||
|
|
|
@ -2124,13 +2124,6 @@ fn build_float_unary_op<'a, 'ctx, 'env>(
|
|||
"f64_to_f32",
|
||||
),
|
||||
(FloatWidth::F64, FloatWidth::F64) => arg.into(),
|
||||
(FloatWidth::F128, FloatWidth::F128) => arg.into(),
|
||||
(FloatWidth::F128, _) => {
|
||||
unimplemented!("I cannot handle F128 with Num.toFrac yet")
|
||||
}
|
||||
(_, FloatWidth::F128) => {
|
||||
unimplemented!("I cannot handle F128 with Num.toFrac yet")
|
||||
}
|
||||
}
|
||||
}
|
||||
NumCeiling => {
|
||||
|
|
|
@ -21,7 +21,6 @@ pub enum StackMemoryFormat {
|
|||
/// Record, Str, List, etc.
|
||||
DataStructure,
|
||||
Int128,
|
||||
Float128,
|
||||
Decimal,
|
||||
}
|
||||
|
||||
|
@ -71,11 +70,6 @@ impl WasmLayout {
|
|||
match float_width {
|
||||
F32 => Self::Primitive(ValueType::F32, size),
|
||||
F64 => Self::Primitive(ValueType::F64, size),
|
||||
F128 => Self::StackMemory {
|
||||
size,
|
||||
alignment_bytes,
|
||||
format: StackMemoryFormat::Float128,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -156,7 +150,7 @@ impl CallConv {
|
|||
use ValueType::*;
|
||||
|
||||
match format {
|
||||
Int128 | Float128 | Decimal => &[I64, I64],
|
||||
Int128 | Decimal => &[I64, I64],
|
||||
|
||||
DataStructure => {
|
||||
if size == 0 {
|
||||
|
@ -191,7 +185,7 @@ impl CallConv {
|
|||
use StackMemoryFormat::*;
|
||||
|
||||
match format {
|
||||
Int128 | Float128 | Decimal => WriteToPointerArg,
|
||||
Int128 | Decimal => WriteToPointerArg,
|
||||
|
||||
DataStructure => {
|
||||
if size == 0 {
|
||||
|
|
|
@ -30,7 +30,6 @@ enum CodeGenNumType {
|
|||
F32, // Supported in Wasm instruction set
|
||||
F64, // Supported in Wasm instruction set
|
||||
I128, // Bytes in memory, needs Zig builtins
|
||||
F128, // Bytes in memory, needs Zig builtins
|
||||
Decimal, // Bytes in memory, needs Zig builtins
|
||||
}
|
||||
|
||||
|
@ -66,7 +65,6 @@ impl From<Layout<'_>> for CodeGenNumType {
|
|||
Builtin::Float(float_width) => match float_width {
|
||||
FloatWidth::F32 => F32,
|
||||
FloatWidth::F64 => F64,
|
||||
FloatWidth::F128 => F128,
|
||||
},
|
||||
Builtin::Decimal => Decimal,
|
||||
_ => not_num_error(),
|
||||
|
@ -91,7 +89,6 @@ impl From<StackMemoryFormat> for CodeGenNumType {
|
|||
fn from(format: StackMemoryFormat) -> CodeGenNumType {
|
||||
match format {
|
||||
StackMemoryFormat::Int128 => CodeGenNumType::I128,
|
||||
StackMemoryFormat::Float128 => CodeGenNumType::F128,
|
||||
StackMemoryFormat::Decimal => CodeGenNumType::Decimal,
|
||||
StackMemoryFormat::DataStructure => {
|
||||
internal_error!("Tried to perform a Num low-level operation on a data structure")
|
||||
|
@ -804,7 +801,6 @@ impl<'a> LowLevelCall<'a> {
|
|||
self.load_args(backend);
|
||||
backend.code_builder.f64_add()
|
||||
}
|
||||
FloatWidth::F128 => todo!("Num.add for f128"),
|
||||
},
|
||||
Layout::Builtin(Builtin::Decimal) => {
|
||||
self.load_args_and_call_zig(backend, bitcode::DEC_ADD_OR_PANIC)
|
||||
|
@ -841,7 +837,6 @@ impl<'a> LowLevelCall<'a> {
|
|||
self.load_args(backend);
|
||||
backend.code_builder.f64_add()
|
||||
}
|
||||
FloatWidth::F128 => todo!("Num.add for f128"),
|
||||
},
|
||||
Layout::Builtin(Builtin::Decimal) => {
|
||||
// TODO: don't panic
|
||||
|
@ -897,7 +892,6 @@ impl<'a> LowLevelCall<'a> {
|
|||
self.load_args(backend);
|
||||
backend.code_builder.f64_sub()
|
||||
}
|
||||
FloatWidth::F128 => todo!("Num.sub for f128"),
|
||||
},
|
||||
Layout::Builtin(Builtin::Decimal) => {
|
||||
self.load_args_and_call_zig(backend, bitcode::DEC_SUB_OR_PANIC)
|
||||
|
@ -934,7 +928,6 @@ impl<'a> LowLevelCall<'a> {
|
|||
self.load_args(backend);
|
||||
backend.code_builder.f64_sub()
|
||||
}
|
||||
FloatWidth::F128 => todo!("Num.sub for f128"),
|
||||
},
|
||||
Layout::Builtin(Builtin::Decimal) => {
|
||||
// TODO: don't panic
|
||||
|
@ -988,7 +981,6 @@ impl<'a> LowLevelCall<'a> {
|
|||
self.load_args(backend);
|
||||
backend.code_builder.f64_mul()
|
||||
}
|
||||
FloatWidth::F128 => todo!("Num.mul for f128"),
|
||||
},
|
||||
Layout::Builtin(Builtin::Decimal) => {
|
||||
self.load_args_and_call_zig(backend, bitcode::DEC_MUL_OR_PANIC)
|
||||
|
@ -1024,7 +1016,6 @@ impl<'a> LowLevelCall<'a> {
|
|||
self.load_args(backend);
|
||||
backend.code_builder.f64_mul()
|
||||
}
|
||||
FloatWidth::F128 => todo!("Num.mul for f128"),
|
||||
},
|
||||
Layout::Builtin(Builtin::Decimal) => {
|
||||
// TODO: don't panic
|
||||
|
@ -1466,9 +1457,6 @@ impl<'a> LowLevelCall<'a> {
|
|||
Layout::Builtin(Builtin::Float(FloatWidth::F64)) => {
|
||||
backend.code_builder.f64_sqrt()
|
||||
}
|
||||
Layout::Builtin(Builtin::Float(FloatWidth::F128)) => {
|
||||
todo!("sqrt for f128")
|
||||
}
|
||||
_ => panic_ret_type(),
|
||||
}
|
||||
}
|
||||
|
@ -2004,8 +1992,6 @@ impl<'a> LowLevelCall<'a> {
|
|||
|
||||
StackMemoryFormat::Int128 => Self::eq_num128_bytes(backend, locations),
|
||||
|
||||
StackMemoryFormat::Float128 => todo!("equality for f128"),
|
||||
|
||||
StackMemoryFormat::DataStructure => {
|
||||
internal_error!("Data structure equality is handled elsewhere")
|
||||
}
|
||||
|
@ -2052,7 +2038,6 @@ impl<'a> LowLevelCall<'a> {
|
|||
FloatWidth::F64 => {
|
||||
self.load_args_and_call_zig(backend, &bitcode::STR_FROM_FLOAT[width]);
|
||||
}
|
||||
FloatWidth::F128 => todo!("F128 to Str"),
|
||||
},
|
||||
Layout::Builtin(Builtin::Decimal) => {
|
||||
self.load_args_and_call_zig(backend, bitcode::DEC_TO_STR)
|
||||
|
@ -2090,27 +2075,13 @@ fn num_is_finite(backend: &mut WasmBackend<'_>, argument: Symbol) {
|
|||
}
|
||||
}
|
||||
}
|
||||
StackMemory {
|
||||
format, location, ..
|
||||
} => {
|
||||
let (local_id, offset) = location.local_and_offset(backend.storage.stack_frame_pointer);
|
||||
|
||||
StackMemory { format, .. } => {
|
||||
match format {
|
||||
// Integers and fixed-point numbers are always finite. Just return True.
|
||||
StackMemoryFormat::Int128 | StackMemoryFormat::Decimal => {
|
||||
backend.code_builder.i32_const(1)
|
||||
}
|
||||
|
||||
// f128 is not supported anywhere else but it's easy to support it here, so why not...
|
||||
StackMemoryFormat::Float128 => {
|
||||
backend.code_builder.get_local(local_id);
|
||||
backend.code_builder.i64_load(Align::Bytes4, offset + 8);
|
||||
backend.code_builder.i64_const(0x7fff_0000_0000_0000);
|
||||
backend.code_builder.i64_and();
|
||||
backend.code_builder.i64_const(0x7fff_0000_0000_0000);
|
||||
backend.code_builder.i64_ne();
|
||||
}
|
||||
|
||||
StackMemoryFormat::DataStructure => {
|
||||
internal_error!("Tried to perform NumIsFinite on a data structure")
|
||||
}
|
||||
|
|
|
@ -252,7 +252,7 @@ impl<'a> Storage<'a> {
|
|||
.extend_from_slice(CallConv::C.stack_memory_arg_types(size, format));
|
||||
|
||||
let location = match format {
|
||||
Int128 | Float128 | Decimal => {
|
||||
Int128 | Decimal => {
|
||||
// passed as two i64's but stored in the stack frame
|
||||
wide_number_args.push(local_index);
|
||||
let loc =
|
||||
|
|
|
@ -2890,7 +2890,6 @@ impl<'a> Builtin<'a> {
|
|||
use FloatWidth::*;
|
||||
|
||||
match float_width {
|
||||
F128 => alloc.text("Float128"),
|
||||
F64 => alloc.text("Float64"),
|
||||
F32 => alloc.text("Float32"),
|
||||
}
|
||||
|
|
|
@ -91,7 +91,6 @@ RocNum : [
|
|||
U128,
|
||||
F32,
|
||||
F64,
|
||||
F128,
|
||||
Dec,
|
||||
]
|
||||
|
||||
|
@ -153,4 +152,4 @@ RocTagUnion : [
|
|||
nonNullPayload: TypeId,
|
||||
whichTagIsNull: [FirstTagIsNull, SecondTagIsNull],
|
||||
},
|
||||
]
|
||||
]
|
||||
|
|
|
@ -571,7 +571,6 @@ struct RocType_RocDict {
|
|||
#[repr(u8)]
|
||||
pub enum RocNum {
|
||||
Dec = 0,
|
||||
F128 = 1,
|
||||
F32 = 2,
|
||||
F64 = 3,
|
||||
I128 = 4,
|
||||
|
@ -590,7 +589,6 @@ impl core::fmt::Debug for RocNum {
|
|||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||
match self {
|
||||
Self::Dec => f.write_str("RocNum::Dec"),
|
||||
Self::F128 => f.write_str("RocNum::F128"),
|
||||
Self::F32 => f.write_str("RocNum::F32"),
|
||||
Self::F64 => f.write_str("RocNum::F64"),
|
||||
Self::I128 => f.write_str("RocNum::I128"),
|
||||
|
|
|
@ -1737,7 +1737,6 @@ fn type_name(id: TypeId, types: &Types) -> String {
|
|||
RocType::Num(RocNum::I128) => "roc_std::I128".to_string(),
|
||||
RocType::Num(RocNum::F32) => "f32".to_string(),
|
||||
RocType::Num(RocNum::F64) => "f64".to_string(),
|
||||
RocType::Num(RocNum::F128) => "roc_std::F128".to_string(),
|
||||
RocType::Num(RocNum::Dec) => "roc_std::RocDec".to_string(),
|
||||
RocType::RocDict(key_id, val_id) => format!(
|
||||
"roc_std::RocDict<{}, {}>",
|
||||
|
@ -2433,7 +2432,7 @@ fn has_float_help(roc_type: &RocType, types: &Types, do_not_recurse: &[TypeId])
|
|||
use RocNum::*;
|
||||
|
||||
match num {
|
||||
F32 | F64 | F128 => true,
|
||||
F32 | F64 => true,
|
||||
I8 | U8 | I16 | U16 | I32 | U32 | I64 | U64 | I128 | U128 | Dec => false,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -544,7 +544,6 @@ pub enum RocNum {
|
|||
U128,
|
||||
F32,
|
||||
F64,
|
||||
F128,
|
||||
Dec,
|
||||
}
|
||||
|
||||
|
@ -566,7 +565,6 @@ impl RocNum {
|
|||
RocNum::U128 => size_of::<roc_std::U128>(),
|
||||
RocNum::F32 => size_of::<f32>(),
|
||||
RocNum::F64 => size_of::<f64>(),
|
||||
RocNum::F128 => todo!(),
|
||||
RocNum::Dec => size_of::<roc_std::RocDec>(),
|
||||
};
|
||||
|
||||
|
@ -1083,11 +1081,6 @@ fn add_builtin_type<'a>(
|
|||
RocType::Num(RocNum::F64),
|
||||
layout,
|
||||
),
|
||||
F128 => types.add_anonymous(
|
||||
&env.layout_cache.interner,
|
||||
RocType::Num(RocNum::F128),
|
||||
layout,
|
||||
),
|
||||
},
|
||||
(Builtin::Decimal, _) => types.add_anonymous(
|
||||
&env.layout_cache.interner,
|
||||
|
|
|
@ -388,7 +388,6 @@ fn jit_to_ast_help<'a, A: ReplApp<'a>>(
|
|||
match float_width {
|
||||
F32 => num_helper!(f32),
|
||||
F64 => num_helper!(f64),
|
||||
F128 => todo!("F128 not implemented"),
|
||||
}
|
||||
}
|
||||
Layout::Builtin(Builtin::Decimal) => num_helper!(RocDec),
|
||||
|
@ -590,7 +589,6 @@ fn addr_to_ast<'a, M: ReplAppMemory>(
|
|||
match float_width {
|
||||
F32 => helper!(deref_f32, f32),
|
||||
F64 => helper!(deref_f64, f64),
|
||||
F128 => todo!("F128 not implemented"),
|
||||
}
|
||||
}
|
||||
(_, Layout::Builtin(Builtin::List(elem_layout))) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue