AuburnSounds / intel-intrinsics

The Dlang SIMD library
https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#techs=MMX,SSE,SSE2,SSE3,SSSE3,SSE4_1
Boost Software License 1.0
68 stars 11 forks source link

Some things are UB, because they are UB in regular D, C and C++ too. #56

Open p0nce opened 3 years ago

p0nce commented 3 years ago

=> document them

p0nce commented 3 years ago

The spec classify UB as illegal, say it in the DDoc.

p0nce commented 3 years ago

intel-intrinsics allows some instruction to shift by more than size in bits, because it has actually no runtime cost in inline optimized code. Not sure how evil that is.

p0nce commented 3 years ago

The question (with regards to shifting) is that D says it's UB, but the x86 instruction is well defined. And I've said at Dconf that "intel-intrinsics semantics is always modelled on the instruction they are supposed to emulate" but that may not be true, some instruction are different from their intrinsic (_mm_comieq_ss) MMMmmmmm...

p0nce commented 3 years ago

Also same question with _mm_alignr_pi8 / _mm_alignr_epi8 with larger counts. If we make this UB, might be better for arm vs x86.

p0nce commented 1 year ago

Need to see if the shift instruction agree between arm and x86, making it UB would be more correct in arm perhaps