Saw a blog post titled "How many registers does an x86-64 CPU have?" and my immediate thought was "it's impossible to know and a sin to ask".
If you think the answer is 16, by the way, no it is not.
Saw a blog post titled "How many registers does an x86-64 CPU have?" and my immediate thought was "it's impossible to know and a sin to ask".
If you think the answer is 16, by the way, no it is not.

@ryanc yeah uhhh off the top of my head
rax, rbx, rcx, rdx, r8-r15, rdi, rsi, rsp, rbp, rip and all the components thereof, and rflags
zmm0-zmm??? (can't remember how many we have now) plus the ymm/xmm components.
6 ye olde segment registers.
gdtr, ldtr, idtr, and another I forgot the name of.
maybe 5 control registers? they're numbered to 15 but most are reserved
8 debug registers
x87 FPU and MMX weirdness
hundreds of MSRs, hundreds more if you count CPUID leaves
plus internal regs
@ryanc and that's if you only count the internal registers for the main x86-64 cores and the surrounding cache/memory architecture.
if we include internal registers for UPI, PCIe, integrated graphics, TPM, IOMMU, VT-d/VT-x, and features like AMT and VROC, there's thousands of them.

@gsuberland @artemist @ryanc It would have been elegant architecture to use the GPRs, but physically it would have been a bad idea - the two live in very different parts of the chip. I talk about it in my video:
https://vimeo.com/450406346
k0 is a perfectly normal register. The only special thing is that for vector instructions, that ENCODING is used to mean "no mask". This is similar to how SP/BP/R12/R13 encodings meaning special things in MOD-R/M - the registers themselves aren't special.

Handmade Seattle 2019
@gsuberland @artemist @ryanc So the first part is not correct - k0 does NOT return all-1s.
But it is correct that "kxnorw k1, k0, k0 sets k1 to all ones"! Because so does "kxnorw k1, k5, k5" <facepalm>
@ryanc Oh, that's easy!
x86-64
x86 = 64
x = 64⁄86
x = 32⁄43
So it has at least 1.344 registers!
@ryanc There's not even 16-visible ISA registers.
If you *really* want to know how many uarch registers there are, I guess you can start by decapping the chip and counting DFF cells and SRAM bits :P That will at least give a hard upper bound
@ryanc between 40 and transistor count / 3.
That's accurate, but not very precise. 😀
A whole bunch of registers. If you run out of it, You might considder to stop using Macro Assembler and write GWBasic programs...
RAX, RBX, RCX, RDX, EAX, EBX, ECX, EDX, RDI, RSI, RBP, RSP, EDI, ESI, EBP, ESP, R8-R15, CS, DS, ES, FS, GS, SS, RIP, EIP, RFLAGS, EFLAGS, CR0-CR4, DR0-DR7, MSRs, SIMD, XMM0-XMM15, YMM0-YMM15, ZMM0-ZMM31, MM0--MM7, ST0-ST7, MXCSR.
I hope I copied all...
@TimWardCam @ryanc, let's see… from what I remember:
8-bit registers (treatable as 16-bit pairs): A, F, B, C, D, E, H, L.
16-bit registers (treatable as 8-bit halves): IX, IY.
8-bit registers: I, R.
16-bit registers: AF', BC', DE', HL', SP, PC.
18 registers in total. I'm specifically not counting different views as distinct registers: AF is counted as A and F, but IXH and IXL are counted as IX.
Yes, some aspects of this are… somewhat arbitrary. I could count BC, DE and HL as three rather than six and it wouldn't be wrong. I could count AF that way too – and it probably does match the other pairs in terms of the actual hardware design (and it could reasonably be called FA as, looking at the opcode patterns, it makes sense for A to be the lower 8 bits).
Now. Have I missed anything…?
@ryanc Related: I grew up thinking the 6502 had three registers.
Then I saw someone say X and Y weren't registers at all.
Then I saw someone else say the first 256 bytes of RAM *were* registers.