Skip to content

Fix sign_min/sign_max/sign_minmax on AArch64, and generic sign_minmax - #25

Closed
r2d3 wants to merge 1 commit into
lsp-plugins:masterfrom
r2d3:minmax_bug
Closed

r2d3 wants to merge 1 commit into
lsp-plugins:masterfrom
r2d3:minmax_bug

Conversation

@r2d3

@r2d3 r2d3 commented Nov 1, 2026

Copy link
Copy Markdown

ASIMD (asimd/search/minmax.h):

  • OP_SIGN_SEARCH_CORE: remove stray x32 bookkeeping from the x16 block. It made
    sign_min/sign_max ignore up to 15 trailing samples.
  • sign_minmax: clear v1 rather than v2 when count == 0, so max returns 0.
  • sign_minmax: use separate min and max candidates in the final reduction.
    The max lanes were replaced by the min lanes, giving a wrong max.
  • sign_minmax: declare v4-v7 as clobbered.

Generic (generic/search.h):

  • sign_minmax compared the signed value with amax; it now uses the absolute value.

Tests (utest/search):

  • sign_minmax failed only if min AND max were both wrong; it now fails if either is.
  • same for minmax (min AND max should be wrong for the test to fail)
  • Add sizes that exercise the x16 block with short tails.

Tested on Apple M1 Max, macOS 26.6: the new sign_* tests fail before the fix and
pass after it, and the full utest suite passes.

Not tested on other architecture. Test correction could expose bug on these architecture.

@r2d3

r2d3 commented Nov 1, 2026

Copy link
Copy Markdown
Author

What is the active branch for this repo ? master, devel, ... ?

@sadko4u

sadko4u commented Nov 1, 2026

Copy link
Copy Markdown
Collaborator

Hello!

Thanks for the contribution. Merged changes to the devel branch: ae96fa9
Just sad to see this patch coming exactly after 1.2.37 release of LSP Plugins.

Please consider further PRs to be based on the devel branch.

@sadko4u sadko4u closed this Nov 1, 2026
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

Successfully merging this pull request may close these issues.

2 participants