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

Failures to use optimal math routine #49

Open
20 tasks
runer112 opened this issue Nov 11, 2024 · 0 comments
Open
20 tasks

Failures to use optimal math routine #49

runer112 opened this issue Nov 11, 2024 · 0 comments

Comments

@runer112
Copy link

runer112 commented Nov 11, 2024

Absolute value

All of them synthesize the operation (poorly)

  • int8_t
  • int16_t
  • int24_t
  • int32_t
  • int48_t
  • int64_t

Bit reverse

  • uint48_t foo(uint48_t x) { return __builtin_bitreverse64(x) >> 16; } uses __llbitrev instead of __i48bitrev (but __builtin_bitreverse32(x >> 16) | (uint48_t)__builtin_bitreverse16(x) << 32 is fine?)

Byte swap

Division

  • int8_t foo(int8_t x, int8_t y) { return x / y; } uses __sdivs instead of __bdivs
  • int16_t foo(int16_t x, int16_t y) { return x / y; } uses __idivs instead of __sdivs

Negation

  • int48_t foo(int48_t x) { return -x; } synthesizes the operation (poorly) instead of using __i48abs

Remainder

  • int8_t foo(int8_t x, int8_t y) { return x % y; } uses __srems instead of __brems
  • int16_t foo(int16_t x, int16_t y) { return x % y; } uses __irems instead of __srems

Shift left

  • int8_t foo(int8_t x, int8_t y) { return x << y; } uses __ishl instead of __bshl
  • int16_t foo(int16_t x, int16_t y) { return x << y; } uses __ishl instead of __sshl

Shift right

  • int8_t foo(int8_t x, int8_t y) { return x >> y; } uses __ishrs instead of __bshl
  • uint8_t foo(uint8_t x, uint8_t y) { return x >> y; } uses __ishru instead of __bshru
  • int16_t foo(int16_t x, int16_t y) { return x >> y; } uses __ishrs instead of __sshrs
  • uint16_t foo(uint16_t x, uint16_t y) { return x >> y; } uses __ishru instead of __sshru
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant