@@ -497,6 +497,13 @@ riscv_expand_strcmp (rtx result, rtx src1, rtx src2,
return false;
nbytes = UINTVAL (bytes_rtx);
+ /* If NBYTES is zero the result of strncmp will always be zero,
+ but that would require special casing in the caller. So for
+ now just don't do an inline expansion. This probably rarely
+ happens in practice, but it is tested by the testsuite. */
+ if (nbytes == 0)
+ return false;
+
/* We don't emit parts of a strncmp() call. */
if (nbytes > compare_max)
return false;
@@ -515,15 +515,15 @@ Target Var(TARGET_INLINE_SUBWORD_ATOMIC) Init(1)
Always inline subword atomic operations.
minline-strcmp
-Target Var(riscv_inline_strcmp) Init(0)
+Target Var(riscv_inline_strcmp) Init(1)
Inline strcmp calls if possible.
minline-strncmp
-Target Var(riscv_inline_strncmp) Init(0)
+Target Var(riscv_inline_strncmp) Init(1)
Inline strncmp calls if possible.
minline-strlen
-Target Var(riscv_inline_strlen) Init(0)
+Target Var(riscv_inline_strlen) Init(1)
Inline strlen calls if possible.
-param=riscv-strcmp-inline-limit=
@@ -1,6 +1,6 @@
/* { dg-do compile } */
-/* { dg-options "-march=rv32gc_zbb" { target { rv32 } } } */
-/* { dg-options "-march=rv64gc_zbb" { target { rv64 } } } */
+/* { dg-options "-mno-inline-strlen -march=rv32gc_zbb" { target { rv32 } } } */
+/* { dg-options "-mno-inline-strlen -march=rv64gc_zbb" { target { rv64 } } } */
/* { dg-skip-if "" { *-*-* } { "-O0" "-Os" "-Og" "-Oz" } } */
typedef long unsigned int size_t;