Skip to content

Commit

Permalink
AArch64: significantly improve formatted input performance by using o…
Browse files Browse the repository at this point in the history
…ptimized libc functions on ARM64

Signed-off-by: Paul Osmialowski <[email protected]>
  • Loading branch information
pawosm-arm committed Dec 19, 2018
1 parent 87c7238 commit ae1cee3
Showing 1 changed file with 38 additions and 0 deletions.
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);
#else
while (w-- > 0)
*item++ = g->rec_buff[idx++];
item += w;
#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

0 comments on commit ae1cee3

Please sign in to comment.