OrderedDemote2To() f64->f32 ?
- Dominant language
- C++
- Stars
- 5.8k
- Forks
- 471
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 81
Description
I'm migrating my DSP codebase from my own attempt of a library to Highway at the moment. Things went mostly well but I found one thing a bit puzzling: I have some algorithms that work on float lanes, but have to do a intermediate calculations at double precision. My own library allowed having double-as-wide f64 aggregates for that, but I see that highway won't do ```Twice``` on full-width tags.
That's fair enough and so I went with PromoteLowerTo() and PromoteUpperTo() to convert each ```float``` tag to two ```double``` tags.. However to go back to float later I found OrderedDemote2To() is curiously missing for ```double``` to ```float```. Is there a specific reason for that or am I missing some other function? I just want to convert N double lanes to N float lanes using half as many registers - it seems like something that would come up quite often with algorithm requiring full float precision results.
I ended up writing this, but it seems a bit silly:
```
auto dbl2float = [](auto d, auto a, auto b) HWY_ATTR {
const Half hd;
return Combine(d, DemoteTo(hd, b), DemoteTo(hd, a));
};
```
Contributor guide
Assessment
This issue has not been assessed yet.