mirror of
https://github.com/EnderIce2/Fennix.git
synced 2025-05-28 15:34:31 +00:00
userspace: add SIMD test application
Signed-off-by: EnderIce2 <enderice2@protonmail.com>
This commit is contained in:
parent
c0acbf8790
commit
a25c5f4a96
1
Userspace/apps/test/simd_test/.gitignore
vendored
Normal file
1
Userspace/apps/test/simd_test/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
simd_test
|
36
Userspace/apps/test/simd_test/Makefile
Normal file
36
Userspace/apps/test/simd_test/Makefile
Normal file
@ -0,0 +1,36 @@
|
||||
default:
|
||||
$(error Do not run this Makefile directly!)
|
||||
|
||||
S_SOURCES = $(shell find ./ -type f -name '*.S')
|
||||
C_SOURCES = $(shell find ./ -type f -name '*.c')
|
||||
CXX_SOURCES = $(shell find ./ -type f -name '*.cpp')
|
||||
|
||||
OBJ = $(S_SOURCES:.S=.o) $(C_SOURCES:.c=.o) $(CXX_SOURCES:.cpp=.o)
|
||||
|
||||
FILENAME = $(notdir $(shell pwd))
|
||||
WARNCFLAG = -Wall -Wextra
|
||||
|
||||
build: $(FILENAME)
|
||||
cp $(FILENAME) $(WORKSPACE_DIR)/out/bin/$(FILENAME)
|
||||
|
||||
# Use static linking
|
||||
LDFLAGS += -static -fno-pic -fno-pie -Wl,-static
|
||||
|
||||
$(FILENAME): $(OBJ)
|
||||
$(info Linking $@)
|
||||
$(CC) $(LDFLAGS) $(SYSROOT) $(OBJ) -o $@
|
||||
|
||||
%.o: %.c $(HEADERS)
|
||||
$(info Compiling $<)
|
||||
$(CC) $(CFLAGS) $(WARNCFLAG) -std=c17 -c $< -o $@
|
||||
|
||||
%.o: %.cpp $(HEADERS)
|
||||
$(info Compiling $<)
|
||||
$(CXX) $(CFLAGS) $(WARNCFLAG) -std=c++20 -fexceptions -c $< -o $@ -fno-rtti
|
||||
|
||||
%.o: %.S
|
||||
$(info Compiling $<)
|
||||
$(AS) -o $@ $<
|
||||
|
||||
clean:
|
||||
rm -f $(OBJ) $(FILENAME)
|
11
Userspace/apps/test/simd_test/simd.c
Normal file
11
Userspace/apps/test/simd_test/simd.c
Normal file
@ -0,0 +1,11 @@
|
||||
int main(int, char *argv[], char *[])
|
||||
{
|
||||
#if defined(__amd64__) || defined(__i386__)
|
||||
__asm__ __volatile__("movaps (%0), %%xmm0\n"
|
||||
"movaps %%xmm0, (%0)\n"
|
||||
: : "r"(argv) : "memory");
|
||||
#else
|
||||
#warning "Unimplemented"
|
||||
#endif
|
||||
return 0;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user