Clean up the riscv64 assembler slightly.

No need for the `_v` names any more, and we can change the two __*_chk
functions to fall through rather than tail call.

Change-Id: Iccb2a67a4186faa03106efbad814d9d5c9770738
diff --git a/libc/Android.bp b/libc/Android.bp
index 794ccc7..ee50dad 100644
--- a/libc/Android.bp
+++ b/libc/Android.bp
@@ -787,12 +787,6 @@
                 "arch-arm64/string/__memset_chk.S",
             ],
         },
-        riscv64: {
-            srcs: [
-                "arch-riscv64/string/__memset_chk.S",
-                "arch-riscv64/string/__memcpy_chk.S",
-            ],
-        },
     },
 }
 
@@ -1102,21 +1096,21 @@
                 "arch-riscv64/bionic/syscall.S",
                 "arch-riscv64/bionic/vfork.S",
 
-                "arch-riscv64/string/memchr_v.S",
-                "arch-riscv64/string/memcmp_v.S",
-                "arch-riscv64/string/memcpy_v.S",
-                "arch-riscv64/string/memmove_v.S",
-                "arch-riscv64/string/memset_v.S",
-                "arch-riscv64/string/stpcpy_v.S",
-                "arch-riscv64/string/strcat_v.S",
-                "arch-riscv64/string/strchr_v.S",
-                "arch-riscv64/string/strcmp_v.S",
-                "arch-riscv64/string/strcpy_v.S",
-                "arch-riscv64/string/strlen_v.S",
-                "arch-riscv64/string/strncat_v.S",
-                "arch-riscv64/string/strncmp_v.S",
-                "arch-riscv64/string/strncpy_v.S",
-                "arch-riscv64/string/strnlen_v.S",
+                "arch-riscv64/string/memchr.S",
+                "arch-riscv64/string/memcmp.S",
+                "arch-riscv64/string/memcpy.S",
+                "arch-riscv64/string/memmove.S",
+                "arch-riscv64/string/memset.S",
+                "arch-riscv64/string/stpcpy.S",
+                "arch-riscv64/string/strcat.S",
+                "arch-riscv64/string/strchr.S",
+                "arch-riscv64/string/strcmp.S",
+                "arch-riscv64/string/strcpy.S",
+                "arch-riscv64/string/strlen.S",
+                "arch-riscv64/string/strncat.S",
+                "arch-riscv64/string/strncmp.S",
+                "arch-riscv64/string/strncpy.S",
+                "arch-riscv64/string/strnlen.S",
             ],
         },
 
@@ -2109,11 +2103,6 @@
                 "arch-arm64/string/__memcpy_chk.S",
             ],
         },
