Skip to main content

is_half

Function is_half 

Source
pub fn is_half(ty: Type) -> bool
Expand description

Whether a type is the float the machine moves but does not compute in at the narrow end.

Sixteen bits, which is _Float16. It is not one of float_slot’s two for the same reason is_quad is not: the answer is a width no arithmetic on this machine is written at, so an entry in that table would hand every rule reading it an index the list of two names does not have.

What the machine does have for it is the moves, and only barely. SSE2 puts sixteen bits into a vector register with pinsrw and takes them out with pextrw, both through the low lane, which is where the psABI says a value of this format lives. Everything else is a call: there is no half precision addition, comparison or conversion below -mavx512fp16, which is above this target’s baseline, so crate::half’s pass turns each of those into the work at a wider format with a runtime call on each side of it. gcc 16 does exactly the same thing at the same baseline.

The one asymmetry worth knowing about is the store. A load of one is a single pinsrw from memory, and a store of one is not a single instruction, because the form of pextrw that writes memory is SSE4.1. So the pass rewrites the store into a sixteen bit integer store of the bits and the rule set answers the load, which is the split gcc’s output has as well.