Skip to content

Commit 0e6ccda

Browse files
committed
Fixed clang-cl compat for ARM64
1 parent 29b8c1c commit 0e6ccda

File tree

3 files changed

+27
-27
lines changed

3 files changed

+27
-27
lines changed

Inc/DirectXMath.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@
135135
#endif
136136

137137
#elif defined(_XM_ARM_NEON_INTRINSICS_)
138-
#if defined(_MSC_VER) && (defined(_M_ARM64) || defined(_M_HYBRID_X86_ARM64))
138+
#if defined(_MSC_VER) && !defined(__clang__) && (defined(_M_ARM64) || defined(_M_HYBRID_X86_ARM64))
139139
#include <arm64_neon.h>
140140
#else
141141
#include <arm_neon.h>

Inc/DirectXMathConvert.inl

+22-22
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ inline XMVECTOR XM_CALLCONV XMConvertVectorIntToFloat
3838
} while (++ElementIndex < 4);
3939
return Result;
4040
#elif defined(_XM_ARM_NEON_INTRINSICS_)
41-
float fScale = 1.0f / (float)(1U << DivExponent);
41+
float fScale = 1.0f / static_cast<float>(1U << DivExponent);
4242
float32x4_t vResult = vcvtq_f32_s32(vreinterpretq_s32_f32(VInt));
4343
return vmulq_n_f32(vResult, fScale);
4444
#else // _XM_SSE_INTRINSICS_
@@ -85,7 +85,7 @@ inline XMVECTOR XM_CALLCONV XMConvertVectorFloatToInt
8585
} while (++ElementIndex < 4);
8686
return Result;
8787
#elif defined(_XM_ARM_NEON_INTRINSICS_)
88-
float32x4_t vResult = vmulq_n_f32(VFloat, (float)(1U << MulExponent));
88+
float32x4_t vResult = vmulq_n_f32(VFloat, static_cast<float>(1U << MulExponent));
8989
// In case of positive overflow, detect it
9090
uint32x4_t vOverflow = vcgtq_f32(vResult, g_XMMaxInt);
9191
// Float to int conversion
@@ -128,7 +128,7 @@ inline XMVECTOR XM_CALLCONV XMConvertVectorUIntToFloat
128128
} while (++ElementIndex < 4);
129129
return Result;
130130
#elif defined(_XM_ARM_NEON_INTRINSICS_)
131-
float fScale = 1.0f / (float)(1U << DivExponent);
131+
float fScale = 1.0f / static_cast<float>(1U << DivExponent);
132132
float32x4_t vResult = vcvtq_f32_u32(vreinterpretq_u32_f32(VUInt));
133133
return vmulq_n_f32(vResult, fScale);
134134
#else // _XM_SSE_INTRINSICS_
@@ -185,7 +185,7 @@ inline XMVECTOR XM_CALLCONV XMConvertVectorFloatToUInt
185185
} while (++ElementIndex < 4);
186186
return Result;
187187
#elif defined(_XM_ARM_NEON_INTRINSICS_)
188-
float32x4_t vResult = vmulq_n_f32(VFloat, (float)(1U << MulExponent));
188+
float32x4_t vResult = vmulq_n_f32(VFloat, static_cast<float>(1U << MulExponent));
189189
// In case of overflow, detect it
190190
uint32x4_t vOverflow = vcgtq_f32(vResult, g_XMMaxUInt);
191191
// Float to int conversion
@@ -301,7 +301,7 @@ inline XMVECTOR XM_CALLCONV XMLoadInt2A(const uint32_t* pSource) noexcept
301301
V.vector4_u32[3] = 0;
302302
return V;
303303
#elif defined(_XM_ARM_NEON_INTRINSICS_)
304-
#ifdef _MSC_VER
304+
#if defined(_MSC_VER) && !defined(__clang__)
305305
uint32x2_t x = vld1_u32_ex(pSource, 64);
306306
#else
307307
uint32x2_t x = vld1_u32(pSource);
@@ -348,7 +348,7 @@ inline XMVECTOR XM_CALLCONV XMLoadFloat2A(const XMFLOAT2A* pSource) noexcept
348348
V.vector4_f32[3] = 0.f;
349349
return V;
350350
#elif defined(_XM_ARM_NEON_INTRINSICS_)
351-
#ifdef _MSC_VER
351+
#if defined(_MSC_VER) && !defined(__clang__)
352352
float32x2_t x = vld1_f32_ex(reinterpret_cast<const float*>(pSource), 64);
353353
#else
354354
float32x2_t x = vld1_f32(reinterpret_cast<const float*>(pSource));
@@ -461,7 +461,7 @@ inline XMVECTOR XM_CALLCONV XMLoadInt3A(const uint32_t* pSource) noexcept
461461
return V;
462462
#elif defined(_XM_ARM_NEON_INTRINSICS_)
463463
// Reads an extra integer which is zero'd
464-
#ifdef _MSC_VER
464+
#if defined(_MSC_VER) && !defined(__clang__)
465465
uint32x4_t V = vld1q_u32_ex(pSource, 128);
466466
#else
467467
uint32x4_t V = vld1q_u32(pSource);
@@ -521,7 +521,7 @@ inline XMVECTOR XM_CALLCONV XMLoadFloat3A(const XMFLOAT3A* pSource) noexcept
521521
return V;
522522
#elif defined(_XM_ARM_NEON_INTRINSICS_)
523523
// Reads an extra float which is zero'd
524-
#ifdef _MSC_VER
524+
#if defined(_MSC_VER) && !defined(__clang__)
525525
float32x4_t V = vld1q_f32_ex(reinterpret_cast<const float*>(pSource), 128);
526526
#else
527527
float32x4_t V = vld1q_f32(reinterpret_cast<const float*>(pSource));
@@ -635,7 +635,7 @@ inline XMVECTOR XM_CALLCONV XMLoadInt4A(const uint32_t* pSource) noexcept
635635
V.vector4_u32[3] = pSource[3];
636636
return V;
637637
#elif defined(_XM_ARM_NEON_INTRINSICS_)
638-
#ifdef _MSC_VER
638+
#if defined(_MSC_VER) && !defined(__clang__)
639639
return vld1q_u32_ex(pSource, 128);
640640
#else
641641
return vreinterpretq_f32_u32(vld1q_u32(pSource));
@@ -679,7 +679,7 @@ inline XMVECTOR XM_CALLCONV XMLoadFloat4A(const XMFLOAT4A* pSource) noexcept
679679
V.vector4_f32[3] = pSource->w;
680680
return V;
681681
#elif defined(_XM_ARM_NEON_INTRINSICS_)
682-
#ifdef _MSC_VER
682+
#if defined(_MSC_VER) && !defined(__clang__)
683683
return vld1q_f32_ex(reinterpret_cast<const float*>(pSource), 128);
684684
#else
685685
return vld1q_f32(reinterpret_cast<const float*>(pSource));
@@ -915,7 +915,7 @@ inline XMMATRIX XM_CALLCONV XMLoadFloat4x3A(const XMFLOAT4X3A* pSource) noexcept
915915
return M;
916916

