A Secret Apple Silicon Extension to Accommodate an Intel 8080 Artifact

Lately I’ve been spending time on Mastodon for … reasons. Here’s my link: https://oldbytes.space/@blakespot. In my recently active time on the platform, I have found quite a few excellent retrocomputing-related posts by creative members of the community. One such post, by Dougall, links to his blog post entitled “Why is Rosetta 2 fast?“.

Rosetta 2 is the ahead-of-time compile translator that’s part of macOS Big Sur (and later) that, upon launch of an x64 Intel binary, translates it to 64-bit ARM code for execution on ARM-based Apple Silicon processors before execution. It is not a real-time emulator. It translates the entire binary — once — at launch time, making best-guess choices along the way. Dougall delves into various aspects of Rosetta 2 in an effort to explain why it is so performant; in many instances the translated binary runs faster on Apple Silicon than on the fastest Intel machines that Apple has ever released. It’s impressive.

It’s a fascinating read for a tech nerd like me that has a particular interest in OS technology. But one detail of the post really grabbed my attention.

Apple’s secret extension

There are only a handful of different instructions that account for 90% of all operations executed, and, near the top of that list are addition and subtraction. On ARM these can optionally set the four-bit NZVC register, whereas on x86 these always set six flag bits: CF, ZF, SF and OF (which correspond well-enough to NZVC), as well as PF (the parity flag) and AF (the adjust flag).

Emulating the last two in software is possible (and seems to be supported by Rosetta 2 for Linux), but can be rather expensive. Most software won’t notice if you get these wrong, but some software will. The Apple M1 has an undocumented extension that, when enabled, ensures instructions like ADDSSUBS and CMP compute PF and AF and store them as bits 26 and 27 of NZCV respectively, providing accurate emulation with no performance penalty.

Intrigued by mention of this “secret extension,” I reached out to the author and asked if he could expand on what Apple has done here. And, he obliged. As he explained in his multi-part Mastodon response:

So, both the “adjust flag” (AF) and the “parity flag” (PF) come from the 8080-family CPUs from the 1970s. Today they’re almost completely unused. The parity flag is set if, in the last eight bits of the result, the number of set-bits is odd. Otherwise, it’s cleared. The adjust flag is set if there’s a “carry out” from the low four-bits of the addition (and otherwise cleared). This was used for binary-coded decimal – that flag would indicate a carry from one 4-bit digit to the next.

Both these flags are computed on every ADD or SUB instruction (extremely often), and 64-bit ARM has no such functionality. For example, to compute the parity flag on ARM, a subtraction turns into something like:

subs w4, w4, w5
dup v24.16b, w4
cnt v23.16b, v24.16b
umov w22, v24.b[0]
and w22, w22, #1


That’s a lot of work for one subtraction (5x as many instructions), and that’s not all of it – we didn’t compute AF.

But it’s not really a lot of work for Intel – in every x86 CPU, they just build some logic that computes both AF and PF at the same time as doing the subtraction. So, since Apple design their own CPUs, they decided to also build this logic. When running Rosetta 2, the CPU is configured to enable this functionality (since it’d break the ARM specification to have it enabled all the time). With that set Rosetta 2 does:

subs w4, w4, w5

And both flags are computed for it by the hardware.

Rosetta 2 can also run in Linux VMs on Apple Silicon. In a VM, it isn’t able to configured the host CPU, so it can’t use this functionality. There are two other options. Either, you can skip computing the flags, because they’re mostly useless and most software won’t care. Or you can compute them the long way shown above. Rosetta 2 chooses the second option, and this mostly works out fine, because they have an “unused flags” optimisation that avoids the computation a lot of the time.

This fascinated me. While few modern applications likely read these AF and PF bits, Apple — who make their own CPUs and can control the entire process — put in place a hardware step to increase performance when running translated x64 code on their own processors. I love it. Apple’s move here demonstrates the benefits of their position in controlling all aspects of the systems. A generic Snapdragon ARM SoC, say, would deliver notably less performance in this specific scenario — getting non-native apps running solid and fast during this transition period — that is critically important to Mac users.

