[llvm] [X86] Add encoding support for indirect branch history fence (PR #200918)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 1 12:47:17 PDT 2026


https://github.com/mahesh-attarde updated https://github.com/llvm/llvm-project/pull/200918

>From 4b30db4a0a39f8c57b71599d31c51222d475bb17 Mon Sep 17 00:00:00 2001
From: mattarde <mattarde at intel.com>
Date: Mon, 1 Jun 2026 12:38:43 -0700
Subject: [PATCH] [X86] Add encoding support for indirect branch history fence

---
 llvm/lib/Target/X86/X86InstrSystem.td     | 7 +++++++
 llvm/test/MC/Disassembler/X86/ibhf-64.txt | 5 +++++
 llvm/test/MC/X86/ibhf-64.s                | 5 +++++
 3 files changed, 17 insertions(+)
 create mode 100644 llvm/test/MC/Disassembler/X86/ibhf-64.txt
 create mode 100644 llvm/test/MC/X86/ibhf-64.s

diff --git a/llvm/lib/Target/X86/X86InstrSystem.td b/llvm/lib/Target/X86/X86InstrSystem.td
index fdf576baba02d..7335846cff258 100644
--- a/llvm/lib/Target/X86/X86InstrSystem.td
+++ b/llvm/lib/Target/X86/X86InstrSystem.td
@@ -606,6 +606,13 @@ let SchedRW = [WriteSystem] in {
     def ENDBR32 : I<0x1E, MRM_FB, (outs), (ins), "endbr32", []>, TB, XS;
 } // SchedRW
 
+//===----------------------------------------------------------------------===//
+// Indirect Branch History Fence
+let SchedRW = [WriteFence] in {
+  def IBHFENCE : RI<0x1E, MRM_F8, (outs), (ins), "ibhf", []>, TB, XS,
+                   Requires<[In64BitMode]>; 
+}
+
 //===----------------------------------------------------------------------===//
 // XSAVE instructions
 let SchedRW = [WriteSystem] in {
diff --git a/llvm/test/MC/Disassembler/X86/ibhf-64.txt b/llvm/test/MC/Disassembler/X86/ibhf-64.txt
new file mode 100644
index 0000000000000..a337793abbecf
--- /dev/null
+++ b/llvm/test/MC/Disassembler/X86/ibhf-64.txt
@@ -0,0 +1,5 @@
+# RUN: llvm-mc --disassemble %s -triple=x86_64 | FileCheck %s 
+
+# IBHF - Indirect Branch History Fence
+# CHECK: ibhf
+0xf3 0x48 0x0f 0x1e 0xf8
diff --git a/llvm/test/MC/X86/ibhf-64.s b/llvm/test/MC/X86/ibhf-64.s
new file mode 100644
index 0000000000000..1b38f60991da4
--- /dev/null
+++ b/llvm/test/MC/X86/ibhf-64.s
@@ -0,0 +1,5 @@
+// RUN: llvm-mc -triple x86_64-unknown-unknown --show-encoding %s | FileCheck %s 
+
+// CHECK: ibhf
+// CHECK: encoding: [0xf3,0x48,0x0f,0x1e,0xf8]
+ibhf
\ No newline at end of file



More information about the llvm-commits mailing list