diff --git a/crates/compiler/builtins/src/bitcode.rs b/crates/compiler/builtins/src/bitcode.rs index f6733f7f4c..56d0bb339b 100644 --- a/crates/compiler/builtins/src/bitcode.rs +++ b/crates/compiler/builtins/src/bitcode.rs @@ -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 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 }}; diff --git a/crates/compiler/gen_llvm/src/llvm/build.rs b/crates/compiler/gen_llvm/src/llvm/build.rs index 3bb3a7d19d..b82f7341e2 100644 --- a/crates/compiler/gen_llvm/src/llvm/build.rs +++ b/crates/compiler/gen_llvm/src/llvm/build.rs @@ -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 diff --git a/crates/compiler/gen_llvm/src/llvm/compare.rs b/crates/compiler/gen_llvm/src/llvm/compare.rs index a03fd0bb50..0cd94a6eb0 100644 --- a/crates/compiler/gen_llvm/src/llvm/compare.rs +++ b/crates/compiler/gen_llvm/src/llvm/compare.rs @@ -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", }; diff --git a/crates/compiler/gen_llvm/src/llvm/convert.rs b/crates/compiler/gen_llvm/src/llvm/convert.rs index e752e98b43..1cbe255fed 100644 --- a/crates/compiler/gen_llvm/src/llvm/convert.rs +++ b/crates/compiler/gen_llvm/src/llvm/convert.rs @@ -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(), } diff --git a/crates/compiler/gen_llvm/src/llvm/intrinsics.rs b/crates/compiler/gen_llvm/src/llvm/intrinsics.rs index dccd7e133e..94de9dfc5d 100644 --- a/crates/compiler/gen_llvm/src/llvm/intrinsics.rs +++ b/crates/compiler/gen_llvm/src/llvm/intrinsics.rs @@ -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>( diff --git a/crates/compiler/gen_llvm/src/llvm/lowlevel.rs b/crates/compiler/gen_llvm/src/llvm/lowlevel.rs index d732b6ce1e..49cfca78d9 100644 --- a/crates/compiler/gen_llvm/src/llvm/lowlevel.rs +++ b/crates/compiler/gen_llvm/src/llvm/lowlevel.rs @@ -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 => { diff --git a/crates/compiler/gen_wasm/src/layout.rs b/crates/compiler/gen_wasm/src/layout.rs index 83c86265f1..44097b94f1 100644 --- a/crates/compiler/gen_wasm/src/layout.rs +++ b/crates/compiler/gen_wasm/src/layout.rs @@ -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 { diff --git a/crates/compiler/gen_wasm/src/low_level.rs b/crates/compiler/gen_wasm/src/low_level.rs index 82efa09c8b..71417f1f0b 100644 --- a/crates/compiler/gen_wasm/src/low_level.rs +++ b/crates/compiler/gen_wasm/src/low_level.rs @@ -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> 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 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") } diff --git a/crates/compiler/gen_wasm/src/storage.rs b/crates/compiler/gen_wasm/src/storage.rs index a2d0032397..85f248b7b8 100644 --- a/crates/compiler/gen_wasm/src/storage.rs +++ b/crates/compiler/gen_wasm/src/storage.rs @@ -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 = diff --git a/crates/compiler/mono/src/layout.rs b/crates/compiler/mono/src/layout.rs index b3a0d0f8f6..27d85c2e24 100644 --- a/crates/compiler/mono/src/layout.rs +++ b/crates/compiler/mono/src/layout.rs @@ -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"), } diff --git a/crates/glue/src/RocType.roc b/crates/glue/src/RocType.roc index ff18cda46d..cbc6cffa22 100644 --- a/crates/glue/src/RocType.roc +++ b/crates/glue/src/RocType.roc @@ -91,7 +91,6 @@ RocNum : [ U128, F32, F64, - F128, Dec, ] @@ -153,4 +152,4 @@ RocTagUnion : [ nonNullPayload: TypeId, whichTagIsNull: [FirstTagIsNull, SecondTagIsNull], }, -] \ No newline at end of file +] diff --git a/crates/glue/src/glue.rs b/crates/glue/src/glue.rs index a352ff820a..325ea22370 100644 --- a/crates/glue/src/glue.rs +++ b/crates/glue/src/glue.rs @@ -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"), diff --git a/crates/glue/src/rust_glue.rs b/crates/glue/src/rust_glue.rs index d00dfb8092..28b1ea1597 100644 --- a/crates/glue/src/rust_glue.rs +++ b/crates/glue/src/rust_glue.rs @@ -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, } } diff --git a/crates/glue/src/types.rs b/crates/glue/src/types.rs index 1504952789..fb93a78771 100644 --- a/crates/glue/src/types.rs +++ b/crates/glue/src/types.rs @@ -544,7 +544,6 @@ pub enum RocNum { U128, F32, F64, - F128, Dec, } @@ -566,7 +565,6 @@ impl RocNum { RocNum::U128 => size_of::(), RocNum::F32 => size_of::(), RocNum::F64 => size_of::(), - RocNum::F128 => todo!(), RocNum::Dec => size_of::(), }; @@ -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, diff --git a/crates/repl_eval/src/eval.rs b/crates/repl_eval/src/eval.rs index 4f6031e2fc..3305b836b8 100644 --- a/crates/repl_eval/src/eval.rs +++ b/crates/repl_eval/src/eval.rs @@ -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))) => {