I relish such minor details as this in the engineering of next generation hardware and wanted to share them with readers who might find a similar appreciation. It puts me in mind of some of the very use-case-specific innovations needed by Microsoft — but not Sony (and vice versa) — in the fascinating tale of the joint creation of the common PowerPC core used in the Sony PS3 and the Xbox 360 as told in Shippy & Phipps’ excellent book, The Race for a New Game Machine: Creating the Chips Inside the XBox 360 and the Playstation 3.

Dougall Johnson, who provided this insight into the M1 and family, is driving an effort to reverse engineer and document the Apple G13 GPU architecture (used by the M1) as well as to document the Apple Firestorm/Icestorm CPU microarchitecture. His work towards these ends can be found on GitHub at these respective links: Apple GPU, Apple CPU.

This entry was posted in Macintosh, OS and tagged , , , , . Bookmark the permalink.

61 Responses to A Secret Apple Silicon Extension to Accommodate an Intel 8080 Artifact

  1. Grammar Nazi says:

    Performant is not a word.

  2. Pingback: Apple Silicon Supports 48-Year-Old Intel 8080 via Secret Extension - Tom's Hardware

  3. Pingback: Apple Silicon, Gizli Uzantı Yoluyla 48 Yıllık Intel 8080'i Destekliyor - Dünyadan Güncel Teknoloji Haberleri | Teknomers

  4. Pingback: 2022 - Apple Silicon unterstützt 48 Jahre alten Intel 8080 über Secret Extension - News Text Area

  5. Pingback: Tech roundup 168: a journal published by a bot - Javi López G.

  6. Pingback: Links 21/11/2022: pgAdmin 4 v6.16 Released and FSFE Exposed | Techrights

  7. JRock says:

    Just another example of the advantage Apple is able to wield by owning the whole stack. The M platform has a 3+ year lead on all other CPU manufacturers and it is quite astounding how Apple shunted away from Intel’s incompetence and implement an unrivaled CPU solution.

  8. Pingback: Apple Silicon Supports 48-Year-Old Intel 8080 via Secret Extension - Techdigipro

  9. Alex Miller says:

    This deep dive into Apple’s secret ISA extensions is absolutely fascinating—it’s amazing how much legacy overhead is still hiding in our modern silicon. It reminds me of how much optimization goes into the hidden mechanics of the games I play, like optimizing potion recipes for speed. For anyone currently playing Wizard Alchemy, I highly recommend checking out these Wizard Alchemy Codes to maximize your efficiency while you wait for the next big architecture breakthrough in our hobby.

  10. Sam Mitchell says:

    Fascinating deep dive — the 8080 on Apple Silicon story is wild. For a retro meetup poster I used https://graffiti-generator.org to get an old-school tech zine vibe without opening Photoshop.

  11. Jeff says:

    Fascinating look at how Apple handles backward compatibility at the hardware level. This kind of low-level engineering is exactly what makes modern software ports and emulation across architectures possible. The fact that they built this in silicon rather than purely in software says a lot about their commitment to the transition. Really appreciated the detailed writeup.

  12. couple ai says:

    Great post on “A Secret Apple Silicon Extension to Accommodate an Intel 8080 Artifact”—clear and practical.

  13. Really enjoyed your write-up on “A Secret Apple Silicon Extension to Accommodate an Intel 8080 Artifact”.

  14. ai banana says:

    This was a strong read on “A Secret Apple Silicon Extension to Accommodate an Intel 8080 Artifact”.

  15. I especially liked the point about Lately I’ve been spending time on Mastodon for … reasons.

  16. Loved this article—concise and useful. I especially liked the point about Lately I’ve been spending time on Mastodon for … reasons.

  17. The examples made it click quickly for me. We also build in this space

  18. Great post on “A Secret Apple Silicon Extension to Accommodate an Intel 8080 Artifact”—clear and practical. I especially liked the point about Lately

  19. meigen ai says:

    Great post on “A Secret Apple Silicon Extension to Accommodate an Intel 8080 Artifact”—clear and practical. I especially liked the point about Lately

  20. ao3dle says:

    Excellent breakdown on “A Secret Apple Silicon Extension to Accommodate an Intel 8080 Artifact”. I especially liked the point about Lately I’ve been spending time on Mastodon

  21. cznull says:

    Great post on “A Secret Apple Silicon Extension to Accommodate an Intel 8080 Artifact”—clear and practical. I especially liked the point about Lately

  22. Really enjoyed your write-up on “A Secret Apple Silicon Extension to Accommodate an Intel 8080 Artifact”. I especially liked the point

  23. wu tang says:

    Loved this article—concise and useful. I especially liked the point about Lately I’ve been spending time on Mastodon for … reasons.

  24. This was a strong read on “A Secret Apple Silicon Extension to Accommodate an Intel 8080 Artifact”. I especially liked the point

  25. This was a strong read on “A Secret Apple Silicon Extension to Accommodate an Intel 8080 Artifact”. I especially liked the point about Lately

  26. black souls says:

    Excellent breakdown on “A Secret Apple Silicon Extension to Accommodate an Intel 8080 Artifact”. I especially liked the point about Lately

  27. rule34dle says:

    clear and practical. I especially liked the point about Lately I’ve been spending time on Mastodon for … reasons.

  28. Loved this article—concise and useful. I especially liked the point about Lately I’ve been spending time on Mastodon

  29. Really enjoyed your write-up on “A Secret Apple Silicon Extension to Accommodate an Intel 8080 Artifact”. I especially liked the point about Lately

  30. I especially liked the point about Lately I’ve been spending time on Mastodon

  31. Rachel Kim says:

    Solid article. For anyone interested in matrix, matrix is worth a look too.

  32. Storage Hunters says:

    Excellent article! I am currently working on Storage Hunters recently, and this provides exactly what I was looking for. Keep up the amazing work!

  33. Jeff says:

    Fascinating how Apple quietly added that extension to Rosetta 2 just to keep an old 8080 demo running. It really shows the lengths they went to for backwards compatibility, even for obscure artifacts.

  34. Jeff says:

    Fascinating how Apple’s Rosetta 2 has these hidden depths—blending modern ARM translation with nods to legacy architectures like the 8080 really shows their attention to compatibility. Thanks for digging into this obscure corner of the implementation.

  35. harmo brain says:

    Reading your words has me questioning so many assumptions I didn’t even realize I held. It’s strange how we internalize these unspoken rules about what’s acceptable to discuss without ever really examining where they came from or whether they serve us.

  36. Demi says:

    This article on the secret Apple Silicon extension is fascinating! I didn’t realize how crucial the adjust and parity flags were in the context of 8080 CPUs and how Apple has cleverly adapted that for the M1. It’s incredible that they’ve managed to enhance performance without sacrificing accuracy. I recently stumbled upon some discussions on retrocomputing on Mastodon that reminded me of this, like a recent post by Dougall about Rosetta 2. You can find it here: Apostate Verity. Thanks for sharing such intriguing insights!

  37. Tom Harrison says:

    Great write-up — I bookmarked matrix destiny for reference on matrix destiny.

  38. wu tang says:

    Great post on “A Secret Apple Silicon Extension to Accommodate an Intel 8080 Artifact”—clear and practical.

  39. cznull says:

    Really enjoyed your write-up on “A Secret Apple Silicon Extension to Accommodate an Intel 8080 Artifact”. I especially liked the point about Lately I’ve been spending time on Mastodon for … reasons.

  40. Great post on “A Secret Apple Silicon Extension to Accommodate an Intel 8080 Artifact”—clear and practical.

  41. brandyaptx says:

    I maintain The Mound Wiki, an independent resource for players looking for verified launch details, beginner and co-op guidance, equipment and mechanics references, patch information, and practical planning tools.

  42. brandyaptx says:

    I maintain Corsair Cove Wiki, a structured player resource covering the game’s goods, buildings, logistics, compass progression, demo updates, and practical planning tools.

  43. James Chen says:

    Good perspective. I found ConceptViz relevant when reading about LandscapeDesignAI.

  44. Anna says:

    It’s fascinating to see how Apple has integrated a secret extension to optimize the handling of legacy Intel 8080 artifacts, especially with how Rosetta 2 translates binaries. The way this undocumented feature manages to compute the adjust and parity flags without a performance hit is impressive. As someone who enjoys delving into retro computing, it’s exciting to see how these old concepts still find relevance today. For those interested in more about retro computing, I often share my thoughts on the subject at LuckyHYP.

  45. youtube to wav converter | yt to wav converter | youtube to .wav | online youtube to wav convert | youtube to wav audio | yt to wav | youtube to wav

  46. wplaceimage says:

    This article highlights the clever workaround for running vintage hardware on modern Apple Silicon, which is fascinating for retrocomputing enthusiasts. If you’re looking to preserve or enhance old pixel art without losing quality, Wplace Image offers a fast and reliable solution. Give it a try with the wplace pixel art generator to convert your vintage graphics effortlessly.

  47. kavel says:

    The bit about Rosetta 2 translating x64 binaries on the fly while still keeping enough compatibility to handle old artifacts like an Intel 8080 reference was fascinating, especially since it shows how much care went into Apple Silicon’s transition. I also thought readers interested in preserving older media or documents might find Old Photo Restoration useful as a related resource.

  48. kling4 says:

    The note about Rosetta 2’s AOT translation and the odd Intel 8080 artifact was fascinating, especially how Apple Silicon still has to account for legacy details like that. I also appreciated the Mastodon thread that led you there; for readers exploring similar tools and workflows, Kling AI Tutorial: How to Use Kling AI Step by Step could be a useful related resource.

  49. This article sheds light on how modern macOS handles legacy hardware integration through Rosetta 2’s translation mechanics. As someone fascinated by both retro computing and AI-driven creativity, I’d recommend checking out Kling 2.6 Motion Control where Kling 2.6 Motion Control transforms static images into dynamic AI videos with intuitive character animation tools.

  50. I maintain matcha filter, a free browser-based video and photo effect tool that creates moving liquid distortion, painterly texture, olive-yellow color, and shifting grain while keeping media on the device.

  51. Diego says:

    Clear writing benefits from feedback that arrives while the draft is still taking shape. Contador de Palabras brings word and character counts together with sentence, readability, keyword, and rhythm checks, so Spanish-language writers can spot issues before a final edit. Keeping those signals in one place can make revision more deliberate without turning the process into a rigid formula.

  52. hop earth says:

    I maintain hop earth, an independent play hub for the Hop.Earth browser game with direct-source play, control guidance, loading troubleshooting, route challenges, and real-world driving ideas.

  53. ASAD DASTI says:

    Imagis TV looks like an interesting option for enjoying live TV and entertainment. The simple concept and variety of content make Imagis TV worth checking out.

  54. I really enjoyed this deep dive into Rosetta 2 and the clever engineering behind translating Intel binaries on Apple Silicon. The way it handles legacy code with ahead-of-time translation is fascinating, especially for someone like me who still tinkers with old 8080-era software. It reminds me of how often we need to bridge the gap between old and new tech, whether it's running vintage programs or cleaning up old images. If you ever find yourself dealing with pixelated scans from that era, you might find it handy to unpixelate image files to see the details more clearly. Thanks for sharing this piece—it sparked a lot of nostalgia and curiosity.

  55. Great read and very helpful breakdown! Really appreciate the clear explanations. (42031)

  56. ImageRework says:

    That bit about Apple’s “secret extension” for handling Intel’s parity flags really stuck with me! It’s wild to think how much optimization goes into making older code run on new architecture, especially when you consider the sheer number of instructions involved. I was just reading about how Rosetta 2 isn’t an emulator but a ahead-of-time translator, which explains that speed difference Dougall mentions. It makes sense that they’d bake in those clever workarounds for things like flag registers that don’t have a direct one-to-one ARM equivalent.

    It’s kind of like how with ImageRework, you sometimes have to find creative ways to adapt old image data to new standards or achieve a desired look. You’re not just blindly converting; there’s a smart translation happening behind the scenes to make it work.

Leave a Reply

Your email address will not be published. Required fields are marked *