
A note on mask registers (AVX-512) - matt_d
https://travisdowns.github.io/blog/2019/12/05/kreg-facts.html
======
tarlinian
I have no particular reason at the moment to care about any of this, but your
posts are always very interesting reading.

I was actually surprised to see the zeroing idioms not being recognized. I
sort of assumed those were cheap to implement. I suppose they may not actually
have much value since you would never actually want to use a zero mask
register as an actual mask?

~~~
BeeOnRope
Yeah, I would think most mask registers values just "pop into existence" as
already nonzero based on a full write to the register, e.g., from a
comparison, a load from memory, move from GP reg, etc.

I can't see all that many scenarios where you want a zeroed register to begin
with. Many of the cases that happens in the GP world (e.g., zeroing out some
accumulator or pointer or whatever) just don't come up in mask registers.

I am not sure about the cost to implement it. I don't think it's all that
complicated to describe how it would work, but it does occur in the renamer,
which is a critical path on modern chips, so probably the less complication
there, the better. We already know that not all zeroing idioms are recognized
(like sub same, same) on some chips, so that is some indication that it's not
super cheap (or else you'd think they'd have just implemented all the idioms
the first time around).

------
BeeOnRope
Author here, happy to answer any questions or for any feedback!

~~~
ylk1
Great article as usual! Nice analysis. btw, just wondering, were you a
processor architect in your previous roles?

~~~
BeeOnRope
No, my training and background is on the software side and so the hardware
stuff is only a hobby.

