What is the better signature for this?

Johan j at j.nl
Tue Oct 11 11:03:52 UTC 2022


On Monday, 10 October 2022 at 12:44:18 UTC, Guillaume Piolat 
wrote:
>
> GCC vectors can be unaligned, and there are types for it (eg: 
> __m128i_u), but I don't think the other compilers can do that. 
> That would be a prime contender.

I think you should be able to define the unaligned type like this:
```
struct __m128u {
     align(1) __m128 data;
     alias data this;
}
```
It works, but I am not 100% sure if this type will always behave 
the same (ABI) as __m128 when used as value, e.g. when passing to 
a function  (`void fun(__m128u a, __m128u b`, passed in simd 
register?).

But unfortunately currently it runs into this LDC bug: 
https://github.com/ldc-developers/ldc/issues/4236 .

cheers,
   Johan





More information about the Digitalmars-d mailing list