<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/llvm-improves-zen-1-zen-2-support-to-deal-with-notoriously-bad-pdep-pext-qsbsh2iqo" -->

---
title: LLVM Improves Zen 1 / Zen 2 Support To Deal With...
description: LLVM engineer Simon Pilgrim merged improved instruction scheduling for the PDEP and PEXT scalar instructions on AMD Zen 1, Zen+, and Zen 2 processors, whose...
canonical: https://daily.dev/posts/llvm-improves-zen-1-zen-2-support-to-deal-with-notoriously-bad-pdep-pext-qsbsh2iqo
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: LLVM Improves Zen 1 / Zen 2 Support To Deal With "Notoriously Bad" PDEP/PEXT | daily.dev
og:description: LLVM engineer Simon Pilgrim merged improved instruction scheduling for the PDEP and PEXT scalar instructions on AMD Zen 1, Zen+, and Zen 2 processors, whose...
og:url: https://daily.dev/posts/llvm-improves-zen-1-zen-2-support-to-deal-with-notoriously-bad-pdep-pext-qsbsh2iqo
og:image: https://api.daily.dev/og/posts/qsbSH2Iqo.png
og:image:alt: LLVM Improves Zen 1 / Zen 2 Support To Deal With "Notoriously Bad" PDEP/PEXT
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# LLVM Improves Zen 1 / Zen 2 Support To Deal With "Notoriously Bad" PDEP/PEXT

**[Phoronix](https://daily.dev/sources/phoronix)** · 2 min read · 0 upvotes · 0 comments

## Summary

LLVM engineer Simon Pilgrim merged improved instruction scheduling for the PDEP and PEXT scalar instructions on AMD Zen 1, Zen+, and Zen 2 processors, whose implementations of these BMI2 bit-manipulation instructions are notoriously slow. The change refines cost modeling for the znver1/znver2 scheduler ahead of LLVM beginning to generate llvm.pdep/pext intrinsics directly, including scalarized vector implementations. PDEP/PEXT are used in databases, cryptography, and games like chess and Sudoku.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.phoronix.com/news/LLVM-Improve-AMD-PDEP-PEXT>

## Questions this post answers

### Why are PDEP and PEXT instructions slow on AMD Zen 1 and Zen 2 processors?

AMD Zen 1, Zen+, and Zen 2 have notoriously bad hardware implementations of the PDEP and PEXT scalar instructions from the BMI2 extension, causing heavy microcoding, awful ALU pipe usage, and uop flooding, especially for the register-memory fold variants. LLVM's compiler engineers merged updated instruction scheduling cost models based on averaged worst-case measurements from uops.info and Agner Fog's tables to help the znver1/znver2 scheduler make better decisions around these instructions.

_daily.dev surfaces compiler internals updates like this for engineers tuning Zen-targeted codegen._

### What are PDEP and PEXT instructions used for?

PDEP (Parallel Bits Deposit) and PEXT (Parallel Bits Extract) are BMI2 bit-manipulation instructions used to scatter or gather bits within a register efficiently. They see practical use in databases, cryptography, and combinatorial games like chess engines and Sudoku solvers where bitboards or bitmask operations are common.

_developers optimizing bitmask-heavy code can track instruction-level compiler changes on daily.dev._

## Similar posts on daily.dev

- [AMD Posts New GCC Compiler Patch For Extended Load Optimization](https://daily.dev/posts/amd-posts-new-gcc-compiler-patch-for-extended-load-optimization-1dupcxxci) · Phoronix · 0 upvotes · 0 comments
- [GCC Git Enables Additional Tuning For AMD Zen 6](https://daily.dev/posts/gcc-git-enables-additional-tuning-for-amd-zen-6-vkxzcsqmn) · Phoronix · 0 upvotes · 0 comments
- [Two studies in compiler optimisations · hmpc](https://daily.dev/posts/two-studies-in-compiler-optimisations-hmpc-scky7w9iq) · Hacker News · 0 upvotes · 0 comments

---

Tags: [#general-programming](https://daily.dev/tags/general-programming), [#compiler-optimization](https://daily.dev/tags/compiler-optimization)

[View this post on daily.dev](https://daily.dev/posts/llvm-improves-zen-1-zen-2-support-to-deal-with-notoriously-bad-pdep-pext-qsbsh2iqo)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"LLVM Improves Zen 1 / Zen 2 Support To Deal With \"Notoriously Bad\" PDEP/PEXT","url":"https://daily.dev/posts/llvm-improves-zen-1-zen-2-support-to-deal-with-notoriously-bad-pdep-pext-qsbsh2iqo","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/llvm-improves-zen-1-zen-2-support-to-deal-with-notoriously-bad-pdep-pext-qsbsh2iqo"},"datePublished":"2026-08-27T10:07:46.992Z","dateModified":"2026-08-27T10:08:11.109Z","description":"LLVM engineer Simon Pilgrim merged improved instruction scheduling for the PDEP and PEXT scalar instructions on AMD Zen 1, Zen+, and Zen 2 processors, whose...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/607f293ebce1b4d203803372aebfefea?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/607f293ebce1b4d203803372aebfefea?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Phoronix","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Phoronix","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/6a26ba379dd64932830aa0c9803dd7ee","url":"https://daily.dev/sources/phoronix"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/llvm-improves-zen-1-zen-2-support-to-deal-with-notoriously-bad-pdep-pext-qsbsh2iqo","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"general-programming,compiler-optimization","timeRequired":"PT2M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Phoronix","item":"https://daily.dev/sources/phoronix"},{"@type":"ListItem","position":3,"name":"LLVM Improves Zen 1 / Zen 2 Support To Deal With \"Notoriously Bad\" PDEP/PEXT"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/llvm-improves-zen-1-zen-2-support-to-deal-with-notoriously-bad-pdep-pext-qsbsh2iqo#faq","mainEntity":[{"@type":"Question","name":"Why are PDEP and PEXT instructions slow on AMD Zen 1 and Zen 2 processors?","acceptedAnswer":{"@type":"Answer","text":"AMD Zen 1, Zen+, and Zen 2 have notoriously bad hardware implementations of the PDEP and PEXT scalar instructions from the BMI2 extension, causing heavy microcoding, awful ALU pipe usage, and uop flooding, especially for the register-memory fold variants. LLVM's compiler engineers merged updated instruction scheduling cost models based on averaged worst-case measurements from uops.info and Agner Fog's tables to help the znver1/znver2 scheduler make better decisions around these instructions. daily.dev surfaces compiler internals updates like this for engineers tuning Zen-targeted codegen."}},{"@type":"Question","name":"What are PDEP and PEXT instructions used for?","acceptedAnswer":{"@type":"Answer","text":"PDEP (Parallel Bits Deposit) and PEXT (Parallel Bits Extract) are BMI2 bit-manipulation instructions used to scatter or gather bits within a register efficiently. They see practical use in databases, cryptography, and combinatorial games like chess engines and Sudoku solvers where bitboards or bitmask operations are common. developers optimizing bitmask-heavy code can track instruction-level compiler changes on daily.dev."}}]}
```

