mirror of
https://github.com/rui314/mold.git
synced 2024-11-14 16:31:42 +03:00
temporary
This commit is contained in:
parent
6440b25fca
commit
3ae64cf861
2
Makefile
2
Makefile
@ -7,7 +7,7 @@ LLVM_LIBS=$(wildcard llvm-project/build/lib/libLLVM*.a)
|
||||
CURRENT_DIR=$(shell pwd)
|
||||
TBB_LIBDIR=$(wildcard $(CURRENT_DIR)/oneTBB/build/linux_intel64_*_release/)
|
||||
|
||||
CPPFLAGS=-g $(shell $(LLVM_CONFIG) --cxxflags) -IoneTBB/include -pthread -std=c++17 -O2
|
||||
CPPFLAGS=-g $(shell $(LLVM_CONFIG) --cxxflags) -IoneTBB/include -pthread -std=c++17
|
||||
LDFLAGS=$(shell $(LLVM_CONFIG) --ldflags) -L$(TBB_LIBDIR) -Wl,-rpath=$(TBB_LIBDIR) -fuse-ld=lld
|
||||
LIBS=-pthread -ltbb -lcurses -Wl,--start-group $(LLVM_LIBS) -Wl,--end-group
|
||||
OBJS=main.o writer.o input_files.o input_sections.o output_chunks.o output_file.o
|
||||
|
25
mold.h
25
mold.h
@ -37,6 +37,7 @@
|
||||
#include <unistd.h>
|
||||
#include <unistd.h>
|
||||
#include <unordered_set>
|
||||
#include <xmmintrin.h>
|
||||
|
||||
#define SECTOR_SIZE 512
|
||||
#define PAGE_SIZE 4096
|
||||
@ -538,13 +539,23 @@ extern std::atomic_int num_string_pieces;
|
||||
// Other
|
||||
//
|
||||
|
||||
inline void memcpy_nontemporal(void *dst, const void *src, size_t n) {
|
||||
#if 1
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
uint8_t val = __builtin_nontemporal_load((char *)src + i);
|
||||
__builtin_nontemporal_store(val, (char *)dst + i);
|
||||
}
|
||||
#else
|
||||
inline void memcpy_nontemporal(void *dst_, const void *src_, size_t n) {
|
||||
#if 0
|
||||
char *src = (char *)src_;
|
||||
char *dst = (char *)dst_;
|
||||
|
||||
if ((uintptr_t)src % 16 || (uintptr_t)dst % 16) {
|
||||
memcpy(dst, src, n);
|
||||
return;
|
||||
}
|
||||
|
||||
size_t i = 0;
|
||||
for (; i + 16 < n; i += 16) {
|
||||
__m128 val = __builtin_nontemporal_load((__m128 *)(src + i));
|
||||
__builtin_nontemporal_store(val, (__m128 *)(dst + i));
|
||||
}
|
||||
memcpy(dst + i, src + i, n - i);
|
||||
#else
|
||||
memcpy(dst_, src_, n);
|
||||
#endif
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user