fuzion icon indicating copy to clipboard operation
fuzion copied to clipboard

guidelines for what is implemented in fuzion vs. via intrinsics

Open michaellilltokiwa opened this issue 1 year ago • 1 comments

We currently have a few intrinsics that might better be implemented in fuzion. e.g.

f32.type.min_exp
f32.type.max_exp
f32.type.min_positive
f32.type.max
f32.type.epsilon
f64.type.min_exp
f64.type.max_exp
f64.type.min_positive
f64.type.max
f64.type.epsilon
f32.type.is_NaN
f64.type.is_NaN

We should describe how and why come to decide for what we use intrinsics and what is implemented in fuzion.

michaellilltokiwa avatar Jun 14 '24 10:06 michaellilltokiwa

Simple guideline: As much as possible should be implemented in Fuzion directly! A notable exceptions is a significant performance impact. An example is is_NaN, which I assume is a very cheap check if implemented as an intrinsic, but probably much more expensive if we try to do this in Fuzion. This in combination with the fact that calls to is_NaN might be quite frequent in certain numeric code, this should remain an intrinsic!

fridis avatar Jul 01 '24 09:07 fridis