You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
chromium/chromium-85-oscillator_node...

35 lines
1.5 KiB

4 years ago
From abd4ce23840614bb9e47fd0e674d1cbe74ec3fb6 Mon Sep 17 00:00:00 2001
From: Jose Dapena Paz <jdapena@igalia.com>
Date: Tue, 16 Jun 2020 21:08:28 +0200
Subject: [PATCH] fixup: do not return to 128 integer word from _mm_cmplt_ps in v_wrap_virtual_index.
After the changes to convert to SIMD several operations in
WebAudio oscillator node, GCC refuses to compile a call to _mm_cmplt_ps
as it returns to an m128i (integer quad), though the declaration of
_mm_cmplt_ps expects to return to an m128 (float quad).
To fix that, we reinterpret_cast<__m128i>. When we obtain 0xffffffff,
that is NaN, if we interpret it as an integer, it will convert it to
0x80000000, which is wrong.
Verified with webaudio/Oscillator/* web tests.
Bug: 819294
Change-Id: Ia00a7695476e84996548b6c679ffeedead49213b
---
diff --git a/third_party/blink/renderer/modules/webaudio/oscillator_node.cc b/third_party/blink/renderer/modules/webaudio/oscillator_node.cc
index 0e38932..03ff1da 100644
--- a/third_party/blink/renderer/modules/webaudio/oscillator_node.cc
+++ b/third_party/blink/renderer/modules/webaudio/oscillator_node.cc
@@ -377,7 +377,8 @@
// cmplt(a,b) returns 0xffffffff (-1) if a < b and 0 if not. So cmp is -1 or
// 0 depending on whether r < f, which is what we need to compute floor(r).
- const __m128i cmp = _mm_cmplt_ps(r, _mm_cvtepi32_ps(f));
+ const __m128i cmp =
+ reinterpret_cast<__m128i>(_mm_cmplt_ps(r, _mm_cvtepi32_ps(f)));
// This subtracts 1 if needed to get floor(r).
f = _mm_add_epi32(f, cmp);