917917
#elif defined(_XM_ARM_NEON_INTRINSICS_)
918-
#ifdef _MSC_VER
918+
#if defined(_MSC_VER) && !defined(__clang__)
919919
float32x4_t v0 = vld1q_f32_ex(&pSource->m[0][0], 128);
920920
float32x4_t v1 = vld1q_f32_ex(&pSource->m[1][1], 128);
921921
float32x4_t v2 = vld1q_f32_ex(&pSource->m[2][2], 128);
@@ -1077,7 +1077,7 @@ inline XMMATRIX XM_CALLCONV XMLoadFloat3x4A(const XMFLOAT3X4A* pSource) noexcept
10771077
return M;
10781078

10791079
#elif defined(_XM_ARM_NEON_INTRINSICS_)
1080-
#ifdef _MSC_VER
1080+
#if defined(_MSC_VER) && !defined(__clang__)
10811081
float32x2x4_t vTemp0 = vld4_f32_ex(&pSource->_11, 128);
10821082
float32x4_t vTemp1 = vld1q_f32_ex(&pSource->_31, 128);
10831083
#else
@@ -1208,7 +1208,7 @@ inline XMMATRIX XM_CALLCONV XMLoadFloat4x4A(const XMFLOAT4X4A* pSource) noexcept
12081208

