[clang] d2cb189 - [X86] Use a do {} while (0) in the _MM_EXTRACT_FLOAT implementation.
Craig Topper via cfe-commits
cfe-commits at lists.llvm.org
Sat Aug 14 16:49:02 PDT 2021
Author: Craig Topper
Date: 2021-08-14T16:41:55-07:00
New Revision: d2cb18918498b8a39657af2a495eba3e983c159b
URL: https://github.com/llvm/llvm-project/commit/d2cb18918498b8a39657af2a495eba3e983c159b
DIFF: https://github.com/llvm/llvm-project/commit/d2cb18918498b8a39657af2a495eba3e983c159b.diff
LOG: [X86] Use a do {} while (0) in the _MM_EXTRACT_FLOAT implementation.
Previously we just used {}, but that doesn't work in situations
like this.
if (1)
_MM_EXTRACT_FLOAT(d, x, n);
else
...
The semicolon would terminate the if.
Added:
Modified:
clang/lib/Headers/smmintrin.h
Removed:
################################################################################
diff --git a/clang/lib/Headers/smmintrin.h b/clang/lib/Headers/smmintrin.h
index c55e6dc65c49..8913a196144b 100644
--- a/clang/lib/Headers/smmintrin.h
+++ b/clang/lib/Headers/smmintrin.h
@@ -871,7 +871,7 @@ _mm_max_epu32 (__m128i __V1, __m128i __V2)
/* Miscellaneous insert and extract macros. */
/* Extract a single-precision float from X at index N into D. */
#define _MM_EXTRACT_FLOAT(D, X, N) \
- { (D) = __builtin_ia32_vec_ext_v4sf((__v4sf)(__m128)(X), (int)(N)); }
+ do { (D) = __builtin_ia32_vec_ext_v4sf((__v4sf)(__m128)(X), (int)(N)); } while (0)
/* Or together 2 sets of indexes (X and Y) with the zeroing bits (Z) to create
an index suitable for _mm_insert_ps. */
More information about the cfe-commits
mailing list