Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FS#1886 - builtin_memcmp(a,b,c) != 0 not used on mips with -Os or -O2 #5950

Open
openwrt-bot opened this issue Oct 8, 2018 · 1 comment
Open
Labels
flyspray toolchain pull request/issue with toolchain related changes

Comments

@openwrt-bot
Copy link

dtaht:

Supply the following if possible:

  • Device problem occurs on

mips, probably everything except x86_64.

  • Software versions of OpenWrt/LEDE release, packages, etc.

18.06.1

  • Steps to reproduce

Well, the simple way is to cross compile anything that uses a pattern like
memcmp(a,b,c) != 0 // (or ==) and count up the memcmps via objdump.

The != or == pattern gets substituted for a string of xors and a final or, which
is way faster than memcmp can ever be. It was added to gcc 7.

I was building the babel daemon and wondering why my x86_64 compiler was doing
the right thing but not the mips compiler of the same era.

memcmp is pretty expensive for 16 byte (ipv6 prefixes) compares especially when
you only care about equal or not equal. Code's usually smaller too. Nothing faster than xor exists.

@openwrt-bot
Copy link
Author

jow-:

Uhm, shouldn't you report this upstream to gcc?

@aparcar aparcar added the toolchain pull request/issue with toolchain related changes label Feb 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flyspray toolchain pull request/issue with toolchain related changes
Projects
None yet
Development

No branches or pull requests

2 participants