12091209
#elif defined(_XM_ARM_NEON_INTRINSICS_)
12101210
XMMATRIX M;
1211-
#ifdef _MSC_VER
1211+
#if defined(_MSC_VER) && !defined(__clang__)
12121212
M.r[0] = vld1q_f32_ex(reinterpret_cast<const float*>(&pSource->_11), 128);
12131213
M.r[1] = vld1q_f32_ex(reinterpret_cast<const float*>(&pSource->_21), 128);
12141214
M.r[2] = vld1q_f32_ex(reinterpret_cast<const float*>(&pSource->_31), 128);
@@ -1305,7 +1305,7 @@ inline void XM_CALLCONV XMStoreInt2A
13051305
pDestination[1] = V.vector4_u32[1];
13061306
#elif defined(_XM_ARM_NEON_INTRINSICS_)
13071307
uint32x2_t VL = vget_low_u32(vreinterpretq_u32_f32(V));
1308-
#ifdef _MSC_VER
1308+
#if defined(_MSC_VER) && !defined(__clang__)
13091309
vst1_u32_ex(pDestination, VL, 64);
13101310
#else
13111311
vst1_u32(pDestination, VL);
@@ -1350,7 +1350,7 @@ inline void XM_CALLCONV XMStoreFloat2A
13501350
pDestination->y = V.vector4_f32[1];
13511351
#elif defined(_XM_ARM_NEON_INTRINSICS_)
13521352
float32x2_t VL = vget_low_f32(V);
1353-
#ifdef _MSC_VER
1353+
#if defined(_MSC_VER) && !defined(__clang__)
13541354
vst1_f32_ex(reinterpret_cast<float*>(pDestination), VL, 64);
13551355
#else
13561356
vst1_f32(reinterpret_cast<float*>(pDestination), VL);
@@ -1469,7 +1469,7 @@ inline void XM_CALLCONV XMStoreInt3A
14691469
pDestination[2] = V.vector4_u32[2];
14701470
#elif defined(_XM_ARM_NEON_INTRINSICS_)
14711471
uint32x2_t VL = vget_low_u32(vreinterpretq_u32_f32(V));
1472-
#ifdef _MSC_VER
1472+
#if defined(_MSC_VER) && !defined(__clang__)
14731473
vst1_u32_ex(pDestination, VL, 64);
14741474
#else
14751475
vst1_u32(pDestination, VL);
@@ -1526,7 +1526,7 @@ inline void XM_CALLCONV XMStoreFloat3A
15261526
pDestination->z = V.vector4_f32[2];
15271527
#elif defined(_XM_ARM_NEON_INTRINSICS_)
15281528
float32x2_t VL = vget_low_f32(V);
1529-
#ifdef _MSC_VER
1529+
#if defined(_MSC_VER) && !defined(__clang__)
15301530
vst1_f32_ex(reinterpret_cast<float*>(pDestination), VL, 64);
15311531
#else
15321532
vst1_f32(reinterpret_cast<float*>(pDestination), VL);
@@ -1656,7 +1656,7 @@ inline void XM_CALLCONV XMStoreInt4A
16561656
pDestination[2] = V.vector4_u32[2];
16571657
pDestination[3] = V.vector4_u32[3];
16581658
#elif defined(_XM_ARM_NEON_INTRINSICS_)
1659-
#ifdef _MSC_VER
1659+
#if defined(_MSC_VER) && !defined(__clang__)
16601660
vst1q_u32_ex(pDestination, V, 128);
16611661
#else
16621662
vst1q_u32(pDestination, vreinterpretq_u32_f32(V));
@@ -1703,7 +1703,7 @@ inline void XM_CALLCONV XMStoreFloat4A
17031703
pDestination->z = V.vector4_f32[2];
17041704
pDestination->w = V.vector4_f32[3];
17051705
#elif defined(_XM_ARM_NEON_INTRINSICS_)
1706-
#ifdef _MSC_VER
1706+
#if defined(_MSC_VER) && !defined(__clang__)
17071707
vst1q_f32_ex(reinterpret_cast<float*>(pDestination), V, 128);
17081708
#else
17091709
vst1q_f32(reinterpret_cast<float*>(pDestination), V);
@@ -1913,7 +1913,7 @@ inline void XM_CALLCONV XMStoreFloat4x3A
19131913
pDestination->m[3][2] = M.r[3].vector4_f32[2];
19141914