-        riscv64: {
-            srcs: [
-                "arch-riscv64/string/__memcpy_chk.S",
-            ],
-        },
     },
     whole_static_libs: [
         "//external/llvm-libc:llvmlibc",
diff --git a/libc/arch-riscv64/string/__memcpy_chk.S b/libc/arch-riscv64/string/__memcpy_chk.S
deleted file mode 100644
index 4a2d13d..0000000
--- a/libc/arch-riscv64/string/__memcpy_chk.S
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <private/bionic_asm.h>
-
-ENTRY(__memcpy_chk)
-  bleu a2, a3, 1f
-  call __memcpy_chk_fail
-
-1:
-   tail memcpy
-END(__memcpy_chk)
diff --git a/libc/arch-riscv64/string/__memset_chk.S b/libc/arch-riscv64/string/__memset_chk.S
deleted file mode 100644
index a5562cb..0000000
--- a/libc/arch-riscv64/string/__memset_chk.S
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <private/bionic_asm.h>
-
-ENTRY(__memset_chk)
-    bleu    a2, a3, 1f
-    call    __memset_chk_fail
-
-1:
-    tail   memset
-END(__memset_chk)
-
diff --git a/libc/arch-riscv64/string/memchr_v.S b/libc/arch-riscv64/string/memchr.S
similarity index 100%
rename from libc/arch-riscv64/string/memchr_v.S
rename to libc/arch-riscv64/string/memchr.S
diff --git a/libc/arch-riscv64/string/memcmp_v.S b/libc/arch-riscv64/string/memcmp.S
similarity index 100%
rename from libc/arch-riscv64/string/memcmp_v.S
rename to libc/arch-riscv64/string/memcmp.S
diff --git a/libc/arch-riscv64/string/memcpy_v.S b/libc/arch-riscv64/string/memcpy.S
similarity index 87%
rename from libc/arch-riscv64/string/memcpy_v.S
rename to libc/arch-riscv64/string/memcpy.S
index def1d9b..2e41069 100644
--- a/libc/arch-riscv64/string/memcpy_v.S
+++ b/libc/arch-riscv64/string/memcpy.S
@@ -55,31 +55,34 @@
 
 #include <private/bionic_asm.h>
 
-#define pDst a0
-#define pSrc a1
-#define iNum a2
+// Arguments.
+#define dst a0
+#define src a1
+#define n a2
+#define dst_len a3 // __memcpy_chk() only
 
+// Locals.
 #define iVL a3
-#define pDstPtr a4
+#define p a4
 
-#define ELEM_LMUL_SETTING m8
-#define vData v0
+ENTRY(__memcpy_chk)
+    bleu n, dst_len, 1f
+    call __memcpy_chk_fail
+1:  // Fall through to memcpy().
+END(__memcpy_chk)
 
 ENTRY(memcpy)
-
-    mv pDstPtr, pDst
+    mv p, dst
 
 L(loop):
-    vsetvli iVL, iNum, e8, ELEM_LMUL_SETTING, ta, ma
+    vsetvli iVL, n, e8, m8, ta, ma
 
-    vle8.v vData, (pSrc)
-    sub iNum, iNum, iVL
-    add pSrc, pSrc, iVL
-    vse8.v vData, (pDstPtr)
-    add pDstPtr, pDstPtr, iVL
-
-    bnez iNum, L(loop)
+    vle8.v v0, (src)
+    sub n, n, iVL
+    add src, src, iVL
+    vse8.v v0, (p)
+    add p, p, iVL
+    bnez n, L(loop)
 
     ret
-
 END(memcpy)
diff --git a/libc/arch-riscv64/string/memmove_v.S b/libc/arch-riscv64/string/memmove.S
similarity index 100%
rename from libc/arch-riscv64/string/memmove_v.S
rename to libc/arch-riscv64/string/memmove.S
diff --git a/libc/arch-riscv64/string/memset_v.S b/libc/arch-riscv64/string/memset.S
similarity index 87%
rename from libc/arch-riscv64/string/memset_v.S
rename to libc/arch-riscv64/string/memset.S
index 5aa525e..2ebf3e9 100644
--- a/libc/arch-riscv64/string/memset_v.S
+++ b/libc/arch-riscv64/string/memset.S
@@ -55,31 +55,35 @@
 
 #include <private/bionic_asm.h>
 
-#define pDst a0
-#define iValue a1
-#define iNum a2
+// Arguments.
+#define dst a0
+#define ch a1
+#define n a2
+#define dst_len a3 // __memset_chk() only
 
+// Locals.
 #define iVL a3
 #define iTemp a4
-#define pDstPtr a5
+#define p a5
 
-#define ELEM_LMUL_SETTING m8
-#define vData v0
+ENTRY(__memset_chk)
+    bleu n, dst_len, 1f
+    call __memset_chk_fail
+1:  // Fall through to memset().
+END(__memset_chk)
 
 ENTRY(memset)
+    mv p, dst
 
-    mv pDstPtr, pDst
-
-    vsetvli iVL, iNum, e8, ELEM_LMUL_SETTING, ta, ma
-    vmv.v.x vData, iValue
+    vsetvli iVL, n, e8, m8, ta, ma
+    vmv.v.x v0, ch
 
 L(loop):
-    vse8.v vData, (pDstPtr)
-    sub iNum, iNum, iVL
-    add pDstPtr, pDstPtr, iVL
-    vsetvli iVL, iNum, e8, ELEM_LMUL_SETTING, ta, ma
-    bnez iNum, L(loop)
+    vse8.v v0, (p)
+    sub n, n, iVL
+    add p, p, iVL
+    vsetvli iVL, n, e8, m8, ta, ma
+    bnez n, L(loop)
 
     ret
-
 END(memset)
diff --git a/libc/arch-riscv64/string/stpcpy_v.S b/libc/arch-riscv64/string/stpcpy.S
similarity index 100%
rename from libc/arch-riscv64/string/stpcpy_v.S
rename to libc/arch-riscv64/string/stpcpy.S
diff --git a/libc/arch-riscv64/string/strcat_v.S b/libc/arch-riscv64/string/strcat.S
similarity index 100%
rename from libc/arch-riscv64/string/strcat_v.S
rename to libc/arch-riscv64/string/strcat.S
diff --git a/libc/arch-riscv64/string/strchr_v.S b/libc/arch-riscv64/string/strchr.S
similarity index 100%
rename from libc/arch-riscv64/string/strchr_v.S
rename to libc/arch-riscv64/string/strchr.S
diff --git a/libc/arch-riscv64/string/strcmp_v.S b/libc/arch-riscv64/string/strcmp.S
similarity index 100%
rename from libc/arch-riscv64/string/strcmp_v.S
rename to libc/arch-riscv64/string/strcmp.S
diff --git a/libc/arch-riscv64/string/strcpy_v.S b/libc/arch-riscv64/string/strcpy.S
similarity index 100%
rename from libc/arch-riscv64/string/strcpy_v.S
rename to libc/arch-riscv64/string/strcpy.S
diff --git a/libc/arch-riscv64/string/strlen_v.S b/libc/arch-riscv64/string/strlen.S
similarity index 100%
rename from libc/arch-riscv64/string/strlen_v.S
rename to libc/arch-riscv64/string/strlen.S
diff --git a/libc/arch-riscv64/string/strncat_v.S b/libc/arch-riscv64/string/strncat.S
similarity index 100%
rename from libc/arch-riscv64/string/strncat_v.S
rename to libc/arch-riscv64/string/strncat.S
diff --git a/libc/arch-riscv64/string/strncmp_v.S b/libc/arch-riscv64/string/strncmp.S
similarity index 100%
rename from libc/arch-riscv64/string/strncmp_v.S
rename to libc/arch-riscv64/string/strncmp.S
diff --git a/libc/arch-riscv64/string/strncpy_v.S b/libc/arch-riscv64/string/strncpy.S
similarity index 100%
rename from libc/arch-riscv64/string/strncpy_v.S
rename to libc/arch-riscv64/string/strncpy.S
diff --git a/libc/arch-riscv64/string/strnlen_v.S b/libc/arch-riscv64/string/strnlen.S
similarity index 100%
rename from libc/arch-riscv64/string/strnlen_v.S
rename to libc/arch-riscv64/string/strnlen.S