버전

menu_open
Wwise SDK 2024.1.0
AkSimd.h
이 파일의 문서화 페이지로 가기
1 /*******************************************************************************
2 The content of this file includes portions of the AUDIOKINETIC Wwise Technology
3 released in source code form as part of the SDK installer package.
4 
5 Commercial License Usage
6 
7 Licensees holding valid commercial licenses to the AUDIOKINETIC Wwise Technology
8 may use this file in accordance with the end user license agreement provided
9 with the software or, alternatively, in accordance with the terms contained in a
10 written agreement between you and Audiokinetic Inc.
11 
12 Apache License Usage
13 
14 Alternatively, this file may be used under the Apache License, Version 2.0 (the
15 "Apache License"); you may not use this file except in compliance with the
16 Apache License. You may obtain a copy of the Apache License at
17 http://www.apache.org/licenses/LICENSE-2.0.
18 
19 Unless required by applicable law or agreed to in writing, software distributed
20 under the Apache License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
21 OR CONDITIONS OF ANY KIND, either express or implied. See the Apache License for
22 the specific language governing permissions and limitations under the License.
23 
24  Copyright (c) 2024 Audiokinetic Inc.
25 *******************************************************************************/
26 
27 // AkSimd.h
28 
29 /// \file
30 /// Simd definitions.
31 
32 #pragma once
33 
35 
36 /// Get the element at index __num__ in vector __vName
37 #define AKSIMD_GETELEMENT_V4F32( __vName, __num__ ) ((AkReal32*)&(__vName))[(__num__)]
38 #define AKSIMD_GETELEMENT_V2F32( __vName, __num__ ) ((AkReal32*)&(__vName))[(__num__)]
39 #define AKSIMD_GETELEMENT_V2F64( __vName, __num__ ) ((AkReal64*)&(__vName))[(__num__)]
40 #define AKSIMD_GETELEMENT_V4I32( __vName, __num__ ) ((AkInt32*)&(__vName))[(__num__)]
41 #define AKSIMD_GETELEMENT_V2I64( __vName, __num__ ) ((AkInt64*)&(__vName))[(__num__)]
42 
43 //////////////////////////////////////////////////////////////////////////
44 // Platform-specific section.
45 
46 #if defined AK_CPU_X86 || defined AK_CPU_X86_64 || defined AK_CPU_WASM
48 #elif defined AK_CPU_ARM_NEON
50 #else
51  #include <AK/SoundEngine/Platforms/Generic/AkSimd.h>
52 #endif
53 
54 
55 //////////////////////////////////////////////////////////////////////////
56 // Other helpers
57 
58 #ifndef AKSIMD_ASSERTFLUSHZEROMODE
59  #define AKSIMD_ASSERTFLUSHZEROMODE
60 #endif
61 
62 // Helper macros and structs to declare vectors in an order that matches memory layout
64 {
66  inline operator const AkReal32* () const noexcept { return f; }
67  inline operator AKSIMD_V4F32() const noexcept { return AKSIMD_LOAD_V4F32(f); }
68 };
70 {
72  inline operator const AkInt32* () const noexcept { return i; }
73  inline operator AKSIMD_V4I32() const noexcept { return AKSIMD_LOAD_V4I32((AKSIMD_V4I32*)i); }
74 };
75 #define AKSIMD_SETVR_V2F64( _a, _b ) AKSIMD_SETV_V2F64( (_b), (_a) )
76 #define AKSIMD_SETVR_V4F32( _a, _b, _c, _d ) AKSIMD_SETV_V4F32( (_d), (_c), (_b), (_a) )
77 #define AKSIMD_SETVR_V2I64( _a, _b) AKSIMD_SETV_V2I64( (_b), (_a) )
78 #define AKSIMD_SETVR_V4I32( _a, _b, _c, _d ) AKSIMD_SETV_V4I32( (_d), (_c), (_b), (_a) )
79 #define AKSIMD_DECLARE_V4F32( _x, _a, _b, _c, _d ) AKSIMD_DECLARE_V4F32_TYPE _x = { _a, _b, _c, _d };
80 #define AKSIMD_DECLARE_V4I32( _x, _a, _b, _c, _d ) AKSIMD_DECLARE_V4I32_TYPE _x = { _a, _b, _c, _d };
81 
82 #define AKSIMD_SETELEMENT_V4F32( __vName__, __num__, __value__ ) ( AKSIMD_GETELEMENT_V4F32( __vName__, __num__ ) = (__value__) )
83 
84 /// Rotate four vectors. After rotation:
85 /// A[3:0] = D[0] C[0] B[0] A[0]
86 /// B[3:0] = D[1] C[1] B[1] A[1]
87 /// C[3:0] = D[2] C[2] B[2] A[2]
88 /// D[3:0] = D[3] C[3] B[3] A[3]
90 {
91  AKSIMD_V4F32 tmp1, tmp2, tmp3, tmp4;
92  tmp1 = AKSIMD_MOVELH_V4F32(A, B);
93  tmp2 = AKSIMD_MOVEHL_V4F32(B, A);
94  tmp3 = AKSIMD_MOVELH_V4F32(C, D);
95  tmp4 = AKSIMD_MOVEHL_V4F32(D, C);
96 
97  A = AKSIMD_SHUFFLE_V4F32(tmp1, tmp3, AKSIMD_SHUFFLE(2, 0, 2, 0));
98  B = AKSIMD_SHUFFLE_V4F32(tmp1, tmp3, AKSIMD_SHUFFLE(3, 1, 3, 1));
99  C = AKSIMD_SHUFFLE_V4F32(tmp2, tmp4, AKSIMD_SHUFFLE(2, 0, 2, 0));
100  D = AKSIMD_SHUFFLE_V4F32(tmp2, tmp4, AKSIMD_SHUFFLE(3, 1, 3, 1));
101 }
102 
#define AKSIMD_SHUFFLE(fp3, fp2, fp1, fp0)
Definition: AkSimd.h:511
AkForceInline void AKSIMD_TRANSPOSE4X4_V4F32(AKSIMD_V4F32 &A, AKSIMD_V4F32 &B, AKSIMD_V4F32 &C, AKSIMD_V4F32 &D)
Definition: AkSimd.h:89
#define AKSIMD_LOAD_V4F32(__addr__)
Definition: AkSimd.h:58
float32x4_t AKSIMD_V4F32
Vector of 4 32-bit floats
Definition: AkSimdTypes.h:62
#define AKSIMD_SHUFFLE_V4F32(a, b, zyxw)
Definition: AkSimd.h:528
float AkReal32
32-bit floating point
int32_t AkInt32
Signed 32-bit integer
#define AKSIMD_MOVEHL_V4F32(__a__, __b__)
Definition: AkSimd.h:544
AK_ALIGN_SIMD(AkInt32 i[4])
AK_ALIGN_SIMD(AkReal32 f[4])
int32x4_t AKSIMD_V4I32
Vector of 4 32-bit signed integers
Definition: AkSimdTypes.h:54
#define AKSIMD_LOAD_V4I32(__addr__)
Loads four 32-bit signed integer values (aligned)
Definition: AkSimd.h:148
#define AkForceInline
Definition: AkTypes.h:63
#define AKSIMD_MOVELH_V4F32(__a__, __b__)
Definition: AkSimd.h:551

이 페이지가 도움이 되었나요?

지원이 필요하신가요?

질문이 있으신가요? 문제를 겪고 계신가요? 더 많은 정보가 필요하신가요? 저희에게 문의해주시면 도와드리겠습니다!

지원 페이지를 방문해 주세요

작업하는 프로젝트에 대해 알려주세요. 언제든지 도와드릴 준비가 되어 있습니다.

프로젝트를 등록하세요. 아무런 조건이나 의무 사항 없이 빠른 시작을 도와드리겠습니다.

Wwise를 시작해 보세요