[compiler-rt] [compiler-rt][nsan] Add support for nan detection (PR #101531)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 15 00:29:04 PDT 2024
================
@@ -0,0 +1,35 @@
+// RUN: %clangxx_nsan -O0 -g -mavx %s -o %t
+// RUN: NSAN_OPTIONS=check_nan=true,halt_on_error=0 %run %t 2>&1 | FileCheck %s
+// RUN: %clangxx_nsan -O3 -g -mavx %s -o %t
+// RUN: NSAN_OPTIONS=check_nan=true,halt_on_error=0 %run %t 2>&1 | FileCheck %s
+
+#include <cmath>
+#include <immintrin.h>
+#include <iostream>
+
+void simd_sqrt(const float *input, float *output, size_t size) {
+ size_t i = 0;
+ for (; i + 7 < size; i += 8) {
+ __m256 vec = _mm256_loadu_ps(&input[i]);
+ __m256 result = _mm256_sqrt_ps(vec);
+ _mm256_storeu_ps(&output[i], result);
+ // when simd is used, the warning is not triggered
----------------
cseslowpoke wrote:
Sure, I’ll check the generated LLVM IR to identify where the issue might be.
https://github.com/llvm/llvm-project/pull/101531
More information about the llvm-commits
mailing list