Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add parentheses for macro parameters #663

Merged
merged 5 commits into from
Feb 17, 2025
Merged

Conversation

toxieainc
Copy link
Contributor

..to avoid potential trouble

@jserv
Copy link
Member

jserv commented Feb 16, 2025

CI breakage on Arm64 host:

  WARNING: The requested image's platform (linux/arm64/v8) does not match the detected host platform (linux/amd64/v3) and no specific platform was requested
  g++ -o tests/binding.o -Wall -Wcast-qual -Wconversion -I. -march=armv8-a+fp+simd -std=gnu++14 -c -MMD -MF tests/binding.o.d tests/binding.cpp
  g++ -o tests/common.o -Wall -Wcast-qual -Wconversion -I. -march=armv8-a+fp+simd -std=gnu++14 -c -MMD -MF tests/common.o.d tests/common.cpp
  g++ -o tests/impl.o -Wall -Wcast-qual -Wconversion -I. -march=armv8-a+fp+simd -std=gnu++14 -c -MMD -MF tests/impl.o.d tests/impl.cpp
  g++ -o tests/main.o -Wall -Wcast-qual -Wconversion -I. -march=armv8-a+fp+simd -std=gnu++14 -c -MMD -MF tests/main.o.d tests/main.cpp
  g++ -lm -o tests/main tests/binding.o tests/common.o tests/impl.o tests/main.o
  g++: internal compiler error: Segmentation fault signal terminated program collect2
  Please submit a full bug report,
  with preprocessed source if appropriate.
  See <file:///usr/share/doc/gcc-11/README.Bugs> for instructions.
  make: *** [Makefile:76: tests/main] Error 4

@toxieainc
Copy link
Contributor Author

Extremely weird..

@toxieainc
Copy link
Contributor Author

Must have been a glitch. 2 runs with slight changes now went through.

@jserv
Copy link
Member

jserv commented Feb 17, 2025

Must have been a glitch. 2 runs with slight changes now went through.

Indent with clang-format-18. That is,

@@ -6235,32 +6232,32 @@ FORCE_INLINE __m64 _mm_abs_pi8(__m64 a)
 // the result right by imm8 bytes, and store the low 16 bytes in dst.
 // https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_alignr_epi8
 #if defined(__GNUC__) && !defined(__clang__)
-#define _mm_alignr_epi8(a, b, imm)                                                \
-    __extension__({                                                               \
-        uint8x16_t _a = vreinterpretq_u8_m128i(a);                                \
-        uint8x16_t _b = vreinterpretq_u8_m128i(b);                                \
-        __m128i ret;                                                              \
-        if (_sse2neon_unlikely((imm) & ~31))                                      \
-            ret = vreinterpretq_m128i_u8(vdupq_n_u8(0));                          \
-        else if ((imm) >= 16)                                                     \
-            ret = _mm_srli_si128(a, (imm) >= 16 ? (imm) - 16 : 0);                \
-        else                                                                      \
-            ret =                                                                 \
-                vreinterpretq_m128i_u8(vextq_u8(_b, _a, (imm) < 16 ? (imm) : 0)); \
-        ret;                                                                      \
+#define _mm_alignr_epi8(a, b, imm)                                 \
+    __extension__({                                                \
+        uint8x16_t _a = vreinterpretq_u8_m128i(a);                 \
+        uint8x16_t _b = vreinterpretq_u8_m128i(b);                 \
+        __m128i ret;                                               \
+        if (_sse2neon_unlikely((imm) & ~31))                       \
+            ret = vreinterpretq_m128i_u8(vdupq_n_u8(0));           \
+        else if ((imm) >= 16)                                      \
+            ret = _mm_srli_si128(a, (imm) >= 16 ? (imm) - 16 : 0); \
+        else                                                       \
+            ret = vreinterpretq_m128i_u8(                          \
+                vextq_u8(_b, _a, (imm) < 16 ? (imm) : 0));         \
+        ret;                                                       \
     })
 
 #else
-#define _mm_alignr_epi8(a, b, imm)                                              \
-    _sse2neon_define2(                                                          \
-        __m128i, a, b, uint8x16_t __a = vreinterpretq_u8_m128i(_a);             \
-        uint8x16_t __b = vreinterpretq_u8_m128i(_b); __m128i ret;               \
-        if (_sse2neon_unlikely((imm) & ~31)) ret =                              \
-            vreinterpretq_m128i_u8(vdupq_n_u8(0));                              \
-        else if ((imm) >= 16) ret =                                             \
-            _mm_srli_si128(_a, (imm) >= 16 ? (imm) - 16 : 0);                   \
-        else ret =                                                              \
-            vreinterpretq_m128i_u8(vextq_u8(__b, __a, (imm) < 16 ? (imm) : 0)); \
+#define _mm_alignr_epi8(a, b, imm)                                  \
+    _sse2neon_define2(                                              \
+        __m128i, a, b, uint8x16_t __a = vreinterpretq_u8_m128i(_a); \
+        uint8x16_t __b = vreinterpretq_u8_m128i(_b); __m128i ret;   \
+        if (_sse2neon_unlikely((imm) & ~31)) ret =                  \
+            vreinterpretq_m128i_u8(vdupq_n_u8(0));                  \
+        else if ((imm) >= 16) ret =                                 \
+            _mm_srli_si128(_a, (imm) >= 16 ? (imm) - 16 : 0);       \
+        else ret = vreinterpretq_m128i_u8(                          \
+            vextq_u8(__b, __a, (imm) < 16 ? (imm) : 0));            \
         _sse2neon_return(ret);)
 
 #endif
@@ -6829,11 +6826,9 @@ FORCE_INLINE __m64 _mm_sign_pi8(__m64 _a, __m64 _b)
 // https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_blend_ps
 FORCE_INLINE __m128 _mm_blend_ps(__m128 _a, __m128 _b, const char imm8)
 {
-    const uint32_t
-        ALIGN_STRUCT(16) data[4] = {(imm8 & (1 << 0)) ? UINT32_MAX : 0,
-                                    (imm8 & (1 << 1)) ? UINT32_MAX : 0,
-                                    (imm8 & (1 << 2)) ? UINT32_MAX : 0,
-                                    (imm8 & (1 << 3)) ? UINT32_MAX : 0};
+    const uint32_t ALIGN_STRUCT(16) data[4] = {
+        (imm8 & (1 << 0)) ? UINT32_MAX : 0, (imm8 & (1 << 1)) ? UINT32_MAX : 0,
+        (imm8 & (1 << 2)) ? UINT32_MAX : 0, (imm8 & (1 << 3)) ? UINT32_MAX : 0};
     uint32x4_t mask = vld1q_u32(data);
     float32x4_t a = vreinterpretq_f32_m128(_a);
     float32x4_t b = vreinterpretq_f32_m128(_b);

@jserv jserv changed the title add () for macro params Add parentheses for macro parameters Feb 17, 2025
@toxieainc
Copy link
Contributor Author

done

@jserv jserv merged commit 6f142ae into DLTcollab:master Feb 17, 2025
16 checks passed
@jserv
Copy link
Member

jserv commented Feb 17, 2025

Thank @toxieainc for contributing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants