Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

which instruction can do logical operations for simd? #7

Open
trcrsired opened this issue Jan 1, 2024 · 5 comments
Open

which instruction can do logical operations for simd? #7

trcrsired opened this issue Jan 1, 2024 · 5 comments

Comments

@trcrsired
Copy link

How to know a register is all zero and generate a mask to compare?

@jiegec
Copy link

jiegec commented Jan 2, 2024

If you meant to check if the whole SIMD Register is all-zero, you can use vseteqz.v and read the result from fcc. If you meant to check the zero elements of SIMD Register, you can use vmsknz.b/h/w/d and invert the result with vnor.v.

@trcrsired
Copy link
Author

trcrsired commented Jan 2, 2024

Any documentations on functionalities of all the simd instruction and its intrinsics?

What i am doing here is that i have a
simd_vector<char,16> v;
if(is_all_zero(v))
{
blah blah blah
}

https://github.com/trcrsired/fast_io/blob/master/include/fast_io_core_impl/simd/is_all_zeros.h#L81

Btw, does it provide instruction for creating mask like __builtin_ia32_pmovmskb128?

@jiegec
Copy link

jiegec commented Jan 2, 2024

Any documentations on functionalities of all the simd instruction and its intrinsics?

The official manual is not yet released, but there is an unofficial one by me: http://jia.je/unofficial-loongarch-intrinsics-guide/

@jiegec
Copy link

jiegec commented Jan 2, 2024

simd_vector<char,16> v;
if(is_all_zero(v))
{
blah blah blah
}

You can use __lsx_bz_v for this.

@jiegec
Copy link

jiegec commented Jan 2, 2024

Btw, does it provide instruction for creating mask like __builtin_ia32_pmovmskb128?

I think you can use __lsx_vmskltz_b + __lsx_vpickve2gr_h to achieve the same effect.

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

No branches or pull requests

2 participants