Skip to content

Commit

Permalink
Add workaround for rustc bug rust-lang/rust#116359
Browse files Browse the repository at this point in the history
by zeroing all sse2 registers on x86-64 architectures at start of processing loop
  • Loading branch information
spfenwick committed Oct 7, 2023
1 parent 947fa9c commit d266043
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/filters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,30 @@ impl FilterGroup {
/// Apply all the filters to an AudioChunk.
fn process_chunk(&mut self, input: &mut AudioChunk) -> Res<()> {
if !input.waveforms[self.channel].is_empty() {
// Zeroes all sse registers on x86_64 architecturesto work around
// rustc bug https://github.com/rust-lang/rust/issues/116359
#[cfg(target_arch = "x86_64")]
unsafe {
use std::arch::asm;
asm!(
"xorpd xmm0, xmm0",
"xorpd xmm1, xmm1",
"xorpd xmm2, xmm2",
"xorpd xmm3, xmm3",
"xorpd xmm4, xmm4",
"xorpd xmm5, xmm5",
"xorpd xmm6, xmm6",
"xorpd xmm7, xmm7",
"xorpd xmm8, xmm8",
"xorpd xmm9, xmm9",
"xorpd xmm10, xmm10",
"xorpd xmm11, xmm11",
"xorpd xmm12, xmm12",
"xorpd xmm13, xmm13",
"xorpd xmm14, xmm14",
"xorpd xmm15, xmm15"
)
}
for filter in &mut self.filters {
filter.process_waveform(&mut input.waveforms[self.channel])?;
}
Expand Down

0 comments on commit d266043

Please sign in to comment.