aboutsummaryrefslogtreecommitdiff
path: root/core/_preload.odin
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2017-12-11 11:06:43 +0000
committergingerBill <bill@gingerbill.org>2017-12-11 11:06:43 +0000
commit3aea08df7869f39c12a4d787be25306944d68e70 (patch)
tree9e7ff86c39ecc54be0ce319d39af8b6c5c4348d9 /core/_preload.odin
parent3c6f90e5524d38bdd30750eb04441a1897bcd8dd (diff)
Change how abs, min, max, and clamp are implemented for floats
Diffstat (limited to 'core/_preload.odin')
-rw-r--r--core/_preload.odin18
1 files changed, 14 insertions, 4 deletions
diff --git a/core/_preload.odin b/core/_preload.odin
index 6317c4a36..1e7c75ab1 100644
--- a/core/_preload.odin
+++ b/core/_preload.odin
@@ -240,18 +240,19 @@ type_info_base_without_enum :: proc(info: ^Type_Info) -> ^Type_Info {
+@(default_calling_convention = "c")
foreign __llvm_core {
@(link_name="llvm.assume")
- assume :: proc "c" (cond: bool) ---;
+ assume :: proc(cond: bool) ---;
@(link_name="llvm.debugtrap")
- __debug_trap :: proc "c" () ---;
+ __debug_trap :: proc() ---;
@(link_name="llvm.trap")
- __trap :: proc "c" () ---;
+ __trap :: proc() ---;
@(link_name="llvm.readcyclecounter")
- read_cycle_counter :: proc "c" () -> u64 ---;
+ read_cycle_counter :: proc() -> u64 ---;
}
@@ -776,6 +777,7 @@ __mem_compare :: proc "contextless" (a, b: ^byte, n: int) -> int {
return 0;
}
+@(default_calling_convention = "c")
foreign __llvm_core {
@(link_name="llvm.sqrt.f32") __sqrt_f32 :: proc(x: f32) -> f32 ---;
@(link_name="llvm.sqrt.f64") __sqrt_f64 :: proc(x: f64) -> f64 ---;
@@ -791,6 +793,14 @@ foreign __llvm_core {
@(link_name="llvm.fmuladd.f32") fmuladd32 :: proc(a, b, c: f32) -> f32 ---;
@(link_name="llvm.fmuladd.f64") fmuladd64 :: proc(a, b, c: f64) -> f64 ---;
+
+ @(link_name="llvm.fabs.f32") __abs_f32 :: proc(x: f32) -> f32 ---;
+ @(link_name="llvm.fabs.f64") __abs_f64 :: proc(x: f64) -> f32 ---;
+
+ @(link_name="llvm.minnum.f32") __min_f32 :: proc(a, b: f32) -> f32 ---;
+ @(link_name="llvm.minnum.f64") __min_f64 :: proc(a, b: f64) -> f32 ---;
+ @(link_name="llvm.maxnum.f32") __max_f32 :: proc(a, b: f32) -> f32 ---;
+ @(link_name="llvm.maxnum.f64") __max_f64 :: proc(a, b: f64) -> f32 ---;
}
__abs_complex64 :: inline proc "contextless" (x: complex64) -> f32 {
r, i := real(x), imag(x);