Commit graph

613 commits

Author SHA1 Message Date
Lars Frogner
560171c238
Add Num.[f32,f64,dec]_[to,from]_bits builtins and deprecate Num.[f32,f64]_[to,from]_parts (#7741)
* Add `Num.[f32,f64,dec]_[to,from]_bits` builtins

* Update mono tests

* Deprecate `Num.[f32,f64]_[to,from]_parts`
2025-04-18 10:10:45 +02:00
Norbert Hajagos
fc0a9ec4cf
add with_ascii_uppercased and caseless_ascii_equals to Str 2025-01-23 15:21:11 +01:00
shua
6c29d7aa1f
Merge branch 'main' into fromutf-roc 2025-01-20 19:16:38 +01:00
Norbert Hajagos
8403f1ea19
with_ascii_lowercased zig builtin 2025-01-20 10:58:41 +01:00
Sam Mohr
a292e070d4
Prefer and and or for boolean operators 2025-01-17 16:15:31 -08:00
shua
414fecd14d
add fromUtf16 and 32, as well as lossy variants 2025-01-15 00:17:09 +01:00
shua
c195cff8e3
fix Num.shift_right_by to not mutate src register
The intent of this change is to fix a bug calling `Num.shift_right_by(a, b)`
mutates `a`. This was happening in the dev backend only, and the cause was
some generated assembly which writes to register a is stored in.
2025-01-12 00:37:10 +01:00
Jakub Konka
3a3556a74c
compiler: bump object to 0.36.7
Update all callsites using `write::Relocation` to the new API.
2024-12-31 16:17:38 +01:00
Luke Boswell
6675734c16
Merge pull request #7314 from shua/wrapped
impl add/sub/mul wrapped for u128/i128
2024-12-09 11:19:58 +11:00
Ayaz
793a95264d
Merge branch 'main' into wrapped 2024-12-08 13:54:43 -05:00
JRI98
90f517712a
Remove unused code 2024-12-05 09:18:52 +00:00
Richard Feldman
bc0c9250f9
Convert unused dbg!()s to eprintln!()s
This makes it nicer to work with dbg! normally,
because grepping the code base for dbg!() reveals
only the usages of it that are currently active.
2024-12-01 23:10:35 -05:00
shua
6f4e501069
impl add/sub/mul wrapped for u128/i128 2024-12-01 22:26:25 +01:00
shua
8fd2fbc3a1
gen-dev: complete Num{Mul,Add,Sub}Saturated impls
MulSaturated and AddSaturated are now implemented for u128, i128
SubSaturated is now implemented for Dec even if it's a little strange to
saturate at a decimal value:

```
» Num.subSaturated -170_141_183_460_469_231_731dec 1

-170141183460469231731.687303715884105728 : Dec
```

I decided to rm the `build_num_{mul,add}_saturated` methods because
they don't require any asm-specifics. They either call out to bitcode, or
use the non-saturated version for floats.
2024-11-30 23:01:44 +01:00
Richard Feldman
0e550a7f68
Merge pull request #7265 from roc-lang/workspace-deps
Update cargo dependencies to use workspace
2024-11-29 17:38:03 -05:00
Richard Feldman
bfbc9ceef0
Merge pull request #7258 from JRI98/remove_unused_typedhole_variant
Remove unused code
2024-11-29 00:19:49 -05:00
Luke Boswell
3c394028d1
replace cargo deps with workspace in derive_key, exhaustive, fmt, gen_dev, gen_llvm 2024-11-29 11:17:42 +11:00
JRI98
75f13d3f2e
Remove unused RuntimeErrorFunction variant from roc_mono::ir::Expr 2024-11-28 20:11:56 +00:00
shua
10f04f1d94
implement Num.isNaN,isFinite,isInfinite for Dec 2024-11-27 00:36:54 +01:00
Brendan Hansknecht
e40b3cd6a9
Merge pull request #7235 from shua/devneg
impl Num.neg for Dec,F32,F64 in repl
2024-11-26 13:29:19 -08:00
shua
a98acff0b9
gen-dev: impl Num.neg for Dec,F32,F64
Dec negation was implemented across gen-dev, gen-llvm, gen-wasm as a call
to the compiled zig function `bitcode::DEC_NEGATE`.

f32 and f64 negation were implemented already for gen-llvm, gen-wasm.

for gen-dev x86_64, float negation is implemented by flipping the sign
bit, which means `xorps` for f32, and `xorpd` for f64

for gen-dev aarch64, there is conveniently a `fneg` instruction
2024-11-23 19:17:55 +01:00
Sam Mohr
c5b2e160ca
Ignore switch stmt ret_layout 2024-11-21 09:52:38 -08:00
Joshua Warner
9ead801536
Remove expect-fx syntax and handling
This was never fully hooked up in platforms, and the plan is to replace the need for this with doing purity-inference on normal `expect` statements.

On the other hand, fuzzing is finding some bugs caused by having a hyphenated keyword, so this is a great time to go ahead and remove it!
2024-11-17 20:25:37 -08:00
Isaac Van Doren
d99c347998
rename Str.split 2024-11-15 21:12:23 -06:00
Norbert Hajagos
72863daa7e
gen_dev-x86_64 extend Num.neg to all Signed and Unsigned int sizes 2024-10-07 23:43:58 +02:00
Brendan Hansknecht
5ad85bcd08
get native dev backend working 2024-07-21 20:07:52 -07:00
Brendan Hansknecht
8008c12a81
fix element refcounted for non-list types in dev backend 2024-07-13 10:39:57 -07:00
Brendan Hansknecht
c734a27b59
move List.map* into roc 2024-07-13 10:39:56 -07:00
Brendan Hansknecht
7d8fbfbe85
also remove inc functions from gen_dev 2024-07-13 10:39:56 -07:00
Brendan Hansknecht
1e04668ee4
remove ld_classic and fix dev backend missing layout 2024-07-13 10:39:56 -07:00
Brendan Hansknecht
b381271150
tiny bit of minor cleanup 2024-07-13 10:39:54 -07:00
Brendan Hansknecht
e92cf1be42
Revert "attempt to correct list refcount generation in dev backends"
This reverts commit 0854a1a53a2db441c648140bdd24de91125ec645.
2024-07-13 10:39:54 -07:00
Brendan Hansknecht
36bc8bfac4
attempt to correct list refcount generation in dev backends 2024-07-13 10:39:54 -07:00
Brendan Hansknecht
54d0409396
correct some gen dev layouts 2024-07-13 10:39:53 -07:00
Brendan Hansknecht
9e70308952
cleanup misc minor issues 2024-07-13 10:39:53 -07:00
Brendan Hansknecht
48eb9c31a9
update list generated refcounting functions for dev and wasm 2024-07-13 10:39:53 -07:00
Brendan Hansknecht
3238ee7d0d
correct UTILS_FREE_DATA_PTR function calls 2024-07-13 10:39:53 -07:00
Brendan Hansknecht
0d0a4a8806
Update refcounting of list builtins to the new system. 2024-07-13 10:39:53 -07:00
Brendan Hansknecht
d5e91ed61e
Update dev and wasm backend to use new list bitcode args 2024-07-13 10:39:52 -07:00
shua
f7bec802c0
PR: rename to List.concatUtf8 2024-06-08 13:36:20 +02:00
shua
33e8a7a439
implement Str.concatUtf8 2024-06-07 19:05:52 +02:00
Fabian Schmalzried
11998b9cc8
f32FromParts and f64FromParts for repl 2024-04-01 21:08:10 +02:00
Fabian Schmalzried
473b8ef2d3
f32/f64toParts in repl only 2024-04-01 21:08:09 +02:00
Fabian Schmalzried
64e9899cad
Add Num.withDecimalPoint 2024-04-01 21:08:09 +02:00
Fabian Schmalzried
9c664172dd
Add Num.withoutDecimalPoint 2024-04-01 21:08:09 +02:00
Brendan Hansknecht
6dc5bfb1b7
Use roc_target over target_lexicon
Tailors a target class for our needs.
Replaces tons of uses across the entire compiler.
This is a base for later adding new targets like thumb.
2024-03-31 10:50:26 -07:00
Richard Feldman
739565e836
Revert "Remove obsolete ListLenUsize"
This reverts commit ad1bca4ac9c40d336522f944df60d61a814435dd.
2024-02-17 13:20:34 -05:00
Richard Feldman
87d4760356
Remove obsolete ListLenUsize 2024-02-17 13:20:34 -05:00
Richard Feldman
37b154df4f
Remove Str.fromUtf8Range
Seamless slices make this obsolete!
2024-02-17 13:20:33 -05:00
Richard Feldman
ada83561e5
Split ListLen into ListLenU64 and ListLenUsize
The usize one gets used internally for things like
pattern matches. This is both more efficient (means
they don't have to do unnecessary casts) and also
less error-prone due to e.g. comparing length to
capacity, which is usize.
2024-02-14 21:00:49 -05:00