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

umash: update to https://github.com/backtrace-labs/umash/tree/fc4c5b6ca1f06c308e96c43aa080bd766238e092 #307

Merged
merged 1 commit into from
Jan 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion umash.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*
* Copyright 2020-2022 Backtrace I/O, Inc.
* Copyright 2022 Paul Khuong
* Copyright 2022 Dougall Johnson
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
Expand Down Expand Up @@ -162,7 +163,13 @@ v128_clmul(uint64_t x, uint64_t y)
static inline v128
v128_clmul_cross(v128 x)
{
return v128_clmul(vgetq_lane_u64(x, 0), vgetq_lane_u64(x, 1));
v128 swapped = vextq_u64(x, x, 1);
#if UMASH_INLINE_ASM
/* Keep the result out of GPRs. */
__asm__("" : "+w"(swapped));
#endif

return v128_clmul(vgetq_lane_u64(x, 0), vgetq_lane_u64(swapped, 0));
}

#else
Expand Down Expand Up @@ -306,6 +313,14 @@ add_mod_slow(uint64_t x, uint64_t y)
if (LIKELY(sum < (uint64_t)-16))
return sum + fixup;

#ifdef UMASH_INLINE_ASM
/*
* Some compilers like to compile the likely branch above with
* conditional moves or predication. Insert a compiler barrier
* in the slow path here to force a branch.
*/
__asm__("" : "+r"(sum));
#endif
return add_mod_slow_slow_path(sum, fixup);
}

Expand Down
Loading
Loading