History

Initial commit

Michael Forney committed 12 months ago

Commit b64b1bcNo parent (first commit)5 files · +102 −0Browse files

Unified · Split

5 files
  1. .gitignore +2 −0
  2. LICENSE +22 −0
  3. Makefile +16 −0
  4. README.md +5 −0
  5. mvec.c +57 −0
.gitignore+2−0
@@ -0,0 +1,2 @@
1/*.o
2/libmvec.so.1
LICENSE+22−0
@@ -0,0 +1,22 @@
1This is free and unencumbered software released into the public domain.
2
3Anyone is free to copy, modify, publish, use, compile, sell, or
4distribute this software, either in source code form or as a compiled
5binary, for any purpose, commercial or non-commercial, and by any
6means.
7
8In jurisdictions that recognize copyright laws, the author or authors
9of this software dedicate any and all copyright interest in the
10software to the public domain. We make this dedication for the benefit
11of the public at large and to the detriment of our heirs and
12successors. We intend this dedication to be an overt act of
13relinquishment in perpetuity of all present and future rights to this
14software under copyright law.
15
16THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22OTHER DEALINGS IN THE SOFTWARE.
Makefile+16−0
@@ -0,0 +1,16 @@
1.POSIX:
2
3PREFIX=/usr/local
4LIBDIR=$(PREFIX)/lib
5
6libmvec.so.1: mvec.o
7 $(CC) -o $@ -shared -Wl,-soname=$@ mvec.o
8
9.PHONY: install
10install: libmvec.so.1
11 mkdir -p $(DESTDIR)$(LIBDIR)
12 cp libmvec.so.1 $(DESTDIR)$(LIBDIR)
13
14.PHONY: clean
15clean:
16 rm -f libmvec.so.1 mvec.o
README.md+5−0
@@ -0,0 +1,5 @@
1This library provides some implementations of the vectorized math
2functions in glibc's libmvec. It is useful for running glibc binaries
3built with -ffast-math under musl with [gcompat].
4
5[gcompat]: https://git.adelielinux.org/adelie/gcompat
mvec.c+57−0
@@ -0,0 +1,57 @@
1/* SPDX-License-Identifier: Unlicense */
2#include <math.h>
3
4typedef double [[gnu::vector_size(16)]] v2df;
5typedef float [[gnu::vector_size(16)]] v4sf;
6
7v2df
8_ZGVbN2v_exp(v2df x)
9{
10 x[0] = exp(x[0]);
11 x[1] = exp(x[1]);
12 return x;
13}
14
15v4sf
16_ZGVbN4v_expf(v4sf x)
17{
18 x[0] = expf(x[0]);
19 x[1] = expf(x[1]);
20 x[2] = expf(x[2]);
21 x[3] = expf(x[3]);
22 return x;
23}
24
25v2df
26_ZGVbN2v_log(v2df x)
27{
28 x[0] = log(x[0]);
29 x[1] = log(x[1]);
30 return x;
31}
32
33v4sf
34_ZGVbN4v_logf(v4sf x)
35{
36 x[0] = logf(x[0]);
37 x[1] = logf(x[1]);
38 x[2] = logf(x[2]);
39 x[3] = logf(x[3]);
40 return x;
41}
42
43v2df
44_ZGVbN2v_sin(v2df x)
45{
46 x[0] = sin(x[0]);
47 x[1] = sin(x[1]);
48 return x;
49}
50
51v2df
52_ZGVbN2vv_pow(v2df x, v2df y)
53{
54 x[0] = pow(x[0], y[2]);
55 x[1] = pow(x[1], y[3]);
56 return x;
57}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t