[clang] [llvm] [X86] Add ACE v1 (AI Compute Extensions) support (PR #208408)

Evgenii Kudriashov via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 23 09:57:17 PST 2026


================
@@ -0,0 +1,311 @@
+//===---- X86InstrACE.td - ACE Instruction Set Extension --*- tablegen -*--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This file describes the instructions that make up the ACE (AI Compute
+// Extensions) instruction set.
+//
+//===----------------------------------------------------------------------===//
+
+//===----------------------------------------------------------------------===//
+// ACE multiclasses
+//
+// Most ACE operations need three definitions: the instruction itself, a pseudo
+// for the user-facing intrinsic that takes an immediate tile ID, and a pseudo
+// for the internal intrinsic that takes a shape and a tile register so the
+// register allocator can assign TMMs. The multiclasses below emit all of them
+// from one mnemonic, which also names the intrinsics.
+//===----------------------------------------------------------------------===//
+
+// BSRMOVH and BSRMOVL move half of the block scale register, which is wider
+// than a vector register, in either direction.
+multiclass ACE_BSRMOV_HALF<string Half, Prefix P> {
+  defvar Insert = !cast<Intrinsic>("int_x86_acev1_bsr0mov"#Half#"insert");
+  defvar Extract = !cast<Intrinsic>("int_x86_acev1_bsr0mov"#Half#"extract");
+
+  let SchedRW = [WriteSystem], OpPrefix = P in {
+    let Defs = [BSR0], Uses = [BSR0] in {
+      def rr_set : I<0x95, MRM0r, (outs),
+                     (ins VR512:$src),
+                     !strconcat("bsrmov", Half, "\t{$src, %bsr0|bsr0, $src}"),
+                     [(Insert (v64i8 VR512:$src))]>,
+                     EVEX, T_MAP6, REX_W, EVEX_V512;
+
+      let mayLoad = 1 in
+      def rm_set : I<0x95, MRM0m, (outs),
+                     (ins f512mem:$src),
+                     !strconcat("bsrmov", Half, "\t{$src, %bsr0|bsr0, $src}"),
+                     []>,
+                     EVEX, T_MAP6, REX_W, EVEX_V512, EVEX_CD8<64, CD8VF>;
+    }
+
+    let Uses = [BSR0] in {
+      def rr_get : I<0x95, MRM0r, (outs VR512:$dst),
+                     (ins),
+                     !strconcat("bsrmov", Half, "\t{%bsr0, $dst|$dst, bsr0}"),
+                     [(set (v64i8 VR512:$dst), (Extract))]>,
+                     EVEX, T_MAP6, EVEX_V512;
+
+      let mayStore = 1 in
+      def mr_get : I<0x95, MRM0m, (outs),
----------------
e-kud wrote:

This `_get` and `_set` are unconventional. The problem is that `b` for `bsr` will be intersected with `broadcast`. We could use `s` for `scale` but then it will intersect with `segment`. So it is still kind of an open question.

https://github.com/llvm/llvm-project/pull/208408


More information about the cfe-commits mailing list