Vector of doubles to vector of floats type conversion

Hi,

I am currently playing around with some vectorization attempts and am a little bit stuck at vector type conversion.

My goal is to be able to convert a vector<8xf64> to a vector<8xf32>. The vector<8xf64> is obtained through a vector.load of f64 memrefs, but the rest of the program uses f32 so I need f32 in the long run. I was hoping for something similar to _mm256_cvtpd_ps or a vector version of std.fptrunc, but can’t seem to find anything like that in the dialects.

I know that I could just read scalar values from the memrefs, apply std.fptrunc and then put them into a vector, but this seems inefficient to me compared to a single vector.load.

So my question is, what is the best way to convert a vector<8xf64> to a vector<8xf32>? Is there maybe even some simple type casting I missed scanning the docs?

Thank you in advance!

fptrunc should work on vectors.

Oh. I didn’t try fptrunc because the docs explicitly state that only scalars are currently supported.

Thank you for the quick answer!

Documentation often gets outdated. Tests are the better source of truth. Please update the documentation.