Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 073ef26

Browse filesBrowse files
CNClareChenpengxu
authored and
pengxu
committed
Modify the npyv_shri macro is implemented using lsx.
1 parent 8183efd commit 073ef26
Copy full SHA for 073ef26

File tree

2 files changed

+7
-43
lines changed
Filter options

2 files changed

+7
-43
lines changed

‎numpy/_core/src/_simd/_simd.dispatch.c.src

Copy file name to clipboardExpand all lines: numpy/_core/src/_simd/_simd.dispatch.c.src
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
* #ncont_sup = 0, 0, 0, 0, 1, 1, 1, 1, 1, 1#
3131
* #intdiv_sup= 1, 1, 1, 1, 1, 1, 1, 1, 0, 0#
3232
* #shl_imm = 0, 0, 15, 15, 31, 31, 63, 63, 0, 0#
33-
* #shr_imm = 0, 0, 16, 16, 32, 32, 64, 64, 0, 0#
33+
* #shr_imm = 1, 1, 15, 15, 31, 31, 63, 63, 0, 0#
3434
* #bitw8b_sup= 1, 0, 0, 0, 0, 0, 0, 0, 0, 0#
3535
*/
3636
#if @simd_sup@

‎numpy/_core/src/common/simd/lsx/operators.h

Copy file name to clipboardExpand all lines: numpy/_core/src/common/simd/lsx/operators.h
+6-42Lines changed: 6 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -34,48 +34,12 @@
3434
#define npyv_shr_s64(A, C) __lsx_vsra_d(A, npyv_setall_u64(C))
3535

3636
// Right by an immediate constant
37-
NPY_FINLINE __m128i npyv_shri_u16(__m128i a, unsigned int imm)
38-
{
39-
if (imm > 15)
40-
return __lsx_vldi(0);
41-
else
42-
return npyv_shr_u16(a, imm);
43-
}
44-
NPY_FINLINE __m128i npyv_shri_s16(__m128i a, int imm)
45-
{
46-
if (imm > 15)
47-
return __lsx_vldi(0);
48-
else
49-
return npyv_shr_s16(a, imm);
50-
}
51-
NPY_FINLINE __m128i npyv_shri_u32(__m128i a, int imm)
52-
{
53-
if (imm > 31)
54-
return __lsx_vldi(0);
55-
else
56-
return npyv_shr_u32(a, imm);
57-
}
58-
NPY_FINLINE __m128i npyv_shri_s32(__m128i a, int imm)
59-
{
60-
if (imm > 31)
61-
return __lsx_vldi(0);
62-
else
63-
return npyv_shr_s32(a, imm);
64-
}
65-
NPY_FINLINE __m128i npyv_shri_u64(__m128i a, int imm)
66-
{
67-
if (imm > 63)
68-
return __lsx_vldi(0);
69-
else
70-
return npyv_shr_u64(a, imm);
71-
}
72-
NPY_FINLINE __m128i npyv_shri_s64(__m128i a, int imm)
73-
{
74-
if (imm > 63)
75-
return __lsx_vldi(0);
76-
else
77-
return npyv_shr_s64(a, imm);
78-
}
37+
#define npyv_shri_u16 __lsx_vsrli_h
38+
#define npyv_shri_s16 __lsx_vsrai_h
39+
#define npyv_shri_u32 __lsx_vsrli_w
40+
#define npyv_shri_s32 __lsx_vsrai_w
41+
#define npyv_shri_u64 __lsx_vsrli_d
42+
#define npyv_shri_s64 __lsx_vsrai_d
7943

8044
/***************************
8145
* Logical

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.