-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implementation of x86 abs_max and abs_min functions
- Loading branch information
Showing
10 changed files
with
252 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/* | ||
* Copyright (C) 2020 Linux Studio Plugins Project <https://lsp-plug.in/> | ||
* (C) 2020 Vladimir Sadovnikov <[email protected]> | ||
* Copyright (C) 2024 Linux Studio Plugins Project <https://lsp-plug.in/> | ||
* (C) 2024 Vladimir Sadovnikov <[email protected]> | ||
* | ||
* This file is part of lsp-dsp-lib | ||
* Created on: 31 мар. 2020 г. | ||
|
@@ -213,6 +213,38 @@ namespace lsp | |
); | ||
} | ||
|
||
void x64_abs_max2(float *dst, const float *src, size_t count) | ||
{ | ||
IF_ARCH_X86_64(size_t off); | ||
ARCH_X86_64_ASM | ||
( | ||
ABS_V4_CORE("dst", "dst", "src", "vmax", OP_DSEL) | ||
: [off] "=&r" (off), [count] "+r" (count) | ||
: [dst] "r"(dst), [src] "r"(src), | ||
[SIGN] "m" (abs_vv_const) | ||
: "cc", "memory", | ||
"%xmm0", "%xmm1", "%xmm2", "%xmm3", | ||
"%xmm4", "%xmm5", "%xmm6", "%xmm7", | ||
"%xmm8", "%xmm9" | ||
); | ||
} | ||
|
||
void x64_abs_min2(float *dst, const float *src, size_t count) | ||
{ | ||
IF_ARCH_X86_64(size_t off); | ||
ARCH_X86_64_ASM | ||
( | ||
ABS_V4_CORE("dst", "dst", "src", "vmin", OP_DSEL) | ||
: [off] "=&r" (off), [count] "+r" (count) | ||
: [dst] "r"(dst), [src] "r"(src), | ||
[SIGN] "m" (abs_vv_const) | ||
: "cc", "memory", | ||
"%xmm0", "%xmm1", "%xmm2", "%xmm3", | ||
"%xmm4", "%xmm5", "%xmm6", "%xmm7", | ||
"%xmm8", "%xmm9" | ||
); | ||
} | ||
|
||
void x64_abs_add3(float *dst, const float *src1, const float *src2, size_t count) | ||
{ | ||
IF_ARCH_X86_64(size_t off); | ||
|
@@ -309,6 +341,38 @@ namespace lsp | |
); | ||
} | ||
|
||
void x64_abs_max3(float *dst, const float *src1, const float *src2, size_t count) | ||
{ | ||
IF_ARCH_X86_64(size_t off); | ||
ARCH_X86_64_ASM | ||
( | ||
ABS_V4_CORE("dst", "src1", "src2", "vmax", OP_DSEL) | ||
: [off] "=&r" (off), [count] "+r" (count) | ||
: [dst] "r"(dst), [src1] "r" (src1), [src2] "r" (src2), | ||
[SIGN] "m" (abs_vv_const) | ||
: "cc", "memory", | ||
"%xmm0", "%xmm1", "%xmm2", "%xmm3", | ||
"%xmm4", "%xmm5", "%xmm6", "%xmm7", | ||
"%xmm8", "%xmm9" | ||
); | ||
} | ||
|
||
void x64_abs_min3(float *dst, const float *src1, const float *src2, size_t count) | ||
{ | ||
IF_ARCH_X86_64(size_t off); | ||
ARCH_X86_64_ASM | ||
( | ||
ABS_V4_CORE("dst", "src1", "src2", "vmin", OP_DSEL) | ||
: [off] "=&r" (off), [count] "+r" (count) | ||
: [dst] "r"(dst), [src1] "r" (src1), [src2] "r" (src2), | ||
[SIGN] "m" (abs_vv_const) | ||
: "cc", "memory", | ||
"%xmm0", "%xmm1", "%xmm2", "%xmm3", | ||
"%xmm4", "%xmm5", "%xmm6", "%xmm7", | ||
"%xmm8", "%xmm9" | ||
); | ||
} | ||
|
||
#undef ABS_V4_CORE | ||
|
||
#define ABS_CORE(DST, SRC) \ | ||
|
@@ -425,7 +489,7 @@ namespace lsp | |
|
||
#undef OP_DSEL | ||
#undef OP_RSEL | ||
} | ||
} | ||
} /* namespace avx */ | ||
} /* namespace lsp */ | ||
|
||
#endif /* PRIVATE_DSP_ARCH_X86_AVX_PMATH_ABS_VV_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/* | ||
* Copyright (C) 2023 Linux Studio Plugins Project <https://lsp-plug.in/> | ||
* (C) 2023 Vladimir Sadovnikov <[email protected]> | ||
* Copyright (C) 2024 Linux Studio Plugins Project <https://lsp-plug.in/> | ||
* (C) 2024 Vladimir Sadovnikov <[email protected]> | ||
* | ||
* This file is part of lsp-dsp-lib | ||
* Created on: 24 окт. 2023 г. | ||
|
@@ -207,6 +207,36 @@ namespace lsp | |
); | ||
} | ||
|
||
void abs_max2(float *dst, const float *src, size_t count) | ||
{ | ||
IF_ARCH_X86_64(size_t off); | ||
ARCH_X86_64_ASM | ||
( | ||
ABS_OP_CORE("dst", "dst", "src", "vmax", OP_DSEL) | ||
: [off] "=&r" (off), [count] "+r" (count) | ||
: [dst] "r"(dst), [src] "r"(src), | ||
[SIGN] "m" (abs_vv_const) | ||
: "cc", "memory", | ||
"%xmm0", "%xmm1", "%xmm2", "%xmm3", | ||
"%xmm4", "%xmm5", "%xmm6", "%xmm7" | ||
); | ||
} | ||
|
||
void abs_min2(float *dst, const float *src, size_t count) | ||
{ | ||
IF_ARCH_X86_64(size_t off); | ||
ARCH_X86_64_ASM | ||
( | ||
ABS_OP_CORE("dst", "dst", "src", "vmin", OP_DSEL) | ||
: [off] "=&r" (off), [count] "+r" (count) | ||
: [dst] "r"(dst), [src] "r"(src), | ||
[SIGN] "m" (abs_vv_const) | ||
: "cc", "memory", | ||
"%xmm0", "%xmm1", "%xmm2", "%xmm3", | ||
"%xmm4", "%xmm5", "%xmm6", "%xmm7" | ||
); | ||
} | ||
|
||
void abs_add3(float *dst, const float *src1, const float *src2, size_t count) | ||
{ | ||
IF_ARCH_X86_64(size_t off); | ||
|
@@ -297,6 +327,36 @@ namespace lsp | |
); | ||
} | ||
|
||
void abs_max3(float *dst, const float *src1, const float *src2, size_t count) | ||
{ | ||
IF_ARCH_X86_64(size_t off); | ||
ARCH_X86_64_ASM | ||
( | ||
ABS_OP_CORE("dst", "src1", "src2", "vmax", OP_DSEL) | ||
: [off] "=&r" (off), [count] "+r" (count) | ||
: [dst] "r"(dst), [src1] "r" (src1), [src2] "r" (src2), | ||
[SIGN] "m" (abs_vv_const) | ||
: "cc", "memory", | ||
"%xmm0", "%xmm1", "%xmm2", "%xmm3", | ||
"%xmm4", "%xmm5", "%xmm6", "%xmm7" | ||
); | ||
} | ||
|
||
void abs_min3(float *dst, const float *src1, const float *src2, size_t count) | ||
{ | ||
IF_ARCH_X86_64(size_t off); | ||
ARCH_X86_64_ASM | ||
( | ||
ABS_OP_CORE("dst", "src1", "src2", "vmin", OP_DSEL) | ||
: [off] "=&r" (off), [count] "+r" (count) | ||
: [dst] "r"(dst), [src1] "r" (src1), [src2] "r" (src2), | ||
[SIGN] "m" (abs_vv_const) | ||
: "cc", "memory", | ||
"%xmm0", "%xmm1", "%xmm2", "%xmm3", | ||
"%xmm4", "%xmm5", "%xmm6", "%xmm7" | ||
); | ||
} | ||
|
||
#undef ABS_OP_CORE | ||
|
||
#define ABS_CORE(DST, SRC) \ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/* | ||
* Copyright (C) 2020 Linux Studio Plugins Project <https://lsp-plug.in/> | ||
* (C) 2020 Vladimir Sadovnikov <[email protected]> | ||
* Copyright (C) 2024 Linux Studio Plugins Project <https://lsp-plug.in/> | ||
* (C) 2024 Vladimir Sadovnikov <[email protected]> | ||
* | ||
* This file is part of lsp-dsp-lib | ||
* Created on: 31 мар. 2020 г. | ||
|
@@ -303,6 +303,34 @@ namespace lsp | |
); | ||
} | ||
|
||
void abs_max2(float *dst, const float *src, size_t count) | ||
{ | ||
IF_ARCH_X86(size_t off); | ||
ARCH_X86_ASM | ||
( | ||
ABS_OP2_CORE("max", "dst", "dst", "src", OP_DSEL) | ||
: [off] "=&r" (off), [count] "+r" (count) | ||
: [dst] "r" (dst), [src] "r" (src), | ||
[X_SIGN] "m" (abs_vv_const) | ||
: "%xmm0", "%xmm1", "%xmm2", "%xmm3", | ||
"%xmm4", "%xmm5", "%xmm6", "%xmm7" | ||
); | ||
} | ||
|
||
void abs_min2(float *dst, const float *src, size_t count) | ||
{ | ||
IF_ARCH_X86(size_t off); | ||
ARCH_X86_ASM | ||
( | ||
ABS_OP2_CORE("min", "dst", "dst", "src", OP_DSEL) | ||
: [off] "=&r" (off), [count] "+r" (count) | ||
: [dst] "r" (dst), [src] "r" (src), | ||
[X_SIGN] "m" (abs_vv_const) | ||
: "%xmm0", "%xmm1", "%xmm2", "%xmm3", | ||
"%xmm4", "%xmm5", "%xmm6", "%xmm7" | ||
); | ||
} | ||
|
||
void abs_add3(float *dst, const float *src1, const float *src2, size_t count) | ||
{ | ||
IF_ARCH_X86(size_t off); | ||
|
@@ -387,11 +415,39 @@ namespace lsp | |
); | ||
} | ||
|
||
void abs_max3(float *dst, const float *src1, const float *src2, size_t count) | ||
{ | ||
IF_ARCH_X86(size_t off); | ||
ARCH_X86_ASM | ||
( | ||
ABS_OP2_CORE("max", "dst", "src1", "src2", OP_DSEL) | ||
: [off] "=&r" (off), [count] "+r" (count) | ||
: [dst] "r" (dst), [src1] "r" (src1), [src2] "r" (src2), | ||
[X_SIGN] "m" (abs_vv_const) | ||
: "%xmm0", "%xmm1", "%xmm2", "%xmm3", | ||
"%xmm4", "%xmm5", "%xmm6", "%xmm7" | ||
); | ||
} | ||
|
||
void abs_min3(float *dst, const float *src1, const float *src2, size_t count) | ||
{ | ||
IF_ARCH_X86(size_t off); | ||
ARCH_X86_ASM | ||
( | ||
ABS_OP2_CORE("min", "dst", "src1", "src2", OP_DSEL) | ||
: [off] "=&r" (off), [count] "+r" (count) | ||
: [dst] "r" (dst), [src1] "r" (src1), [src2] "r" (src2), | ||
[X_SIGN] "m" (abs_vv_const) | ||
: "%xmm0", "%xmm1", "%xmm2", "%xmm3", | ||
"%xmm4", "%xmm5", "%xmm6", "%xmm7" | ||
); | ||
} | ||
|
||
#undef ABS_OP2_CORE | ||
|
||
#undef OP_DSEL | ||
#undef OP_RSEL | ||
} | ||
} | ||
} /* namespace sse */ | ||
} /* namespace lsp */ | ||
|
||
#endif /* PRIVATE_DSP_ARCH_X86_SSE_PMATH_ABS_VV_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.