Skip to content

arm/neon: add LSX implementations - #1447

Open
jinboson wants to merge 1 commit into
simd-everywhere:masterfrom
jinboson:loongarch_neon_2_lsx
Open

arm/neon: add LSX implementations#1447
jinboson wants to merge 1 commit into
simd-everywhere:masterfrom
jinboson:loongarch_neon_2_lsx

Conversation

@jinboson

@jinboson jinboson commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Based on this libjpeg-turbo/libjpeg-turbo#838, we made a performance test:

Current libjpeg-turbo commit: 174da652ef60ef7191357620eaf1d8fe776de723
Current SIMDe commit: 6a72a0434262d0f7f50e1e264284973bcbbd373e
Loongson-3A5000HV, Loongnix GNU/Linux 20 (DaoXiangHu), gcc (Loongnix 8.3.0-6.lnd.vec.44) 8.3.0 :

Algorithm Scalar/C Native SIMDe
RGB-to-YCbCr Color Conversion (Mpixels/sec) 209 0 387
RGB-to-Grayscale Color Conversion (Mpixels/sec) 456 0 579
H2V1 (4:2:2) Downsampling (Msamples/sec) 857 0 3924
H2V2 (4:2:0) Downsampling (Msamples/sec) 1222 0 5084
Integer Sample Conversion (Msamples/sec) 825 0 1185
Accurate Integer Forward DCT (Mcoefficients/sec) 316 0 479
Integer Quantization (Mcoefficients/sec) 277 0 651
Huffman Encoding (Mcoefficients/sec) 558 0 522
Accurate Integer Inverse DCT (Mcoefficients/sec) 392 0 461
H2V1 (4:2:2) Fancy (Smooth) Upsampling (Msamples/sec) 1601 0 4751
H2V2 (4:2:0) Fancy (Smooth) Upsampling (Msamples/sec) 1197 0 3907
H2V1 (4:2:2) Merged Upsampling/Color Conversion (Mpixels/sec) 375 0 629
H2V2 (4:2:0) Merged Upsampling/Color Conversion (Mpixels/sec) 432 0 784
YCbCr-to-RGB Color Conversion (Mpixels/sec) 204 0 458

This change only implements the NEON instructions used by the
libjpeg-turbo project in the simde/arm directory. The remaining
instructions in each file will be submitted in subsequent patches.
Comment thread simde/arm/neon/get_lane.h

r = v_.values[lane];
#if defined(SIMDE_LOONGARCH_LSX_NATIVE)
r = __lsx_vpickve2gr_d(simde_x_lsx_load64(&v_.values), 0);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2026-09-08T13:56:02.8905240Z In file included from ../simde/arm/neon/cmla_lane.h:39,
2026-09-08T13:56:02.8905555Z                  from ../simde/arm/neon.h:73,
2026-09-08T13:56:02.8905823Z                  from ../test/arm/neon/cgez.c:37:
2026-09-08T13:56:02.8906623Z ../simde/arm/neon/get_lane.h: In function ‘simde_vget_lane_s64’:
2026-09-08T13:56:02.8907291Z ../simde/arm/neon/get_lane.h:168:50: error: unused parameter ‘lane’ [-Werror=unused-parameter]
2026-09-08T13:56:02.8907762Z   168 | simde_vget_lane_s64(simde_int64x1_t v, const int lane)
2026-09-08T13:56:02.8908075Z       |                                        ~~~~~~~~~~^~~~
Suggested change
r = __lsx_vpickve2gr_d(simde_x_lsx_load64(&v_.values), 0);
(void) lane;
r = __lsx_vpickve2gr_d(simde_x_lsx_load64(&v_.values), 0);

Comment thread simde/arm/neon/ld1_lane.h
Comment on lines +236 to +245
case 0: r.m128i = __lsx_vinsgr2vr_h(r.m128i, (int)*ptr, 0); break;
case 1: r.m128i = __lsx_vinsgr2vr_h(r.m128i, (int)*ptr, 1); break;
case 2: r.m128i = __lsx_vinsgr2vr_h(r.m128i, (int)*ptr, 2); break;
case 3: r.m128i = __lsx_vinsgr2vr_h(r.m128i, (int)*ptr, 3); break;
case 4: r.m128i = __lsx_vinsgr2vr_h(r.m128i, (int)*ptr, 4); break;
case 5: r.m128i = __lsx_vinsgr2vr_h(r.m128i, (int)*ptr, 5); break;
case 6: r.m128i = __lsx_vinsgr2vr_h(r.m128i, (int)*ptr, 6); break;
case 7: r.m128i = __lsx_vinsgr2vr_h(r.m128i, (int)*ptr, 7); break;
default: HEDLEY_UNREACHABLE();
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did SIMDE_CONSTIFY_8_ not work?

@jinboson

Copy link
Copy Markdown
Contributor Author

Sorry for the delay — I'm away on vacation. I'll get back to this once I return. Thanks for your understanding!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants