1//
2// Redistribution and use in source and binary forms, with or without
3// modification, are permitted provided that the following conditions
4// are met:
5// * Redistributions of source code must retain the above copyright
6// notice, this list of conditions and the following disclaimer.
7// * Redistributions in binary form must reproduce the above copyright
8// notice, this list of conditions and the following disclaimer in the
9// documentation and/or other materials provided with the distribution.
10// * Neither the name of NVIDIA CORPORATION nor the names of its
11// contributors may be used to endorse or promote products derived
12// from this software without specific prior written permission.
13//
14// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
15// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
18// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
21// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
22// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25//
26// Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
27// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
28// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
29
30#ifndef PSFOUNDATION_PSUNIXSSE2AOS_H
31#define PSFOUNDATION_PSUNIXSSE2AOS_H
32
33// no includes here! this file should be included from PxcVecMath.h only!!!
34
35#if !COMPILE_VECTOR_INTRINSICS
36#error Vector intrinsics should not be included when using scalar implementation.
37#endif
38
39namespace physx
40{
41namespace shdfnd
42{
43namespace aos
44{
45
46#if PX_EMSCRIPTEN
47typedef int8_t __int8_t;
48typedef int16_t __int16_t;
49typedef int32_t __int32_t;
50typedef int64_t __int64_t;
51typedef uint16_t __uint16_t;
52typedef uint32_t __uint32_t;
53typedef uint64_t __uint64_t;
54#endif
55
56typedef union UnionM128
57{
58 UnionM128()
59 {
60 }
61 UnionM128(__m128 in)
62 {
63 m128 = in;
64 }
65
66 UnionM128(__m128i in)
67 {
68 m128i = in;
69 }
70
71 operator __m128()
72 {
73 return m128;
74 }
75
76 operator const __m128() const
77 {
78 return m128;
79 }
80
81 float m128_f32[4];
82 __int8_t m128_i8[16];
83 __int16_t m128_i16[8];
84 __int32_t m128_i32[4];
85 __int64_t m128_i64[2];
86 __uint16_t m128_u16[8];
87 __uint32_t m128_u32[4];
88 __uint64_t m128_u64[2];
89 __m128 m128;
90 __m128i m128i;
91} UnionM128;
92
93typedef __m128 FloatV;
94typedef __m128 Vec3V;
95typedef __m128 Vec4V;
96typedef __m128 BoolV;
97typedef __m128 QuatV;
98typedef __m128i VecI32V;
99typedef UnionM128 VecU32V;
100typedef UnionM128 VecU16V;
101typedef UnionM128 VecI16V;
102typedef UnionM128 VecU8V;
103
104#define FloatVArg FloatV &
105#define Vec3VArg Vec3V &
106#define Vec4VArg Vec4V &
107#define BoolVArg BoolV &
108#define VecU32VArg VecU32V &
109#define VecI32VArg VecI32V &
110#define VecU16VArg VecU16V &
111#define VecI16VArg VecI16V &
112#define VecU8VArg VecU8V &
113#define QuatVArg QuatV &
114
115// Optimization for situations in which you cross product multiple vectors with the same vector.
116// Avoids 2X shuffles per product
117struct VecCrossV
118{
119 Vec3V mL1;
120 Vec3V mR1;
121};
122
123struct VecShiftV
124{
125 VecI32V shift;
126};
127#define VecShiftVArg VecShiftV &
128
129PX_ALIGN_PREFIX(16)
130struct Mat33V
131{
132 Mat33V()
133 {
134 }
135 Mat33V(const Vec3V& c0, const Vec3V& c1, const Vec3V& c2) : col0(c0), col1(c1), col2(c2)
136 {
137 }
138 Vec3V PX_ALIGN(16, col0);
139 Vec3V PX_ALIGN(16, col1);
140 Vec3V PX_ALIGN(16, col2);
141} PX_ALIGN_SUFFIX(16);
142
143PX_ALIGN_PREFIX(16)
144struct Mat34V
145{
146 Mat34V()
147 {
148 }
149 Mat34V(const Vec3V& c0, const Vec3V& c1, const Vec3V& c2, const Vec3V& c3) : col0(c0), col1(c1), col2(c2), col3(c3)
150 {
151 }
152 Vec3V PX_ALIGN(16, col0);
153 Vec3V PX_ALIGN(16, col1);
154 Vec3V PX_ALIGN(16, col2);
155 Vec3V PX_ALIGN(16, col3);
156} PX_ALIGN_SUFFIX(16);
157
158PX_ALIGN_PREFIX(16)
159struct Mat43V
160{
161 Mat43V()
162 {
163 }
164 Mat43V(const Vec4V& c0, const Vec4V& c1, const Vec4V& c2) : col0(c0), col1(c1), col2(c2)
165 {
166 }
167 Vec4V PX_ALIGN(16, col0);
168 Vec4V PX_ALIGN(16, col1);
169 Vec4V PX_ALIGN(16, col2);
170} PX_ALIGN_SUFFIX(16);
171
172PX_ALIGN_PREFIX(16)
173struct Mat44V
174{
175 Mat44V()
176 {
177 }
178 Mat44V(const Vec4V& c0, const Vec4V& c1, const Vec4V& c2, const Vec4V& c3) : col0(c0), col1(c1), col2(c2), col3(c3)
179 {
180 }
181 Vec4V PX_ALIGN(16, col0);
182 Vec4V PX_ALIGN(16, col1);
183 Vec4V PX_ALIGN(16, col2);
184 Vec4V PX_ALIGN(16, col3);
185} PX_ALIGN_SUFFIX(16);
186
187} // namespace aos
188} // namespace shdfnd
189} // namespace physx
190
191#endif // PSFOUNDATION_PSUNIXSSE2AOS_H
192

source code of qtquick3dphysics/src/3rdparty/PhysX/source/foundation/include/unix/sse2/PsUnixSse2AoS.h