| author | |
| committer | |
| log | 19334f95c1797af2ead725baf3a67070d90c8586 |
| tree | bdfb9791b5ce90f702025db2f8593de8f78eae01 |
| parent | bd1dc8948f6093a13f1ac887b71fb71466b24f9e |
| signature |
This was checked by running:
```
$ ./build/stage3/bin/zig build -p stage4 -Denable-llvm -Dno-lib
$ stage4/bin/zig build test-libc -Dlibc-test-path=<LIBC-TEST-PATH> -Dtest-filter=lrintf -fqemu -fwasmtime --summary line
Build Summary: 369/369 steps succeeded
```9 files changed, 5 insertions(+), 62 deletions(-)
lib/c/math.zig+5| ... | ... | @@ -72,6 +72,7 @@ comptime { |
| 72 | 72 | symbol(&frexp, "frexp"); |
| 73 | 73 | symbol(&hypot, "hypot"); |
| 74 | 74 | symbol(&lrint, "lrint"); |
| 75 | symbol(&lrintf, "lrintf"); | |
| 75 | 76 | symbol(&modf, "modf"); |
| 76 | 77 | symbol(&pow, "pow"); |
| 77 | 78 | symbol(&pow10, "pow10"); |
| ... | ... | @@ -238,6 +239,10 @@ fn lrint(x: f64) callconv(.c) c_long { |
| 238 | 239 | return @intFromFloat(rint(x)); |
| 239 | 240 | } |
| 240 | 241 | |
| 242 | fn lrintf(x: f32) callconv(.c) c_long { | |
| 243 | return @intFromFloat(rintf(x)); | |
| 244 | } | |
| 245 | ||
| 241 | 246 | fn modfGeneric(comptime T: type, x: T, iptr: *T) T { |
| 242 | 247 | if (math.isNegativeInf(x)) { |
| 243 | 248 | iptr.* = -math.inf(T); |
lib/libc/musl/src/math/aarch64/lrintf.c deleted-10| ... | ... | @@ -1,10 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | long lrintf(float x) | |
| 4 | { | |
| 5 | 	long n; | |
| 6 | 	__asm__ ( | |
| 7 | 		"frintx %s1, %s1\n" | |
| 8 | 		"fcvtzs %x0, %s1\n" : "=r"(n), "+w"(x)); | |
| 9 | 	return n; | |
| 10 | } |
lib/libc/musl/src/math/i386/lrintf.c deleted-8| ... | ... | @@ -1,8 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | long lrintf(float x) | |
| 4 | { | |
| 5 | 	long r; | |
| 6 | 	__asm__ ("fistpl %0" : "=m"(r) : "t"(x) : "st"); | |
| 7 | 	return r; | |
| 8 | } |
lib/libc/musl/src/math/lrintf.c deleted-8| ... | ... | @@ -1,8 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | /* uses LONG_MAX > 2^24, see comments in lrint.c */ | |
| 4 | ||
| 5 | long lrintf(float x) | |
| 6 | { | |
| 7 | 	return rintf(x); | |
| 8 | } |
lib/libc/musl/src/math/powerpc64/lrintf.c deleted-16| ... | ... | @@ -1,16 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | #ifdef _ARCH_PWR5X | |
| 4 | ||
| 5 | long lrintf(float x) | |
| 6 | { | |
| 7 | 	long n; | |
| 8 | 	__asm__ ("fctid %0, %1" : "=d"(n) : "f"(x)); | |
| 9 | 	return n; | |
| 10 | } | |
| 11 | ||
| 12 | #else | |
| 13 | ||
| 14 | #include "../lrintf.c" | |
| 15 | ||
| 16 | #endif |
lib/libc/musl/src/math/x32/lrintf.s deleted-5| ... | ... | @@ -1,5 +0,0 @@ |
| 1 | .global lrintf | |
| 2 | .type lrintf,@function | |
| 3 | lrintf: | |
| 4 | 	cvtss2si %xmm0,%rax | |
| 5 | 	ret |
lib/libc/musl/src/math/x86_64/lrintf.c deleted-8| ... | ... | @@ -1,8 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | long lrintf(float x) | |
| 4 | { | |
| 5 | 	long r; | |
| 6 | 	__asm__ ("cvtss2si %1, %0" : "=r"(r) : "x"(x)); | |
| 7 | 	return r; | |
| 8 | } |
src/libs/musl.zig-6| ... | ... | @@ -787,7 +787,6 @@ const src_files = [_][]const u8{ |
| 787 | 787 | "musl/src/math/aarch64/llrintf.c", |
| 788 | 788 | "musl/src/math/aarch64/llround.c", |
| 789 | 789 | "musl/src/math/aarch64/llroundf.c", |
| 790 | "musl/src/math/aarch64/lrintf.c", | |
| 791 | 790 | "musl/src/math/aarch64/lround.c", |
| 792 | 791 | "musl/src/math/aarch64/lroundf.c", |
| 793 | 792 | "musl/src/math/aarch64/nearbyint.c", |
| ... | ... | @@ -858,7 +857,6 @@ const src_files = [_][]const u8{ |
| 858 | 857 | "musl/src/math/i386/log1p.s", |
| 859 | 858 | "musl/src/math/i386/log2l.s", |
| 860 | 859 | "musl/src/math/i386/logl.s", |
| 861 | "musl/src/math/i386/lrintf.c", | |
| 862 | 860 | "musl/src/math/i386/lrintl.c", |
| 863 | 861 | "musl/src/math/i386/remainder.c", |
| 864 | 862 | "musl/src/math/i386/remainderf.c", |
| ... | ... | @@ -906,7 +904,6 @@ const src_files = [_][]const u8{ |
| 906 | 904 | "musl/src/math/logbf.c", |
| 907 | 905 | "musl/src/math/logbl.c", |
| 908 | 906 | "musl/src/math/logl.c", |
| 909 | "musl/src/math/lrintf.c", | |
| 910 | 907 | "musl/src/math/lrintl.c", |
| 911 | 908 | "musl/src/math/lround.c", |
| 912 | 909 | "musl/src/math/lroundf.c", |
| ... | ... | @@ -935,7 +932,6 @@ const src_files = [_][]const u8{ |
| 935 | 932 | "musl/src/math/pow_data.c", |
| 936 | 933 | "musl/src/math/powerpc64/fma.c", |
| 937 | 934 | "musl/src/math/powerpc64/fmaf.c", |
| 938 | "musl/src/math/powerpc64/lrintf.c", | |
| 939 | 935 | "musl/src/math/powerpc64/lround.c", |
| 940 | 936 | "musl/src/math/powerpc64/lroundf.c", |
| 941 | 937 | "musl/src/math/powerpc/fma.c", |
| ... | ... | @@ -1007,7 +1003,6 @@ const src_files = [_][]const u8{ |
| 1007 | 1003 | "musl/src/math/x32/log1pl.s", |
| 1008 | 1004 | "musl/src/math/x32/log2l.s", |
| 1009 | 1005 | "musl/src/math/x32/logl.s", |
| 1010 | "musl/src/math/x32/lrintf.s", | |
| 1011 | 1006 | "musl/src/math/x32/lrintl.s", |
| 1012 | 1007 | "musl/src/math/x32/remainderl.s", |
| 1013 | 1008 | "musl/src/math/x32/rintl.s", |
| ... | ... | @@ -1027,7 +1022,6 @@ const src_files = [_][]const u8{ |
| 1027 | 1022 | "musl/src/math/x86_64/log1pl.s", |
| 1028 | 1023 | "musl/src/math/x86_64/log2l.s", |
| 1029 | 1024 | "musl/src/math/x86_64/logl.s", |
| 1030 | "musl/src/math/x86_64/lrintf.c", | |
| 1031 | 1025 | "musl/src/math/x86_64/lrintl.c", |
| 1032 | 1026 | "musl/src/math/x86_64/remainderl.c", |
| 1033 | 1027 | "musl/src/math/x86_64/remquol.c", |
src/libs/wasi_libc.zig-1| ... | ... | @@ -732,7 +732,6 @@ const libc_top_half_src_files = [_][]const u8{ |
| 732 | 732 | "musl/src/math/logbf.c", |
| 733 | 733 | "musl/src/math/logbl.c", |
| 734 | 734 | "musl/src/math/logl.c", |
| 735 | "musl/src/math/lrintf.c", | |
| 736 | 735 | "musl/src/math/lrintl.c", |
| 737 | 736 | "musl/src/math/lround.c", |
| 738 | 737 | "musl/src/math/lroundf.c", |