19151915
#elif defined(_XM_ARM_NEON_INTRINSICS_)
1916-
#ifdef _MSC_VER
1916+
#if defined(_MSC_VER) && !defined(__clang__)
19171917
float32x4_t T1 = vextq_f32(M.r[0], M.r[1], 1);
19181918
float32x4_t T2 = vbslq_f32(g_XMMask3, M.r[0], T1);
19191919
vst1q_f32_ex(&pDestination->m[0][0], T2, 128);
@@ -2057,7 +2057,7 @@ inline void XM_CALLCONV XMStoreFloat3x4A
20572057
float32x4x2_t T0 = vzipq_f32(P0.val[0], P1.val[0]);
20582058
float32x4x2_t T1 = vzipq_f32(P0.val[1], P1.val[1]);
20592059

2060-
#ifdef _MSC_VER
2060+
#if defined(_MSC_VER) && !defined(__clang__)
20612061
vst1q_f32_ex(&pDestination->m[0][0], T0.val[0], 128);
20622062
vst1q_f32_ex(&pDestination->m[1][0], T0.val[1], 128);
20632063
vst1q_f32_ex(&pDestination->m[2][0], T1.val[0], 128);
@@ -2166,7 +2166,7 @@ inline void XM_CALLCONV XMStoreFloat4x4A
21662166
pDestination->m[3][3] = M.r[3].vector4_f32[3];
21672167

21682168
#elif defined(_XM_ARM_NEON_INTRINSICS_)
2169-
#ifdef _MSC_VER
2169+
#if defined(_MSC_VER) && !defined(__clang__)
21702170
vst1q_f32_ex(reinterpret_cast<float*>(&pDestination->_11), M.r[0], 128);
21712171
vst1q_f32_ex(reinterpret_cast<float*>(&pDestination->_21), M.r[1], 128);
21722172
vst1q_f32_ex(reinterpret_cast<float*>(&pDestination->_31), M.r[2], 128);

Inc/DirectXMathVector.inl

+4-4
Original file line numberDiff line numberDiff line change
@@ -1734,7 +1734,7 @@ inline XMVECTOR XM_CALLCONV XMVectorNearEqual
17341734

17351735
#elif defined(_XM_ARM_NEON_INTRINSICS_)
17361736
float32x4_t vDelta = vsubq_f32(V1, V2);
1737-
#ifdef _MSC_VER
1737+
#if defined(_MSC_VER) && !defined(__clang__)
17381738
return vacleq_f32(vDelta, Epsilon);
17391739
#else
17401740
return vreinterpretq_f32_u32(vcleq_f32(vabsq_f32(vDelta), Epsilon));
@@ -6328,7 +6328,7 @@ inline bool XM_CALLCONV XMVector2NearEqual
63286328
(dy <= Epsilon.vector4_f32[1]));
63296329
#elif defined(_XM_ARM_NEON_INTRINSICS_)
63306330
float32x2_t vDelta = vsub_f32(vget_low_f32(V1), vget_low_f32(V2));
6331-
#ifdef _MSC_VER
6331+
#if defined(_MSC_VER) && !defined(__clang__)
63326332
uint32x2_t vTemp = vacle_f32(vDelta, vget_low_u32(Epsilon));
63336333
#else
63346334
uint32x2_t vTemp = vcle_f32(vabs_f32(vDelta), vget_low_f32(Epsilon));
@@ -9057,7 +9057,7 @@ inline bool XM_CALLCONV XMVector3NearEqual
90579057
(dz <= Epsilon.vector4_f32[2])) != 0);
90589058
#elif defined(_XM_ARM_NEON_INTRINSICS_)
90599059
float32x4_t vDelta = vsubq_f32(V1, V2);
9060-
#ifdef _MSC_VER
9060+
#if defined(_MSC_VER) && !defined(__clang__)
90619061
uint32x4_t vResult = vacleq_f32(vDelta, Epsilon);
90629062
#else
90639063
uint32x4_t vResult = vcleq_f32(vabsq_f32(vDelta), Epsilon);
@@ -12924,7 +12924,7 @@ inline bool XM_CALLCONV XMVector4NearEqual
1292412924
(dw <= Epsilon.vector4_f32[3])) != 0);
1292512925
#elif defined(_XM_ARM_NEON_INTRINSICS_)
1292612926
float32x4_t vDelta = vsubq_f32(V1, V2);
12927-
#ifdef _MSC_VER
12927+
#if defined(_MSC_VER) && !defined(__clang__)
1292812928
uint32x4_t vResult = vacleq_f32(vDelta, Epsilon);
1292912929
#else
1293012930
uint32x4_t vResult = vcleq_f32(vabsq_f32(vDelta), Epsilon);

0 commit comments

Comments
 (0)