2

I saw this in Making Code 64-Bit Clean topic

╔═════════════════════╤══════════════════════════════════════════════════════╗
║ Register name       │ Description                                          ║
╠═════════════════════╪══════════════════════════════════════════════════════╣
║ R8                  │ A 64-bit register.                                   ║
╟─────────────────────┼──────────────────────────────────────────────────────╢
║ R8d                 │ A 32-bit register containing the bottom half of R8.  ║
╟─────────────────────┼──────────────────────────────────────────────────────╢
║ R8w                 │ A 16-bit register containing the bottom half of R8d. ║
╟─────────────────────┼──────────────────────────────────────────────────────╢
║ R8l (Lowercase “l”) │ An 8-bit register containing the bottom half of R8w. ║
╚═════════════════════╧══════════════════════════════════════════════════════╝

With the l suffix I first thought that it's a long register like in GAS syntax.

Why is Apple using a different name from everybody else?

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
phuclv
  • 37,963
  • 15
  • 156
  • 475
  • It's 'l' as in "lower byte" – David Hoelzer May 16 '17 at 03:01
  • Those are the Intel register names. – Ross Ridge May 16 '17 at 04:06
  • @RossRidge just checked Intel manual and indeed they use the `L` suffix. So why does other assemblers use R8b instead of using the Intel one? – phuclv May 16 '17 at 04:36
  • 8
    Because AMD uses the B suffix for the numbered registers. AMD manual lists the low-byte registers as "AL, BL, CL, DL, SIL, DIL, BPL, SPL, R8B, R9B, R10B, R11B, R12B, R13B, R14B, R15B" while Intel's manual lists them as "AL, BL, CL, DL, DIL, SIL, BPL, SPL, R8L - R15L". Arguably Intel's names are more consistent, but arguably AMD's names are more correct as they created the additional 64-bit registers. – Ross Ridge May 16 '17 at 06:10

1 Answers1

3

As from Ross Ridge's comment, that's because of the difference in AMD and Intel's register naming convention

From AMD64 Architecture Programmer’s Manual, Volume 1: Application Programming

3.1.2 64-Bit-Mode Registers

In 64-bit mode, eight new GPRs are added to the eight legacy GPRs, all 16 GPRs are 64 bits wide, and the low bytes of all registers are accessible. Figure 3-3 on page 27 shows the GPRs, flags register, and instruction-pointer register available in 64-bit mode. The GPRs include:

  • Sixteen 8-bit low-byte registers (AL, BL, CL, DL, SIL, DIL, BPL, SPL, R8B, R9B, R10B, R11B, R12B, R13B, R14B, R15B).
  • Four 8-bit high-byte registers (AH, BH, CH, DH), addressable only when no REX prefix is used.
  • Sixteen 16-bit registers (AX, BX, CX, DX, DI, SI, BP, SP, R8W, R9W, R10W, R11W, R12W, R13W, R14W, R15W).
  • Sixteen 32-bit registers (EAX, EBX, ECX, EDX, EDI, ESI, EBP, ESP, R8D, R9D, R10D, R11D, R12D, R13D, R14D, R15D).
  • Sixteen 64-bit registers (RAX, RBX, RCX, RDX, RDI, RSI, RBP, RSP, R8, R9, R10, R11, R12, R13, R14, R15).

Compared to Intel® 64 and IA-32 Architectures - Software Developer’s Manual Volume 1: Basic Architecture

3.7.2.1 Register Operands in 64-Bit Mode

Register operands in 64-bit mode can be any of the following:

  • 64-bit general-purpose registers (RAX, RBX, RCX, RDX, RSI, RDI, RSP, RBP, or R8-R15)
  • 32-bit general-purpose registers (EAX, EBX, ECX, EDX, ESI, EDI, ESP, EBP, or R8D-R15D)
  • 16-bit general-purpose registers (AX, BX, CX, DX, SI, DI, SP, BP, or R8W-R15W)
  • 8-bit general-purpose registers: AL, BL, CL, DL, SIL, DIL, SPL, BPL, and R8L-R15L are available using REX prefixes; AL, BL, CL, DL, AH, BH, CH, DH are available without using REX prefixes.
Community
  • 1
  • 1
phuclv
  • 37,963
  • 15
  • 156
  • 475
  • 2
    Current versions of Intel manuals have changed to using R8B-R15B, presumably because that's the more widely used register name among developers, and/or because of the GAS `l` vs. `b` suffix consistency. (e.g. the April 2021 vol.2 manual doesn't mention R8L at all, only R8B.) Your direct link to a PDF is now dead, and https://software.intel.com/content/www/us/en/develop/articles/intel-sdm.html#three-volume doesn't have archives, but I have a copy of the Jan2015 vol.2 pdf (325383-053US) locally and it uses R8L everywhere, unlike the current manual. – Peter Cordes Apr 10 '21 at 03:47
  • 1
    Despite that, GDB still uses `l`. fasm accepts both variants. Other assemblers I checked—gas, nasm, yasm—only support the `b` variant. – Ruslan Apr 10 '21 at 10:02