Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AArch64: significantly improve formatted input performance by using optimized libc functions on ARM64 #642

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions runtime/flang/fmtread.c
Original file line number Diff line number Diff line change
Expand Up @@ -1624,8 +1624,15 @@ fr_read(char *item, /* where to transfer data to. The value of item may
if (g->curr_pos > g->obuff_len)
g->curr_pos = g->obuff_len;
else {
#ifdef TARGET_LLVM_ARM64
if (g->rec_len < g->curr_pos) {
memset(g->rec_buff + g->rec_len, ' ', g->curr_pos - g->rec_len);
g->rec_len = g->curr_pos;
}
#else
while (g->rec_len < g->curr_pos)
g->rec_buff[g->rec_len++] = ' ';
#endif
}
}
}
Expand Down Expand Up @@ -1713,11 +1720,23 @@ fr_read(char *item, /* where to transfer data to. The value of item may
i = fr_move_fwd(w);
if (i != 0)
return i;
#ifdef TARGET_LLVM_ARM64
memcpy(item, g->rec_buff + idx, w);
item += w;
#else
while (w-- > 0)
*item++ = g->rec_buff[idx++];
#endif
if (g->pad == FIO_YES) {
#ifdef TARGET_LLVM_ARM64
if (pad > 0) {
memset(item, ' ', pad);
item += pad;
}
#else
while (pad > 0)
*item++ = ' ', pad--;
#endif
}
}
goto exit_loop;
Expand Down Expand Up @@ -1749,11 +1768,23 @@ fr_read(char *item, /* where to transfer data to. The value of item may
i = fr_move_fwd(w);
if (i != 0)
return i;
#ifdef TARGET_LLVM_ARM64
memcpy(item, g->rec_buff + idx, w);
item += w;
#else
while (w-- > 0)
*item++ = g->rec_buff[idx++];
#endif
if (g->pad == FIO_YES) {
#ifdef TARGET_LLVM_ARM64
if (pad > 0) {
memset(item, ' ', pad);
item += pad;
}
#else
while (pad > 0)
*item++ = ' ', pad--;
#endif
}
goto exit_loop;
}
Expand Down Expand Up @@ -3199,8 +3230,15 @@ fr_move_fwd(int len)
move_fwd_eor = 1;
}

#if TARGET_LLVM_ARM64
if (g->rec_len < g->curr_pos) {
memset(g->rec_buff + g->rec_len, ' ', g->curr_pos - g->rec_len);
g->rec_len = g->curr_pos;
}
#else
while (g->rec_len < g->curr_pos)
g->rec_buff[g->rec_len++] = ' ';
#endif
}
g->max_pos = g->curr_pos;
return 0;
Expand Down