[clang] [llvm] [X86] Add ACE v1 (AI Compute Extensions) support (PR #208408)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 23 22:54:05 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),
----------------
ganeshgit wrote:
> I don't think it is psABI related problem. psABI is just one data path whether bsr is clobbered or not. The problem itself is when we restore tile configuration the BSR value is reset. It has nothing to do with psABI it is about ACE configuration restoration.
I didn't mean psABI as the problem. I meant we need to update psABI for BSR call clobbering.
> These _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.
I thought of removing _get and _set and use br <> bm load fold, rb <> mb store fold however we need too much deciphering based on the opcode. So, not sure. If you prefer br, bm, mb, rb version, I am okay.
https://github.com/llvm/llvm-project/pull/208408
More information about the cfe-commits
mailing list