[PATCH v5 2/2] lib/string_kunit: extend benchmarks and unit test to memcmp()

kernel test robot lkp at intel.com
Tue May 19 17:45:02 PDT 2026


Hi Milan,

kernel test robot noticed the following build errors:

[auto build test ERROR on kees/for-next/hardening]
[also build test ERROR on next-20260519]
[cannot apply to linus/master v6.16-rc1]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Milan-Tripkovic/riscv-lib-add-memcmp-implementation/20260519-221028
base:   https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/hardening
patch link:    https://lore.kernel.org/r/20260519140029.1190381-3-milant2002%40gmail.com
patch subject: [PATCH v5 2/2] lib/string_kunit: extend benchmarks and unit test to memcmp()
config: riscv-allnoconfig-bpf (https://download.01.org/0day-ci/archive/20260520/202605200211.1iDJR97h-lkp@intel.com/config)
compiler: riscv64-linux-gnu-gcc (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260520/202605200211.1iDJR97h-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp at intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202605200211.1iDJR97h-lkp@intel.com/

All errors (new ones prefixed by >>):

   arch/riscv/lib/memcmp.S: Assembler messages:
>> arch/riscv/lib/memcmp.S:58: Error: unrecognized opcode `rev8 t1,t1', extension `zbb' or `zbkb' required
>> arch/riscv/lib/memcmp.S:59: Error: unrecognized opcode `rev8 t2,t2', extension `zbb' or `zbkb' required
   arch/riscv/lib/memcmp.S:85: Error: unrecognized opcode `rev8 t1,t1', extension `zbb' or `zbkb' required
   arch/riscv/lib/memcmp.S:86: Error: unrecognized opcode `rev8 t2,t2', extension `zbb' or `zbkb' required


vim +58 arch/riscv/lib/memcmp.S

    12	
    13	/* int memcmp(const void *cs, const void *ct, size_t n) */
    14	SYM_FUNC_START(memcmp)
    15	/*
    16	 * Parameters
    17	 *	a0 - Pointer to first memory block (cs), also return value
    18	 *	a1 - Pointer to second memory block (ct)
    19	 *	a2 - Number of bytes to compare (n), decremented during loop
    20	 *
    21	 * Returns
    22	 *	a0 - 0 if equal, positive if cs > ct, negative if cs < ct
    23	 *
    24	 * Clobbers
    25	 *	t0, t1, t2, t3, t4
    26	 */
    27		add	t3, a0, a2
    28		or	t0, a0, a1
    29		andi	t0, t0, (SZREG - 1)
    30		bnez	t0, 5f
    31	
    32		addi	t4, t3, -SZREG
    33		bltu	t4, a0, 7f
    34	
    35	1:
    36		REG_L	t1, 0(a0)
    37		REG_L	t2, 0(a1)
    38		bne	t1, t2, 2f
    39		addi	a0, a0, SZREG
    40		addi	a1, a1, SZREG
    41		bleu	a0, t4, 1b
    42	
    43	#if defined(CONFIG_TOOLCHAIN_HAS_ZBB)
    44	7:
    45		__ALTERNATIVE_CFG("j 5f", "nop", 0, RISCV_ISA_EXT_ZBB,
    46				  IS_ENABLED(CONFIG_RISCV_ISA_ZBB))
    47	
    48		beq	a0, t3, 4f
    49		REG_L	t1, 0(a0)
    50		REG_L	t2, 0(a1)
    51	
    52		sub	t0, t3, a0
    53		li	t4, SZREG
    54		sub	t0, t4, t0
    55		slli	t0, t0, 3
    56	
    57	#ifndef CONFIG_CPU_BIG_ENDIAN
  > 58		rev8	t1, t1
  > 59		rev8	t2, t2
    60	#endif
    61		srl	t1, t1, t0
    62		srl	t2, t2, t0
    63	
    64		bne	t1, t2, 8f
    65		li	a0, 0
    66		ret
    67	#else
    68		j	5f
    69	#endif
    70	5:
    71		beq	a0, t3, 4f
    72	6:
    73		lbu	t1, 0(a0)
    74		lbu	t2, 0(a1)
    75		bne	t1, t2, 3f
    76		addi	a0, a0, 1
    77		addi	a1, a1, 1
    78		bne	a0, t3, 6b
    79	

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki



More information about the linux-riscv mailing list