Re: ARM Cortex-A7 feature misdetection

2018-02-07 Thread Jeffrey Walton
On Tue, Feb 6, 2018 at 2:33 PM, Torbjörn Granlund  wrote:
> Jeffrey Walton  writes:
>
>   > You should edit the .asm source files under mpn/arm/neon. Before m4
>   > processing.
>
> There are at least two neon subdirs under mpn/arm.
>
>   I see one file that looks interesting (lshiftc.asm):
>
>   $ ls mpn/arm/neon/
>   README   lorrshift.asm  sec_tabselect.asm
>   hamdist.asm  lshiftc.asmpopcount.asm
>
>   Does this look about right:
>
>   # mpn/arm/neon/lshiftc.asm
>   ...
>
>   ASM_START()
>   TEXT
>   ALIGN(64)
>   .fpu neon
>   PROLOGUE(mpn_lshiftc)
>   IFLSH(` mov r12, n, lsl #2  ')
>   IFLSH(` add rp, rp, r12 ')
>   IFLSH(` add ap, ap, r12 ')
>
> I think this is perhaps not as clean as one would want it to be.
> Perhaps add a parameter to ASM_START, or add a new macro which could be
> made empty for machines which do not need or accept the new directive.
>
> (About your error: Your adting the lshiftc.asm file. Note the c at the
> end.  Wrong file.)

Thanks .

OK, so I added '.fpu neon' to  mpn/arm/lshift.asm:

ASM_START()
PROLOGUE(mpn_lshift)
.fpuneon
add up, up, n, lsl #2
push{r4, r6, r7, r8}
...

It produces the same error. I'm still not sure if this is the correct
fix applied to the correct file.

So let me back up and ask, what is the name of the file I should be
editing? Once I have the name of the file we can move on to the
changes that should be made.

Jeff
___
gmp-bugs mailing list
gmp-bugs@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-bugs


Re: ARM Cortex-A7 feature misdetection

2018-02-05 Thread Niels Möller
Jeffrey Walton  writes:

> I believe ARM AS and LD are not like i386/x86_64 tools. You must
> explicitly enable the ISA, or it is not available (like shown below).

What I've done in other neon assembly files is to add a

  .fpu neon

pseudo-op early in the file. Seems less brittle to me than passing the
corresponding command line options, in particular for fat builds (i.e.,
some files with neon assembly, used at runtime only after some check of
available instructions), where one might not want the C compiler to emit
any neon instructions.

Regards,
/Niels

-- 
Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677.
Internet email is subject to wholesale government surveillance.
___
gmp-bugs mailing list
gmp-bugs@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-bugs


Re: ARM Cortex-A7 feature misdetection

2018-02-04 Thread Jeffrey Walton
On Sun, Feb 4, 2018 at 4:16 PM, Marc Glisse  wrote:
> On Sun, 4 Feb 2018, Jeffrey Walton wrote:
>
>> gcc -std=gnu99 -c -DHAVE_CONFIG_H -I. -I.. -D__GMP_WITHIN_GMP -I..
>> -DOPERATION_rshift -I/usr/local/include -DNDEBUG -march=native -fPIC
>> -Wa,--noexecstack tmp-rshift.s -fPIC -DPIC -o .libs/rshift.o
>
>
> and
>
>>  CC="gcc -std=gnu99"
>>  CFLAGS="-O2 -pedantic -fomit-frame-pointer -march=armv7-a
>> -mfloat-abi=hard -mfpu=neon -mtune=cortex-a7"
>
>
> don't match. Are you sure they come from the same build? -march=native
> makes me think you set your own CFLAGS...

Yes, these are the flags I use as a baseline. They are set in the environment.

PKGCONFIG: /usr/local/lib/pkgconfig
 CPPFLAGS: -I/usr/local/include -DNDEBUG
   CFLAGS: -g -march=native -fPIC
 CXXFLAGS: -g -march=native -fPIC
  LDFLAGS: -L/usr/local/lib -Wl,-R,/usr/local/lib -Wl,--enable-new-dtags
   LDLIBS: -ldl -lpthread

I don't force the override. I.e., I do not perform:

make CPPFLAGS="" CFLAGS="..."

Below is the config with my tweaks.

checking build system type... armcortexa7neon-unknown-linux-gnueabihf
checking host system type... armcortexa7neon-unknown-linux-gnueabihf
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking ABI=32
checking compiler gcc -g -march=native -fPIC -I/usr/local/include
-DNDEBUG... yes
checking whether ARM gcc unsigned division works... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking for gcc option to accept ISO C99... -std=gnu99
checking for gcc -std=gnu99 option to accept ISO Standard C...
(cached) -std=gnu99
checking how to run the C preprocessor... gcc -std=gnu99 -E
checking build system compiler gcc -std=gnu99... yes
checking for build system preprocessor... gcc -std=gnu99 -E
checking for build system executable suffix...
checking whether build system compiler is ANSI... yes
checking for build system compiler math library... -lm
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
using ABI="32"
  CC="gcc -std=gnu99"
  CFLAGS="-g -march=native -fPIC"
  CPPFLAGS="-I/usr/local/include -DNDEBUG"
  MPN_PATH=" arm/neon arm/v7a/cora7 arm/v6t2 arm/v6 arm/v5 arm generic"
checking whether assembler supports --noexecstack option... yes
checking for ar... ar
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking how to print strings... printf
checking for a sed that does not truncate output... /bin/sed
checking for fgrep... /bin/grep -F
checking for ld used by gcc -std=gnu99... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking how to convert armcortexa7neon-unknown-linux-gnueabihf file
names to armcortexa7neon-unknown-linux-gnueabihf format...
func_convert_file_noop
checking how to convert armcortexa7neon-unknown-linux-gnueabihf file
names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... dlltool
checking how to associate runtime and link libraries... printf %s\n
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc -std=gnu99 object... ok
checking for sysroot... no
checking for a working dd... /bin/dd
checking how to truncate binary pipes... /bin/dd bs=4096 count=1
checking for mt... mt
checking if mt is a manifest tool... no
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc -std=gnu99 supports -fno-rtti -fno-exceptions... no
checking for gcc -std=gnu99 option to produce PIC... -fPIC -DPIC
checking if gcc -std=gnu99 PIC flag -fPIC -DPIC 

Re: ARM Cortex-A7 feature misdetection

2018-02-04 Thread Marc Glisse

On Sun, 4 Feb 2018, Jeffrey Walton wrote:


gcc -std=gnu99 -c -DHAVE_CONFIG_H -I. -I.. -D__GMP_WITHIN_GMP -I..
-DOPERATION_rshift -I/usr/local/include -DNDEBUG -march=native -fPIC
-Wa,--noexecstack tmp-rshift.s -fPIC -DPIC -o .libs/rshift.o


and


 CC="gcc -std=gnu99"
 CFLAGS="-O2 -pedantic -fomit-frame-pointer -march=armv7-a
-mfloat-abi=hard -mfpu=neon -mtune=cortex-a7"


don't match. Are you sure they come from the same build? -march=native
makes me think you set your own CFLAGS...

--
Marc Glisse
___
gmp-bugs mailing list
gmp-bugs@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-bugs