I posted this as a comment on GitHub [1] but writing this here in case
it isn't seen:

Has anyone tried to use the ARMv7-m optimized (assembly-coded) strcmp?

I cannot seem to build with CONFIG_ARMV7M_STRCMP:

```
$ tools/configure.sh tm4c129e-launchpad:nsh

(snip)

$ make menuconfig
```

Here I enable these options:
CONFIG_ARMV7M_MEMCHR=y
CONFIG_ARMV7M_MEMCPY=y
CONFIG_ARMV7M_MEMMOVE=y
CONFIG_ARMV7M_MEMSET=y
CONFIG_ARMV7M_STRCMP=y
CONFIG_ARMV7M_STRCPY=y
CONFIG_ARMV7M_STRLEN=y

```
$ make
Create version.h
LN: platform/board to /home/work/NuttX/apps/platform/dummy
Register: ping
Register: nsh
Register: sh
Register: telnetd
AS:  machine/arm/armv7-m/gnu/arch_strcmp.S
machine/arm/armv7-m/gnu/arch_strcmp.S: Assembler messages:
machine/arm/armv7-m/gnu/arch_strcmp.S:51: Error: bad instruction `def_fn strcmp'
machine/arm/armv7-m/gnu/arch_strcmp.S:75: Error: bad instruction `s2lo
r12,r3,r12'
machine/arm/armv7-m/gnu/arch_strcmp.S:94: Error: bad instruction `s2hi
r0,r2,#24'
machine/arm/armv7-m/gnu/arch_strcmp.S:95: Error: bad instruction `s2lo r2,r2,#8'
machine/arm/armv7-m/gnu/arch_strcmp.S:98: Error: shift expression
expected -- `cmpcs r0,r3,S2HI#24'
machine/arm/armv7-m/gnu/arch_strcmp.S:99: Error: IT falling in the
range of a previous IT block -- `it eq'
machine/arm/armv7-m/gnu/arch_strcmp.S:100: Error: bad instruction
`s2loeq r3,r3,#8'
machine/arm/armv7-m/gnu/arch_strcmp.S:247: Error: shift expression
expected -- `cmp r5,r3,S2LO#8'
machine/arm/armv7-m/gnu/arch_strcmp.S:256: Error: shift expression
expected -- `cmp r5,r3,S2HI#24'
machine/arm/armv7-m/gnu/arch_strcmp.S:261: Error: bad instruction
`s2lo r3,r3,#8'
machine/arm/armv7-m/gnu/arch_strcmp.S:278: Error: bad instruction
`s2lo r5,r2,#24'
machine/arm/armv7-m/gnu/arch_strcmp.S:285: Error: bad instruction
`s2lo r5,r2,#24'
machine/arm/armv7-m/gnu/arch_strcmp.S:292: Error: bad instruction
`s2hi r5,r2,#16'
machine/arm/armv7-m/gnu/arch_strcmp.S:294: Error: bad instruction
`s2lo r5,r5,#16'
machine/arm/armv7-m/gnu/arch_strcmp.S:296: Error: shift expression
expected -- `cmp r5,r3,S2LO#16'
machine/arm/armv7-m/gnu/arch_strcmp.S:303: Error: shift expression
expected -- `cmp r5,r3,S2HI#16'
machine/arm/armv7-m/gnu/arch_strcmp.S:321: Error: bad instruction
`s2lo r5,r2,#16'
machine/arm/armv7-m/gnu/arch_strcmp.S:328: Error: bad instruction
`s2hi r3,r3,#16'
machine/arm/armv7-m/gnu/arch_strcmp.S:329: Error: bad instruction
`s2lo r5,r2,#16'
machine/arm/armv7-m/gnu/arch_strcmp.S:331: Error: bad instruction
`s2lo r3,r3,#16'
machine/arm/armv7-m/gnu/arch_strcmp.S:338: Error: shift expression
expected -- `cmp r5,r3,S2LO#24'
machine/arm/armv7-m/gnu/arch_strcmp.S:347: Error: shift expression
expected -- `cmp r5,r3,S2HI#8'
machine/arm/armv7-m/gnu/arch_strcmp.S:352: Error: bad instruction
`s2lo r3,r3,#24'
machine/arm/armv7-m/gnu/arch_strcmp.S:361: Error: bad instruction
`s2lo r5,r2,#8'
machine/arm/armv7-m/gnu/arch_strcmp.S:380: Error: bad instruction
`s2loeq r5,r5,#8'
machine/arm/armv7-m/gnu/arch_strcmp.S:381: Error: bad instruction
`s2loeq r3,r3,#8'
machine/arm/armv7-m/gnu/arch_strcmp.S:382: Error: branch must be last
instruction in IT block -- `beq .Lstrcmp_tail'
machine/arm/armv7-m/gnu/arch_strcmp.S:383: Error: instruction not
allowed in IT block -- `sub r0,r2,r0'
machine/arm/armv7-m/gnu/arch_strcmp.S:73: Error: undefined symbol MSB
used as an immediate value
machine/arm/armv7-m/gnu/arch_strcmp.S:246: Error: undefined symbol MSB
used as an immediate value
machine/arm/armv7-m/gnu/arch_strcmp.S:286: Error: undefined symbol LSB
used as an immediate value
machine/arm/armv7-m/gnu/arch_strcmp.S:337: Error: undefined symbol LSB
used as an immediate value
machine/arm/armv7-m/gnu/arch_strcmp.S:357: Error: undefined symbol LSB
used as an immediate value
machine/arm/armv7-m/gnu/arch_strcmp.S:362: Error: undefined symbol MSB
used as an immediate value
machine/arm/armv7-m/gnu/arch_strcmp.S:374: Error: undefined symbol LSB
used as an immediate value
machine/arm/armv7-m/gnu/arch_strcmp.S:375: Error: undefined symbol LSB
used as an immediate value
{standard input}: Error: .size expression for strcmp does not evaluate
to a constant
make[1]: *** [Makefile:143: bin/arch_strcmp.o] Error 1
make: *** [tools/LibTargets.mk:180: libs/libc/libc.a] Error 2
```

I noticed that some of the other files have something like this:

```
.macro def_fn f p2align=0
  .text
  .p2align \p2align
  .global \f
  .type \f, %function
 \f:
  .endm

```

However I do not understand the assembly sources so I don't know
what will happen if I copy-and-paste that.

Interestingly, I found the newlib code and it also doesn't have the
macro def_fn. See [2].

[1] https://github.com/apache/nuttx/pull/8042#issuecomment-1527653447

[2] 
https://cygwin.com/git/?p=newlib-cygwin.git;a=blob;f=newlib/libc/machine/arm/strcmp-armv7.S;h=7cafca151b162210c2af4a512a14255a2aecc4cd;hb=HEAD

Cheers,
Nathan

Reply via email to