MCPcopy Create free account
hub / github.com/DLTcollab/sse2neon / test_ordered_unordered_cmp

Function test_ordered_unordered_cmp

tests/fuzz.cpp:815–855  ·  view source on GitHub ↗

Strategy 11: Ordered vs Unordered Comparisons * * Tests comieq/ucomieq differences in NaN handling and flag setting. */

Source from the content-addressed store, hash-verified

813 * Tests comieq/ucomieq differences in NaN handling and flag setting.
814 */
815static void test_ordered_unordered_cmp(const uint8_t *data, size_t size)
816{
817 if (size < 16)
818 return;
819
820 __m128 a = _mm_loadu_ps((const float *) data);
821 __m128 b = _mm_loadu_ps((const float *) (data + (size >= 32 ? 16 : 0)));
822 __m128d da = _mm_loadu_pd((const double *) data);
823 __m128d db = _mm_loadu_pd((const double *) (data + (size >= 32 ? 16 : 0)));
824
825 __m128 nan_ps = _mm_set1_ps(__builtin_nanf(""));
826 __m128d nan_pd = _mm_set1_pd(__builtin_nan(""));
827
828 /* Ordered comparisons (signal on QNaN) */
829 SINK_I32(_mm_comieq_ss(a, b));
830 SINK_I32(_mm_comilt_ss(a, b));
831 SINK_I32(_mm_comile_ss(a, b));
832 SINK_I32(_mm_comigt_ss(a, b));
833 SINK_I32(_mm_comige_ss(a, b));
834 SINK_I32(_mm_comineq_ss(a, b));
835
836 /* Unordered comparisons (quiet on QNaN) */
837 SINK_I32(_mm_ucomieq_ss(a, b));
838 SINK_I32(_mm_ucomilt_ss(a, b));
839 SINK_I32(_mm_ucomile_ss(a, b));
840 SINK_I32(_mm_ucomigt_ss(a, b));
841 SINK_I32(_mm_ucomige_ss(a, b));
842 SINK_I32(_mm_ucomineq_ss(a, b));
843
844 /* Compare with NaN */
845 SINK_I32(_mm_comieq_ss(a, nan_ps));
846 SINK_I32(_mm_ucomieq_ss(a, nan_ps));
847 SINK_I32(_mm_comilt_ss(nan_ps, a));
848 SINK_I32(_mm_ucomilt_ss(nan_ps, a));
849
850 /* Double precision */
851 SINK_I32(_mm_comieq_sd(da, db));
852 SINK_I32(_mm_ucomieq_sd(da, db));
853 SINK_I32(_mm_comieq_sd(da, nan_pd));
854 SINK_I32(_mm_ucomieq_sd(da, nan_pd));
855}
856
857/* Strategy 12: Dot Product Operations
858 *

Callers 1

LLVMFuzzerTestOneInputFunction · 0.85

Calls 11

_mm_loadu_psFunction · 0.85
_mm_loadu_pdFunction · 0.85
_mm_set1_psFunction · 0.85
_mm_set1_pdFunction · 0.85
_mm_comieq_ssFunction · 0.85
_mm_comilt_ssFunction · 0.85
_mm_comile_ssFunction · 0.85
_mm_comigt_ssFunction · 0.85
_mm_comige_ssFunction · 0.85
_mm_comineq_ssFunction · 0.85
_mm_comieq_sdFunction · 0.85

Tested by

no test coverage detected