[llvm-branch-commits] [clang] [clang][modules] Derive mtime from PCM timestamps, not PCM files (PR #163264)
https://github.com/c-rhodes updated
https://github.com/llvm/llvm-project/pull/163264
>From dfdee9a929aa2d3ca75534da48f25076bc634bc5 Mon Sep 17 00:00:00 2001
From: Jan Svoboda
Date: Mon, 13 Oct 2025 13:38:38 -0700
Subject: [PATCH] [clang][modules] Derive mtime from PCM timestamps, not PCM
files (#162965)
#137363 was supposed to be NFC for the `CrossProcessModuleCache` (a.k.a
normal implicit module builds), but accidentally passed the wrong path
to `sys::fs::status`. Then, #141358 removed the correct path that
should've been passed instead. (The variable was flagged as unused.)
None of our existing tests caught this regression, we only found out due
to a SourceKit-LSP benchmark getting slower.
This PR re-implements the original behavior, adds new remark to Clang
for PCM input file validation, and uses it to create more reliable tests
of the `-fmodules-validate-once-per-build-session` flag.
(cherry picked from commit ce8abef25e242e65e459bcb7d9998a4e85ae03d2)
---
clang/include/clang/Basic/DiagnosticGroups.td | 1 +
.../Basic/DiagnosticSerializationKinds.td | 4 +
clang/lib/Serialization/ASTReader.cpp | 4 +
clang/lib/Serialization/ModuleCache.cpp | 4 +-
...fmodules-validate-once-per-build-session.c | 235 ++
5 files changed, 137 insertions(+), 111 deletions(-)
diff --git a/clang/include/clang/Basic/DiagnosticGroups.td
b/clang/include/clang/Basic/DiagnosticGroups.td
index c28a919e35d08..76f9addab47d8 100644
--- a/clang/include/clang/Basic/DiagnosticGroups.td
+++ b/clang/include/clang/Basic/DiagnosticGroups.td
@@ -624,6 +624,7 @@ def MissingFieldInitializers :
DiagGroup<"missing-field-initializers",
def ModuleLock : DiagGroup<"module-lock">;
def ModuleBuild : DiagGroup<"module-build">;
def ModuleImport : DiagGroup<"module-import">;
+def ModuleValidation : DiagGroup<"module-validation">;
def ModuleConflict : DiagGroup<"module-conflict">;
def ModuleFileExtension : DiagGroup<"module-file-extension">;
def ModuleIncludeDirectiveTranslation :
DiagGroup<"module-include-translation">;
diff --git a/clang/include/clang/Basic/DiagnosticSerializationKinds.td
b/clang/include/clang/Basic/DiagnosticSerializationKinds.td
index 584c8d62280bf..6494f3415b7a5 100644
--- a/clang/include/clang/Basic/DiagnosticSerializationKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSerializationKinds.td
@@ -82,6 +82,10 @@ def remark_module_import : Remark<
"importing module '%0'%select{| into '%3'}2 from '%1'">,
ShowInSystemHeader,
InGroup;
+def remark_module_validation : Remark<
+ "validating %0 input files in module '%1' from '%2'">,
+ ShowInSystemHeader,
+ InGroup;
def err_imported_module_not_found : Error<
"module '%0' in precompiled file '%1' %select{(imported by precompiled
file '%2') |}4"
diff --git a/clang/lib/Serialization/ASTReader.cpp
b/clang/lib/Serialization/ASTReader.cpp
index 30e0973149594..3e7ccfdd9db5d 100644
--- a/clang/lib/Serialization/ASTReader.cpp
+++ b/clang/lib/Serialization/ASTReader.cpp
@@ -3103,6 +3103,10 @@ ASTReader::ReadControlBlock(ModuleFile &F,
F.Kind == MK_ImplicitModule)
N = ForceValidateUserInputs ? NumUserInputs : 0;
+if (N != 0)
+ Diag(diag::remark_module_validation)
+ << N << F.ModuleName << F.FileName;
+
for (unsigned I = 0; I < N; ++I) {
InputFile IF = getInputFile(F, I+1, Complain);
if (!IF.getFile() || IF.isOutOfDate())
diff --git a/clang/lib/Serialization/ModuleCache.cpp
b/clang/lib/Serialization/ModuleCache.cpp
index f42bdc16d815d..88ad8dd6495dd 100644
--- a/clang/lib/Serialization/ModuleCache.cpp
+++ b/clang/lib/Serialization/ModuleCache.cpp
@@ -34,8 +34,10 @@ class CrossProcessModuleCache : public ModuleCache {
}
std::time_t getModuleTimestamp(StringRef ModuleFilename) override {
+std::string TimestampFilename =
+serialization::ModuleFile::getTimestampFilename(ModuleFilename);
llvm::sys::fs::file_status Status;
-if (llvm::sys::fs::status(ModuleFilename, Status) != std::error_code{})
+if (llvm::sys::fs::status(TimestampFilename, Status) != std::error_code{})
return 0;
return llvm::sys::toTimeT(Status.getLastModificationTime());
}
diff --git a/clang/test/Modules/fmodules-validate-once-per-build-session.c
b/clang/test/Modules/fmodules-validate-once-per-build-session.c
index d9d79b001e30c..2348ca1381e8a 100644
--- a/clang/test/Modules/fmodules-validate-once-per-build-session.c
+++ b/clang/test/Modules/fmodules-validate-once-per-build-session.c
@@ -1,119 +1,134 @@
-#include "foo.h"
-#include "bar.h"
-
-// Clear the module cache.
-// RUN: rm -rf %t
-// RUN: mkdir -p %t/Inputs
-// RUN: mkdir -p %t/modules-to-compare
+// This tests the behavior of -fmodules-validate-once-per-build-session with
+// different combinations of flags and states of the module cache.
-// ===
-// Create a module. We will use -I or -isystem to determine whether to treat
-// foo.h as a system header.
-// RUN: e
[llvm-branch-commits] [clang] [llvm] [AArch64][llvm] Armv9.7-A: Add support for Virtual Memory Tagging (FEAT_MTETC) (PR #163158)
@@ -0,0 +1,29 @@ +// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+mtetc < %s \ +// RUN:| FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST +// RUN: not llvm-mc -triple=aarch64 -show-encoding < %s 2>&1 \ +// RUN:| FileCheck %s --check-prefix=CHECK-ERROR +// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+all < %s \ +// RUN:| llvm-objdump -d --mattr=+mtetc --no-print-imm-hex - | FileCheck %s --check-prefix=CHECK-INST +// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+all < %s \ +// RUN:| llvm-objdump -d --mattr=-mtetc --no-print-imm-hex - | FileCheck %s --check-prefix=CHECK-UNKNOWN +// Disassemble encoding and check the re-encoding (-show-encoding) matches. +// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+mtetc < %s \ +// RUN:| sed '/.text/d' | sed 's/.*encoding: //g' \ +// RUN:| llvm-mc -triple=aarch64 -mattr=+mtetc -disassemble -show-encoding \ +// RUN:| FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST + +//-- +// FEAT_MTETC Extension instructions +//-- + +dc zgbva, x0 CarolineConcatto wrote: I've just notice that there is no diagnostic test, should we add these: dc zgbva dc gbva https://github.com/llvm/llvm-project/pull/163158 ___ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [AArch64][llvm] Armv9.7-A: Add support for SVE2p3 LUTI6 operations (PR #163164)
@@ -0,0 +1,176 @@
+// RUN: not llvm-mc -triple=aarch64 -show-encoding -mattr=+sme2p3 2>&1 < %s|
FileCheck %s
+
+// --//
+// Invalid element width
+
+luti6 z0.h, zt0, z0
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand for instruction
+// CHECK-NEXT: luti6 z0.h, zt0, z0
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+luti6 z0.s, zt0, z0
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid element width
+// CHECK-NEXT: luti6 z0.s, zt0, z0
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+luti6 z0.d, zt0, z0
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid element width
+// CHECK-NEXT: luti6 z0.d, zt0, z0
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+// --//
+// Negative tests for instructions that are incompatible with movprfx
+
+movprfx z0.h, p0/m, z7.h
+luti6 z0.b, zt0, z0
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: instruction is unpredictable when
following a movprfx, suggest replacing movprfx with mov
+// CHECK-NEXT: luti6 z0.b, zt0, z0
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+movprfx z0, z7
+luti6 z0.b, zt0, z0
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: instruction is unpredictable when
following a movprfx, suggest replacing movprfx with mov
+// CHECK-NEXT: luti6 z0.b, zt0, z0
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+// --//
+// Invalid vectors/mis-matched registers/invalid index
+
+luti6 { z0.h - z5.h }, { z0.h, z1.h }, { z0, z1 }[0]
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid number of vectors
+// CHECK-NEXT: luti6 { z0.h - z5.h }, { z0.h, z1.h }, { z0, z1 }[0]
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+luti6 { z0.b - z3.h }, { z0.h, z1.h }, { z0, z1 }[0]
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: mismatched register size suffix
+// CHECK-NEXT: luti6 { z0.b - z3.h }, { z0.h, z1.h }, { z0, z1 }[0]
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+luti6 { z0.h - z3.h }, { z0.h, z1.h }, { z0, z1 }[2]
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: vector lane must be an integer in
range [0, 1].
+// CHECK-NEXT: luti6 { z0.h - z3.h }, { z0.h, z1.h }, { z0, z1 }[2]
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+// --//
+// Negative tests for instructions that are incompatible with movprfx
+
+movprfx z0.h, p0/m, z7.h
+luti6 { z0.h - z3.h }, { z0.h, z1.h }, { z0, z1 }[0]
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: instruction is unpredictable when
following a movprfx, suggest replacing movprfx with mov
+// CHECK-NEXT: luti6 { z0.h - z3.h }, { z0.h, z1.h }, { z0, z1 }[0]
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+movprfx z0, z7
+luti6 { z0.h - z3.h }, { z0.h, z1.h }, { z0, z1 }[0]
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: instruction is unpredictable when
following a movprfx, suggest replacing movprfx with mov
+// CHECK-NEXT: luti6 { z0.h - z3.h }, { z0.h, z1.h }, { z0, z1 }[0]
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+// --//
+// Wrong striding/registers/index
+
+luti6 { z0.h, z4.h, z8.h, z13.h }, { z0.h, z1.h }, { z0, z1 }[0]
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: registers must have the same
sequential stride
+// CHECK-NEXT: luti6 { z0.h, z4.h, z8.h, z13.h }, { z0.h, z1.h }, { z0, z1 }[0]
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+luti6 { z1.h, z2.h, z3.h, z4.h }, { z0.h, z1.h }, { z0, z1 }[0]
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: Invalid vector list, expected list
with 4 consecutive SVE vectors, where the first vector is a multiple of 4 and
with matching element types
+// CHECK-NEXT: luti6 { z1.h, z2.h, z3.h, z4.h }, { z0.h, z1.h }, { z0, z1 }[0]
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+luti6 { z0.b, z4.h, z8.h, z12.h }, { z0.h, z1.h }, { z0, z1 }[0]
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: mismatched register size suffix
+// CHECK-NEXT: luti6 { z0.b, z4.h, z8.h, z12.h }, { z0.h, z1.h }, { z0, z1 }[0]
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+luti6 { z0.h, z4.h, z8.h, z12.h }, { z0.h, z1.h }, { z0, z1 }[2]
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: vector lane must be an integer in
range [0, 1].
+// CHECK-NEXT: luti6 { z0.h, z4.h, z8.h, z12.h }, { z0.h, z1.h }, { z0, z1 }[2]
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+// --//
+// Negative tests for instructions that are incompatible with movprfx
+
+movprfx z0.h, p0/m, z7.h
+luti6 { z0.h, z4.h, z8.h, z12.h }, { z0.h, z1.h }, { z0, z1 }[0]
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: instruction is unpredictable when
following a movprfx, suggest replacing movprfx with mov
+// CHECK-NEXT: luti6 { z0.h, z4.h, z8.h, z12.h }, { z0.h, z1.h }, { z0, z1 }[0]
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+movprfx z0, z7
+luti6 { z0.h, z4.h, z8.h, z12.h }, { z0.h, z1.h }, { z0, z1 }[0]
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: instruction is unpr
[llvm-branch-commits] [libc] [libc][stdlib][annex_k] Add ignore_handler_s. (PR #163313)
https://github.com/bassiounix updated
https://github.com/llvm/llvm-project/pull/163313
>From d31d3d6854bd9c500fef7e46ec97ab7983eb4c92 Mon Sep 17 00:00:00 2001
From: bassiounix
Date: Tue, 14 Oct 2025 06:20:42 +0300
Subject: [PATCH] [libc][stdlib][annex_k] Add ignore_handler_s.
---
libc/config/linux/aarch64/entrypoints.txt | 1 +
libc/config/linux/riscv/entrypoints.txt | 1 +
libc/config/linux/x86_64/entrypoints.txt | 1 +
libc/include/CMakeLists.txt | 1 +
libc/include/stdlib.yaml | 9 +
libc/src/stdlib/CMakeLists.txt| 13 +
libc/src/stdlib/ignore_handler_s.cpp | 16
libc/src/stdlib/ignore_handler_s.h| 22 ++
8 files changed, 64 insertions(+)
create mode 100644 libc/src/stdlib/ignore_handler_s.cpp
create mode 100644 libc/src/stdlib/ignore_handler_s.h
diff --git a/libc/config/linux/aarch64/entrypoints.txt
b/libc/config/linux/aarch64/entrypoints.txt
index b86d3f22afec1..b2b3789cc2f60 100644
--- a/libc/config/linux/aarch64/entrypoints.txt
+++ b/libc/config/linux/aarch64/entrypoints.txt
@@ -1,6 +1,7 @@
set(TARGET_ANNEX_K_ENTRYPOINTS
# stdlib.h entrypoints
libc.src.stdlib.abort_handler_s
+libc.src.stdlib.ignore_handler_s
)
set(TARGET_LIBC_ENTRYPOINTS
diff --git a/libc/config/linux/riscv/entrypoints.txt
b/libc/config/linux/riscv/entrypoints.txt
index fb0fbe9c456c9..5d92b112272fb 100644
--- a/libc/config/linux/riscv/entrypoints.txt
+++ b/libc/config/linux/riscv/entrypoints.txt
@@ -1,6 +1,7 @@
set(TARGET_ANNEX_K_ENTRYPOINTS
# stdlib.h entrypoints
libc.src.stdlib.abort_handler_s
+libc.src.stdlib.ignore_handler_s
)
set(TARGET_LIBC_ENTRYPOINTS
diff --git a/libc/config/linux/x86_64/entrypoints.txt
b/libc/config/linux/x86_64/entrypoints.txt
index f9d2379570c3b..4cb412ae7c526 100644
--- a/libc/config/linux/x86_64/entrypoints.txt
+++ b/libc/config/linux/x86_64/entrypoints.txt
@@ -1,6 +1,7 @@
set(TARGET_ANNEX_K_ENTRYPOINTS
# stdlib.h entrypoints
libc.src.stdlib.abort_handler_s
+libc.src.stdlib.ignore_handler_s
)
set(TARGET_LIBC_ENTRYPOINTS
diff --git a/libc/include/CMakeLists.txt b/libc/include/CMakeLists.txt
index 7ef6940763519..6f62a052b80e6 100644
--- a/libc/include/CMakeLists.txt
+++ b/libc/include/CMakeLists.txt
@@ -360,6 +360,7 @@ add_header_macro(
../libc/include/stdlib.yaml
stdlib.h
DEPENDS
+.llvm-libc-macros.annex_k_macros
.llvm-libc-macros.null_macro
.llvm-libc-macros.stdlib_macros
.llvm-libc-types.__atexithandler_t
diff --git a/libc/include/stdlib.yaml b/libc/include/stdlib.yaml
index 050cf246decf6..7c3b113a62415 100644
--- a/libc/include/stdlib.yaml
+++ b/libc/include/stdlib.yaml
@@ -113,6 +113,15 @@ functions:
return_type: char *
arguments:
- type: const char *
+ - name: ignore_handler_s
+standards:
+ - stdc
+return_type: void
+arguments:
+ - type: const char *__restrict
+ - type: void *__restrict
+ - type: errno_t
+guard: 'LIBC_HAS_ANNEX_K'
- name: labs
standards:
- stdc
diff --git a/libc/src/stdlib/CMakeLists.txt b/libc/src/stdlib/CMakeLists.txt
index 8fd149880e2d5..5efd7f13ff3ee 100644
--- a/libc/src/stdlib/CMakeLists.txt
+++ b/libc/src/stdlib/CMakeLists.txt
@@ -663,3 +663,16 @@ add_entrypoint_object(
DEPENDS
.${LIBC_TARGET_OS}.system
)
+
+add_entrypoint_object(
+ ignore_handler_s
+ HDRS
+ignore_handler_s.h
+ SRCS
+ignore_handler_s.cpp
+ DEPENDS
+libc.hdr.types.errno_t
+libc.src.__support.libc_errno
+libc.src.__support.macros.config
+libc.src.__support.macros.attributes
+)
diff --git a/libc/src/stdlib/ignore_handler_s.cpp
b/libc/src/stdlib/ignore_handler_s.cpp
new file mode 100644
index 0..172b1bcdb7b30
--- /dev/null
+++ b/libc/src/stdlib/ignore_handler_s.cpp
@@ -0,0 +1,16 @@
+//===-- Implementation header for ignore_handler_s --*- C++
-*-===//
+//
+// 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
+//
+//===--===//
+
+#include "src/stdlib/ignore_handler_s.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(void, ignore_handler_s,
+ (const char *__restrict, void *__restrict, errno_t)) {}
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/stdlib/ignore_handler_s.h
b/libc/src/stdlib/ignore_handler_s.h
new file mode 100644
index 0..07328d4be01ce
--- /dev/null
+++ b/libc/src/stdlib/ignore_handler_s.h
@@ -0,0 +1,22 @@
+//===-- Implementation header for ignore_handler_s --*- C++
-*-===//
+//
+// 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
[llvm-branch-commits] [llvm] [AArch64][llvm] Armv9.7-A: Add support for SVE2p3 LUTI6 operations (PR #163164)
@@ -0,0 +1,70 @@
+// RUN: not llvm-mc -triple=aarch64 -show-encoding -mattr=+sve2p3 2>&1 < %s|
FileCheck %s
+
+// --//
+// Invalid element width
+
+luti6 z10.h, { z0.b, z1.b }, z0
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand for instruction
+// CHECK-NEXT: luti6 z10.h, { z0.b, z1.b }, z0
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+luti6 z10.s, { z0.b, z1.b }, z0
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid element width
+// CHECK-NEXT: luti6 z10.s, { z0.b, z1.b }, z0
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+// --//
+// Negative tests for instructions that are incompatible with movprfx
+
+movprfx z0.h, p0/m, z7.h
+luti6 z10.b, { z0.b, z1.b }, z0
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: instruction is unpredictable when
following a movprfx, suggest replacing movprfx with mov
+// CHECK-NEXT: luti6 z10.b, { z0.b, z1.b }, z0
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+movprfx z0, z7
+luti6 z10.b, { z0.b, z1.b }, z0
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: instruction is unpredictable when
following a movprfx, suggest replacing movprfx with mov
+// CHECK-NEXT: luti6 z10.b, { z0.b, z1.b }, z0
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+// --//
+// Invalid element width
+
+luti6 z10.s, { z0.h, z1.h }, z0[0]
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid element width
+// CHECK-NEXT: luti6 z10.s, { z0.h, z1.h }, z0[0]
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+luti6 z10.b, { z0.h, z1.h }, z0[0]
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand for instruction
+// CHECK-NEXT: luti6 z10.b, { z0.h, z1.h }, z0[0]
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+// --//
+// Invalid immediate range
+
+luti6 z10.h, { z0.h, z1.h }, z0[-1]
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: vector lane must be an integer in
range [0, 1].
+// CHECK-NEXT: luti6 z10.h, { z0.h, z1.h }, z0[-1]
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+luti6 z10.h, { z0.h, z1.h }, z0[2]
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: vector lane must be an integer in
range [0, 1].
+// CHECK-NEXT: luti6 z10.h, { z0.h, z1.h }, z0[2]
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+// --//
+// Negative tests for instructions that are incompatible with movprfx
+
+movprfx z0.h, p0/m, z7.h
jthackray wrote:
Done
https://github.com/llvm/llvm-project/pull/163164
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [AArch64][llvm] Armv9.7-A: Add support for SVE2p3 LUTI6 operations (PR #163164)
@@ -0,0 +1,70 @@
+// RUN: not llvm-mc -triple=aarch64 -show-encoding -mattr=+sve2p3 2>&1 < %s|
FileCheck %s
+
+// --//
+// Invalid element width
+
+luti6 z10.h, { z0.b, z1.b }, z0
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand for instruction
+// CHECK-NEXT: luti6 z10.h, { z0.b, z1.b }, z0
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+luti6 z10.s, { z0.b, z1.b }, z0
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid element width
+// CHECK-NEXT: luti6 z10.s, { z0.b, z1.b }, z0
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+// --//
+// Negative tests for instructions that are incompatible with movprfx
+
+movprfx z0.h, p0/m, z7.h
jthackray wrote:
Thanks, done.
https://github.com/llvm/llvm-project/pull/163164
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libunwind] release/21.x: [libunwind] Fix aarch64 SEH unwinding with a debugger attached (#162867) (PR #163854)
https://github.com/llvmbot created
https://github.com/llvm/llvm-project/pull/163854
Backport a17afee7ec41e53292f074fc967d264452e4363b
Requested by: @mstorsjo
>From dbb224a44857d10fa529ded34e757e4fb2a09135 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?=
Date: Thu, 16 Oct 2025 22:47:08 +0300
Subject: [PATCH] [libunwind] Fix aarch64 SEH unwinding with a debugger
attached (#162867)
See https://github.com/LuaJIT/LuaJIT/issues/593#issuecomment-1717728494
for the original explanation of the problem.
In short; when a debugger is attached, there's a
function KiUserExceptionDispatcher in the stack that is being unwound.
The function KiUserExceptionDispatcher contains a CONTEXT, with a copy
of the context from where the exception was raised. When unwinding
through this function, this whole CONTEXT gets restored.
This CONTEXT is what we receive a pointer to in the callbacks, as the
ms_ctx pointer.
When we unwind manually using RtlUnwindEx, the unwinding overwrites the
CONTEXT that is passed to it. Thus, to avoid clobbering the CONTEXT that
needs to be restored by KiUserExceptionDispatcher, we could either
declare a new temporary CONTEXT on the stack before calling RtlUnwindEx,
or just use disp->ContextRecord as we already have available.
Fixes: https://github.com/llvm/llvm-project/issues/161851
Co-authored-by: Peter Cawley
Co-authored-by: Hannes Domani
(cherry picked from commit a17afee7ec41e53292f074fc967d264452e4363b)
---
libunwind/src/Unwind-seh.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/libunwind/src/Unwind-seh.cpp b/libunwind/src/Unwind-seh.cpp
index 8b83f10615f22..110c5987c3f1a 100644
--- a/libunwind/src/Unwind-seh.cpp
+++ b/libunwind/src/Unwind-seh.cpp
@@ -174,7 +174,8 @@ _GCC_specific_handler(PEXCEPTION_RECORD ms_exc, PVOID
frame, PCONTEXT ms_ctx,
}
// FIXME: Indicate target frame in foreign case!
// phase 2: the clean up phase
-RtlUnwindEx(frame, (PVOID)disp->ControlPc, ms_exc, exc, ms_ctx,
disp->HistoryTable);
+RtlUnwindEx(frame, (PVOID)disp->ControlPc, ms_exc, exc,
disp->ContextRecord,
+disp->HistoryTable);
_LIBUNWIND_ABORT("RtlUnwindEx() failed");
case _URC_INSTALL_CONTEXT: {
// If we were called by __libunwind_seh_personality(), indicate that
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libunwind] release/21.x: [libunwind] Fix aarch64 SEH unwinding with a debugger attached (#162867) (PR #163854)
llvmbot wrote: @cdavis5e What do you think about merging this PR to the release branch? https://github.com/llvm/llvm-project/pull/163854 ___ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [llvm] [AArch64][llvm] Armv9.7-A: Add support for SVE2p3 DOT and MLA operations (PR #163161)
jthackray wrote: > @jthackray OK, the CI is using the same machines except 16-cores instead of > 32, so it sounds like it could be a coincidence, so don't block your merge on > this failure. @tstellar - thanks, it's just vanilla assembly/disassembly support for Armv9.7-A, so I can't think of why it should cause an issue, unless the VM was running out of free memory for example (as those VMs presumably have a smaller amount of RAM than mine). Obviously there's a fair bit of new tablegen code and more C++, but I can't think of anything in particular likely to cause an issue. https://github.com/llvm/llvm-project/pull/163161 ___ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [clang][modules] Derive mtime from PCM timestamps, not PCM files (PR #163264)
c-rhodes wrote: > This looks reasonable to me. ok thanks, please approve and I'll land. https://github.com/llvm/llvm-project/pull/163264 ___ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [AArch64] (NFC) Tidy up alignment/formatting in AArch64/AArch64InstrInfo.td (PR #163645)
https://github.com/jthackray updated https://github.com/llvm/llvm-project/pull/163645 >From 57200cf27b2ae623a25a99482a6aa350065586c2 Mon Sep 17 00:00:00 2001 From: Jonathan Thackray Date: Wed, 15 Oct 2025 22:24:17 +0100 Subject: [PATCH] (NFC) Tidy up alignment/formatting in AArch64/AArch64InstrInfo.td It was noted in a code-review for earlier changes in this stack that some of the new 9.7 entries were mis-aligned. But actually, many of the entries were, so I've tidied them all up. --- llvm/lib/Target/AArch64/AArch64InstrInfo.td | 227 +--- 1 file changed, 104 insertions(+), 123 deletions(-) diff --git a/llvm/lib/Target/AArch64/AArch64InstrInfo.td b/llvm/lib/Target/AArch64/AArch64InstrInfo.td index 176040d5f3475..3ac9486a64335 100644 --- a/llvm/lib/Target/AArch64/AArch64InstrInfo.td +++ b/llvm/lib/Target/AArch64/AArch64InstrInfo.td @@ -50,63 +50,44 @@ def HasV9_4a : Predicate<"Subtarget->hasV9_4aOps()">, AssemblerPredicateWithAll<(all_of HasV9_4aOps), "armv9.4a">; def HasV8_0r : Predicate<"Subtarget->hasV8_0rOps()">, AssemblerPredicateWithAll<(all_of HasV8_0rOps), "armv8-r">; - def HasEL2VMSA : Predicate<"Subtarget->hasEL2VMSA()">, - AssemblerPredicateWithAll<(all_of FeatureEL2VMSA), "el2vmsa">; - + AssemblerPredicateWithAll<(all_of FeatureEL2VMSA), "el2vmsa">; def HasEL3 : Predicate<"Subtarget->hasEL3()">, - AssemblerPredicateWithAll<(all_of FeatureEL3), "el3">; - + AssemblerPredicateWithAll<(all_of FeatureEL3), "el3">; def HasVH: Predicate<"Subtarget->hasVH()">, - AssemblerPredicateWithAll<(all_of FeatureVH), "vh">; - + AssemblerPredicateWithAll<(all_of FeatureVH), "vh">; def HasLOR : Predicate<"Subtarget->hasLOR()">, - AssemblerPredicateWithAll<(all_of FeatureLOR), "lor">; - + AssemblerPredicateWithAll<(all_of FeatureLOR), "lor">; def HasPAuth : Predicate<"Subtarget->hasPAuth()">, - AssemblerPredicateWithAll<(all_of FeaturePAuth), "pauth">; - + AssemblerPredicateWithAll<(all_of FeaturePAuth), "pauth">; def HasPAuthLR : Predicate<"Subtarget->hasPAuthLR()">, - AssemblerPredicateWithAll<(all_of FeaturePAuthLR), "pauth-lr">; - + AssemblerPredicateWithAll<(all_of FeaturePAuthLR), "pauth-lr">; def HasJS: Predicate<"Subtarget->hasJS()">, - AssemblerPredicateWithAll<(all_of FeatureJS), "jsconv">; - + AssemblerPredicateWithAll<(all_of FeatureJS), "jsconv">; def HasCCIDX : Predicate<"Subtarget->hasCCIDX()">, - AssemblerPredicateWithAll<(all_of FeatureCCIDX), "ccidx">; - -def HasComplxNum : Predicate<"Subtarget->hasComplxNum()">, - AssemblerPredicateWithAll<(all_of FeatureComplxNum), "complxnum">; - + AssemblerPredicateWithAll<(all_of FeatureCCIDX), "ccidx">; +def HasComplxNum : Predicate<"Subtarget->hasComplxNum()">, + AssemblerPredicateWithAll<(all_of FeatureComplxNum), "complxnum">; def HasNV: Predicate<"Subtarget->hasNV()">, - AssemblerPredicateWithAll<(all_of FeatureNV), "nv">; - + AssemblerPredicateWithAll<(all_of FeatureNV), "nv">; def HasMPAM : Predicate<"Subtarget->hasMPAM()">, - AssemblerPredicateWithAll<(all_of FeatureMPAM), "mpam">; - + AssemblerPredicateWithAll<(all_of FeatureMPAM), "mpam">; def HasDIT : Predicate<"Subtarget->hasDIT()">, - AssemblerPredicateWithAll<(all_of FeatureDIT), "dit">; - -def HasTRACEV8_4 : Predicate<"Subtarget->hasTRACEV8_4()">, - AssemblerPredicateWithAll<(all_of FeatureTRACEV8_4), "tracev8.4">; - + AssemblerPredicateWithAll<(all_of FeatureDIT), "dit">; +def HasTRACEV8_4 : Predicate<"Subtarget->hasTRACEV8_4()">, + AssemblerPredicateWithAll<(all_of FeatureTRACEV8_4), "tracev8.4">; def HasAM: Predicate<"Subtarget->hasAM()">, - AssemblerPredicateWithAll<(all_of FeatureAM), "am">; - + AssemblerPredicateWithAll<(all_of FeatureAM), "am">; def HasSEL2 : Predicate<"Subtarget->hasSEL2()">, - AssemblerPredicateWithAll<(all_of FeatureSEL2), "sel2">; - -def HasTLB_RMI : Predicate<"Subtarget->hasTLB_RMI()">, - AssemblerPredicateWithAll<(all_of FeatureTLB_RMI), "tlb-rmi">; - + A
[llvm-branch-commits] [clang] [llvm] [AArch64][llvm] Armv9.7-A: Add support for SVE2p3 DOT and MLA operations (PR #163161)
tstellar wrote: @jthackray We just added a AArch64 CI job and it seems like something in this series is causing the agents to crash. https://github.com/llvm/llvm-project/pull/163161 ___ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [X86] Remove extra MOV after widening atomic load (PR #148898)
https://github.com/jofrn updated
https://github.com/llvm/llvm-project/pull/148898
>From 74eb40e5db3e0a602a0339f6376954a1d9dcad0a Mon Sep 17 00:00:00 2001
From: jofrn
Date: Tue, 15 Jul 2025 13:01:24 -0400
Subject: [PATCH] [X86] Remove extra MOV after widening atomic load
This change adds patterns to optimize out an extra MOV
present after widening the atomic load.
---
llvm/lib/Target/X86/X86InstrCompiler.td| 7 +
llvm/test/CodeGen/X86/atomic-load-store.ll | 192 +++--
2 files changed, 35 insertions(+), 164 deletions(-)
diff --git a/llvm/lib/Target/X86/X86InstrCompiler.td
b/llvm/lib/Target/X86/X86InstrCompiler.td
index ec31675731b79..85db6762dbaf3 100644
--- a/llvm/lib/Target/X86/X86InstrCompiler.td
+++ b/llvm/lib/Target/X86/X86InstrCompiler.td
@@ -1204,6 +1204,13 @@ def : Pat<(i16 (atomic_load_nonext_16 addr:$src)),
(MOV16rm addr:$src)>;
def : Pat<(i32 (atomic_load_nonext_32 addr:$src)), (MOV32rm addr:$src)>;
def : Pat<(i64 (atomic_load_nonext_64 addr:$src)), (MOV64rm addr:$src)>;
+def : Pat<(v4i32 (scalar_to_vector (i32 (zext (i16 (atomic_load_16
addr:$src)),
+ (MOVDI2PDIrm addr:$src)>; // load atomic <2 x i8>
+def : Pat<(v4i32 (scalar_to_vector (i32 (atomic_load_32 addr:$src,
+ (MOVDI2PDIrm addr:$src)>; // load atomic <2 x i16>
+def : Pat<(v2i64 (scalar_to_vector (i64 (atomic_load_64 addr:$src,
+ (MOV64toPQIrm addr:$src)>; // load atomic <2 x i32,float>
+
// Floating point loads/stores.
def : Pat<(atomic_store_32 (i32 (bitconvert (f32 FR32:$src))), addr:$dst),
(MOVSSmr addr:$dst, FR32:$src)>, Requires<[UseSSE1]>;
diff --git a/llvm/test/CodeGen/X86/atomic-load-store.ll
b/llvm/test/CodeGen/X86/atomic-load-store.ll
index ff5391f44bbe3..4b818b6cfa57e 100644
--- a/llvm/test/CodeGen/X86/atomic-load-store.ll
+++ b/llvm/test/CodeGen/X86/atomic-load-store.ll
@@ -319,159 +319,60 @@ define <2 x i8> @atomic_vec2_i8(ptr %x) {
define <2 x i16> @atomic_vec2_i16(ptr %x) {
; CHECK-O3-LABEL: atomic_vec2_i16:
; CHECK-O3: # %bb.0:
-; CHECK-O3-NEXT:movl (%rdi), %eax
-; CHECK-O3-NEXT:movd %eax, %xmm0
+; CHECK-O3-NEXT:movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
; CHECK-O3-NEXT:retq
;
; CHECK-SSE-O3-LABEL: atomic_vec2_i16:
; CHECK-SSE-O3: # %bb.0:
-; CHECK-SSE-O3-NEXT:movl (%rdi), %eax
-; CHECK-SSE-O3-NEXT:movd %eax, %xmm0
+; CHECK-SSE-O3-NEXT:movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
; CHECK-SSE-O3-NEXT:retq
;
; CHECK-AVX-O3-LABEL: atomic_vec2_i16:
; CHECK-AVX-O3: # %bb.0:
-; CHECK-AVX-O3-NEXT:movl (%rdi), %eax
-; CHECK-AVX-O3-NEXT:vmovd %eax, %xmm0
+; CHECK-AVX-O3-NEXT:movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
; CHECK-AVX-O3-NEXT:retq
;
; CHECK-O0-LABEL: atomic_vec2_i16:
; CHECK-O0: # %bb.0:
-; CHECK-O0-NEXT:movl (%rdi), %eax
-; CHECK-O0-NEXT:movd %eax, %xmm0
+; CHECK-O0-NEXT:movd {{.*#+}} xmm0 = mem[0],zero,zero,zero
; CHECK-O0-NEXT:retq
;
; CHECK-SSE-O0-LABEL: atomic_vec2_i16:
; CHECK-SSE-O0: # %bb.0:
-; CHECK-SSE-O0-NEXT:movl (%rdi), %eax
-; CHECK-SSE-O0-NEXT:movd %eax, %xmm0
+; CHECK-SSE-O0-NEXT:movd {{.*#+}} xmm0 = mem[0],zero,zero,zero
; CHECK-SSE-O0-NEXT:retq
;
; CHECK-AVX-O0-LABEL: atomic_vec2_i16:
; CHECK-AVX-O0: # %bb.0:
-; CHECK-AVX-O0-NEXT:movl (%rdi), %eax
-; CHECK-AVX-O0-NEXT:vmovd %eax, %xmm0
+; CHECK-AVX-O0-NEXT:movd {{.*#+}} xmm0 = mem[0],zero,zero,zero
; CHECK-AVX-O0-NEXT:retq
%ret = load atomic <2 x i16>, ptr %x acquire, align 4
ret <2 x i16> %ret
}
define <2 x ptr addrspace(270)> @atomic_vec2_ptr270(ptr %x) {
-; CHECK-O3-LABEL: atomic_vec2_ptr270:
-; CHECK-O3: # %bb.0:
-; CHECK-O3-NEXT:movq (%rdi), %rax
-; CHECK-O3-NEXT:movq %rax, %xmm0
-; CHECK-O3-NEXT:retq
-;
-; CHECK-SSE-O3-LABEL: atomic_vec2_ptr270:
-; CHECK-SSE-O3: # %bb.0:
-; CHECK-SSE-O3-NEXT:movq (%rdi), %rax
-; CHECK-SSE-O3-NEXT:movq %rax, %xmm0
-; CHECK-SSE-O3-NEXT:retq
-;
-; CHECK-AVX-O3-LABEL: atomic_vec2_ptr270:
-; CHECK-AVX-O3: # %bb.0:
-; CHECK-AVX-O3-NEXT:movq (%rdi), %rax
-; CHECK-AVX-O3-NEXT:vmovq %rax, %xmm0
-; CHECK-AVX-O3-NEXT:retq
-;
-; CHECK-O0-LABEL: atomic_vec2_ptr270:
-; CHECK-O0: # %bb.0:
-; CHECK-O0-NEXT:movq (%rdi), %rax
-; CHECK-O0-NEXT:movq %rax, %xmm0
-; CHECK-O0-NEXT:retq
-;
-; CHECK-SSE-O0-LABEL: atomic_vec2_ptr270:
-; CHECK-SSE-O0: # %bb.0:
-; CHECK-SSE-O0-NEXT:movq (%rdi), %rax
-; CHECK-SSE-O0-NEXT:movq %rax, %xmm0
-; CHECK-SSE-O0-NEXT:retq
-;
-; CHECK-AVX-O0-LABEL: atomic_vec2_ptr270:
-; CHECK-AVX-O0: # %bb.0:
-; CHECK-AVX-O0-NEXT:movq (%rdi), %rax
-; CHECK-AVX-O0-NEXT:vmovq %rax, %xmm0
-; CHECK-AVX-O0-NEXT:retq
+; CHECK-LABEL: atomic_vec2_ptr270:
+; CHECK: # %bb.0:
+; CHECK-NEXT:movq (%rdi), %xmm0
+; CHECK-NEXT:retq
%ret = load atomic <2 x ptr addrspace(270)>, ptr %x acquire, align 8
ret <2 x ptr addrspace(270)> %ret
}
define <2
[llvm-branch-commits] [llvm] [AArch64][llvm] Armv9.7-A: Add support for SVE2p3 LUTI6 operations (PR #163164)
https://github.com/jthackray updated
https://github.com/llvm/llvm-project/pull/163164
>From b99fc1b6c2549da670a28bd60b8b92d7b5cea957 Mon Sep 17 00:00:00 2001
From: Jonathan Thackray
Date: Sat, 6 Sep 2025 00:00:23 +0100
Subject: [PATCH] [AArch64][llvm] Armv9.7-A: Add support for SVE2p3 LUTI6
operations
Add instructions for SVE2p3 LUTI6 operations:
- LUTI6 (16-bit)
- LUTI6 (8-bit)
- LUTI6 (vector, 16-bit)
- LUTI6 (table, four registers, 8-bit)
- LUTI6 (table, single, 8-bit)
as documented here:
* https://developer.arm.com/documentation/ddi0602/2025-09/
*
https://developer.arm.com/documentation/109697/2025_09/2025-Architecture-Extensions
---
llvm/lib/Target/AArch64/AArch64InstrInfo.td | 4 +
.../lib/Target/AArch64/AArch64RegisterInfo.td | 8 +
.../lib/Target/AArch64/AArch64SMEInstrInfo.td | 11 +
.../lib/Target/AArch64/AArch64SVEInstrInfo.td | 9 +
.../AArch64/AsmParser/AArch64AsmParser.cpp| 7 +
llvm/lib/Target/AArch64/SMEInstrFormats.td| 74 +++
llvm/lib/Target/AArch64/SVEInstrFormats.td| 35 +-
.../MC/AArch64/SME2p3/luti6-diagnostics.s | 176 +++
llvm/test/MC/AArch64/SME2p3/luti6.s | 472 ++
.../MC/AArch64/SVE2p3/luti6-diagnostics.s | 70 +++
llvm/test/MC/AArch64/SVE2p3/luti6.s | 115 +
11 files changed, 977 insertions(+), 4 deletions(-)
create mode 100644 llvm/test/MC/AArch64/SME2p3/luti6-diagnostics.s
create mode 100644 llvm/test/MC/AArch64/SME2p3/luti6.s
create mode 100644 llvm/test/MC/AArch64/SVE2p3/luti6-diagnostics.s
create mode 100644 llvm/test/MC/AArch64/SVE2p3/luti6.s
diff --git a/llvm/lib/Target/AArch64/AArch64InstrInfo.td
b/llvm/lib/Target/AArch64/AArch64InstrInfo.td
index 9f7d6ddea31e5..22872d9eb10b5 100644
--- a/llvm/lib/Target/AArch64/AArch64InstrInfo.td
+++ b/llvm/lib/Target/AArch64/AArch64InstrInfo.td
@@ -252,6 +252,10 @@ def HasSVE_B16MM:
Predicate<"Subtarget->isSVEAvailable() && Subtarget->hasSV
AssemblerPredicateWithAll<(all_of
FeatureSVE_B16MM), "sve-b16mm">;
def HasF16MM: Predicate<"Subtarget->isSVEAvailable() &&
Subtarget->hasF16MM()">,
AssemblerPredicateWithAll<(all_of
FeatureF16MM), "f16mm">;
+def HasSVE2p3 : Predicate<"Subtarget->hasSVE2p3()">,
+ AssemblerPredicateWithAll<(all_of
FeatureSVE2p3), "sve2p3">;
+def HasSME2p3 : Predicate<"Subtarget->hasSME2p3()">,
+ AssemblerPredicateWithAll<(all_of
FeatureSME2p3), "sme2p3">;
// A subset of SVE(2) instructions are legal in Streaming SVE execution mode,
// they should be enabled if either has been specified.
diff --git a/llvm/lib/Target/AArch64/AArch64RegisterInfo.td
b/llvm/lib/Target/AArch64/AArch64RegisterInfo.td
index ef974df823100..86a1fb52be789 100644
--- a/llvm/lib/Target/AArch64/AArch64RegisterInfo.td
+++ b/llvm/lib/Target/AArch64/AArch64RegisterInfo.td
@@ -1341,6 +1341,10 @@ def Z_q : RegisterOperand"> {
let ParserMatchClass = ZPRVectorList<128, 1>;
}
+def ZZ_Any : RegisterOperand"> {
+ let ParserMatchClass = ZPRVectorList<0, 2>;
+}
+
def ZZ_b : RegisterOperand"> {
let ParserMatchClass = ZPRVectorList<8, 2>;
}
@@ -1361,6 +1365,10 @@ def ZZ_q : RegisterOperand"> {
let ParserMatchClass = ZPRVectorList<128, 2>;
}
+def ZZZ_Any : RegisterOperand"> {
+ let ParserMatchClass = ZPRVectorList<0, 3>;
+}
+
def ZZZ_b : RegisterOperand"> {
let ParserMatchClass = ZPRVectorList<8, 3>;
}
diff --git a/llvm/lib/Target/AArch64/AArch64SMEInstrInfo.td
b/llvm/lib/Target/AArch64/AArch64SMEInstrInfo.td
index e552afee0d8cf..f3411c4d95d19 100644
--- a/llvm/lib/Target/AArch64/AArch64SMEInstrInfo.td
+++ b/llvm/lib/Target/AArch64/AArch64SMEInstrInfo.td
@@ -1173,3 +1173,14 @@ let Predicates = [HasSME_MOP4, HasSMEF64F64] in {
defm FMOP4A : sme2_fmop4as_fp64_non_widening<0, "fmop4a",
"int_aarch64_sme_mop4a">;
defm FMOP4S : sme2_fmop4as_fp64_non_widening<1, "fmop4s",
"int_aarch64_sme_mop4s">;
}
+
+//===--===//
+// SME2.3 instructions
+//===--===//
+let Predicates = [HasSME2p3] in {
+ def LUTI6_ZTZ : sme2_lut_single<"luti6">;
+ def LUTI6_4ZT3Z : sme2_luti6_zt<"luti6">;
+ def LUTI6_S_4ZT3Z : sme2_luti6_zt_strided<"luti6">;
+ def LUTI6_4Z2Z2ZI : sme2_luti6_vector_vg4<"luti6">;
+ def LUTI6_S_4Z2Z2ZI : sme2_luti6_vector_vg4_strided<"luti6">;
+} // [HasSME2p3]
diff --git a/llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
b/llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
index 7de6071d29467..0a0f1f41c3e56 100644
--- a/llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
+++ b/llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
@@ -4659,8 +4659,17 @@ let Predicates = [HasSVE2p3_or_SME2p3] in {
defm SQSHRUN_Z2ZI_StoH : sve_multi_vec_shift_narrow<"sqshrun", 0b100,
null_frag>;
defm SQSHRN_Z2ZI_StoH : sve_multi_vec_
[llvm-branch-commits] [llvm] [AArch64][llvm] Armv9.7-A: Add support for SVE2p3 CVT operations (PR #163162)
https://github.com/jthackray updated
https://github.com/llvm/llvm-project/pull/163162
>From 3aabdd283f382cd60f994a6a9e261557e91d4592 Mon Sep 17 00:00:00 2001
From: Jonathan Thackray
Date: Fri, 5 Sep 2025 23:47:55 +0100
Subject: [PATCH 1/2] [AArch64][llvm] Armv9.7-A: Add support for SVE2p3 CVT
operations
Add instructions for SVE2p3 CVT operations:
- FCVTZSN
- FCVTZUN
- SCVTF
- SCVTFLT
- UCVTF
- UCVTFLT
as documented here:
* https://developer.arm.com/documentation/ddi0602/2025-09/
*
https://developer.arm.com/documentation/109697/2025_09/2025-Architecture-Extensions
---
.../lib/Target/AArch64/AArch64SVEInstrInfo.td | 9 +
llvm/lib/Target/AArch64/SVEInstrFormats.td| 46 +
.../MC/AArch64/SVE2p3/fcvtz-diagnostics.s | 55 ++
llvm/test/MC/AArch64/SVE2p3/fcvtz.s | 165 ++
.../MC/AArch64/SVE2p3/scvtf-diagnostics.s | 65 +++
llvm/test/MC/AArch64/SVE2p3/scvtf.s | 93 ++
.../MC/AArch64/SVE2p3/ucvtf-diagnostics.s | 65 +++
llvm/test/MC/AArch64/SVE2p3/ucvtf.s | 93 ++
8 files changed, 591 insertions(+)
create mode 100644 llvm/test/MC/AArch64/SVE2p3/fcvtz-diagnostics.s
create mode 100644 llvm/test/MC/AArch64/SVE2p3/fcvtz.s
create mode 100644 llvm/test/MC/AArch64/SVE2p3/scvtf-diagnostics.s
create mode 100644 llvm/test/MC/AArch64/SVE2p3/scvtf.s
create mode 100644 llvm/test/MC/AArch64/SVE2p3/ucvtf-diagnostics.s
create mode 100644 llvm/test/MC/AArch64/SVE2p3/ucvtf.s
diff --git a/llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
b/llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
index 2607a5d0c53a1..dfb7bd348e0e0 100644
--- a/llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
+++ b/llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
@@ -4639,6 +4639,15 @@ let Predicates = [HasSVE2p3_or_SME2p3] in {
def SDOT_ZZZI_BtoH : sve_intx_dot_by_indexed_elem_x<0b0, "sdot">;
def UDOT_ZZZI_BtoH : sve_intx_dot_by_indexed_elem_x<0b1, "udot">;
+ // SVE2 fp convert, narrow and interleave to integer, rounding toward zero
+ defm FCVTZSN_Z2Z : sve2_fp_to_int_downcvt<"fcvtzsn", 0b0>;
+ defm FCVTZUN_Z2Z : sve2_fp_to_int_downcvt<"fcvtzun", 0b1>;
+
+ // SVE2 signed/unsigned integer convert to floating-point
+ defm SCVTF_ZZ : sve2_int_to_fp_upcvt<"scvtf", 0b00>;
+ defm SCVTFLT_ZZ : sve2_int_to_fp_upcvt<"scvtflt", 0b10>;
+ defm UCVTF_ZZ : sve2_int_to_fp_upcvt<"ucvtf", 0b01>;
+ defm UCVTFLT_ZZ : sve2_int_to_fp_upcvt<"ucvtflt", 0b11>;
} // End HasSME2p3orSVE2p3
//===--===//
diff --git a/llvm/lib/Target/AArch64/SVEInstrFormats.td
b/llvm/lib/Target/AArch64/SVEInstrFormats.td
index 21b9310f69159..3255d8e6cbe74 100644
--- a/llvm/lib/Target/AArch64/SVEInstrFormats.td
+++ b/llvm/lib/Target/AArch64/SVEInstrFormats.td
@@ -11300,3 +11300,49 @@ class sve_int_mla_cpa
let ElementSize = ZPR64.ElementSize;
}
+
+//===--===//
+// FCVTZSN
+//===--===//
+class sve2_fp_to_int_downcvt size, bit U>
+ : I<(outs ZdRC:$Zd), (ins ZSrcOp:$Zn),
+ asm, "\t$Zd, $Zn", "", []>, Sched<[]> {
+ bits<5> Zd;
+ bits<4> Zn;
+ let Inst{31-24} = 0b01100101;
+ let Inst{23-22} = size;
+ let Inst{21-11} = 0b00110100110;
+ let Inst{10}= U;
+ let Inst{9-6} = Zn;
+ let Inst{5} = 0b0;
+ let Inst{4-0} = Zd;
+}
+
+multiclass sve2_fp_to_int_downcvt {
+ def _HtoB : sve2_fp_to_int_downcvt;
+ def _StoH : sve2_fp_to_int_downcvt;
+ def _DtoS : sve2_fp_to_int_downcvt;
+}
+
+//===--===//
+// SCVTF
+//===--===//
+class sve2_int_to_fp_upcvt size, bits<2> U>
+ : I<(outs ZdRC:$Zd), (ins ZnRC:$Zn),
+ asm, "\t$Zd, $Zn", "", []>, Sched<[]> {
+ bits<5> Zd;
+ bits<5> Zn;
+ let Inst{31-24} = 0b01100101;
+ let Inst{23-22} = size;
+ let Inst{21-12} = 0b001111;
+ let Inst{11-10} = U;
+ let Inst{9-5} = Zn;
+ let Inst{4-0} = Zd;
+}
+
+multiclass sve2_int_to_fp_upcvt U> {
+ def _BtoH : sve2_int_to_fp_upcvt;
+ def _HtoS : sve2_int_to_fp_upcvt;
+ def _StoD : sve2_int_to_fp_upcvt;
+}
diff --git a/llvm/test/MC/AArch64/SVE2p3/fcvtz-diagnostics.s
b/llvm/test/MC/AArch64/SVE2p3/fcvtz-diagnostics.s
new file mode 100644
index 0..bd182e8713e18
--- /dev/null
+++ b/llvm/test/MC/AArch64/SVE2p3/fcvtz-diagnostics.s
@@ -0,0 +1,55 @@
+// RUN: not llvm-mc -triple=aarch64 -show-encoding -mattr=+sve2p3 2>&1 < %s|
FileCheck %s
+
+// --//
+// Invalid operand for instruction
+
+fcvtzsn z0.b, { z0.b, z1.b }
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand for instruction
+// CHECK-NEXT: fcvtzsn z0.b, { z0.b, z1.b }
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+fcvtzsn z0.h, { z0.h, z1.h }
+// CHECK: [[@LINE-1]]:{{[0-9
[llvm-branch-commits] [llvm] [AArch64][llvm] Armv9.7-A: Add support for SVE2p3 CVT operations (PR #163162)
https://github.com/jthackray updated
https://github.com/llvm/llvm-project/pull/163162
>From 3aabdd283f382cd60f994a6a9e261557e91d4592 Mon Sep 17 00:00:00 2001
From: Jonathan Thackray
Date: Fri, 5 Sep 2025 23:47:55 +0100
Subject: [PATCH 1/2] [AArch64][llvm] Armv9.7-A: Add support for SVE2p3 CVT
operations
Add instructions for SVE2p3 CVT operations:
- FCVTZSN
- FCVTZUN
- SCVTF
- SCVTFLT
- UCVTF
- UCVTFLT
as documented here:
* https://developer.arm.com/documentation/ddi0602/2025-09/
*
https://developer.arm.com/documentation/109697/2025_09/2025-Architecture-Extensions
---
.../lib/Target/AArch64/AArch64SVEInstrInfo.td | 9 +
llvm/lib/Target/AArch64/SVEInstrFormats.td| 46 +
.../MC/AArch64/SVE2p3/fcvtz-diagnostics.s | 55 ++
llvm/test/MC/AArch64/SVE2p3/fcvtz.s | 165 ++
.../MC/AArch64/SVE2p3/scvtf-diagnostics.s | 65 +++
llvm/test/MC/AArch64/SVE2p3/scvtf.s | 93 ++
.../MC/AArch64/SVE2p3/ucvtf-diagnostics.s | 65 +++
llvm/test/MC/AArch64/SVE2p3/ucvtf.s | 93 ++
8 files changed, 591 insertions(+)
create mode 100644 llvm/test/MC/AArch64/SVE2p3/fcvtz-diagnostics.s
create mode 100644 llvm/test/MC/AArch64/SVE2p3/fcvtz.s
create mode 100644 llvm/test/MC/AArch64/SVE2p3/scvtf-diagnostics.s
create mode 100644 llvm/test/MC/AArch64/SVE2p3/scvtf.s
create mode 100644 llvm/test/MC/AArch64/SVE2p3/ucvtf-diagnostics.s
create mode 100644 llvm/test/MC/AArch64/SVE2p3/ucvtf.s
diff --git a/llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
b/llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
index 2607a5d0c53a1..dfb7bd348e0e0 100644
--- a/llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
+++ b/llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
@@ -4639,6 +4639,15 @@ let Predicates = [HasSVE2p3_or_SME2p3] in {
def SDOT_ZZZI_BtoH : sve_intx_dot_by_indexed_elem_x<0b0, "sdot">;
def UDOT_ZZZI_BtoH : sve_intx_dot_by_indexed_elem_x<0b1, "udot">;
+ // SVE2 fp convert, narrow and interleave to integer, rounding toward zero
+ defm FCVTZSN_Z2Z : sve2_fp_to_int_downcvt<"fcvtzsn", 0b0>;
+ defm FCVTZUN_Z2Z : sve2_fp_to_int_downcvt<"fcvtzun", 0b1>;
+
+ // SVE2 signed/unsigned integer convert to floating-point
+ defm SCVTF_ZZ : sve2_int_to_fp_upcvt<"scvtf", 0b00>;
+ defm SCVTFLT_ZZ : sve2_int_to_fp_upcvt<"scvtflt", 0b10>;
+ defm UCVTF_ZZ : sve2_int_to_fp_upcvt<"ucvtf", 0b01>;
+ defm UCVTFLT_ZZ : sve2_int_to_fp_upcvt<"ucvtflt", 0b11>;
} // End HasSME2p3orSVE2p3
//===--===//
diff --git a/llvm/lib/Target/AArch64/SVEInstrFormats.td
b/llvm/lib/Target/AArch64/SVEInstrFormats.td
index 21b9310f69159..3255d8e6cbe74 100644
--- a/llvm/lib/Target/AArch64/SVEInstrFormats.td
+++ b/llvm/lib/Target/AArch64/SVEInstrFormats.td
@@ -11300,3 +11300,49 @@ class sve_int_mla_cpa
let ElementSize = ZPR64.ElementSize;
}
+
+//===--===//
+// FCVTZSN
+//===--===//
+class sve2_fp_to_int_downcvt size, bit U>
+ : I<(outs ZdRC:$Zd), (ins ZSrcOp:$Zn),
+ asm, "\t$Zd, $Zn", "", []>, Sched<[]> {
+ bits<5> Zd;
+ bits<4> Zn;
+ let Inst{31-24} = 0b01100101;
+ let Inst{23-22} = size;
+ let Inst{21-11} = 0b00110100110;
+ let Inst{10}= U;
+ let Inst{9-6} = Zn;
+ let Inst{5} = 0b0;
+ let Inst{4-0} = Zd;
+}
+
+multiclass sve2_fp_to_int_downcvt {
+ def _HtoB : sve2_fp_to_int_downcvt;
+ def _StoH : sve2_fp_to_int_downcvt;
+ def _DtoS : sve2_fp_to_int_downcvt;
+}
+
+//===--===//
+// SCVTF
+//===--===//
+class sve2_int_to_fp_upcvt size, bits<2> U>
+ : I<(outs ZdRC:$Zd), (ins ZnRC:$Zn),
+ asm, "\t$Zd, $Zn", "", []>, Sched<[]> {
+ bits<5> Zd;
+ bits<5> Zn;
+ let Inst{31-24} = 0b01100101;
+ let Inst{23-22} = size;
+ let Inst{21-12} = 0b001111;
+ let Inst{11-10} = U;
+ let Inst{9-5} = Zn;
+ let Inst{4-0} = Zd;
+}
+
+multiclass sve2_int_to_fp_upcvt U> {
+ def _BtoH : sve2_int_to_fp_upcvt;
+ def _HtoS : sve2_int_to_fp_upcvt;
+ def _StoD : sve2_int_to_fp_upcvt;
+}
diff --git a/llvm/test/MC/AArch64/SVE2p3/fcvtz-diagnostics.s
b/llvm/test/MC/AArch64/SVE2p3/fcvtz-diagnostics.s
new file mode 100644
index 0..bd182e8713e18
--- /dev/null
+++ b/llvm/test/MC/AArch64/SVE2p3/fcvtz-diagnostics.s
@@ -0,0 +1,55 @@
+// RUN: not llvm-mc -triple=aarch64 -show-encoding -mattr=+sve2p3 2>&1 < %s|
FileCheck %s
+
+// --//
+// Invalid operand for instruction
+
+fcvtzsn z0.b, { z0.b, z1.b }
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand for instruction
+// CHECK-NEXT: fcvtzsn z0.b, { z0.b, z1.b }
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+fcvtzsn z0.h, { z0.h, z1.h }
+// CHECK: [[@LINE-1]]:{{[0-9
[llvm-branch-commits] [llvm] [AArch64][llvm] Armv9.7-A: Add support for SVE2p3 shift operations (PR #163163)
https://github.com/jthackray updated
https://github.com/llvm/llvm-project/pull/163163
>From dfccf5aa93bf1fd4be3f136238e415c8838b2465 Mon Sep 17 00:00:00 2001
From: Jonathan Thackray
Date: Fri, 5 Sep 2025 23:50:38 +0100
Subject: [PATCH] [AArch64][llvm] Armv9.7-A: Add support for SVE2p3 shift
operations
Add instructions for SVE2p3 shift operations:
- SQRSHRN
- SQRSHRUN
- SQSHRN
- SQSHRUN
- UQRSHRN
- UQSHRN
as documented here:
* https://developer.arm.com/documentation/ddi0602/2025-09/
*
https://developer.arm.com/documentation/109697/2025_09/2025-Architecture-Extensions
---
.../lib/Target/AArch64/AArch64SVEInstrInfo.td | 17 +-
llvm/lib/Target/AArch64/SVEInstrFormats.td| 22 +-
.../MC/AArch64/SVE2p3/qshrn-diagnostics.s | 266 ++
llvm/test/MC/AArch64/SVE2p3/qshrn.s | 255 +
4 files changed, 550 insertions(+), 10 deletions(-)
create mode 100644 llvm/test/MC/AArch64/SVE2p3/qshrn-diagnostics.s
create mode 100644 llvm/test/MC/AArch64/SVE2p3/qshrn.s
diff --git a/llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
b/llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
index dfb7bd348e0e0..7de6071d29467 100644
--- a/llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
+++ b/llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
@@ -4272,9 +4272,9 @@ def : Pat<(nxv4i32 (partial_reduce_smla nxv4i32:$Acc,
nxv8i16:$MulLHS, nxv8i16:$
defm SQCVTN_Z2Z_StoH : sve2p1_multi_vec_extract_narrow<"sqcvtn", 0b00,
int_aarch64_sve_sqcvtn_x2>;
defm UQCVTN_Z2Z_StoH : sve2p1_multi_vec_extract_narrow<"uqcvtn", 0b01,
int_aarch64_sve_uqcvtn_x2>;
defm SQCVTUN_Z2Z_StoH : sve2p1_multi_vec_extract_narrow<"sqcvtun", 0b10,
int_aarch64_sve_sqcvtun_x2>;
-defm SQRSHRN_Z2ZI_StoH : sve2p1_multi_vec_shift_narrow<"sqrshrn", 0b101,
int_aarch64_sve_sqrshrn_x2>;
-defm UQRSHRN_Z2ZI_StoH : sve2p1_multi_vec_shift_narrow<"uqrshrn", 0b111,
int_aarch64_sve_uqrshrn_x2>;
-defm SQRSHRUN_Z2ZI_StoH : sve2p1_multi_vec_shift_narrow<"sqrshrun", 0b001,
int_aarch64_sve_sqrshrun_x2>;
+defm SQRSHRN_Z2ZI_StoH : sve_multi_vec_shift_narrow<"sqrshrn", 0b101,
int_aarch64_sve_sqrshrn_x2>;
+defm UQRSHRN_Z2ZI_StoH : sve_multi_vec_shift_narrow<"uqrshrn", 0b111,
int_aarch64_sve_uqrshrn_x2>;
+defm SQRSHRUN_Z2ZI_StoH : sve_multi_vec_shift_narrow<"sqrshrun", 0b001,
int_aarch64_sve_sqrshrun_x2>;
defm WHILEGE_2PXX : sve2p1_int_while_rr_pair<"whilege", 0b000>;
defm WHILEGT_2PXX : sve2p1_int_while_rr_pair<"whilegt", 0b001>;
@@ -4648,6 +4648,17 @@ let Predicates = [HasSVE2p3_or_SME2p3] in {
defm SCVTFLT_ZZ : sve2_int_to_fp_upcvt<"scvtflt", 0b10>;
defm UCVTF_ZZ : sve2_int_to_fp_upcvt<"ucvtf", 0b01>;
defm UCVTFLT_ZZ : sve2_int_to_fp_upcvt<"ucvtflt", 0b11>;
+
+ // SVE2 saturating shift right narrow by immediate and interleave
+ defm SQRSHRN_Z2ZI_HtoB : sve_multi_vec_round_shift_narrow<"sqrshrn",
0b101>;
+ defm SQRSHRUN_Z2ZI_HtoB : sve_multi_vec_round_shift_narrow<"sqrshrun",
0b001>;
+ defm SQSHRN_Z2ZI_HtoB : sve_multi_vec_round_shift_narrow<"sqshrn",
0b000>;
+ defm SQSHRUN_Z2ZI_HtoB : sve_multi_vec_round_shift_narrow<"sqshrun",
0b100>;
+ defm UQRSHRN_Z2ZI_HtoB : sve_multi_vec_round_shift_narrow<"uqrshrn",
0b111>;
+ defm UQSHRN_Z2ZI_HtoB : sve_multi_vec_round_shift_narrow<"uqshrn",
0b010>;
+ defm SQSHRUN_Z2ZI_StoH : sve_multi_vec_shift_narrow<"sqshrun", 0b100,
null_frag>;
+ defm SQSHRN_Z2ZI_StoH : sve_multi_vec_shift_narrow<"sqshrn", 0b000,
null_frag>;
+ defm UQSHRN_Z2ZI_StoH : sve_multi_vec_shift_narrow<"uqshrn", 0b010,
null_frag>;
} // End HasSME2p3orSVE2p3
//===--===//
diff --git a/llvm/lib/Target/AArch64/SVEInstrFormats.td
b/llvm/lib/Target/AArch64/SVEInstrFormats.td
index 19b42c7549a62..449b35d397f0f 100644
--- a/llvm/lib/Target/AArch64/SVEInstrFormats.td
+++ b/llvm/lib/Target/AArch64/SVEInstrFormats.td
@@ -10050,18 +10050,19 @@ multiclass sve2p1_multi_vec_extract_narrow opc, SDPatte
}
// SVE2 multi-vec shift narrow
-class sve2p1_multi_vec_shift_narrow opc, bits<2> tsz>
-: I<(outs ZPR16:$Zd), (ins ZZ_s_mul_r:$Zn, vecshiftR16:$imm4),
-mnemonic, "\t$Zd, $Zn, $imm4",
+class sve2p1_multi_vec_shift_narrow opc, bits<2> tsz>
+: I<(outs ZdRC:$Zd), (ins ZSrcOp:$Zn, immtype:$imm),
+mnemonic, "\t$Zd, $Zn, $imm",
"", []>, Sched<[]> {
bits<5> Zd;
bits<4> Zn;
- bits<4> imm4;
+ bits<4> imm;
let Inst{31-23} = 0b010001011;
let Inst{22}= tsz{1};
let Inst{21}= 0b1;
let Inst{20}= tsz{0};
- let Inst{19-16} = imm4;
+ let Inst{18-16} = imm{2-0}; // imm3
let Inst{15-14} = 0b00;
let Inst{13-11} = opc;
let Inst{10}= 0b0;
@@ -10072,12 +10073,19 @@ class sve2p1_multi_vec_shift_narrow opc, bits<2> tsz>
let hasSideEffects = 0;
}
-multiclass sve2p1_multi_vec_shift_narrow opc,
SDPatternOperator intrinsic> {
- def NAME : sve2p1_multi_vec_shift_narrow;
+multiclass sve_multi_vec_shift_narrow opc,
SDPatternOperator intrinsic> {
[llvm-branch-commits] [Clang] Implement constexpr evaluation for __builtin_infer_alloc_token() (PR #163639)
https://github.com/melver edited https://github.com/llvm/llvm-project/pull/163639 ___ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libc] [libc][annex_k] Add libc_constraint_handler. (PR #163315)
https://github.com/bassiounix updated
https://github.com/llvm/llvm-project/pull/163315
>From a78a7696420ae3277725b0f6accade2cac857fb9 Mon Sep 17 00:00:00 2001
From: bassiounix
Date: Tue, 14 Oct 2025 06:38:29 +0300
Subject: [PATCH] [libc][annex_k] Add libc_constraint_handler.
---
libc/src/__support/annex_k/CMakeLists.txt | 9 +++
.../annex_k/libc_constraint_handler.h | 26 +++
2 files changed, 35 insertions(+)
create mode 100644 libc/src/__support/annex_k/libc_constraint_handler.h
diff --git a/libc/src/__support/annex_k/CMakeLists.txt
b/libc/src/__support/annex_k/CMakeLists.txt
index 78f5b3cddebd7..8eb65f2469b4f 100644
--- a/libc/src/__support/annex_k/CMakeLists.txt
+++ b/libc/src/__support/annex_k/CMakeLists.txt
@@ -10,3 +10,12 @@ add_header_library(
libc.src.__support.OSUtil.osutil
libc.src.stdlib.abort
)
+
+add_header_library(
+ libc_constraint_handler
+ HDRS
+libc_constraint_handler.h
+ DEPENDS
+.abort_handler_s
+libc.hdr.types.constraint_handler_t
+)
diff --git a/libc/src/__support/annex_k/libc_constraint_handler.h
b/libc/src/__support/annex_k/libc_constraint_handler.h
new file mode 100644
index 0..db01c8dd940a0
--- /dev/null
+++ b/libc/src/__support/annex_k/libc_constraint_handler.h
@@ -0,0 +1,26 @@
+//===-- Static header for libc_constraint_handler ---*- C++
-*-===//
+//
+// 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
+//
+//===--===//
+
+#ifndef LLVM_LIBC_SRC___SUPPORT_ANNEX_K_LIBC_CONSTRAINT_HANDLER_H
+#define LLVM_LIBC_SRC___SUPPORT_ANNEX_K_LIBC_CONSTRAINT_HANDLER_H
+
+#include "abort_handler_s.h"
+#include "hdr/types/constraint_handler_t.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+namespace annex_k {
+
+LIBC_INLINE static constraint_handler_t libc_constraint_handler =
+&abort_handler_s;
+
+} // namespace annex_k
+
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_ANNEX_K_LIBC_CONSTRAINT_HANDLER_H
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [llvm] [AArch64][llvm] Armv9.7-A: Add support for new Advanced SIMD (Neon) instructions (PR #163165)
https://github.com/jthackray updated https://github.com/llvm/llvm-project/pull/163165 >From 9cd6e3cedd6b82fafef45be547812fdd5bc608e2 Mon Sep 17 00:00:00 2001 From: Jonathan Thackray Date: Mon, 15 Sep 2025 21:13:29 +0100 Subject: [PATCH 1/2] [AArch64][llvm] Armv9.7-A: Add support for new Advanced SIMD (Neon) instructions Add support for new Advanced SIMD (Neon) instructions: - FDOT (half-precision to single-precision, by element) - FDOT (half-precision to single-precision, vector) - FMMLA (half-precision, non-widening) - FMMLA (widening, half-precision to single-precision) as documented here: * https://developer.arm.com/documentation/ddi0602/2025-09/ * https://developer.arm.com/documentation/109697/2025_09/2025-Architecture-Extensions Co-authored-by: Kerry McLaughlin Co-authored-by: Caroline Concatto Co-authored-by: Virginia Cangelosi --- .../print-supported-extensions-aarch64.c | 2 + llvm/lib/Target/AArch64/AArch64Features.td| 6 + .../lib/Target/AArch64/AArch64InstrFormats.td | 42 - llvm/lib/Target/AArch64/AArch64InstrInfo.td | 17 +- .../AArch64/AsmParser/AArch64AsmParser.cpp| 2 + llvm/test/MC/AArch64/FP8/fmmla-diagnostics.s | 2 +- llvm/test/MC/AArch64/neon-fdot-diagnostics.s | 59 +++ llvm/test/MC/AArch64/neon-fdot.s | 147 ++ .../MC/AArch64/neon-fmmla-HtoS-diagnostics.s | 24 +++ llvm/test/MC/AArch64/neon-fmmla-HtoS.s| 37 + llvm/test/MC/AArch64/neon-fmmla-diagnostics.s | 24 +++ llvm/test/MC/AArch64/neon-fmmla.s | 37 + .../TargetParser/TargetParserTest.cpp | 32 +++- 13 files changed, 424 insertions(+), 7 deletions(-) create mode 100644 llvm/test/MC/AArch64/neon-fdot-diagnostics.s create mode 100644 llvm/test/MC/AArch64/neon-fdot.s create mode 100644 llvm/test/MC/AArch64/neon-fmmla-HtoS-diagnostics.s create mode 100644 llvm/test/MC/AArch64/neon-fmmla-HtoS.s create mode 100644 llvm/test/MC/AArch64/neon-fmmla-diagnostics.s create mode 100644 llvm/test/MC/AArch64/neon-fmmla.s diff --git a/clang/test/Driver/print-supported-extensions-aarch64.c b/clang/test/Driver/print-supported-extensions-aarch64.c index 50c3610123646..7975b5ab7cb83 100644 --- a/clang/test/Driver/print-supported-extensions-aarch64.c +++ b/clang/test/Driver/print-supported-extensions-aarch64.c @@ -18,6 +18,8 @@ // CHECK-NEXT: d128FEAT_D128, FEAT_LVA3, FEAT_SYSREG128, FEAT_SYSINSTR128 Enable Armv9.4-A 128-bit Page Table Descriptors, System Registers and instructions // CHECK-NEXT: dit FEAT_DIT Enable Armv8.4-A Data Independent Timing instructions // CHECK-NEXT: dotprod FEAT_DotProd Enable dot product support +// CHECK-NEXT: f16f32dot FEAT_F16F32DOT Enable Armv9.7-A Advanced SIMD half-precision dot product accumulate to single-precision +// CHECK-NEXT: f16f32mmFEAT_F16F32MM Enable Armv9.7-A Advanced SIMD half-precision matrix multiply-accumulate to single-precision // CHECK-NEXT: f16mm FEAT_F16MM Enable Armv9.7-A non-widening half-precision matrix multiply-accumulate // CHECK-NEXT: f32mm FEAT_F32MM Enable Matrix Multiply FP32 Extension // CHECK-NEXT: f64mm FEAT_F64MM Enable Matrix Multiply FP64 Extension diff --git a/llvm/lib/Target/AArch64/AArch64Features.td b/llvm/lib/Target/AArch64/AArch64Features.td index 5f943d39321f9..d2838d5065d28 100644 --- a/llvm/lib/Target/AArch64/AArch64Features.td +++ b/llvm/lib/Target/AArch64/AArch64Features.td @@ -619,6 +619,12 @@ def FeatureSVE_B16MM : ExtensionWithMArch<"sve-b16mm", "SVE_B16MM", "FEAT_SVE_B1 def FeatureF16MM : ExtensionWithMArch<"f16mm", "F16MM", "FEAT_F16MM", "Enable Armv9.7-A non-widening half-precision matrix multiply-accumulate", [FeatureFullFP16]>; +def FeatureF16F32DOT : ExtensionWithMArch<"f16f32dot", "F16F32DOT", "FEAT_F16F32DOT", + "Enable Armv9.7-A Advanced SIMD half-precision dot product accumulate to single-precision", [FeatureNEON, FeatureFullFP16]>; + +def FeatureF16F32MM : ExtensionWithMArch<"f16f32mm", "F16F32MM", "FEAT_F16F32MM", + "Enable Armv9.7-A Advanced SIMD half-precision matrix multiply-accumulate to single-precision", [FeatureNEON, FeatureFullFP16]>; + //===--===// // Other Features //===--===// diff --git a/llvm/lib/Target/AArch64/AArch64InstrFormats.td b/llvm/lib/Target/AArch64/AArch64InstrFormats.td index d2f282eadd302..1bc9aea52a265 100644 --- a/llvm/lib/Target/AArch64/AArch64InstrFormats.td +++ b/llvm/lib/Target/AArch64
[llvm-branch-commits] [libc] [libc][stdlib][annex_k] Add set_constraint_handler_s. (PR #163320)
https://github.com/bassiounix updated
https://github.com/llvm/llvm-project/pull/163320
>From 72604c26f1823435525d49cf5e6654bdcea16fbe Mon Sep 17 00:00:00 2001
From: bassiounix
Date: Tue, 14 Oct 2025 07:06:06 +0300
Subject: [PATCH] [libc][stdlib][annex_k] Add set_constraint_handler_s.
---
libc/config/linux/aarch64/entrypoints.txt| 1 +
libc/config/linux/riscv/entrypoints.txt | 1 +
libc/config/linux/x86_64/entrypoints.txt | 1 +
libc/include/stdlib.yaml | 7 +
libc/src/stdlib/CMakeLists.txt | 11
libc/src/stdlib/set_constraint_handler_s.cpp | 28
libc/src/stdlib/set_constraint_handler_s.h | 21 +++
7 files changed, 70 insertions(+)
create mode 100644 libc/src/stdlib/set_constraint_handler_s.cpp
create mode 100644 libc/src/stdlib/set_constraint_handler_s.h
diff --git a/libc/config/linux/aarch64/entrypoints.txt
b/libc/config/linux/aarch64/entrypoints.txt
index b2b3789cc2f60..a6493467d2143 100644
--- a/libc/config/linux/aarch64/entrypoints.txt
+++ b/libc/config/linux/aarch64/entrypoints.txt
@@ -2,6 +2,7 @@ set(TARGET_ANNEX_K_ENTRYPOINTS
# stdlib.h entrypoints
libc.src.stdlib.abort_handler_s
libc.src.stdlib.ignore_handler_s
+libc.src.stdlib.set_constraint_handler_s
)
set(TARGET_LIBC_ENTRYPOINTS
diff --git a/libc/config/linux/riscv/entrypoints.txt
b/libc/config/linux/riscv/entrypoints.txt
index 5d92b112272fb..b19641a0a656b 100644
--- a/libc/config/linux/riscv/entrypoints.txt
+++ b/libc/config/linux/riscv/entrypoints.txt
@@ -2,6 +2,7 @@ set(TARGET_ANNEX_K_ENTRYPOINTS
# stdlib.h entrypoints
libc.src.stdlib.abort_handler_s
libc.src.stdlib.ignore_handler_s
+libc.src.stdlib.set_constraint_handler_s
)
set(TARGET_LIBC_ENTRYPOINTS
diff --git a/libc/config/linux/x86_64/entrypoints.txt
b/libc/config/linux/x86_64/entrypoints.txt
index 4cb412ae7c526..12e81121a1a01 100644
--- a/libc/config/linux/x86_64/entrypoints.txt
+++ b/libc/config/linux/x86_64/entrypoints.txt
@@ -2,6 +2,7 @@ set(TARGET_ANNEX_K_ENTRYPOINTS
# stdlib.h entrypoints
libc.src.stdlib.abort_handler_s
libc.src.stdlib.ignore_handler_s
+libc.src.stdlib.set_constraint_handler_s
)
set(TARGET_LIBC_ENTRYPOINTS
diff --git a/libc/include/stdlib.yaml b/libc/include/stdlib.yaml
index 7c3b113a62415..49d45f105fe7a 100644
--- a/libc/include/stdlib.yaml
+++ b/libc/include/stdlib.yaml
@@ -202,6 +202,13 @@ functions:
- type: void *__restrict
- type: errno_t
guard: 'LIBC_HAS_ANNEX_K'
+ - name: set_constraint_handler_s
+standards:
+ - stdc
+return_type: constraint_handler_t
+arguments:
+ - type: constraint_handler_t
+guard: 'LIBC_HAS_ANNEX_K'
- name: srand
standards:
- stdc
diff --git a/libc/src/stdlib/CMakeLists.txt b/libc/src/stdlib/CMakeLists.txt
index 5efd7f13ff3ee..c380657300cfe 100644
--- a/libc/src/stdlib/CMakeLists.txt
+++ b/libc/src/stdlib/CMakeLists.txt
@@ -664,6 +664,17 @@ add_entrypoint_object(
.${LIBC_TARGET_OS}.system
)
+add_entrypoint_object(
+ set_constraint_handler_s
+ SRCS
+set_constraint_handler_s.cpp
+ HDRS
+set_constraint_handler_s.h
+ DEPENDS
+libc.src.__support.annex_k.abort_handler_s
+libc.src.__support.annex_k.libc_constraint_handler
+)
+
add_entrypoint_object(
ignore_handler_s
HDRS
diff --git a/libc/src/stdlib/set_constraint_handler_s.cpp
b/libc/src/stdlib/set_constraint_handler_s.cpp
new file mode 100644
index 0..d3a16d77e3b0a
--- /dev/null
+++ b/libc/src/stdlib/set_constraint_handler_s.cpp
@@ -0,0 +1,28 @@
+//===-- Implementation of set_constraint_handler_s
===//
+//
+// 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
+//
+//===--===//
+
+#include "set_constraint_handler_s.h"
+#include "src/__support/annex_k/abort_handler_s.h"
+#include "src/__support/annex_k/libc_constraint_handler.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(constraint_handler_t, set_constraint_handler_s,
+ (constraint_handler_t handler)) {
+ auto previous_handler = annex_k::libc_constraint_handler;
+
+ if (!handler) {
+annex_k::libc_constraint_handler = &annex_k::abort_handler_s;
+ } else {
+annex_k::libc_constraint_handler = handler;
+ }
+
+ return previous_handler;
+}
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/stdlib/set_constraint_handler_s.h
b/libc/src/stdlib/set_constraint_handler_s.h
new file mode 100644
index 0..f5c6e01712ef0
--- /dev/null
+++ b/libc/src/stdlib/set_constraint_handler_s.h
@@ -0,0 +1,21 @@
+//===-- Implementation header for set_constraint_handler_s --*- C++
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// S
[llvm-branch-commits] [libc] [libc][annex_k] Add libc_constraint_handler. (PR #163315)
https://github.com/bassiounix updated
https://github.com/llvm/llvm-project/pull/163315
>From 387bde0d66c637adf8208654f65e792f4aa5254b Mon Sep 17 00:00:00 2001
From: bassiounix
Date: Tue, 14 Oct 2025 06:38:29 +0300
Subject: [PATCH] [libc][annex_k] Add libc_constraint_handler.
---
libc/src/__support/annex_k/CMakeLists.txt | 9 +++
.../annex_k/libc_constraint_handler.h | 26 +++
2 files changed, 35 insertions(+)
create mode 100644 libc/src/__support/annex_k/libc_constraint_handler.h
diff --git a/libc/src/__support/annex_k/CMakeLists.txt
b/libc/src/__support/annex_k/CMakeLists.txt
index 78f5b3cddebd7..8eb65f2469b4f 100644
--- a/libc/src/__support/annex_k/CMakeLists.txt
+++ b/libc/src/__support/annex_k/CMakeLists.txt
@@ -10,3 +10,12 @@ add_header_library(
libc.src.__support.OSUtil.osutil
libc.src.stdlib.abort
)
+
+add_header_library(
+ libc_constraint_handler
+ HDRS
+libc_constraint_handler.h
+ DEPENDS
+.abort_handler_s
+libc.hdr.types.constraint_handler_t
+)
diff --git a/libc/src/__support/annex_k/libc_constraint_handler.h
b/libc/src/__support/annex_k/libc_constraint_handler.h
new file mode 100644
index 0..db01c8dd940a0
--- /dev/null
+++ b/libc/src/__support/annex_k/libc_constraint_handler.h
@@ -0,0 +1,26 @@
+//===-- Static header for libc_constraint_handler ---*- C++
-*-===//
+//
+// 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
+//
+//===--===//
+
+#ifndef LLVM_LIBC_SRC___SUPPORT_ANNEX_K_LIBC_CONSTRAINT_HANDLER_H
+#define LLVM_LIBC_SRC___SUPPORT_ANNEX_K_LIBC_CONSTRAINT_HANDLER_H
+
+#include "abort_handler_s.h"
+#include "hdr/types/constraint_handler_t.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+namespace annex_k {
+
+LIBC_INLINE static constraint_handler_t libc_constraint_handler =
+&abort_handler_s;
+
+} // namespace annex_k
+
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_ANNEX_K_LIBC_CONSTRAINT_HANDLER_H
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libc] [libc][annex_k] Add errno_t. (PR #163094)
https://github.com/bassiounix edited https://github.com/llvm/llvm-project/pull/163094 ___ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libc] [libc][annex_k] Add errno_t. (PR #163094)
https://github.com/bassiounix updated https://github.com/llvm/llvm-project/pull/163094 >From d215d654f9036ca16aadc969b5785c53e87f9986 Mon Sep 17 00:00:00 2001 From: bassiounix Date: Sun, 12 Oct 2025 22:18:17 +0300 Subject: [PATCH 1/5] [libc][annex_k] Add errno_t. --- libc/hdr/types/CMakeLists.txt | 9 + libc/hdr/types/errno_t.h| 18 ++ libc/include/CMakeLists.txt | 1 + libc/include/errno.h.def| 2 ++ libc/include/llvm-libc-types/CMakeLists.txt | 2 ++ libc/include/llvm-libc-types/errno_t.h | 18 ++ 6 files changed, 50 insertions(+) create mode 100644 libc/hdr/types/errno_t.h create mode 100644 libc/include/llvm-libc-types/errno_t.h diff --git a/libc/hdr/types/CMakeLists.txt b/libc/hdr/types/CMakeLists.txt index 225843924c243..8ec2926ee16fc 100644 --- a/libc/hdr/types/CMakeLists.txt +++ b/libc/hdr/types/CMakeLists.txt @@ -162,6 +162,15 @@ add_proxy_header_library( libc.include.fcntl ) +add_proxy_header_library( + errno_t + HDRS +errno_t.h + FULL_BUILD_DEPENDS +libc.include.llvm-libc-types.errno_t +libc.include.errno +) + add_proxy_header_library( fenv_t HDRS diff --git a/libc/hdr/types/errno_t.h b/libc/hdr/types/errno_t.h new file mode 100644 index 0..91706b05c9155 --- /dev/null +++ b/libc/hdr/types/errno_t.h @@ -0,0 +1,18 @@ +//===-- Proxy for errno_t -===// +// +// 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 +// +//===--===// + +#ifndef LLVM_LIBC_HDR_TYPES_ERRNO_T_H +#define LLVM_LIBC_HDR_TYPES_ERRNO_T_H + +#define LIBC_HAS_ANNEX_K + +#include "include/llvm-libc-types/errno_t.h" + +#undef LIBC_HAS_ANNEX_K + +#endif // LLVM_LIBC_HDR_TYPES_ERRNO_T_H diff --git a/libc/include/CMakeLists.txt b/libc/include/CMakeLists.txt index 81360aac984e0..c70d1190e8342 100644 --- a/libc/include/CMakeLists.txt +++ b/libc/include/CMakeLists.txt @@ -302,6 +302,7 @@ add_header_macro( DEPENDS .llvm-libc-macros.generic_error_number_macros .llvm-libc-macros.error_number_macros +.llvm-libc-types.errno_t ) add_header_macro( diff --git a/libc/include/errno.h.def b/libc/include/errno.h.def index aa1f6c9e48444..35341c60e38b2 100644 --- a/libc/include/errno.h.def +++ b/libc/include/errno.h.def @@ -33,4 +33,6 @@ __END_C_DECLS #define errno (*__llvm_libc_errno()) +#include "llvm-libc-types/errno_t.h" + #endif // LLVM_LIBC_ERRNO_H diff --git a/libc/include/llvm-libc-types/CMakeLists.txt b/libc/include/llvm-libc-types/CMakeLists.txt index 5f506c4d25c9b..cfd0eabc42d5e 100644 --- a/libc/include/llvm-libc-types/CMakeLists.txt +++ b/libc/include/llvm-libc-types/CMakeLists.txt @@ -298,3 +298,5 @@ add_header(EFI_SYSTEM_TABLE .EFI_TABLE_HEADER .char16_t ) + +add_header(errno_t HDR errno_t.h) diff --git a/libc/include/llvm-libc-types/errno_t.h b/libc/include/llvm-libc-types/errno_t.h new file mode 100644 index 0..f99fe1266ccd1 --- /dev/null +++ b/libc/include/llvm-libc-types/errno_t.h @@ -0,0 +1,18 @@ +//===-- Definition of type errno_t ===// +// +// 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 +// +//===--===// + +#ifndef LLVM_LIBC_INCLUDE_LLVM_LIBC_TYPES_ERRNO_T_H +#define LLVM_LIBC_INCLUDE_LLVM_LIBC_TYPES_ERRNO_T_H + +#ifdef LIBC_HAS_ANNEX_K + +typedef int errno_t; + +#endif // LIBC_HAS_ANNEX_K + +#endif // LLVM_LIBC_INCLUDE_LLVM_LIBC_TYPES_ERRNO_T_H >From 17c0bbe0c9f8791104f75bce37c29064bc4387b2 Mon Sep 17 00:00:00 2001 From: bassiounix Date: Tue, 14 Oct 2025 00:44:08 +0300 Subject: [PATCH 2/5] change location of errno_t --- libc/include/llvm-libc-types/CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libc/include/llvm-libc-types/CMakeLists.txt b/libc/include/llvm-libc-types/CMakeLists.txt index cfd0eabc42d5e..e8b3ae8c08a90 100644 --- a/libc/include/llvm-libc-types/CMakeLists.txt +++ b/libc/include/llvm-libc-types/CMakeLists.txt @@ -29,6 +29,7 @@ add_header(double_t HDR double_t.h) add_header(DIR HDR DIR.h) add_header(dev_t HDR dev_t.h) add_header(div_t HDR div_t.h) +add_header(errno_t HDR errno_t.h) add_header(ldiv_t HDR ldiv_t.h) add_header(lldiv_t HDR lldiv_t.h) add_header(FILE HDR FILE.h) @@ -298,5 +299,3 @@ add_header(EFI_SYSTEM_TABLE .EFI_TABLE_HEADER .char16_t ) - -add_header(errno_t HDR errno_t.h) >From f998c2bfca5013cb29043556912436df17850fcd Mon Sep 17 00:00:00 2001 From: bassiounix Date: Fri, 17 Oct 2025 01:17:20 +0300 Subject
[llvm-branch-commits] [FlowSensitive] [StatusOr] [3/N] Support absl::Status ops (PR #163868)
https://github.com/fmayer edited https://github.com/llvm/llvm-project/pull/163868 ___ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [FlowSensitive] [StatusOr] [7/N] Support StatusOr::emplace (PR #163876)
https://github.com/fmayer edited https://github.com/llvm/llvm-project/pull/163876 ___ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [llvm] [AArch64][llvm] Armv9.7-A: Add support for TLBI Domains (FEAT_TLBID) (PR #163156)
https://github.com/jthackray updated
https://github.com/llvm/llvm-project/pull/163156
>From 3d6ab1b50e6fa4a06f74cf1ec1c86b478b7d33e5 Mon Sep 17 00:00:00 2001
From: Jonathan Thackray
Date: Mon, 8 Sep 2025 13:19:57 +0100
Subject: [PATCH] [AArch64][llvm] Armv9.7-A: Add support for TLBI Domains
(FEAT_TLBID)
Allow the following `TLBI` operation types to take an optional register
operand when enabled by `FEAT_TLBID`:
- ALL*
- VMALL*
- VMALLS12*
- VMALLWS2*
as documented here:
* https://developer.arm.com/documentation/ddi0602/2025-09/
*
https://developer.arm.com/documentation/109697/2025_09/2025-Architecture-Extensions
Notes on implementation:
Currently, AArch64 `SYS` alias instructions fall into two categories:
* a register value must be present (indicated by any value except `XZR`)
* no register value must be present (this value must be `XZR`)
When +tblid is enabled, `SYS` aliases are now allowed to take an optional
register, or no register as before. We need an extra tablegen flag to
indicate if the register is optional or not (the existing "NeedsReg" flag
is binary and not suitable; the register is either present or absent,
not either for a specific TLBI operation)
Don't produce an error message if the register operand is missing or
unexpected, if it is specified as an optional register.
---
clang/test/Driver/aarch64-v97a.c | 4 +
.../print-supported-extensions-aarch64.c | 1 +
llvm/lib/Target/AArch64/AArch64Features.td| 3 +
llvm/lib/Target/AArch64/AArch64InstrInfo.td | 2 +
.../Target/AArch64/AArch64SystemOperands.td | 72
.../AArch64/AsmParser/AArch64AsmParser.cpp| 20 +++--
.../MCTargetDesc/AArch64InstPrinter.cpp | 14 +++-
.../Target/AArch64/Utils/AArch64BaseInfo.h| 24 --
.../MC/AArch64/armv9.7a-tlbid-diagnostics.s | 64 ++
llvm/test/MC/AArch64/armv9.7a-tlbid.s | 84 +++
.../TargetParser/TargetParserTest.cpp | 4 +-
11 files changed, 239 insertions(+), 53 deletions(-)
create mode 100644 llvm/test/MC/AArch64/armv9.7a-tlbid-diagnostics.s
create mode 100644 llvm/test/MC/AArch64/armv9.7a-tlbid.s
diff --git a/clang/test/Driver/aarch64-v97a.c b/clang/test/Driver/aarch64-v97a.c
index 4a55d44466cc0..ec0e4245b81aa 100644
--- a/clang/test/Driver/aarch64-v97a.c
+++ b/clang/test/Driver/aarch64-v97a.c
@@ -25,3 +25,7 @@
// RUN: %clang -target aarch64 -march=armv9.7a+lscp -### -c %s 2>&1 |
FileCheck -check-prefix=V97A-LSCP %s
// RUN: %clang -target aarch64 -march=armv9.7-a+lscp -### -c %s 2>&1 |
FileCheck -check-prefix=V97A-LSCP %s
// V97A-LSCP: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "generic"
"-target-feature" "+v9.7a"{{.*}} "-target-feature" "+lscp"
+
+// RUN: %clang -target aarch64 -march=armv9.7a+tlbid -### -c %s 2>&1 |
FileCheck -check-prefix=V97A-TLBID %s
+// RUN: %clang -target aarch64 -march=armv9.7-a+tlbid -### -c %s 2>&1 |
FileCheck -check-prefix=V97A-TLBID %s
+// V97A-TLBID: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "generic"
"-target-feature" "+v9.7a"{{.*}} "-target-feature" "+tlbid"
diff --git a/clang/test/Driver/print-supported-extensions-aarch64.c
b/clang/test/Driver/print-supported-extensions-aarch64.c
index 9928f395866d8..3e4ceae5bd5c1 100644
--- a/clang/test/Driver/print-supported-extensions-aarch64.c
+++ b/clang/test/Driver/print-supported-extensions-aarch64.c
@@ -104,6 +104,7 @@
// CHECK-NEXT: sve2p1 FEAT_SVE2p1
Enable Scalable Vector Extension 2.1 instructions
// CHECK-NEXT: sve2p2 FEAT_SVE2p2
Enable Armv9.6-A Scalable Vector Extension 2.2 instructions
// CHECK-NEXT: the FEAT_THE
Enable Armv8.9-A Translation Hardening Extension
+// CHECK-NEXT: tlbid FEAT_TLBID
Enable Armv9.7-A TLBI Domains extension
// CHECK-NEXT: tlbiw FEAT_TLBIW
Enable Armv9.5-A TLBI VMALL for Dirty State
// CHECK-NEXT: tme FEAT_TME
Enable Transactional Memory Extension
// CHECK-NEXT: wfxtFEAT_WFxT
Enable Armv8.7-A WFET and WFIT instruction
diff --git a/llvm/lib/Target/AArch64/AArch64Features.td
b/llvm/lib/Target/AArch64/AArch64Features.td
index 7fe83537b7a36..eea06968f438a 100644
--- a/llvm/lib/Target/AArch64/AArch64Features.td
+++ b/llvm/lib/Target/AArch64/AArch64Features.td
@@ -595,6 +595,9 @@ def FeatureCMH : ExtensionWithMArch<"cmh", "CMH",
"FEAT_CMH",
def FeatureLSCP : ExtensionWithMArch<"lscp", "LSCP", "FEAT_LSCP",
"Enable Armv9.7-A Load-acquire and store-release pair extension">;
+def FeatureTLBID: ExtensionWithMArch<"tlbid", "TLBID", "FEAT_TLBID",
+ "Enable Armv9.7-A TLBI Domains extension
[llvm-branch-commits] [llvm] [AArch64][llvm] Armv9.7-A: Add support for SVE2p3 LUTI6 operations (PR #163164)
@@ -0,0 +1,70 @@
+// RUN: not llvm-mc -triple=aarch64 -show-encoding -mattr=+sve2p3 2>&1 < %s|
FileCheck %s
+
+// --//
+// Invalid element width
+
+luti6 z10.h, { z0.b, z1.b }, z0
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand for instruction
+// CHECK-NEXT: luti6 z10.h, { z0.b, z1.b }, z0
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+luti6 z10.s, { z0.b, z1.b }, z0
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid element width
+// CHECK-NEXT: luti6 z10.s, { z0.b, z1.b }, z0
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+// --//
+// Negative tests for instructions that are incompatible with movprfx
+
+movprfx z0.h, p0/m, z7.h
+luti6 z10.b, { z0.b, z1.b }, z0
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: instruction is unpredictable when
following a movprfx, suggest replacing movprfx with mov
+// CHECK-NEXT: luti6 z10.b, { z0.b, z1.b }, z0
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+movprfx z0, z7
+luti6 z10.b, { z0.b, z1.b }, z0
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: instruction is unpredictable when
following a movprfx, suggest replacing movprfx with mov
+// CHECK-NEXT: luti6 z10.b, { z0.b, z1.b }, z0
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+// --//
+// Invalid element width
+
+luti6 z10.s, { z0.h, z1.h }, z0[0]
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid element width
+// CHECK-NEXT: luti6 z10.s, { z0.h, z1.h }, z0[0]
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+luti6 z10.b, { z0.h, z1.h }, z0[0]
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand for instruction
+// CHECK-NEXT: luti6 z10.b, { z0.h, z1.h }, z0[0]
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+// --//
+// Invalid immediate range
+
+luti6 z10.h, { z0.h, z1.h }, z0[-1]
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: vector lane must be an integer in
range [0, 1].
+// CHECK-NEXT: luti6 z10.h, { z0.h, z1.h }, z0[-1]
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+luti6 z10.h, { z0.h, z1.h }, z0[2]
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: vector lane must be an integer in
range [0, 1].
+// CHECK-NEXT: luti6 z10.h, { z0.h, z1.h }, z0[2]
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+// --//
+// Negative tests for instructions that are incompatible with movprfx
+
+movprfx z0.h, p0/m, z7.h
+luti6 z10.h, { z0.h, z1.h }, z0[0]
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: instruction is unpredictable when
following a movprfx, suggest replacing movprfx with mov
+// CHECK-NEXT: luti6 z10.h, { z0.h, z1.h }, z0[0]
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+movprfx z0, z7
CarolineConcatto wrote:
an we have something like this instead:
movprfx z0.h, z7.h
luti6 z0.b, { z2.b, z3.b }, z4
https://github.com/llvm/llvm-project/pull/163164
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [AArch64][llvm] Armv9.7-A: Add support for SVE2p3 LUTI6 operations (PR #163164)
@@ -4659,8 +4659,17 @@ let Predicates = [HasSVE2p3_or_SME2p3] in {
defm SQSHRUN_Z2ZI_StoH : sve_multi_vec_shift_narrow<"sqshrun", 0b100,
null_frag>;
defm SQSHRN_Z2ZI_StoH : sve_multi_vec_shift_narrow<"sqshrn", 0b000,
null_frag>;
defm UQSHRN_Z2ZI_StoH : sve_multi_vec_shift_narrow<"uqshrn", 0b010,
null_frag>;
+
+ defm LUTI6_Z2ZZI : sve2_luti6_vector_index<"luti6">;
} // End HasSME2p3orSVE2p3
+//===--===//
+// SVE2.3 instructions
+//===--===//
+let Predicates = [HasSVE2p3] in {
+ def LUTI6_Z2ZZ : sve2_luti6_vector;
CarolineConcatto wrote:
I am not sure why are you passing this if only one instruction is using this
class.
Why not only:
def LUTI6_Z2ZZ : sve2_luti6_vector<"luti6">;
https://github.com/llvm/llvm-project/pull/163164
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [outliners] Turn nooutline into an Enum Attribute (PR #163665)
https://github.com/lenary updated
https://github.com/llvm/llvm-project/pull/163665
>From ed1193ff7d938d3ff49315e72bdf2d4f91f85670 Mon Sep 17 00:00:00 2001
From: Sam Elliott
Date: Wed, 15 Oct 2025 17:24:04 -0700
Subject: [PATCH 1/2] [outliners] Turn nooutline into an Enum Attribute
This change turns the `"nooutline"` attribute into an enum attribute
called `nooutline`, and adds an auto-upgrader for bitcode to make the
same change to existing IR.
This IR attribute disables both the Machine Outliner (enabled at Oz for
some targets), and the IR Outliner (disabled by default).
---
llvm/docs/LangRef.rst| 2 +-
llvm/include/llvm/Bitcode/LLVMBitCodes.h | 1 +
llvm/include/llvm/IR/Attributes.td | 3 +++
llvm/lib/Bitcode/Reader/BitcodeReader.cpp| 2 ++
llvm/lib/Bitcode/Writer/BitcodeWriter.cpp| 2 ++
llvm/lib/CodeGen/MachineOutliner.cpp | 2 +-
llvm/lib/IR/AutoUpgrade.cpp | 6 ++
llvm/lib/Transforms/IPO/IROutliner.cpp | 2 +-
llvm/lib/Transforms/Utils/CodeExtractor.cpp | 4
llvm/test/Bitcode/upgrade-nooutline.ll | 12
.../AArch64/machine-outliner-mapper-debug-output.mir | 2 +-
.../Transforms/IROutliner/nooutline-attribute.ll | 4 ++--
12 files changed, 36 insertions(+), 6 deletions(-)
create mode 100644 llvm/test/Bitcode/upgrade-nooutline.ll
diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index 4884e2dcbbe00..73887d1039488 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -2738,7 +2738,7 @@ For example:
to signify an unbounded maximum. The syntax `vscale_range()` can be
used to set both `min` and `max` to the same value. Functions that don't
include this attribute make no assumptions about the value of `vscale`.
-``"nooutline"``
+``nooutline``
This attribute indicates that outlining passes should not modify the
function.
diff --git a/llvm/include/llvm/Bitcode/LLVMBitCodes.h
b/llvm/include/llvm/Bitcode/LLVMBitCodes.h
index 464f475098ec5..95596273aad69 100644
--- a/llvm/include/llvm/Bitcode/LLVMBitCodes.h
+++ b/llvm/include/llvm/Bitcode/LLVMBitCodes.h
@@ -801,6 +801,7 @@ enum AttributeKindCodes {
ATTR_KIND_CAPTURES = 102,
ATTR_KIND_DEAD_ON_RETURN = 103,
ATTR_KIND_SANITIZE_ALLOC_TOKEN = 104,
+ ATTR_KIND_NOOUTLINE = 105,
};
enum ComdatSelectionKindCodes {
diff --git a/llvm/include/llvm/IR/Attributes.td
b/llvm/include/llvm/IR/Attributes.td
index 8e7d9dcebfe2a..46a77ec121039 100644
--- a/llvm/include/llvm/IR/Attributes.td
+++ b/llvm/include/llvm/IR/Attributes.td
@@ -207,6 +207,9 @@ def NoImplicitFloat : EnumAttr<"noimplicitfloat",
IntersectPreserve, [FnAttr]>;
/// inline=never.
def NoInline : EnumAttr<"noinline", IntersectPreserve, [FnAttr]>;
+/// nooutline
+def NoOutline : EnumAttr<"nooutline", IntersectPreserve, [FnAttr]>;
+
/// Function is called early and/or often, so lazy binding isn't worthwhile.
def NonLazyBind : EnumAttr<"nonlazybind", IntersectPreserve, [FnAttr]>;
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index aaee1f0a7687c..ab80da376fdf8 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -2257,6 +2257,8 @@ static Attribute::AttrKind getAttrFromCode(uint64_t Code)
{
return Attribute::Captures;
case bitc::ATTR_KIND_DEAD_ON_RETURN:
return Attribute::DeadOnReturn;
+ case bitc::ATTR_KIND_NOOUTLINE:
+return Attribute::NoOutline;
}
}
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
index 54e916e2dcfe1..0efe7e030e0dc 100644
--- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -956,6 +956,8 @@ static uint64_t getAttrKindEncoding(Attribute::AttrKind
Kind) {
return bitc::ATTR_KIND_CAPTURES;
case Attribute::DeadOnReturn:
return bitc::ATTR_KIND_DEAD_ON_RETURN;
+ case Attribute::NoOutline:
+return bitc::ATTR_KIND_NOOUTLINE;
case Attribute::EndAttrKinds:
llvm_unreachable("Can not encode end-attribute kinds marker.");
case Attribute::None:
diff --git a/llvm/lib/CodeGen/MachineOutliner.cpp
b/llvm/lib/CodeGen/MachineOutliner.cpp
index 9feb9740de126..d6f7305278f38 100644
--- a/llvm/lib/CodeGen/MachineOutliner.cpp
+++ b/llvm/lib/CodeGen/MachineOutliner.cpp
@@ -1257,7 +1257,7 @@ void MachineOutliner::populateMapper(InstructionMapper
&Mapper, Module &M) {
for (Function &F : M) {
LLVM_DEBUG(dbgs() << "MAPPING FUNCTION: " << F.getName() << "\n");
-if (F.hasFnAttribute("nooutline")) {
+if (F.hasFnAttribute(Attribute::NoOutline)) {
LLVM_DEBUG(dbgs() << "SKIP: Function has nooutline attribute\n");
continue;
}
diff --git a/llvm/lib/IR/AutoUpgrade.cpp b/llvm/lib/IR/AutoUpgrade.cpp
index f28b98957cae4..f3b164e5d0603 100644
--- a/llvm/lib/IR/AutoUpgrade.cpp
+
[llvm-branch-commits] [clang] [clang] Add clang::nooutline Attribute (PR #163666)
@@ -0,0 +1,7 @@ +// RUN: %clang_cc1 -verify -fsyntax-only %s -Wno-c++17-extensions Sirraide wrote: ```suggestion // RUN: %clang_cc1 -verify -fsyntax-only %s ``` I don’t think we need to pass `-Wno-c++17-extensions` here since we’re not using any from what I can tell (and Clang defaults to C++17 anyway). https://github.com/llvm/llvm-project/pull/163666 ___ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [clang] Add clang::nooutline Attribute (PR #163666)
@@ -0,0 +1,16 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --check-attributes --version 6 +// RUN: %clang_cc1 -emit-llvm %s -triple x86_64-unknown-linux-gnu -disable-O0-optnone -o - | FileCheck %s Sirraide wrote: > * C++ Lambdas? > * C++ Methods? > * Blocks? > * Objective-C Methods? It would be a good idea to add tests for all of those yes. https://github.com/llvm/llvm-project/pull/163666 ___ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [clang] Add clang::nooutline Attribute (PR #163666)
@@ -2355,6 +2355,13 @@ def NoInline : DeclOrStmtAttr {
let SimpleHandler = 1;
}
+def NoOutline : DeclOrStmtAttr {
+ let Spellings = [CXX11<"clang", "nooutline">, C23<"clang", "nooutline">];
lenary wrote:
Sorry, yes I was following `NoInline`. fixed.
https://github.com/llvm/llvm-project/pull/163666
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [clang] Add clang::nooutline Attribute (PR #163666)
@@ -862,6 +862,36 @@ with ``__noinline__`` defined as a macro as
``__attribute__((noinline))``.
}];
}
+def NoOutlineDocs : Documentation {
+ let Category = DocCatFunction;
+ let Content = [{
+This function attribute suppresses outlining from the annotated function.
+
+Outlining is the process where common parts of separate functions are extracted
+into a separate function (or assembly snippet), and calls to that function or
+snippet are inserted in the original functions. In this way, it can be seen as
+the opposite of inlining. It can help to reduce code size.
+
+.. code-block:: c
+
+ [[clang::nooutline]] int x1(int y) {
+int z = COMPLEX_MACRO(y); // Not outlined
+return z + const1;
+ }
+
+ int x2(int y) {
+int z = COMPLEX_MACRO(y); // May be outlined
+return z * const2;
+ }
+
+ int x3(int y) {
+int z = COMPLEX_MACRO(y); // May be outlined
+reutrn z / const3;
+ }
+
+ }];
+}
erichkeane wrote:
Can you explain why one would not want this to happen? Perhaps a quick
example? And can you show a psuedo-code version of x2/x3 (though I'd probably
suggest only a single-one of those examples, they aren't unique enough to have
2) as to what it might look like as an 'outlined' version?
https://github.com/llvm/llvm-project/pull/163666
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [clang] Add clang::nooutline Attribute (PR #163666)
@@ -0,0 +1,25 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
UTC_ARGS: --check-attributes --version 6
+// RUN: %clang_cc1 -emit-llvm %s -triple x86_64-unknown-linux-gnu -o - |
FileCheck %s --check-prefix=C
+// RUN: %clang_cc1 -emit-llvm -x c++ %s -triple x86_64-unknown-linux-gnu -o -
| FileCheck %s --check-prefix=CXX
+
+// C: Function Attrs: noinline nooutline nounwind optnone
+// C-LABEL: define dso_local i32 @t1(
+// C-SAME: i32 noundef [[X:%.*]]) #[[ATTR0:[0-9]+]] {
+// C-NEXT: [[ENTRY:.*:]]
lenary wrote:
I agree with the fragility aspect, is there a better way to automatically test
these or should I just write the checks by hand?
https://github.com/llvm/llvm-project/pull/163666
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lldb] [lldb][NFC] Refactor StopInfoWatchpoint::PerformAction (PR #163696)
llvmbot wrote:
@llvm/pr-subscribers-lldb
Author: None (dlav-sc)
Changes
Refactor watchpoint logic 2/2
This patch refactors the StopInfoWatchpoint::PerformAction function. It
leverages the ShouldReport method introduced in the previous patch to
significantly simplify the PerformAction logic.
---
Full diff: https://github.com/llvm/llvm-project/pull/163696.diff
3 Files Affected:
- (modified) lldb/include/lldb/Breakpoint/Watchpoint.h (-5)
- (modified) lldb/source/Breakpoint/Watchpoint.cpp (-56)
- (modified) lldb/source/Target/StopInfo.cpp (+52-136)
``diff
diff --git a/lldb/include/lldb/Breakpoint/Watchpoint.h
b/lldb/include/lldb/Breakpoint/Watchpoint.h
index 9e7e986e60606..3ca7629750ebb 100644
--- a/lldb/include/lldb/Breakpoint/Watchpoint.h
+++ b/lldb/include/lldb/Breakpoint/Watchpoint.h
@@ -86,7 +86,6 @@ class Watchpoint : public
std::enable_shared_from_this,
void SetDeclInfo(const std::string &str);
std::string GetWatchSpec() const;
void SetWatchSpec(const std::string &str);
- bool WatchedValueReportable(const ExecutionContext &exe_ctx);
// This function determines whether we should report a watchpoint value
// change. Specifically, it checks the watchpoint condition (if present),
@@ -102,7 +101,6 @@ class Watchpoint : public
std::enable_shared_from_this,
// Snapshot management interface.
bool IsWatchVariable() const;
void SetWatchVariable(bool val);
- bool CaptureWatchedValue(const ExecutionContext &exe_ctx);
/// \struct WatchpointVariableContext
/// \brief Represents the context of a watchpoint variable.
@@ -205,7 +203,6 @@ class Watchpoint : public
std::enable_shared_from_this,
private:
friend class Target;
friend class WatchpointList;
- friend class StopInfoWatchpoint; // This needs to call UndoHitCount()
lldb::ValueObjectSP CalculateWatchedValue() const;
@@ -223,8 +220,6 @@ class Watchpoint : public
std::enable_shared_from_this,
m_new_value_sp.reset();
}
- void UndoHitCount() { m_hit_counter.Decrement(); }
-
Target &m_target;
bool m_enabled; // Is this watchpoint enabled
bool m_is_hardware; // Is this a hardware watchpoint
diff --git a/lldb/source/Breakpoint/Watchpoint.cpp
b/lldb/source/Breakpoint/Watchpoint.cpp
index 07d8f64737dc1..5ee8b227428d3 100644
--- a/lldb/source/Breakpoint/Watchpoint.cpp
+++ b/lldb/source/Breakpoint/Watchpoint.cpp
@@ -260,66 +260,10 @@ bool Watchpoint::IsWatchVariable() const { return
m_is_watch_variable; }
void Watchpoint::SetWatchVariable(bool val) { m_is_watch_variable = val; }
-bool Watchpoint::CaptureWatchedValue(const ExecutionContext &exe_ctx) {
- ConstString g_watch_name("$__lldb__watch_value");
- m_old_value_sp = m_new_value_sp;
- Address watch_address(GetLoadAddress());
- if (!m_type.IsValid()) {
-// Don't know how to report new & old values, since we couldn't make a
-// scalar type for this watchpoint. This works around an assert in
-// ValueObjectMemory::Create.
-// FIXME: This should not happen, but if it does in some case we care
about,
-// we can go grab the value raw and print it as unsigned.
-return false;
- }
- m_new_value_sp = ValueObjectMemory::Create(
- exe_ctx.GetBestExecutionContextScope(), g_watch_name.GetStringRef(),
- watch_address, m_type);
- m_new_value_sp = m_new_value_sp->CreateConstantValue(g_watch_name);
- return (m_new_value_sp && m_new_value_sp->GetError().Success());
-}
-
-bool Watchpoint::WatchedValueReportable(const ExecutionContext &exe_ctx) {
- if (!WatchpointModify() || WatchpointRead())
-return true;
- if (!m_type.IsValid())
-return true;
-
- ConstString g_watch_name("$__lldb__watch_value");
- Address watch_address(GetLoadAddress());
- ValueObjectSP newest_valueobj_sp = ValueObjectMemory::Create(
- exe_ctx.GetBestExecutionContextScope(), g_watch_name.GetStringRef(),
- watch_address, m_type);
- newest_valueobj_sp = newest_valueobj_sp->CreateConstantValue(g_watch_name);
- Status error;
-
- DataExtractor new_data;
- DataExtractor old_data;
-
- newest_valueobj_sp->GetData(new_data, error);
- if (error.Fail())
-return true;
- m_new_value_sp->GetData(old_data, error);
- if (error.Fail())
-return true;
-
- if (new_data.GetByteSize() != old_data.GetByteSize() ||
- new_data.GetByteSize() == 0)
-return true;
-
- if (memcmp(new_data.GetDataStart(), old_data.GetDataStart(),
- old_data.GetByteSize()) == 0)
-return false; // Value has not changed, user requested modify watchpoint
-
- return true;
-}
-
// RETURNS - true if we should stop at this breakpoint, false if we
// should continue.
bool Watchpoint::ShouldStop(StoppointCallbackContext *context) {
- m_hit_counter.Increment();
-
return IsEnabled();
}
diff --git a/lldb/source/Target/StopInfo.cpp b/lldb/source/Target/StopInfo.cpp
index 7fa1fc5d71f13..586421c9daa6d 100644
--- a/lldb/source/Target/StopInfo.cpp
+++ b/lldb/source/Target/StopInfo.cpp
@@ -28,6
[llvm-branch-commits] [clang] [llvm] [HLSL] GetDimensions methods for buffer resources (PR #161929)
@@ -421,13 +444,32 @@ BuiltinTypeMethodBuilder::addParam(StringRef Name,
QualType Ty,
void BuiltinTypeMethodBuilder::createDecl() {
assert(Method == nullptr && "Method or constructor is already created");
- // create method or constructor type
+ // create function prototype
ASTContext &AST = DeclBuilder.SemaRef.getASTContext();
SmallVector ParamTypes;
- for (Param &MP : Params)
-ParamTypes.emplace_back(MP.Ty);
+ SmallVector ParamExtInfos(Params.size());
+ uint32_t ArgIndex = 0;
+ bool IsTemplate = DeclBuilder.Template != nullptr;
+ bool UseParamExtInfo = false;
+ for (Param &MP : Params) {
+QualType Ty = MP.Ty;
+if (MP.Modifier != HLSLParamModifierAttr::Keyword_in) {
+ UseParamExtInfo = true;
+ ParamExtInfos[ArgIndex].withABI(
+ convertParamModifierToParamABI(MP.Modifier));
+ // Only update types on inout and out parameters for non-templated
+ // methods. Templated types will have their inout/out parameters
+ // converted to references during template instantiation.
+ if (!IsTemplate)
+Ty = getInoutParameterType(AST, Ty);
+}
+ParamTypes.emplace_back(Ty);
+++ArgIndex;
+ }
hekota wrote:
Bug fix in review: https://github.com/llvm/llvm-project/pull/163832
I have updated this to always change the type of `inout` and `out` parameter to
a reference - unless the parameter type is dependent on the template
instantiation. It turns out it is needed for both the function prototype (ABI
params & type) and for the param list on the decl.
I also had a bug in how the ABI params were set (or not set, actually), which
is why the function prototype string did not include the `out` modifier in the
AST dump. This is now fixed.
https://github.com/llvm/llvm-project/pull/161929
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [clang] Add clang::nooutline Attribute (PR #163666)
@@ -2355,6 +2355,13 @@ def NoInline : DeclOrStmtAttr {
let SimpleHandler = 1;
}
+def NoOutline : DeclOrStmtAttr {
+ let Spellings = [Clang<"nooutline">];
erichkeane wrote:
I see, thanks.
Hmm... my mental parse is still not really picking up the actual meaning of
what this is (and as I'm the second one to mention that, perhaps something we
should care about?). The rest don't have that parse problem for me. While I
appreciate the symmetry, at the same time readability should, IMO trump it.
https://github.com/llvm/llvm-project/pull/163666
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [llvm] [HLSL] GetDimensions methods for buffer resources (PR #161929)
https://github.com/hekota ready_for_review https://github.com/llvm/llvm-project/pull/161929 ___ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libc] [libc][annex_k] Add libannex_k as build target in LLVM libc. (PR #163869)
https://github.com/bassiounix created
https://github.com/llvm/llvm-project/pull/163869
None
>From a2f4fe3ddab73afdf58f6d8d62ce66d850958f70 Mon Sep 17 00:00:00 2001
From: bassiounix
Date: Fri, 17 Oct 2025 00:15:35 +0300
Subject: [PATCH] [libc][annex_k] Add libannex_k as build target in LLVM libc.
---
libc/config/linux/aarch64/entrypoints.txt | 3 +++
libc/config/linux/riscv/entrypoints.txt | 3 +++
libc/config/linux/x86_64/entrypoints.txt | 3 +++
libc/lib/CMakeLists.txt | 9 ++---
4 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/libc/config/linux/aarch64/entrypoints.txt
b/libc/config/linux/aarch64/entrypoints.txt
index 4824684103983..f372a7a4c0af0 100644
--- a/libc/config/linux/aarch64/entrypoints.txt
+++ b/libc/config/linux/aarch64/entrypoints.txt
@@ -1,3 +1,5 @@
+set(TARGET_ANNEX_K_ENTRYPOINTS "")
+
set(TARGET_LIBC_ENTRYPOINTS
# ctype.h entrypoints
libc.src.ctype.isalnum
@@ -1176,4 +1178,5 @@ endif()
set(TARGET_LLVMLIBC_ENTRYPOINTS
${TARGET_LIBC_ENTRYPOINTS}
${TARGET_LIBM_ENTRYPOINTS}
+ ${TARGET_ANNEX_K_ENTRYPOINTS}
)
diff --git a/libc/config/linux/riscv/entrypoints.txt
b/libc/config/linux/riscv/entrypoints.txt
index 5f407e842121e..18043c9e43759 100644
--- a/libc/config/linux/riscv/entrypoints.txt
+++ b/libc/config/linux/riscv/entrypoints.txt
@@ -1,3 +1,5 @@
+set(TARGET_ANNEX_K_ENTRYPOINTS "")
+
set(TARGET_LIBC_ENTRYPOINTS
# ctype.h entrypoints
libc.src.ctype.isalnum
@@ -1321,4 +1323,5 @@ endif()
set(TARGET_LLVMLIBC_ENTRYPOINTS
${TARGET_LIBC_ENTRYPOINTS}
${TARGET_LIBM_ENTRYPOINTS}
+ ${TARGET_ANNEX_K_ENTRYPOINTS}
)
diff --git a/libc/config/linux/x86_64/entrypoints.txt
b/libc/config/linux/x86_64/entrypoints.txt
index 87b78a337b875..20d6274fec223 100644
--- a/libc/config/linux/x86_64/entrypoints.txt
+++ b/libc/config/linux/x86_64/entrypoints.txt
@@ -1,3 +1,5 @@
+set(TARGET_ANNEX_K_ENTRYPOINTS "")
+
set(TARGET_LIBC_ENTRYPOINTS
# ctype.h entrypoints
libc.src.ctype.isalnum
@@ -1377,4 +1379,5 @@ endif()
set(TARGET_LLVMLIBC_ENTRYPOINTS
${TARGET_LIBC_ENTRYPOINTS}
${TARGET_LIBM_ENTRYPOINTS}
+ ${TARGET_ANNEX_K_ENTRYPOINTS}
)
diff --git a/libc/lib/CMakeLists.txt b/libc/lib/CMakeLists.txt
index ce0b07fb6cb49..6fde2c8fc827d 100644
--- a/libc/lib/CMakeLists.txt
+++ b/libc/lib/CMakeLists.txt
@@ -2,10 +2,13 @@ set(libc_archive_targets "")
set(libc_archive_names "")
set(libc_archive_entrypoint_lists "")
if(LLVM_LIBC_FULL_BUILD)
- list(APPEND libc_archive_names c m)
- list(APPEND libc_archive_targets libc libm)
+ list(APPEND libc_archive_names c m annex_k)
+ list(APPEND libc_archive_targets libc libm libannex_k)
list(APPEND libc_archive_entrypoint_lists
- TARGET_LIBC_ENTRYPOINTS TARGET_LIBM_ENTRYPOINTS)
+ TARGET_LIBC_ENTRYPOINTS
+ TARGET_LIBM_ENTRYPOINTS
+ TARGET_ANNEX_K_ENTRYPOINTS
+ )
else()
list(APPEND libc_archive_names llvmlibc)
list(APPEND libc_archive_targets libc)
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [FlowSensitive] [StatusOr] [4/N] Support comparisons (PR #163871)
github-actions[bot] wrote:
:warning: C/C++ code formatter, clang-format found issues in your code.
:warning:
You can test this locally with the following command:
``bash
git-clang-format --diff origin/main HEAD --extensions cpp --
clang/lib/Analysis/FlowSensitive/Models/UncheckedStatusOrAccessModel.cpp
clang/unittests/Analysis/FlowSensitive/UncheckedStatusOrAccessModelTestFixture.cpp
--diff_from_common_commit
``
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
View the diff from clang-format here.
``diff
diff --git
a/clang/lib/Analysis/FlowSensitive/Models/UncheckedStatusOrAccessModel.cpp
b/clang/lib/Analysis/FlowSensitive/Models/UncheckedStatusOrAccessModel.cpp
index 4ebf3e425..24381083b 100644
--- a/clang/lib/Analysis/FlowSensitive/Models/UncheckedStatusOrAccessModel.cpp
+++ b/clang/lib/Analysis/FlowSensitive/Models/UncheckedStatusOrAccessModel.cpp
@@ -116,13 +116,12 @@ static auto valueOperatorCall() {
}
static clang::ast_matchers::TypeMatcher statusType() {
- using namespace ::clang::ast_matchers; // NOLINT: Too many names
+ using namespace ::clang::ast_matchers; // NOLINT: Too many names
return hasCanonicalType(qualType(hasDeclaration(statusClass(;
}
-
static auto isComparisonOperatorCall(llvm::StringRef operator_name) {
- using namespace ::clang::ast_matchers; // NOLINT: Too many names
+ using namespace ::clang::ast_matchers; // NOLINT: Too many names
return cxxOperatorCallExpr(
hasOverloadedOperatorName(operator_name), argumentCountIs(2),
hasArgument(0, anyOf(hasType(statusType()), hasType(statusOrType(,
@@ -318,10 +317,10 @@ static void transferStatusUpdateCall(const
CXXMemberCallExpr *Expr,
State.Env.setValue(locForOk(*ThisLoc), NewVal);
}
-static BoolValue* evaluateStatusEquality(RecordStorageLocation& LhsStatusLoc,
- RecordStorageLocation& RhsStatusLoc,
- Environment& Env) {
- auto& A = Env.arena();
+static BoolValue *evaluateStatusEquality(RecordStorageLocation &LhsStatusLoc,
+ RecordStorageLocation &RhsStatusLoc,
+ Environment &Env) {
+ auto &A = Env.arena();
// Logically, a Status object is composed of an error code that could take
one
// of multiple possible values, including the "ok" value. We track whether a
// Status object has an "ok" value and represent this as an `ok` bit.
Equality
@@ -331,10 +330,10 @@ static BoolValue*
evaluateStatusEquality(RecordStorageLocation& LhsStatusLoc,
// only track the `ok` bits, we can't make any conclusions about equality
when
// we know that two Status objects have non-ok values.
- auto& LhsOkVal = valForOk(LhsStatusLoc, Env);
- auto& RhsOkVal = valForOk(RhsStatusLoc, Env);
+ auto &LhsOkVal = valForOk(LhsStatusLoc, Env);
+ auto &RhsOkVal = valForOk(RhsStatusLoc, Env);
- auto& Res = Env.makeAtomicBoolValue();
+ auto &Res = Env.makeAtomicBoolValue();
// lhs && rhs => res (a.k.a. !res => !lhs || !rhs)
Env.assume(A.makeImplies(A.makeAnd(LhsOkVal.formula(), RhsOkVal.formula()),
@@ -346,10 +345,11 @@ static BoolValue*
evaluateStatusEquality(RecordStorageLocation& LhsStatusLoc,
return &Res;
}
-static BoolValue* evaluateStatusOrEquality(
-RecordStorageLocation& LhsStatusOrLoc,
-RecordStorageLocation& RhsStatusOrLoc, Environment& Env) {
- auto& A = Env.arena();
+static BoolValue *
+evaluateStatusOrEquality(RecordStorageLocation &LhsStatusOrLoc,
+ RecordStorageLocation &RhsStatusOrLoc,
+ Environment &Env) {
+ auto &A = Env.arena();
// Logically, a StatusOr object is composed of two values - a Status and a
// value of type T. Equality of StatusOr objects compares both values.
// Therefore, merely comparing the `ok` bits of the Status values isn't
@@ -359,9 +359,9 @@ static BoolValue* evaluateStatusOrEquality(
// codes matters. Since we only track the `ok` bits of the Status values, we
// can't make any conclusions about equality when we know that two StatusOr
// objects are engaged or when their Status values contain non-ok error
codes.
- auto& LhsOkVal = valForOk(locForStatus(LhsStatusOrLoc), Env);
- auto& RhsOkVal = valForOk(locForStatus(RhsStatusOrLoc), Env);
- auto& res = Env.makeAtomicBoolValue();
+ auto &LhsOkVal = valForOk(locForStatus(LhsStatusOrLoc), Env);
+ auto &RhsOkVal = valForOk(locForStatus(RhsStatusOrLoc), Env);
+ auto &res = Env.makeAtomicBoolValue();
// res => (lhs == rhs)
Env.assume(A.makeImplies(
@@ -369,17 +369,18 @@ static BoolValue* evaluateStatusOrEquality(
return &res;
}
-
-static BoolValue* evaluateEquality(const Expr* LhsExpr, const Expr* RhsE
[llvm-branch-commits] [FlowSensitive] [StatusOr] [5/N] Support absl::OkStatus et al (PR #163872)
https://github.com/fmayer created https://github.com/llvm/llvm-project/pull/163872 This allows comparison which these status codes ___ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libc] [libc][annex_k] Add constraint_handler_t. (PR #163239)
https://github.com/bassiounix updated https://github.com/llvm/llvm-project/pull/163239 >From 1d6c270339866348db4ec325e6b2abfb6f177cce Mon Sep 17 00:00:00 2001 From: bassiounix Date: Mon, 13 Oct 2025 21:38:25 +0300 Subject: [PATCH 1/2] [libc][annex_k] Add constraint_handler_t. --- libc/hdr/types/CMakeLists.txt | 9 libc/hdr/types/constraint_handler_t.h | 18 libc/include/CMakeLists.txt | 1 + libc/include/llvm-libc-types/CMakeLists.txt | 2 ++ .../llvm-libc-types/constraint_handler_t.h| 21 +++ libc/include/stdlib.yaml | 1 + 6 files changed, 52 insertions(+) create mode 100644 libc/hdr/types/constraint_handler_t.h create mode 100644 libc/include/llvm-libc-types/constraint_handler_t.h diff --git a/libc/hdr/types/CMakeLists.txt b/libc/hdr/types/CMakeLists.txt index 6fe26881f737e..111dd208997df 100644 --- a/libc/hdr/types/CMakeLists.txt +++ b/libc/hdr/types/CMakeLists.txt @@ -170,6 +170,15 @@ add_proxy_header_library( libc.include.fcntl ) +add_proxy_header_library( + constraint_handler_t + HDRS +constraint_handler_t.h + FULL_BUILD_DEPENDS +libc.include.llvm-libc-types.constraint_handler_t +libc.include.stdlib +) + add_proxy_header_library( errno_t HDRS diff --git a/libc/hdr/types/constraint_handler_t.h b/libc/hdr/types/constraint_handler_t.h new file mode 100644 index 0..ca7798b84228e --- /dev/null +++ b/libc/hdr/types/constraint_handler_t.h @@ -0,0 +1,18 @@ +//===-- Proxy for constraint_handler_t ===// +// +// 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 +// +//===--===// + +#ifndef LLVM_LIBC_HDR_TYPES_CONSTRAINT_HANDLER_T_H +#define LLVM_LIBC_HDR_TYPES_CONSTRAINT_HANDLER_T_H + +#define LIBC_HAS_ANNEX_K + +#include "include/llvm-libc-types/constraint_handler_t.h" + +#undef LIBC_HAS_ANNEX_K + +#endif // LLVM_LIBC_HDR_TYPES_CONSTRAINT_HANDLER_T_H diff --git a/libc/include/CMakeLists.txt b/libc/include/CMakeLists.txt index c70d1190e8342..3266b57bc8ecd 100644 --- a/libc/include/CMakeLists.txt +++ b/libc/include/CMakeLists.txt @@ -366,6 +366,7 @@ add_header_macro( .llvm-libc-types.__qsortcompare_t .llvm-libc-types.__qsortrcompare_t .llvm-libc-types.__search_compare_t +.llvm-libc-types.constraint_handler_t .llvm-libc-types.div_t .llvm-libc-types.ldiv_t .llvm-libc-types.lldiv_t diff --git a/libc/include/llvm-libc-types/CMakeLists.txt b/libc/include/llvm-libc-types/CMakeLists.txt index cc7b2847909e4..e3bfc7dd3e95b 100644 --- a/libc/include/llvm-libc-types/CMakeLists.txt +++ b/libc/include/llvm-libc-types/CMakeLists.txt @@ -300,3 +300,5 @@ add_header(EFI_SYSTEM_TABLE .EFI_TABLE_HEADER .char16_t ) + +add_header(constraint_handler_t HDR constraint_handler_t.h DEPENDS .errno_t) diff --git a/libc/include/llvm-libc-types/constraint_handler_t.h b/libc/include/llvm-libc-types/constraint_handler_t.h new file mode 100644 index 0..efd21296cd399 --- /dev/null +++ b/libc/include/llvm-libc-types/constraint_handler_t.h @@ -0,0 +1,21 @@ +//===-- Definition of type constraint_handler_t ---===// +// +// 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 +// +//===--===// + +#ifndef LLVM_LIBC_INCLUDE_LLVM_LIBC_TYPES_CONSTRAINT_HANDLER_T_H +#define LLVM_LIBC_INCLUDE_LLVM_LIBC_TYPES_CONSTRAINT_HANDLER_T_H + +#include "errno_t.h" + +#ifdef LIBC_HAS_ANNEX_K + +typedef void (*constraint_handler_t)(const char *__restrict, void *__restrict, + errno_t); + +#endif // LIBC_HAS_ANNEX_K + +#endif // LLVM_LIBC_INCLUDE_LLVM_LIBC_TYPES_CONSTRAINT_HANDLER_T_H diff --git a/libc/include/stdlib.yaml b/libc/include/stdlib.yaml index 3b2ff13c684b1..29fd6bc3a1e75 100644 --- a/libc/include/stdlib.yaml +++ b/libc/include/stdlib.yaml @@ -12,6 +12,7 @@ types: - type_name: __qsortcompare_t - type_name: __qsortrcompare_t - type_name: __search_compare_t + - type_name: constraint_handler_t - type_name: div_t - type_name: ldiv_t - type_name: lldiv_t >From 4490790159b88df61e8a7b508293dd0f7e04df90 Mon Sep 17 00:00:00 2001 From: bassiounix Date: Tue, 14 Oct 2025 00:55:56 +0300 Subject: [PATCH 2/2] change location --- libc/include/llvm-libc-types/CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libc/include/llvm-libc-types/CMakeLists.txt b/libc/include/llvm-libc-types/CMakeLists.txt index e3bfc7dd3e95b..fe34abfc2e38b 100644 --- a/libc/include/llvm-libc-types/
[llvm-branch-commits] [libc] [libc][annex_k] Add Annex K support macros. (PR #163100)
https://github.com/bassiounix updated
https://github.com/llvm/llvm-project/pull/163100
>From 52153584c232fb0b4fa077a0ab6209c0e9cff160 Mon Sep 17 00:00:00 2001
From: bassiounix
Date: Sun, 12 Oct 2025 23:58:37 +0300
Subject: [PATCH] [libc][annex_k] Add Annex K support macros.
---
libc/include/llvm-libc-macros/CMakeLists.txt | 6 +
.../include/llvm-libc-macros/annex-k-macros.h | 26 +++
2 files changed, 32 insertions(+)
create mode 100644 libc/include/llvm-libc-macros/annex-k-macros.h
diff --git a/libc/include/llvm-libc-macros/CMakeLists.txt
b/libc/include/llvm-libc-macros/CMakeLists.txt
index 76c03d913ee12..f41da94e1d726 100644
--- a/libc/include/llvm-libc-macros/CMakeLists.txt
+++ b/libc/include/llvm-libc-macros/CMakeLists.txt
@@ -31,6 +31,12 @@ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_OS})
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_OS})
endif()
+add_macro_header(
+ annex_k_macros
+ HDR
+annex-k-macros.h
+)
+
add_macro_header(
assert_macros
HDR
diff --git a/libc/include/llvm-libc-macros/annex-k-macros.h
b/libc/include/llvm-libc-macros/annex-k-macros.h
new file mode 100644
index 0..c3f845cd77574
--- /dev/null
+++ b/libc/include/llvm-libc-macros/annex-k-macros.h
@@ -0,0 +1,26 @@
+//===-- Definition of macros to be used with Annex K functions
===//
+//
+// 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
+//
+//===--===//
+
+#ifndef LLVM_LIBC_INCLUDE_LLVM_LIBC_MACROS_ANNEX_K_MACROS_H
+#define LLVM_LIBC_INCLUDE_LLVM_LIBC_MACROS_ANNEX_K_MACROS_H
+
+#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) ||
\
+(defined(__cplusplus) && __cplusplus >= 201703L)
+
+// TODO(bassiounix): Who should def this macro (clang vs libc)? Where?
+#define __STDC_LIB_EXT1__ 201112L
+
+#if defined(__STDC_WANT_LIB_EXT1__) && __STDC_WANT_LIB_EXT1__ == 1
+
+#define LIBC_HAS_ANNEX_K
+
+#endif // defined(__STDC_WANT_LIB_EXT1__) && __STDC_WANT_LIB_EXT1__ == 1
+
+#endif // (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) ||
+ // (defined(__cplusplus) && __cplusplus >= 201703L)
+#endif // LLVM_LIBC_INCLUDE_LLVM_LIBC_MACROS_ANNEX_K_MACROS_H
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [FlowSensitive] [StatusOr] [6/N] support pointer comparison (PR #163875)
llvmbot wrote:
@llvm/pr-subscribers-clang
Author: Florian Mayer (fmayer)
Changes
---
Full diff: https://github.com/llvm/llvm-project/pull/163875.diff
2 Files Affected:
- (modified)
clang/lib/Analysis/FlowSensitive/Models/UncheckedStatusOrAccessModel.cpp (+80)
- (modified)
clang/unittests/Analysis/FlowSensitive/UncheckedStatusOrAccessModelTestFixture.cpp
(+57)
``diff
diff --git
a/clang/lib/Analysis/FlowSensitive/Models/UncheckedStatusOrAccessModel.cpp
b/clang/lib/Analysis/FlowSensitive/Models/UncheckedStatusOrAccessModel.cpp
index 76f93d5a88c3e..dc0a8f7e4cfd6 100644
--- a/clang/lib/Analysis/FlowSensitive/Models/UncheckedStatusOrAccessModel.cpp
+++ b/clang/lib/Analysis/FlowSensitive/Models/UncheckedStatusOrAccessModel.cpp
@@ -146,6 +146,20 @@ static auto isNotOkStatusCall() {
"::absl::UnimplementedError", "::absl::UnknownError";
}
+static auto isPointerComparisonOperatorCall(std::string operator_name) {
+ using namespace ::clang::ast_matchers; // NOLINT: Too many names
+ return binaryOperator(
+ hasOperatorName(operator_name),
+ hasLHS(
+
anyOf(hasType(hasCanonicalType(pointerType(pointee(statusOrType(),
+hasType(hasCanonicalType(
+pointerType(pointee(possiblyAliasedStatusType())),
+ hasRHS(
+
anyOf(hasType(hasCanonicalType(pointerType(pointee(statusOrType(),
+hasType(hasCanonicalType(
+pointerType(pointee(possiblyAliasedStatusType(;
+}
+
static auto
buildDiagnoseMatchSwitch(const UncheckedStatusOrAccessModelOptions &Options) {
return CFGMatchSwitchBuilder(Expr))
+return dyn_cast(&PointerVal->getPointeeLoc());
+ return nullptr;
+}
+
+static BoolValue *evaluatePointerEquality(const Expr *LhsExpr,
+ const Expr *RhsExpr,
+ Environment &Env) {
+ assert(LhsExpr->getType()->isPointerType());
+ assert(RhsExpr->getType()->isPointerType());
+ RecordStorageLocation *LhsStatusLoc = nullptr;
+ RecordStorageLocation *RhsStatusLoc = nullptr;
+ if (isStatusOrType(LhsExpr->getType()->getPointeeType()) &&
+ isStatusOrType(RhsExpr->getType()->getPointeeType())) {
+auto *LhsStatusOrLoc = getPointeeLocation(*LhsExpr, Env);
+auto *RhsStatusOrLoc = getPointeeLocation(*RhsExpr, Env);
+if (LhsStatusOrLoc == nullptr || RhsStatusOrLoc == nullptr)
+ return nullptr;
+LhsStatusLoc = &locForStatus(*LhsStatusOrLoc);
+RhsStatusLoc = &locForStatus(*RhsStatusOrLoc);
+ } else if (isStatusType(LhsExpr->getType()->getPointeeType()) &&
+ isStatusType(RhsExpr->getType()->getPointeeType())) {
+LhsStatusLoc = getPointeeLocation(*LhsExpr, Env);
+RhsStatusLoc = getPointeeLocation(*RhsExpr, Env);
+ }
+ if (LhsStatusLoc == nullptr || RhsStatusLoc == nullptr)
+return nullptr;
+ auto &LhsOkVal = valForOk(*LhsStatusLoc, Env);
+ auto &RhsOkVal = valForOk(*RhsStatusLoc, Env);
+ auto &Res = Env.makeAtomicBoolValue();
+ auto &A = Env.arena();
+ Env.assume(A.makeImplies(
+ Res.formula(), A.makeEquals(LhsOkVal.formula(), RhsOkVal.formula(;
+ return &Res;
+}
+
+static void transferPointerComparisonOperator(const BinaryOperator *Expr,
+ LatticeTransferState &State,
+ bool IsNegative) {
+ auto *LhsAndRhsVal =
+ evaluatePointerEquality(Expr->getLHS(), Expr->getRHS(), State.Env);
+ if (LhsAndRhsVal == nullptr)
+return;
+
+ if (IsNegative)
+State.Env.setValue(*Expr, State.Env.makeNot(*LhsAndRhsVal));
+ else
+State.Env.setValue(*Expr, *LhsAndRhsVal);
+}
+
static void transferOkStatusCall(const CallExpr *Expr,
const MatchFinder::MatchResult &,
LatticeTransferState &State) {
@@ -477,6 +543,20 @@ buildTransferMatchSwitch(ASTContext &Ctx,
transferComparisonOperator(Expr, State,
/*IsNegative=*/true);
})
+ .CaseOfCFGStmt(
+ isPointerComparisonOperatorCall("=="),
+ [](const BinaryOperator *Expr, const MatchFinder::MatchResult &,
+ LatticeTransferState &State) {
+transferPointerComparisonOperator(Expr, State,
+ /*IsNegative=*/false);
+ })
+ .CaseOfCFGStmt(
+ isPointerComparisonOperatorCall("!="),
+ [](const BinaryOperator *Expr, const MatchFinder::MatchResult &,
+ LatticeTransferState &State) {
+transferPointerComparisonOperator(Expr, State,
+ /*IsNegative=*/true);
+ })
.CaseOfCFGStmt(isOkStatusCall(), transferOkStatusCall)
.CaseOfCFGStmt(isNotOkStatusCall(), transferNotOkStatusCall)
.Build();
diff --git
a/clang/unittests/Analysis/FlowSensitive/UncheckedStatusOrAccessModelTestFixt
[llvm-branch-commits] [libc] [libc][annex_k] Add rsize_t. (PR #163238)
https://github.com/bassiounix updated https://github.com/llvm/llvm-project/pull/163238 >From c74da0b7e4269b25f58d16b4de29616b5cb8e521 Mon Sep 17 00:00:00 2001 From: bassiounix Date: Mon, 13 Oct 2025 21:14:40 +0300 Subject: [PATCH] [libc][annex_k] Add rsize_t. --- libc/hdr/types/CMakeLists.txt | 8 +++ libc/hdr/types/rsize_t.h| 23 + libc/include/llvm-libc-types/CMakeLists.txt | 1 + libc/include/llvm-libc-types/rsize_t.h | 18 4 files changed, 50 insertions(+) create mode 100644 libc/hdr/types/rsize_t.h create mode 100644 libc/include/llvm-libc-types/rsize_t.h diff --git a/libc/hdr/types/CMakeLists.txt b/libc/hdr/types/CMakeLists.txt index 8ec2926ee16fc..6fe26881f737e 100644 --- a/libc/hdr/types/CMakeLists.txt +++ b/libc/hdr/types/CMakeLists.txt @@ -135,6 +135,14 @@ add_proxy_header_library( libc.include.llvm-libc-types.struct_tm ) +add_proxy_header_library( + rsize_t + HDRS +rsize_t.h + FULL_BUILD_DEPENDS +libc.include.llvm-libc-types.rsize_t +) + add_proxy_header_library( size_t HDRS diff --git a/libc/hdr/types/rsize_t.h b/libc/hdr/types/rsize_t.h new file mode 100644 index 0..130e6c308e264 --- /dev/null +++ b/libc/hdr/types/rsize_t.h @@ -0,0 +1,23 @@ +//===-- Proxy for rsize_t -===// +// +// 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 +// +//===--===// +#ifndef LLVM_LIBC_HDR_TYPES_SIZE_T_H +#define LLVM_LIBC_HDR_TYPES_SIZE_T_H + +#ifdef LIBC_FULL_BUILD + +#include "include/llvm-libc-types/rsize_t.h" + +#else + +#define __need_rsize_t +#include +#undef __need_rsize_t + +#endif // LIBC_FULL_BUILD + +#endif // LLVM_LIBC_HDR_TYPES_SIZE_T_H diff --git a/libc/include/llvm-libc-types/CMakeLists.txt b/libc/include/llvm-libc-types/CMakeLists.txt index e8b3ae8c08a90..cc7b2847909e4 100644 --- a/libc/include/llvm-libc-types/CMakeLists.txt +++ b/libc/include/llvm-libc-types/CMakeLists.txt @@ -1,4 +1,5 @@ add_header(off64_t HDR off64_t.h) +add_header(rsize_t HDR rsize_t.h) add_header(size_t HDR size_t.h) add_header(ssize_t HDR ssize_t.h) add_header(__atfork_callback_t HDR __atfork_callback_t.h) diff --git a/libc/include/llvm-libc-types/rsize_t.h b/libc/include/llvm-libc-types/rsize_t.h new file mode 100644 index 0..dc8be02bee592 --- /dev/null +++ b/libc/include/llvm-libc-types/rsize_t.h @@ -0,0 +1,18 @@ +//===-- Definition of size_t types ===// +// +// 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 +// +//===--===// + +#ifndef LLVM_LIBC_TYPES_RSIZE_T_H +#define LLVM_LIBC_TYPES_RSIZE_T_H + +#ifdef LIBC_HAS_ANNEX_K + +typedef __SIZE_TYPE__ rsize_t; + +#endif // LIBC_HAS_ANNEX_K + +#endif // LLVM_LIBC_TYPES_RSIZE_T_H ___ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libc] [libc][annex_k] Add rsize_t. (PR #163238)
https://github.com/bassiounix updated https://github.com/llvm/llvm-project/pull/163238 >From c74da0b7e4269b25f58d16b4de29616b5cb8e521 Mon Sep 17 00:00:00 2001 From: bassiounix Date: Mon, 13 Oct 2025 21:14:40 +0300 Subject: [PATCH] [libc][annex_k] Add rsize_t. --- libc/hdr/types/CMakeLists.txt | 8 +++ libc/hdr/types/rsize_t.h| 23 + libc/include/llvm-libc-types/CMakeLists.txt | 1 + libc/include/llvm-libc-types/rsize_t.h | 18 4 files changed, 50 insertions(+) create mode 100644 libc/hdr/types/rsize_t.h create mode 100644 libc/include/llvm-libc-types/rsize_t.h diff --git a/libc/hdr/types/CMakeLists.txt b/libc/hdr/types/CMakeLists.txt index 8ec2926ee16fc..6fe26881f737e 100644 --- a/libc/hdr/types/CMakeLists.txt +++ b/libc/hdr/types/CMakeLists.txt @@ -135,6 +135,14 @@ add_proxy_header_library( libc.include.llvm-libc-types.struct_tm ) +add_proxy_header_library( + rsize_t + HDRS +rsize_t.h + FULL_BUILD_DEPENDS +libc.include.llvm-libc-types.rsize_t +) + add_proxy_header_library( size_t HDRS diff --git a/libc/hdr/types/rsize_t.h b/libc/hdr/types/rsize_t.h new file mode 100644 index 0..130e6c308e264 --- /dev/null +++ b/libc/hdr/types/rsize_t.h @@ -0,0 +1,23 @@ +//===-- Proxy for rsize_t -===// +// +// 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 +// +//===--===// +#ifndef LLVM_LIBC_HDR_TYPES_SIZE_T_H +#define LLVM_LIBC_HDR_TYPES_SIZE_T_H + +#ifdef LIBC_FULL_BUILD + +#include "include/llvm-libc-types/rsize_t.h" + +#else + +#define __need_rsize_t +#include +#undef __need_rsize_t + +#endif // LIBC_FULL_BUILD + +#endif // LLVM_LIBC_HDR_TYPES_SIZE_T_H diff --git a/libc/include/llvm-libc-types/CMakeLists.txt b/libc/include/llvm-libc-types/CMakeLists.txt index e8b3ae8c08a90..cc7b2847909e4 100644 --- a/libc/include/llvm-libc-types/CMakeLists.txt +++ b/libc/include/llvm-libc-types/CMakeLists.txt @@ -1,4 +1,5 @@ add_header(off64_t HDR off64_t.h) +add_header(rsize_t HDR rsize_t.h) add_header(size_t HDR size_t.h) add_header(ssize_t HDR ssize_t.h) add_header(__atfork_callback_t HDR __atfork_callback_t.h) diff --git a/libc/include/llvm-libc-types/rsize_t.h b/libc/include/llvm-libc-types/rsize_t.h new file mode 100644 index 0..dc8be02bee592 --- /dev/null +++ b/libc/include/llvm-libc-types/rsize_t.h @@ -0,0 +1,18 @@ +//===-- Definition of size_t types ===// +// +// 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 +// +//===--===// + +#ifndef LLVM_LIBC_TYPES_RSIZE_T_H +#define LLVM_LIBC_TYPES_RSIZE_T_H + +#ifdef LIBC_HAS_ANNEX_K + +typedef __SIZE_TYPE__ rsize_t; + +#endif // LIBC_HAS_ANNEX_K + +#endif // LLVM_LIBC_TYPES_RSIZE_T_H ___ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libc] [libc][annex_k] Add libc_constraint_handler macros. (PR #163316)
https://github.com/bassiounix updated
https://github.com/llvm/llvm-project/pull/163316
>From 8694e32b628e32253a683c1e85eb393dc1a16b17 Mon Sep 17 00:00:00 2001
From: bassiounix
Date: Tue, 14 Oct 2025 06:45:09 +0300
Subject: [PATCH] [libc][annex_k] Add libc_constraint_handler macros.
---
libc/src/__support/annex_k/CMakeLists.txt | 9
.../src/__support/annex_k/constraint_macros.h | 44 +++
2 files changed, 53 insertions(+)
create mode 100644 libc/src/__support/annex_k/constraint_macros.h
diff --git a/libc/src/__support/annex_k/CMakeLists.txt
b/libc/src/__support/annex_k/CMakeLists.txt
index 8eb65f2469b4f..4ef4e32ebdd85 100644
--- a/libc/src/__support/annex_k/CMakeLists.txt
+++ b/libc/src/__support/annex_k/CMakeLists.txt
@@ -11,6 +11,15 @@ add_header_library(
libc.src.stdlib.abort
)
+add_header_library(
+ constraint_macros
+ HDRS
+constraint_macros.h
+ DEPENDS
+.libc_constraint_handler
+libc.src.__support.libc_errno
+)
+
add_header_library(
libc_constraint_handler
HDRS
diff --git a/libc/src/__support/annex_k/constraint_macros.h
b/libc/src/__support/annex_k/constraint_macros.h
new file mode 100644
index 0..835c161dd0d30
--- /dev/null
+++ b/libc/src/__support/annex_k/constraint_macros.h
@@ -0,0 +1,44 @@
+//===-- Helper macros header for constraint violations --*- C++
-*-===//
+//
+// 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
+//
+//===--===//
+
+#ifndef LLVM_LIBC_SRC___SUPPORT_ANNEX_K_MACROS_H
+#define LLVM_LIBC_SRC___SUPPORT_ANNEX_K_MACROS_H
+
+#include "libc_constraint_handler.h"
+#include "src/__support/libc_errno.h"
+
+#define _CONSTRAINT_VIOLATION(msg, error_code, ret_code)
\
+ {
\
+libc_errno = error_code;
\
+libc_constraint_handler(msg, nullptr, error_code);
\
+return ret_code;
\
+ }
+
+#define _CONSTRAINT_VIOLATION_IF(expr, error_code, return_code)
\
+ {
\
+auto expr_val = expr;
\
+if (expr_val) {
\
+ libc_errno = error_code;
\
+ libc_constraint_handler(nullptr, nullptr, error_code);
\
+ return return_code;
\
+}
\
+ }
+
+#define _CONSTRAINT_VIOLATION_CLEANUP_IF(expr, cleanup, error_code,
\
+ return_code)
\
+ {
\
+auto expr_val = expr;
\
+if (expr_val) {
\
+ cleanup;
\
+ libc_errno = error_code;
\
+ libc_constraint_handler(nullptr, nullptr, error_code);
\
+ return return_code;
\
+}
\
+ }
+
+#endif // LLVM_LIBC_SRC___SUPPORT_ANNEX_K_MACROS_H
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libc] [libc][stdlib][annex_k] Add set_constraint_handler_s. (PR #163320)
https://github.com/bassiounix updated
https://github.com/llvm/llvm-project/pull/163320
>From 13af6bb9c875ef751fdca9230c1fa6046a5c46c7 Mon Sep 17 00:00:00 2001
From: bassiounix
Date: Tue, 14 Oct 2025 07:06:06 +0300
Subject: [PATCH] [libc][stdlib][annex_k] Add set_constraint_handler_s.
---
libc/config/linux/aarch64/entrypoints.txt| 1 +
libc/config/linux/riscv/entrypoints.txt | 1 +
libc/config/linux/x86_64/entrypoints.txt | 1 +
libc/include/stdlib.yaml | 7 +
libc/src/__support/annex_k/CMakeLists.txt| 8 ++
libc/src/stdlib/CMakeLists.txt | 11
libc/src/stdlib/set_constraint_handler_s.cpp | 28
libc/src/stdlib/set_constraint_handler_s.h | 21 +++
8 files changed, 78 insertions(+)
create mode 100644 libc/src/stdlib/set_constraint_handler_s.cpp
create mode 100644 libc/src/stdlib/set_constraint_handler_s.h
diff --git a/libc/config/linux/aarch64/entrypoints.txt
b/libc/config/linux/aarch64/entrypoints.txt
index b2b3789cc2f60..3c918c305e4f9 100644
--- a/libc/config/linux/aarch64/entrypoints.txt
+++ b/libc/config/linux/aarch64/entrypoints.txt
@@ -1087,6 +1087,7 @@ if(LLVM_LIBC_FULL_BUILD)
libc.src.stdlib.exit
libc.src.stdlib.getenv
libc.src.stdlib.quick_exit
+libc.src.stdlib.set_constraint_handler_s
# signal.h entrypoints
libc.src.signal.kill
diff --git a/libc/config/linux/riscv/entrypoints.txt
b/libc/config/linux/riscv/entrypoints.txt
index 5d92b112272fb..11786e26bf1e7 100644
--- a/libc/config/linux/riscv/entrypoints.txt
+++ b/libc/config/linux/riscv/entrypoints.txt
@@ -1215,6 +1215,7 @@ if(LLVM_LIBC_FULL_BUILD)
libc.src.stdlib.exit
libc.src.stdlib.getenv
libc.src.stdlib.quick_exit
+libc.src.stdlib.set_constraint_handler_s
# signal.h entrypoints
libc.src.signal.kill
diff --git a/libc/config/linux/x86_64/entrypoints.txt
b/libc/config/linux/x86_64/entrypoints.txt
index 4cb412ae7c526..da06cfc92f6d1 100644
--- a/libc/config/linux/x86_64/entrypoints.txt
+++ b/libc/config/linux/x86_64/entrypoints.txt
@@ -1254,6 +1254,7 @@ if(LLVM_LIBC_FULL_BUILD)
libc.src.stdlib.exit
libc.src.stdlib.getenv
libc.src.stdlib.quick_exit
+libc.src.stdlib.set_constraint_handler_s
# signal.h entrypoints
libc.src.signal.kill
diff --git a/libc/include/stdlib.yaml b/libc/include/stdlib.yaml
index 7c3b113a62415..49d45f105fe7a 100644
--- a/libc/include/stdlib.yaml
+++ b/libc/include/stdlib.yaml
@@ -202,6 +202,13 @@ functions:
- type: void *__restrict
- type: errno_t
guard: 'LIBC_HAS_ANNEX_K'
+ - name: set_constraint_handler_s
+standards:
+ - stdc
+return_type: constraint_handler_t
+arguments:
+ - type: constraint_handler_t
+guard: 'LIBC_HAS_ANNEX_K'
- name: srand
standards:
- stdc
diff --git a/libc/src/__support/annex_k/CMakeLists.txt
b/libc/src/__support/annex_k/CMakeLists.txt
index 4ef4e32ebdd85..f9c067753b6e6 100644
--- a/libc/src/__support/annex_k/CMakeLists.txt
+++ b/libc/src/__support/annex_k/CMakeLists.txt
@@ -28,3 +28,11 @@ add_header_library(
.abort_handler_s
libc.hdr.types.constraint_handler_t
)
+
+add_header_library(
+ set_constraint_handler_s
+ HDRS
+set_constraint_handler_s.h
+ DEPENDS
+
+)
diff --git a/libc/src/stdlib/CMakeLists.txt b/libc/src/stdlib/CMakeLists.txt
index 5efd7f13ff3ee..c380657300cfe 100644
--- a/libc/src/stdlib/CMakeLists.txt
+++ b/libc/src/stdlib/CMakeLists.txt
@@ -664,6 +664,17 @@ add_entrypoint_object(
.${LIBC_TARGET_OS}.system
)
+add_entrypoint_object(
+ set_constraint_handler_s
+ SRCS
+set_constraint_handler_s.cpp
+ HDRS
+set_constraint_handler_s.h
+ DEPENDS
+libc.src.__support.annex_k.abort_handler_s
+libc.src.__support.annex_k.libc_constraint_handler
+)
+
add_entrypoint_object(
ignore_handler_s
HDRS
diff --git a/libc/src/stdlib/set_constraint_handler_s.cpp
b/libc/src/stdlib/set_constraint_handler_s.cpp
new file mode 100644
index 0..d3a16d77e3b0a
--- /dev/null
+++ b/libc/src/stdlib/set_constraint_handler_s.cpp
@@ -0,0 +1,28 @@
+//===-- Implementation of set_constraint_handler_s
===//
+//
+// 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
+//
+//===--===//
+
+#include "set_constraint_handler_s.h"
+#include "src/__support/annex_k/abort_handler_s.h"
+#include "src/__support/annex_k/libc_constraint_handler.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(constraint_handler_t, set_constraint_handler_s,
+ (constraint_handler_t handler)) {
+ auto previous_handler = annex_k::libc_constraint_handler;
+
+ if (!handler) {
+annex_k::libc_constraint_handler = &annex_k::abort_handler_s;
+ } else {
+annex_
[llvm-branch-commits] [libc] [libc][annex_k] Add libc_constraint_handler macros. (PR #163316)
https://github.com/bassiounix updated
https://github.com/llvm/llvm-project/pull/163316
>From edaf560b2d3444cbc586820f6bae23428e0f7f8d Mon Sep 17 00:00:00 2001
From: bassiounix
Date: Tue, 14 Oct 2025 06:45:09 +0300
Subject: [PATCH] [libc][annex_k] Add libc_constraint_handler macros.
---
libc/src/__support/annex_k/CMakeLists.txt | 9
.../src/__support/annex_k/constraint_macros.h | 44 +++
2 files changed, 53 insertions(+)
create mode 100644 libc/src/__support/annex_k/constraint_macros.h
diff --git a/libc/src/__support/annex_k/CMakeLists.txt
b/libc/src/__support/annex_k/CMakeLists.txt
index 8eb65f2469b4f..4ef4e32ebdd85 100644
--- a/libc/src/__support/annex_k/CMakeLists.txt
+++ b/libc/src/__support/annex_k/CMakeLists.txt
@@ -11,6 +11,15 @@ add_header_library(
libc.src.stdlib.abort
)
+add_header_library(
+ constraint_macros
+ HDRS
+constraint_macros.h
+ DEPENDS
+.libc_constraint_handler
+libc.src.__support.libc_errno
+)
+
add_header_library(
libc_constraint_handler
HDRS
diff --git a/libc/src/__support/annex_k/constraint_macros.h
b/libc/src/__support/annex_k/constraint_macros.h
new file mode 100644
index 0..835c161dd0d30
--- /dev/null
+++ b/libc/src/__support/annex_k/constraint_macros.h
@@ -0,0 +1,44 @@
+//===-- Helper macros header for constraint violations --*- C++
-*-===//
+//
+// 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
+//
+//===--===//
+
+#ifndef LLVM_LIBC_SRC___SUPPORT_ANNEX_K_MACROS_H
+#define LLVM_LIBC_SRC___SUPPORT_ANNEX_K_MACROS_H
+
+#include "libc_constraint_handler.h"
+#include "src/__support/libc_errno.h"
+
+#define _CONSTRAINT_VIOLATION(msg, error_code, ret_code)
\
+ {
\
+libc_errno = error_code;
\
+libc_constraint_handler(msg, nullptr, error_code);
\
+return ret_code;
\
+ }
+
+#define _CONSTRAINT_VIOLATION_IF(expr, error_code, return_code)
\
+ {
\
+auto expr_val = expr;
\
+if (expr_val) {
\
+ libc_errno = error_code;
\
+ libc_constraint_handler(nullptr, nullptr, error_code);
\
+ return return_code;
\
+}
\
+ }
+
+#define _CONSTRAINT_VIOLATION_CLEANUP_IF(expr, cleanup, error_code,
\
+ return_code)
\
+ {
\
+auto expr_val = expr;
\
+if (expr_val) {
\
+ cleanup;
\
+ libc_errno = error_code;
\
+ libc_constraint_handler(nullptr, nullptr, error_code);
\
+ return return_code;
\
+}
\
+ }
+
+#endif // LLVM_LIBC_SRC___SUPPORT_ANNEX_K_MACROS_H
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libc] [libc][annex_k] Add libc_constraint_handler macros. (PR #163316)
https://github.com/bassiounix updated
https://github.com/llvm/llvm-project/pull/163316
>From edaf560b2d3444cbc586820f6bae23428e0f7f8d Mon Sep 17 00:00:00 2001
From: bassiounix
Date: Tue, 14 Oct 2025 06:45:09 +0300
Subject: [PATCH] [libc][annex_k] Add libc_constraint_handler macros.
---
libc/src/__support/annex_k/CMakeLists.txt | 9
.../src/__support/annex_k/constraint_macros.h | 44 +++
2 files changed, 53 insertions(+)
create mode 100644 libc/src/__support/annex_k/constraint_macros.h
diff --git a/libc/src/__support/annex_k/CMakeLists.txt
b/libc/src/__support/annex_k/CMakeLists.txt
index 8eb65f2469b4f..4ef4e32ebdd85 100644
--- a/libc/src/__support/annex_k/CMakeLists.txt
+++ b/libc/src/__support/annex_k/CMakeLists.txt
@@ -11,6 +11,15 @@ add_header_library(
libc.src.stdlib.abort
)
+add_header_library(
+ constraint_macros
+ HDRS
+constraint_macros.h
+ DEPENDS
+.libc_constraint_handler
+libc.src.__support.libc_errno
+)
+
add_header_library(
libc_constraint_handler
HDRS
diff --git a/libc/src/__support/annex_k/constraint_macros.h
b/libc/src/__support/annex_k/constraint_macros.h
new file mode 100644
index 0..835c161dd0d30
--- /dev/null
+++ b/libc/src/__support/annex_k/constraint_macros.h
@@ -0,0 +1,44 @@
+//===-- Helper macros header for constraint violations --*- C++
-*-===//
+//
+// 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
+//
+//===--===//
+
+#ifndef LLVM_LIBC_SRC___SUPPORT_ANNEX_K_MACROS_H
+#define LLVM_LIBC_SRC___SUPPORT_ANNEX_K_MACROS_H
+
+#include "libc_constraint_handler.h"
+#include "src/__support/libc_errno.h"
+
+#define _CONSTRAINT_VIOLATION(msg, error_code, ret_code)
\
+ {
\
+libc_errno = error_code;
\
+libc_constraint_handler(msg, nullptr, error_code);
\
+return ret_code;
\
+ }
+
+#define _CONSTRAINT_VIOLATION_IF(expr, error_code, return_code)
\
+ {
\
+auto expr_val = expr;
\
+if (expr_val) {
\
+ libc_errno = error_code;
\
+ libc_constraint_handler(nullptr, nullptr, error_code);
\
+ return return_code;
\
+}
\
+ }
+
+#define _CONSTRAINT_VIOLATION_CLEANUP_IF(expr, cleanup, error_code,
\
+ return_code)
\
+ {
\
+auto expr_val = expr;
\
+if (expr_val) {
\
+ cleanup;
\
+ libc_errno = error_code;
\
+ libc_constraint_handler(nullptr, nullptr, error_code);
\
+ return return_code;
\
+}
\
+ }
+
+#endif // LLVM_LIBC_SRC___SUPPORT_ANNEX_K_MACROS_H
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [FlowSensitive] [StatusOr] [5/N] Support absl::OkStatus et al (PR #163872)
https://github.com/fmayer updated https://github.com/llvm/llvm-project/pull/163872 ___ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libc] [libc][annex_k] Add libc_constraint_handler macros. (PR #163316)
https://github.com/bassiounix updated
https://github.com/llvm/llvm-project/pull/163316
>From c6bdbcd8cd00d1c9daa5a55c7d487c8288ccb3c9 Mon Sep 17 00:00:00 2001
From: bassiounix
Date: Tue, 14 Oct 2025 06:45:09 +0300
Subject: [PATCH] [libc][annex_k] Add libc_constraint_handler macros.
---
libc/src/__support/annex_k/CMakeLists.txt | 9
.../src/__support/annex_k/constraint_macros.h | 44 +++
2 files changed, 53 insertions(+)
create mode 100644 libc/src/__support/annex_k/constraint_macros.h
diff --git a/libc/src/__support/annex_k/CMakeLists.txt
b/libc/src/__support/annex_k/CMakeLists.txt
index 8eb65f2469b4f..4ef4e32ebdd85 100644
--- a/libc/src/__support/annex_k/CMakeLists.txt
+++ b/libc/src/__support/annex_k/CMakeLists.txt
@@ -11,6 +11,15 @@ add_header_library(
libc.src.stdlib.abort
)
+add_header_library(
+ constraint_macros
+ HDRS
+constraint_macros.h
+ DEPENDS
+.libc_constraint_handler
+libc.src.__support.libc_errno
+)
+
add_header_library(
libc_constraint_handler
HDRS
diff --git a/libc/src/__support/annex_k/constraint_macros.h
b/libc/src/__support/annex_k/constraint_macros.h
new file mode 100644
index 0..835c161dd0d30
--- /dev/null
+++ b/libc/src/__support/annex_k/constraint_macros.h
@@ -0,0 +1,44 @@
+//===-- Helper macros header for constraint violations --*- C++
-*-===//
+//
+// 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
+//
+//===--===//
+
+#ifndef LLVM_LIBC_SRC___SUPPORT_ANNEX_K_MACROS_H
+#define LLVM_LIBC_SRC___SUPPORT_ANNEX_K_MACROS_H
+
+#include "libc_constraint_handler.h"
+#include "src/__support/libc_errno.h"
+
+#define _CONSTRAINT_VIOLATION(msg, error_code, ret_code)
\
+ {
\
+libc_errno = error_code;
\
+libc_constraint_handler(msg, nullptr, error_code);
\
+return ret_code;
\
+ }
+
+#define _CONSTRAINT_VIOLATION_IF(expr, error_code, return_code)
\
+ {
\
+auto expr_val = expr;
\
+if (expr_val) {
\
+ libc_errno = error_code;
\
+ libc_constraint_handler(nullptr, nullptr, error_code);
\
+ return return_code;
\
+}
\
+ }
+
+#define _CONSTRAINT_VIOLATION_CLEANUP_IF(expr, cleanup, error_code,
\
+ return_code)
\
+ {
\
+auto expr_val = expr;
\
+if (expr_val) {
\
+ cleanup;
\
+ libc_errno = error_code;
\
+ libc_constraint_handler(nullptr, nullptr, error_code);
\
+ return return_code;
\
+}
\
+ }
+
+#endif // LLVM_LIBC_SRC___SUPPORT_ANNEX_K_MACROS_H
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libc] [libc][stdlib][annex_k] Add set_constraint_handler_s. (PR #163320)
https://github.com/bassiounix updated
https://github.com/llvm/llvm-project/pull/163320
>From 80068e5bfc41e5e0a6ee6084f24997e04f3289c1 Mon Sep 17 00:00:00 2001
From: bassiounix
Date: Tue, 14 Oct 2025 07:06:06 +0300
Subject: [PATCH] [libc][stdlib][annex_k] Add set_constraint_handler_s.
---
libc/config/linux/aarch64/entrypoints.txt| 1 +
libc/config/linux/riscv/entrypoints.txt | 1 +
libc/config/linux/x86_64/entrypoints.txt | 1 +
libc/include/stdlib.yaml | 7 +
libc/src/stdlib/CMakeLists.txt | 11
libc/src/stdlib/set_constraint_handler_s.cpp | 28
libc/src/stdlib/set_constraint_handler_s.h | 21 +++
7 files changed, 70 insertions(+)
create mode 100644 libc/src/stdlib/set_constraint_handler_s.cpp
create mode 100644 libc/src/stdlib/set_constraint_handler_s.h
diff --git a/libc/config/linux/aarch64/entrypoints.txt
b/libc/config/linux/aarch64/entrypoints.txt
index b2b3789cc2f60..a6493467d2143 100644
--- a/libc/config/linux/aarch64/entrypoints.txt
+++ b/libc/config/linux/aarch64/entrypoints.txt
@@ -2,6 +2,7 @@ set(TARGET_ANNEX_K_ENTRYPOINTS
# stdlib.h entrypoints
libc.src.stdlib.abort_handler_s
libc.src.stdlib.ignore_handler_s
+libc.src.stdlib.set_constraint_handler_s
)
set(TARGET_LIBC_ENTRYPOINTS
diff --git a/libc/config/linux/riscv/entrypoints.txt
b/libc/config/linux/riscv/entrypoints.txt
index 5d92b112272fb..b19641a0a656b 100644
--- a/libc/config/linux/riscv/entrypoints.txt
+++ b/libc/config/linux/riscv/entrypoints.txt
@@ -2,6 +2,7 @@ set(TARGET_ANNEX_K_ENTRYPOINTS
# stdlib.h entrypoints
libc.src.stdlib.abort_handler_s
libc.src.stdlib.ignore_handler_s
+libc.src.stdlib.set_constraint_handler_s
)
set(TARGET_LIBC_ENTRYPOINTS
diff --git a/libc/config/linux/x86_64/entrypoints.txt
b/libc/config/linux/x86_64/entrypoints.txt
index 4cb412ae7c526..12e81121a1a01 100644
--- a/libc/config/linux/x86_64/entrypoints.txt
+++ b/libc/config/linux/x86_64/entrypoints.txt
@@ -2,6 +2,7 @@ set(TARGET_ANNEX_K_ENTRYPOINTS
# stdlib.h entrypoints
libc.src.stdlib.abort_handler_s
libc.src.stdlib.ignore_handler_s
+libc.src.stdlib.set_constraint_handler_s
)
set(TARGET_LIBC_ENTRYPOINTS
diff --git a/libc/include/stdlib.yaml b/libc/include/stdlib.yaml
index 7c3b113a62415..49d45f105fe7a 100644
--- a/libc/include/stdlib.yaml
+++ b/libc/include/stdlib.yaml
@@ -202,6 +202,13 @@ functions:
- type: void *__restrict
- type: errno_t
guard: 'LIBC_HAS_ANNEX_K'
+ - name: set_constraint_handler_s
+standards:
+ - stdc
+return_type: constraint_handler_t
+arguments:
+ - type: constraint_handler_t
+guard: 'LIBC_HAS_ANNEX_K'
- name: srand
standards:
- stdc
diff --git a/libc/src/stdlib/CMakeLists.txt b/libc/src/stdlib/CMakeLists.txt
index 5efd7f13ff3ee..c380657300cfe 100644
--- a/libc/src/stdlib/CMakeLists.txt
+++ b/libc/src/stdlib/CMakeLists.txt
@@ -664,6 +664,17 @@ add_entrypoint_object(
.${LIBC_TARGET_OS}.system
)
+add_entrypoint_object(
+ set_constraint_handler_s
+ SRCS
+set_constraint_handler_s.cpp
+ HDRS
+set_constraint_handler_s.h
+ DEPENDS
+libc.src.__support.annex_k.abort_handler_s
+libc.src.__support.annex_k.libc_constraint_handler
+)
+
add_entrypoint_object(
ignore_handler_s
HDRS
diff --git a/libc/src/stdlib/set_constraint_handler_s.cpp
b/libc/src/stdlib/set_constraint_handler_s.cpp
new file mode 100644
index 0..d3a16d77e3b0a
--- /dev/null
+++ b/libc/src/stdlib/set_constraint_handler_s.cpp
@@ -0,0 +1,28 @@
+//===-- Implementation of set_constraint_handler_s
===//
+//
+// 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
+//
+//===--===//
+
+#include "set_constraint_handler_s.h"
+#include "src/__support/annex_k/abort_handler_s.h"
+#include "src/__support/annex_k/libc_constraint_handler.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(constraint_handler_t, set_constraint_handler_s,
+ (constraint_handler_t handler)) {
+ auto previous_handler = annex_k::libc_constraint_handler;
+
+ if (!handler) {
+annex_k::libc_constraint_handler = &annex_k::abort_handler_s;
+ } else {
+annex_k::libc_constraint_handler = handler;
+ }
+
+ return previous_handler;
+}
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/stdlib/set_constraint_handler_s.h
b/libc/src/stdlib/set_constraint_handler_s.h
new file mode 100644
index 0..f5c6e01712ef0
--- /dev/null
+++ b/libc/src/stdlib/set_constraint_handler_s.h
@@ -0,0 +1,21 @@
+//===-- Implementation header for set_constraint_handler_s --*- C++
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// S
[llvm-branch-commits] [libc] [libc][annex_k] Add libannex_k as build target in LLVM libc. (PR #163869)
https://github.com/bassiounix updated
https://github.com/llvm/llvm-project/pull/163869
>From 1b6ea98737a45caeacdd09da163e8b6e015bee8c Mon Sep 17 00:00:00 2001
From: bassiounix
Date: Fri, 17 Oct 2025 00:15:35 +0300
Subject: [PATCH] [libc][annex_k] Add libannex_k as build target in LLVM libc.
---
libc/config/linux/aarch64/entrypoints.txt | 3 +++
libc/config/linux/riscv/entrypoints.txt | 3 +++
libc/config/linux/x86_64/entrypoints.txt | 3 +++
libc/lib/CMakeLists.txt | 9 ++---
4 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/libc/config/linux/aarch64/entrypoints.txt
b/libc/config/linux/aarch64/entrypoints.txt
index 8bf6c44b1d669..d79682cad8b80 100644
--- a/libc/config/linux/aarch64/entrypoints.txt
+++ b/libc/config/linux/aarch64/entrypoints.txt
@@ -1,3 +1,5 @@
+set(TARGET_ANNEX_K_ENTRYPOINTS "")
+
set(TARGET_LIBC_ENTRYPOINTS
# ctype.h entrypoints
libc.src.ctype.isalnum
@@ -1177,4 +1179,5 @@ endif()
set(TARGET_LLVMLIBC_ENTRYPOINTS
${TARGET_LIBC_ENTRYPOINTS}
${TARGET_LIBM_ENTRYPOINTS}
+ ${TARGET_ANNEX_K_ENTRYPOINTS}
)
diff --git a/libc/config/linux/riscv/entrypoints.txt
b/libc/config/linux/riscv/entrypoints.txt
index dffccbab9a8e9..fd9bd9d4350eb 100644
--- a/libc/config/linux/riscv/entrypoints.txt
+++ b/libc/config/linux/riscv/entrypoints.txt
@@ -1,3 +1,5 @@
+set(TARGET_ANNEX_K_ENTRYPOINTS "")
+
set(TARGET_LIBC_ENTRYPOINTS
# ctype.h entrypoints
libc.src.ctype.isalnum
@@ -1323,4 +1325,5 @@ endif()
set(TARGET_LLVMLIBC_ENTRYPOINTS
${TARGET_LIBC_ENTRYPOINTS}
${TARGET_LIBM_ENTRYPOINTS}
+ ${TARGET_ANNEX_K_ENTRYPOINTS}
)
diff --git a/libc/config/linux/x86_64/entrypoints.txt
b/libc/config/linux/x86_64/entrypoints.txt
index b4ab073ec912f..3503b8473ae78 100644
--- a/libc/config/linux/x86_64/entrypoints.txt
+++ b/libc/config/linux/x86_64/entrypoints.txt
@@ -1,3 +1,5 @@
+set(TARGET_ANNEX_K_ENTRYPOINTS "")
+
set(TARGET_LIBC_ENTRYPOINTS
# ctype.h entrypoints
libc.src.ctype.isalnum
@@ -1379,4 +1381,5 @@ endif()
set(TARGET_LLVMLIBC_ENTRYPOINTS
${TARGET_LIBC_ENTRYPOINTS}
${TARGET_LIBM_ENTRYPOINTS}
+ ${TARGET_ANNEX_K_ENTRYPOINTS}
)
diff --git a/libc/lib/CMakeLists.txt b/libc/lib/CMakeLists.txt
index ce0b07fb6cb49..6fde2c8fc827d 100644
--- a/libc/lib/CMakeLists.txt
+++ b/libc/lib/CMakeLists.txt
@@ -2,10 +2,13 @@ set(libc_archive_targets "")
set(libc_archive_names "")
set(libc_archive_entrypoint_lists "")
if(LLVM_LIBC_FULL_BUILD)
- list(APPEND libc_archive_names c m)
- list(APPEND libc_archive_targets libc libm)
+ list(APPEND libc_archive_names c m annex_k)
+ list(APPEND libc_archive_targets libc libm libannex_k)
list(APPEND libc_archive_entrypoint_lists
- TARGET_LIBC_ENTRYPOINTS TARGET_LIBM_ENTRYPOINTS)
+ TARGET_LIBC_ENTRYPOINTS
+ TARGET_LIBM_ENTRYPOINTS
+ TARGET_ANNEX_K_ENTRYPOINTS
+ )
else()
list(APPEND libc_archive_names llvmlibc)
list(APPEND libc_archive_targets libc)
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libc] [libc][annex_k] Add libc_constraint_handler. (PR #163315)
https://github.com/bassiounix updated
https://github.com/llvm/llvm-project/pull/163315
>From 6c5ed3e008fac6e065578d2b6179587473f5773a Mon Sep 17 00:00:00 2001
From: bassiounix
Date: Tue, 14 Oct 2025 06:38:29 +0300
Subject: [PATCH] [libc][annex_k] Add libc_constraint_handler.
---
libc/src/__support/annex_k/CMakeLists.txt | 9 +++
.../annex_k/libc_constraint_handler.h | 26 +++
2 files changed, 35 insertions(+)
create mode 100644 libc/src/__support/annex_k/libc_constraint_handler.h
diff --git a/libc/src/__support/annex_k/CMakeLists.txt
b/libc/src/__support/annex_k/CMakeLists.txt
index 78f5b3cddebd7..8eb65f2469b4f 100644
--- a/libc/src/__support/annex_k/CMakeLists.txt
+++ b/libc/src/__support/annex_k/CMakeLists.txt
@@ -10,3 +10,12 @@ add_header_library(
libc.src.__support.OSUtil.osutil
libc.src.stdlib.abort
)
+
+add_header_library(
+ libc_constraint_handler
+ HDRS
+libc_constraint_handler.h
+ DEPENDS
+.abort_handler_s
+libc.hdr.types.constraint_handler_t
+)
diff --git a/libc/src/__support/annex_k/libc_constraint_handler.h
b/libc/src/__support/annex_k/libc_constraint_handler.h
new file mode 100644
index 0..db01c8dd940a0
--- /dev/null
+++ b/libc/src/__support/annex_k/libc_constraint_handler.h
@@ -0,0 +1,26 @@
+//===-- Static header for libc_constraint_handler ---*- C++
-*-===//
+//
+// 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
+//
+//===--===//
+
+#ifndef LLVM_LIBC_SRC___SUPPORT_ANNEX_K_LIBC_CONSTRAINT_HANDLER_H
+#define LLVM_LIBC_SRC___SUPPORT_ANNEX_K_LIBC_CONSTRAINT_HANDLER_H
+
+#include "abort_handler_s.h"
+#include "hdr/types/constraint_handler_t.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+namespace annex_k {
+
+LIBC_INLINE static constraint_handler_t libc_constraint_handler =
+&abort_handler_s;
+
+} // namespace annex_k
+
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_ANNEX_K_LIBC_CONSTRAINT_HANDLER_H
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libc] [libc][annex_k] Add constraint_handler_t. (PR #163239)
https://github.com/bassiounix updated https://github.com/llvm/llvm-project/pull/163239 >From d898a51693b943fbea55f14b43a9e2fce2cd6218 Mon Sep 17 00:00:00 2001 From: bassiounix Date: Mon, 13 Oct 2025 21:38:25 +0300 Subject: [PATCH 1/2] [libc][annex_k] Add constraint_handler_t. --- libc/hdr/types/CMakeLists.txt | 9 libc/hdr/types/constraint_handler_t.h | 18 libc/include/CMakeLists.txt | 1 + libc/include/llvm-libc-types/CMakeLists.txt | 2 ++ .../llvm-libc-types/constraint_handler_t.h| 21 +++ libc/include/stdlib.yaml | 1 + 6 files changed, 52 insertions(+) create mode 100644 libc/hdr/types/constraint_handler_t.h create mode 100644 libc/include/llvm-libc-types/constraint_handler_t.h diff --git a/libc/hdr/types/CMakeLists.txt b/libc/hdr/types/CMakeLists.txt index 6fe26881f737e..111dd208997df 100644 --- a/libc/hdr/types/CMakeLists.txt +++ b/libc/hdr/types/CMakeLists.txt @@ -170,6 +170,15 @@ add_proxy_header_library( libc.include.fcntl ) +add_proxy_header_library( + constraint_handler_t + HDRS +constraint_handler_t.h + FULL_BUILD_DEPENDS +libc.include.llvm-libc-types.constraint_handler_t +libc.include.stdlib +) + add_proxy_header_library( errno_t HDRS diff --git a/libc/hdr/types/constraint_handler_t.h b/libc/hdr/types/constraint_handler_t.h new file mode 100644 index 0..ca7798b84228e --- /dev/null +++ b/libc/hdr/types/constraint_handler_t.h @@ -0,0 +1,18 @@ +//===-- Proxy for constraint_handler_t ===// +// +// 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 +// +//===--===// + +#ifndef LLVM_LIBC_HDR_TYPES_CONSTRAINT_HANDLER_T_H +#define LLVM_LIBC_HDR_TYPES_CONSTRAINT_HANDLER_T_H + +#define LIBC_HAS_ANNEX_K + +#include "include/llvm-libc-types/constraint_handler_t.h" + +#undef LIBC_HAS_ANNEX_K + +#endif // LLVM_LIBC_HDR_TYPES_CONSTRAINT_HANDLER_T_H diff --git a/libc/include/CMakeLists.txt b/libc/include/CMakeLists.txt index c70d1190e8342..3266b57bc8ecd 100644 --- a/libc/include/CMakeLists.txt +++ b/libc/include/CMakeLists.txt @@ -366,6 +366,7 @@ add_header_macro( .llvm-libc-types.__qsortcompare_t .llvm-libc-types.__qsortrcompare_t .llvm-libc-types.__search_compare_t +.llvm-libc-types.constraint_handler_t .llvm-libc-types.div_t .llvm-libc-types.ldiv_t .llvm-libc-types.lldiv_t diff --git a/libc/include/llvm-libc-types/CMakeLists.txt b/libc/include/llvm-libc-types/CMakeLists.txt index cc7b2847909e4..e3bfc7dd3e95b 100644 --- a/libc/include/llvm-libc-types/CMakeLists.txt +++ b/libc/include/llvm-libc-types/CMakeLists.txt @@ -300,3 +300,5 @@ add_header(EFI_SYSTEM_TABLE .EFI_TABLE_HEADER .char16_t ) + +add_header(constraint_handler_t HDR constraint_handler_t.h DEPENDS .errno_t) diff --git a/libc/include/llvm-libc-types/constraint_handler_t.h b/libc/include/llvm-libc-types/constraint_handler_t.h new file mode 100644 index 0..efd21296cd399 --- /dev/null +++ b/libc/include/llvm-libc-types/constraint_handler_t.h @@ -0,0 +1,21 @@ +//===-- Definition of type constraint_handler_t ---===// +// +// 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 +// +//===--===// + +#ifndef LLVM_LIBC_INCLUDE_LLVM_LIBC_TYPES_CONSTRAINT_HANDLER_T_H +#define LLVM_LIBC_INCLUDE_LLVM_LIBC_TYPES_CONSTRAINT_HANDLER_T_H + +#include "errno_t.h" + +#ifdef LIBC_HAS_ANNEX_K + +typedef void (*constraint_handler_t)(const char *__restrict, void *__restrict, + errno_t); + +#endif // LIBC_HAS_ANNEX_K + +#endif // LLVM_LIBC_INCLUDE_LLVM_LIBC_TYPES_CONSTRAINT_HANDLER_T_H diff --git a/libc/include/stdlib.yaml b/libc/include/stdlib.yaml index 3b2ff13c684b1..29fd6bc3a1e75 100644 --- a/libc/include/stdlib.yaml +++ b/libc/include/stdlib.yaml @@ -12,6 +12,7 @@ types: - type_name: __qsortcompare_t - type_name: __qsortrcompare_t - type_name: __search_compare_t + - type_name: constraint_handler_t - type_name: div_t - type_name: ldiv_t - type_name: lldiv_t >From 3ce16781e9f3b0179b2911db4511834b79659ec8 Mon Sep 17 00:00:00 2001 From: bassiounix Date: Tue, 14 Oct 2025 00:55:56 +0300 Subject: [PATCH 2/2] change location --- libc/include/llvm-libc-types/CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libc/include/llvm-libc-types/CMakeLists.txt b/libc/include/llvm-libc-types/CMakeLists.txt index e3bfc7dd3e95b..fe34abfc2e38b 100644 --- a/libc/include/llvm-libc-types/
[llvm-branch-commits] [libc] [libc][annex_k] Add rsize_t. (PR #163238)
https://github.com/bassiounix updated https://github.com/llvm/llvm-project/pull/163238 >From aa63b69cfedf984b2c57cfa694f365e9ffb35b71 Mon Sep 17 00:00:00 2001 From: bassiounix Date: Mon, 13 Oct 2025 21:14:40 +0300 Subject: [PATCH] [libc][annex_k] Add rsize_t. --- libc/hdr/types/CMakeLists.txt | 8 +++ libc/hdr/types/rsize_t.h| 23 + libc/include/llvm-libc-types/CMakeLists.txt | 1 + libc/include/llvm-libc-types/rsize_t.h | 18 4 files changed, 50 insertions(+) create mode 100644 libc/hdr/types/rsize_t.h create mode 100644 libc/include/llvm-libc-types/rsize_t.h diff --git a/libc/hdr/types/CMakeLists.txt b/libc/hdr/types/CMakeLists.txt index 8ec2926ee16fc..6fe26881f737e 100644 --- a/libc/hdr/types/CMakeLists.txt +++ b/libc/hdr/types/CMakeLists.txt @@ -135,6 +135,14 @@ add_proxy_header_library( libc.include.llvm-libc-types.struct_tm ) +add_proxy_header_library( + rsize_t + HDRS +rsize_t.h + FULL_BUILD_DEPENDS +libc.include.llvm-libc-types.rsize_t +) + add_proxy_header_library( size_t HDRS diff --git a/libc/hdr/types/rsize_t.h b/libc/hdr/types/rsize_t.h new file mode 100644 index 0..130e6c308e264 --- /dev/null +++ b/libc/hdr/types/rsize_t.h @@ -0,0 +1,23 @@ +//===-- Proxy for rsize_t -===// +// +// 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 +// +//===--===// +#ifndef LLVM_LIBC_HDR_TYPES_SIZE_T_H +#define LLVM_LIBC_HDR_TYPES_SIZE_T_H + +#ifdef LIBC_FULL_BUILD + +#include "include/llvm-libc-types/rsize_t.h" + +#else + +#define __need_rsize_t +#include +#undef __need_rsize_t + +#endif // LIBC_FULL_BUILD + +#endif // LLVM_LIBC_HDR_TYPES_SIZE_T_H diff --git a/libc/include/llvm-libc-types/CMakeLists.txt b/libc/include/llvm-libc-types/CMakeLists.txt index e8b3ae8c08a90..cc7b2847909e4 100644 --- a/libc/include/llvm-libc-types/CMakeLists.txt +++ b/libc/include/llvm-libc-types/CMakeLists.txt @@ -1,4 +1,5 @@ add_header(off64_t HDR off64_t.h) +add_header(rsize_t HDR rsize_t.h) add_header(size_t HDR size_t.h) add_header(ssize_t HDR ssize_t.h) add_header(__atfork_callback_t HDR __atfork_callback_t.h) diff --git a/libc/include/llvm-libc-types/rsize_t.h b/libc/include/llvm-libc-types/rsize_t.h new file mode 100644 index 0..dc8be02bee592 --- /dev/null +++ b/libc/include/llvm-libc-types/rsize_t.h @@ -0,0 +1,18 @@ +//===-- Definition of size_t types ===// +// +// 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 +// +//===--===// + +#ifndef LLVM_LIBC_TYPES_RSIZE_T_H +#define LLVM_LIBC_TYPES_RSIZE_T_H + +#ifdef LIBC_HAS_ANNEX_K + +typedef __SIZE_TYPE__ rsize_t; + +#endif // LIBC_HAS_ANNEX_K + +#endif // LLVM_LIBC_TYPES_RSIZE_T_H ___ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [llvm] [AArch64][llvm] Armv9.7-A: Add support for SVE2p3 DOT and MLA operations (PR #163161)
@@ -0,0 +1,34 @@
+// RUN: not llvm-mc -triple=aarch64 -show-encoding -mattr=+sve-b16mm 2>&1 <
%s| FileCheck %s
+
+// --//
+// Invalid element width
+
+bfmmla z0.h, z0.b, z0.b
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid element width
+// CHECK-NEXT: bfmmla z0.h, z0.b, z0.b
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+bfmmla z0.s, z0.s, z0.s
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid element width
+// CHECK-NEXT: bfmmla z0.s, z0.s, z0.s
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+bfmmla z0.d, z0.d, z0.d
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid element width
+// CHECK-NEXT: bfmmla z0.d, z0.d, z0.d
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+// --//
+// Negative tests for instructions that are incompatible with movprfx
+
+movprfx z0.h, p0/m, z7.h
+bfmmla z0.h, z0.h, z0.h
jthackray wrote:
The one which passes in `bfmmla.s` uses a different source/dest:
```
movprfx z0, z7
bfmmla z0.h, z1.h, z2.h
```
whereas this one uses `z0.h` for both src and dest, and so should cause this
error. Perhaps it's not a helpful test?
https://github.com/llvm/llvm-project/pull/163161
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [llvm] [AArch64][llvm] Armv9.7-A: Add support for SVE2p3 DOT and MLA operations (PR #163161)
https://github.com/jthackray edited https://github.com/llvm/llvm-project/pull/163161 ___ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [llvm] [AArch64][llvm] Armv9.7-A: Add support for SVE2p3 DOT and MLA operations (PR #163161)
@@ -29,7 +29,7 @@ sdot z0.s, z0.h, z0.h[-1]
// Invalid vector suffix
sdot z0.h, z0.s, z0.s
-// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid element width
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand for instruction
jthackray wrote:
It does complain, but with this slightly different error message.
https://github.com/llvm/llvm-project/pull/163161
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libc] [libc][annex_k] Add constraint_handler_t. (PR #163239)
https://github.com/bassiounix updated https://github.com/llvm/llvm-project/pull/163239 >From d898a51693b943fbea55f14b43a9e2fce2cd6218 Mon Sep 17 00:00:00 2001 From: bassiounix Date: Mon, 13 Oct 2025 21:38:25 +0300 Subject: [PATCH 1/2] [libc][annex_k] Add constraint_handler_t. --- libc/hdr/types/CMakeLists.txt | 9 libc/hdr/types/constraint_handler_t.h | 18 libc/include/CMakeLists.txt | 1 + libc/include/llvm-libc-types/CMakeLists.txt | 2 ++ .../llvm-libc-types/constraint_handler_t.h| 21 +++ libc/include/stdlib.yaml | 1 + 6 files changed, 52 insertions(+) create mode 100644 libc/hdr/types/constraint_handler_t.h create mode 100644 libc/include/llvm-libc-types/constraint_handler_t.h diff --git a/libc/hdr/types/CMakeLists.txt b/libc/hdr/types/CMakeLists.txt index 6fe26881f737e..111dd208997df 100644 --- a/libc/hdr/types/CMakeLists.txt +++ b/libc/hdr/types/CMakeLists.txt @@ -170,6 +170,15 @@ add_proxy_header_library( libc.include.fcntl ) +add_proxy_header_library( + constraint_handler_t + HDRS +constraint_handler_t.h + FULL_BUILD_DEPENDS +libc.include.llvm-libc-types.constraint_handler_t +libc.include.stdlib +) + add_proxy_header_library( errno_t HDRS diff --git a/libc/hdr/types/constraint_handler_t.h b/libc/hdr/types/constraint_handler_t.h new file mode 100644 index 0..ca7798b84228e --- /dev/null +++ b/libc/hdr/types/constraint_handler_t.h @@ -0,0 +1,18 @@ +//===-- Proxy for constraint_handler_t ===// +// +// 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 +// +//===--===// + +#ifndef LLVM_LIBC_HDR_TYPES_CONSTRAINT_HANDLER_T_H +#define LLVM_LIBC_HDR_TYPES_CONSTRAINT_HANDLER_T_H + +#define LIBC_HAS_ANNEX_K + +#include "include/llvm-libc-types/constraint_handler_t.h" + +#undef LIBC_HAS_ANNEX_K + +#endif // LLVM_LIBC_HDR_TYPES_CONSTRAINT_HANDLER_T_H diff --git a/libc/include/CMakeLists.txt b/libc/include/CMakeLists.txt index c70d1190e8342..3266b57bc8ecd 100644 --- a/libc/include/CMakeLists.txt +++ b/libc/include/CMakeLists.txt @@ -366,6 +366,7 @@ add_header_macro( .llvm-libc-types.__qsortcompare_t .llvm-libc-types.__qsortrcompare_t .llvm-libc-types.__search_compare_t +.llvm-libc-types.constraint_handler_t .llvm-libc-types.div_t .llvm-libc-types.ldiv_t .llvm-libc-types.lldiv_t diff --git a/libc/include/llvm-libc-types/CMakeLists.txt b/libc/include/llvm-libc-types/CMakeLists.txt index cc7b2847909e4..e3bfc7dd3e95b 100644 --- a/libc/include/llvm-libc-types/CMakeLists.txt +++ b/libc/include/llvm-libc-types/CMakeLists.txt @@ -300,3 +300,5 @@ add_header(EFI_SYSTEM_TABLE .EFI_TABLE_HEADER .char16_t ) + +add_header(constraint_handler_t HDR constraint_handler_t.h DEPENDS .errno_t) diff --git a/libc/include/llvm-libc-types/constraint_handler_t.h b/libc/include/llvm-libc-types/constraint_handler_t.h new file mode 100644 index 0..efd21296cd399 --- /dev/null +++ b/libc/include/llvm-libc-types/constraint_handler_t.h @@ -0,0 +1,21 @@ +//===-- Definition of type constraint_handler_t ---===// +// +// 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 +// +//===--===// + +#ifndef LLVM_LIBC_INCLUDE_LLVM_LIBC_TYPES_CONSTRAINT_HANDLER_T_H +#define LLVM_LIBC_INCLUDE_LLVM_LIBC_TYPES_CONSTRAINT_HANDLER_T_H + +#include "errno_t.h" + +#ifdef LIBC_HAS_ANNEX_K + +typedef void (*constraint_handler_t)(const char *__restrict, void *__restrict, + errno_t); + +#endif // LIBC_HAS_ANNEX_K + +#endif // LLVM_LIBC_INCLUDE_LLVM_LIBC_TYPES_CONSTRAINT_HANDLER_T_H diff --git a/libc/include/stdlib.yaml b/libc/include/stdlib.yaml index 3b2ff13c684b1..29fd6bc3a1e75 100644 --- a/libc/include/stdlib.yaml +++ b/libc/include/stdlib.yaml @@ -12,6 +12,7 @@ types: - type_name: __qsortcompare_t - type_name: __qsortrcompare_t - type_name: __search_compare_t + - type_name: constraint_handler_t - type_name: div_t - type_name: ldiv_t - type_name: lldiv_t >From 3ce16781e9f3b0179b2911db4511834b79659ec8 Mon Sep 17 00:00:00 2001 From: bassiounix Date: Tue, 14 Oct 2025 00:55:56 +0300 Subject: [PATCH 2/2] change location --- libc/include/llvm-libc-types/CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libc/include/llvm-libc-types/CMakeLists.txt b/libc/include/llvm-libc-types/CMakeLists.txt index e3bfc7dd3e95b..fe34abfc2e38b 100644 --- a/libc/include/llvm-libc-types/
[llvm-branch-commits] [libc] [libc][annex_k] Add libc_constraint_handler macros. (PR #163316)
https://github.com/bassiounix updated
https://github.com/llvm/llvm-project/pull/163316
>From d66c46efb84545f8dff5ee858d8599dc2a769967 Mon Sep 17 00:00:00 2001
From: bassiounix
Date: Tue, 14 Oct 2025 06:45:09 +0300
Subject: [PATCH] [libc][annex_k] Add libc_constraint_handler macros.
---
libc/src/__support/annex_k/CMakeLists.txt | 9
.../src/__support/annex_k/constraint_macros.h | 44 +++
2 files changed, 53 insertions(+)
create mode 100644 libc/src/__support/annex_k/constraint_macros.h
diff --git a/libc/src/__support/annex_k/CMakeLists.txt
b/libc/src/__support/annex_k/CMakeLists.txt
index 8eb65f2469b4f..4ef4e32ebdd85 100644
--- a/libc/src/__support/annex_k/CMakeLists.txt
+++ b/libc/src/__support/annex_k/CMakeLists.txt
@@ -11,6 +11,15 @@ add_header_library(
libc.src.stdlib.abort
)
+add_header_library(
+ constraint_macros
+ HDRS
+constraint_macros.h
+ DEPENDS
+.libc_constraint_handler
+libc.src.__support.libc_errno
+)
+
add_header_library(
libc_constraint_handler
HDRS
diff --git a/libc/src/__support/annex_k/constraint_macros.h
b/libc/src/__support/annex_k/constraint_macros.h
new file mode 100644
index 0..835c161dd0d30
--- /dev/null
+++ b/libc/src/__support/annex_k/constraint_macros.h
@@ -0,0 +1,44 @@
+//===-- Helper macros header for constraint violations --*- C++
-*-===//
+//
+// 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
+//
+//===--===//
+
+#ifndef LLVM_LIBC_SRC___SUPPORT_ANNEX_K_MACROS_H
+#define LLVM_LIBC_SRC___SUPPORT_ANNEX_K_MACROS_H
+
+#include "libc_constraint_handler.h"
+#include "src/__support/libc_errno.h"
+
+#define _CONSTRAINT_VIOLATION(msg, error_code, ret_code)
\
+ {
\
+libc_errno = error_code;
\
+libc_constraint_handler(msg, nullptr, error_code);
\
+return ret_code;
\
+ }
+
+#define _CONSTRAINT_VIOLATION_IF(expr, error_code, return_code)
\
+ {
\
+auto expr_val = expr;
\
+if (expr_val) {
\
+ libc_errno = error_code;
\
+ libc_constraint_handler(nullptr, nullptr, error_code);
\
+ return return_code;
\
+}
\
+ }
+
+#define _CONSTRAINT_VIOLATION_CLEANUP_IF(expr, cleanup, error_code,
\
+ return_code)
\
+ {
\
+auto expr_val = expr;
\
+if (expr_val) {
\
+ cleanup;
\
+ libc_errno = error_code;
\
+ libc_constraint_handler(nullptr, nullptr, error_code);
\
+ return return_code;
\
+}
\
+ }
+
+#endif // LLVM_LIBC_SRC___SUPPORT_ANNEX_K_MACROS_H
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libc] [libc][annex_k] Add libannex_k as build target in LLVM libc. (PR #163869)
https://github.com/bassiounix updated
https://github.com/llvm/llvm-project/pull/163869
>From 1b6ea98737a45caeacdd09da163e8b6e015bee8c Mon Sep 17 00:00:00 2001
From: bassiounix
Date: Fri, 17 Oct 2025 00:15:35 +0300
Subject: [PATCH] [libc][annex_k] Add libannex_k as build target in LLVM libc.
---
libc/config/linux/aarch64/entrypoints.txt | 3 +++
libc/config/linux/riscv/entrypoints.txt | 3 +++
libc/config/linux/x86_64/entrypoints.txt | 3 +++
libc/lib/CMakeLists.txt | 9 ++---
4 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/libc/config/linux/aarch64/entrypoints.txt
b/libc/config/linux/aarch64/entrypoints.txt
index 8bf6c44b1d669..d79682cad8b80 100644
--- a/libc/config/linux/aarch64/entrypoints.txt
+++ b/libc/config/linux/aarch64/entrypoints.txt
@@ -1,3 +1,5 @@
+set(TARGET_ANNEX_K_ENTRYPOINTS "")
+
set(TARGET_LIBC_ENTRYPOINTS
# ctype.h entrypoints
libc.src.ctype.isalnum
@@ -1177,4 +1179,5 @@ endif()
set(TARGET_LLVMLIBC_ENTRYPOINTS
${TARGET_LIBC_ENTRYPOINTS}
${TARGET_LIBM_ENTRYPOINTS}
+ ${TARGET_ANNEX_K_ENTRYPOINTS}
)
diff --git a/libc/config/linux/riscv/entrypoints.txt
b/libc/config/linux/riscv/entrypoints.txt
index dffccbab9a8e9..fd9bd9d4350eb 100644
--- a/libc/config/linux/riscv/entrypoints.txt
+++ b/libc/config/linux/riscv/entrypoints.txt
@@ -1,3 +1,5 @@
+set(TARGET_ANNEX_K_ENTRYPOINTS "")
+
set(TARGET_LIBC_ENTRYPOINTS
# ctype.h entrypoints
libc.src.ctype.isalnum
@@ -1323,4 +1325,5 @@ endif()
set(TARGET_LLVMLIBC_ENTRYPOINTS
${TARGET_LIBC_ENTRYPOINTS}
${TARGET_LIBM_ENTRYPOINTS}
+ ${TARGET_ANNEX_K_ENTRYPOINTS}
)
diff --git a/libc/config/linux/x86_64/entrypoints.txt
b/libc/config/linux/x86_64/entrypoints.txt
index b4ab073ec912f..3503b8473ae78 100644
--- a/libc/config/linux/x86_64/entrypoints.txt
+++ b/libc/config/linux/x86_64/entrypoints.txt
@@ -1,3 +1,5 @@
+set(TARGET_ANNEX_K_ENTRYPOINTS "")
+
set(TARGET_LIBC_ENTRYPOINTS
# ctype.h entrypoints
libc.src.ctype.isalnum
@@ -1379,4 +1381,5 @@ endif()
set(TARGET_LLVMLIBC_ENTRYPOINTS
${TARGET_LIBC_ENTRYPOINTS}
${TARGET_LIBM_ENTRYPOINTS}
+ ${TARGET_ANNEX_K_ENTRYPOINTS}
)
diff --git a/libc/lib/CMakeLists.txt b/libc/lib/CMakeLists.txt
index ce0b07fb6cb49..6fde2c8fc827d 100644
--- a/libc/lib/CMakeLists.txt
+++ b/libc/lib/CMakeLists.txt
@@ -2,10 +2,13 @@ set(libc_archive_targets "")
set(libc_archive_names "")
set(libc_archive_entrypoint_lists "")
if(LLVM_LIBC_FULL_BUILD)
- list(APPEND libc_archive_names c m)
- list(APPEND libc_archive_targets libc libm)
+ list(APPEND libc_archive_names c m annex_k)
+ list(APPEND libc_archive_targets libc libm libannex_k)
list(APPEND libc_archive_entrypoint_lists
- TARGET_LIBC_ENTRYPOINTS TARGET_LIBM_ENTRYPOINTS)
+ TARGET_LIBC_ENTRYPOINTS
+ TARGET_LIBM_ENTRYPOINTS
+ TARGET_ANNEX_K_ENTRYPOINTS
+ )
else()
list(APPEND libc_archive_names llvmlibc)
list(APPEND libc_archive_targets libc)
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libc] [libc][annex_k] Add libc_constraint_handler. (PR #163315)
https://github.com/bassiounix updated
https://github.com/llvm/llvm-project/pull/163315
>From 6c5ed3e008fac6e065578d2b6179587473f5773a Mon Sep 17 00:00:00 2001
From: bassiounix
Date: Tue, 14 Oct 2025 06:38:29 +0300
Subject: [PATCH] [libc][annex_k] Add libc_constraint_handler.
---
libc/src/__support/annex_k/CMakeLists.txt | 9 +++
.../annex_k/libc_constraint_handler.h | 26 +++
2 files changed, 35 insertions(+)
create mode 100644 libc/src/__support/annex_k/libc_constraint_handler.h
diff --git a/libc/src/__support/annex_k/CMakeLists.txt
b/libc/src/__support/annex_k/CMakeLists.txt
index 78f5b3cddebd7..8eb65f2469b4f 100644
--- a/libc/src/__support/annex_k/CMakeLists.txt
+++ b/libc/src/__support/annex_k/CMakeLists.txt
@@ -10,3 +10,12 @@ add_header_library(
libc.src.__support.OSUtil.osutil
libc.src.stdlib.abort
)
+
+add_header_library(
+ libc_constraint_handler
+ HDRS
+libc_constraint_handler.h
+ DEPENDS
+.abort_handler_s
+libc.hdr.types.constraint_handler_t
+)
diff --git a/libc/src/__support/annex_k/libc_constraint_handler.h
b/libc/src/__support/annex_k/libc_constraint_handler.h
new file mode 100644
index 0..db01c8dd940a0
--- /dev/null
+++ b/libc/src/__support/annex_k/libc_constraint_handler.h
@@ -0,0 +1,26 @@
+//===-- Static header for libc_constraint_handler ---*- C++
-*-===//
+//
+// 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
+//
+//===--===//
+
+#ifndef LLVM_LIBC_SRC___SUPPORT_ANNEX_K_LIBC_CONSTRAINT_HANDLER_H
+#define LLVM_LIBC_SRC___SUPPORT_ANNEX_K_LIBC_CONSTRAINT_HANDLER_H
+
+#include "abort_handler_s.h"
+#include "hdr/types/constraint_handler_t.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+namespace annex_k {
+
+LIBC_INLINE static constraint_handler_t libc_constraint_handler =
+&abort_handler_s;
+
+} // namespace annex_k
+
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_ANNEX_K_LIBC_CONSTRAINT_HANDLER_H
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [llvm] [AArch64][llvm] Armv9.7-A: Add support for SVE2p3 DOT and MLA operations (PR #163161)
@@ -0,0 +1,34 @@
+// RUN: not llvm-mc -triple=aarch64 -show-encoding -mattr=+sve-b16mm 2>&1 <
%s| FileCheck %s
+
+// --//
+// Invalid element width
+
+bfmmla z0.h, z0.b, z0.b
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid element width
+// CHECK-NEXT: bfmmla z0.h, z0.b, z0.b
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+bfmmla z0.s, z0.s, z0.s
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid element width
+// CHECK-NEXT: bfmmla z0.s, z0.s, z0.s
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+bfmmla z0.d, z0.d, z0.d
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid element width
+// CHECK-NEXT: bfmmla z0.d, z0.d, z0.d
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+// --//
+// Negative tests for instructions that are incompatible with movprfx
+
+movprfx z0.h, p0/m, z7.h
+bfmmla z0.h, z0.h, z0.h
jthackray wrote:
Test now removed.
https://github.com/llvm/llvm-project/pull/163161
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [FlowSensitive] [StatusOr] [8/N] Support value ctor and assignment (PR #163894)
https://github.com/fmayer updated
https://github.com/llvm/llvm-project/pull/163894
>From a410f9239726cb16960f047c67054b183035a361 Mon Sep 17 00:00:00 2001
From: Florian Mayer
Date: Thu, 16 Oct 2025 17:27:24 -0700
Subject: [PATCH] fix test
Created using spr 1.3.7
---
.../FlowSensitive/Models/UncheckedOptionalAccessModel.cpp | 6 +++---
.../FlowSensitive/Models/UncheckedStatusOrAccessModel.cpp | 6 ++
2 files changed, 5 insertions(+), 7 deletions(-)
diff --git
a/clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp
b/clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp
index bb703eff4baff..0fa333eedcfdd 100644
--- a/clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp
+++ b/clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp
@@ -241,9 +241,9 @@ auto nulloptTypeDecl() {
auto hasNulloptType() { return hasType(nulloptTypeDecl()); }
auto inPlaceClass() {
- return recordDecl(hasAnyName("std::in_place_t", "absl::in_place_t",
- "base::in_place_t", "folly::in_place_t",
- "bsl::in_place_t"));
+ return namedDecl(hasAnyName("std::in_place_t", "absl::in_place_t",
+ "base::in_place_t", "folly::in_place_t",
+ "bsl::in_place_t"));
}
auto isOptionalNulloptConstructor() {
diff --git
a/clang/lib/Analysis/FlowSensitive/Models/UncheckedStatusOrAccessModel.cpp
b/clang/lib/Analysis/FlowSensitive/Models/UncheckedStatusOrAccessModel.cpp
index c1d9e8d202f3d..542c35433d3de 100644
--- a/clang/lib/Analysis/FlowSensitive/Models/UncheckedStatusOrAccessModel.cpp
+++ b/clang/lib/Analysis/FlowSensitive/Models/UncheckedStatusOrAccessModel.cpp
@@ -177,10 +177,8 @@ static auto isStatusOrValueConstructor() {
hasArgument(0,
anyOf(hasType(hasCanonicalType(type(equalsBoundNode("T",
nullPointerConstant(),
-hasType(namedDecl(hasName("absl::in_place_t"))),
-hasType(namedDecl(hasName("std::in_place_t")))
-
-)));
+hasType(namedDecl(hasAnyName("absl::in_place_t",
+ "std::in_place_t"));
}
static auto
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [llvm] [AArch64][llvm] Armv9.7-A: Add support for SVE2p3 DOT and MLA operations (PR #163161)
https://github.com/jthackray updated
https://github.com/llvm/llvm-project/pull/163161
>From e76e1206a569891a3616db31c4b6415576d285f6 Mon Sep 17 00:00:00 2001
From: Jonathan Thackray
Date: Thu, 4 Sep 2025 21:40:09 +0100
Subject: [PATCH 1/3] [AArch64][llvm] Armv9.7-A: Add support for SVE2p3 DOT and
MLA operations
Add instructions for SVE2p3 DOT and MLA operations:
- BFMMLA (non-widening)
- FMMLA (non-widening)
- SDOT (2-way, vectors)
- SDOT (2-way, indexed)
- UDOT (2-way, vectors)
- UDOT (2-way, indexed)
as documented here:
* https://developer.arm.com/documentation/ddi0602/2025-09/
*
https://developer.arm.com/documentation/109697/2025_09/2025-Architecture-Extensions
---
clang/test/Driver/aarch64-v97a.c | 8 +
.../print-supported-extensions-aarch64.c | 2 +
llvm/lib/Target/AArch64/AArch64.td| 2 +-
llvm/lib/Target/AArch64/AArch64Features.td| 6 +
llvm/lib/Target/AArch64/AArch64InstrInfo.td | 6 +
.../lib/Target/AArch64/AArch64SVEInstrInfo.td | 30 ++-
.../AArch64/AsmParser/AArch64AsmParser.cpp| 2 +
llvm/lib/Target/AArch64/SVEInstrFormats.td| 36 +++-
llvm/test/MC/AArch64/SVE/bfmmla-diagnostics.s | 5 -
.../test/MC/AArch64/SVE2p1/sdot-diagnostics.s | 2 +-
.../test/MC/AArch64/SVE2p1/udot-diagnostics.s | 4 +-
.../MC/AArch64/SVE2p2/fmmla-diagnostics.s | 24 +++
llvm/test/MC/AArch64/SVE2p2/fmmla.s | 45 +
.../MC/AArch64/SVE2p3/bfmmla-diagnostics.s| 34
llvm/test/MC/AArch64/SVE2p3/bfmmla.s | 45 +
llvm/test/MC/AArch64/SVE2p3/dot-diagnostics.s | 188 ++
llvm/test/MC/AArch64/SVE2p3/dot.s | 173
.../TargetParser/TargetParserTest.cpp | 15 +-
18 files changed, 600 insertions(+), 27 deletions(-)
create mode 100644 llvm/test/MC/AArch64/SVE2p2/fmmla-diagnostics.s
create mode 100644 llvm/test/MC/AArch64/SVE2p2/fmmla.s
create mode 100644 llvm/test/MC/AArch64/SVE2p3/bfmmla-diagnostics.s
create mode 100644 llvm/test/MC/AArch64/SVE2p3/bfmmla.s
create mode 100644 llvm/test/MC/AArch64/SVE2p3/dot-diagnostics.s
create mode 100644 llvm/test/MC/AArch64/SVE2p3/dot.s
diff --git a/clang/test/Driver/aarch64-v97a.c b/clang/test/Driver/aarch64-v97a.c
index a607c1f92ed07..1392029ecda6e 100644
--- a/clang/test/Driver/aarch64-v97a.c
+++ b/clang/test/Driver/aarch64-v97a.c
@@ -26,6 +26,14 @@
// RUN: %clang -target aarch64 -march=armv9.7-a+sve2p3 -### -c %s 2>&1 |
FileCheck -check-prefix=V97A-SVE2p3 %s
// V97A-SVE2p3: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "generic"
"-target-feature" "+v9.7a"{{.*}} "-target-feature" "+sve2p3"
+// RUN: %clang -target aarch64 -march=armv9.7a+sve-b16mm -### -c %s 2>&1 |
FileCheck -check-prefix=V97A-SVE-B16MM %s
+// RUN: %clang -target aarch64 -march=armv9.7-a+sve-b16mm -### -c %s 2>&1 |
FileCheck -check-prefix=V97A-SVE-B16MM %s
+// V97A-SVE-B16MM: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu"
"generic" "-target-feature" "+v9.7a"{{.*}} "-target-feature" "+sve-b16mm"
+
+// RUN: %clang -target aarch64 -march=armv9.7a+f16mm -### -c %s 2>&1 |
FileCheck -check-prefix=V97A-F16MM %s
+// RUN: %clang -target aarch64 -march=armv9.7-a+f16mm -### -c %s 2>&1 |
FileCheck -check-prefix=V97A-F16MM %s
+// V97A-F16MM: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "generic"
"-target-feature" "+v9.7a"{{.*}} "-target-feature" "+f16mm"
+
// RUN: %clang -target aarch64 -march=armv9.7a+cmh -### -c %s 2>&1 | FileCheck
-check-prefix=V97A-CMH %s
// RUN: %clang -target aarch64 -march=armv9.7-a+cmh -### -c %s 2>&1 |
FileCheck -check-prefix=V97A-CMH %s
// V97A-CMH: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "generic"
"-target-feature" "+v9.7a"{{.*}} "-target-feature" "+cmh"
diff --git a/clang/test/Driver/print-supported-extensions-aarch64.c
b/clang/test/Driver/print-supported-extensions-aarch64.c
index ef53f9fba4c43..50c3610123646 100644
--- a/clang/test/Driver/print-supported-extensions-aarch64.c
+++ b/clang/test/Driver/print-supported-extensions-aarch64.c
@@ -18,6 +18,7 @@
// CHECK-NEXT: d128FEAT_D128, FEAT_LVA3, FEAT_SYSREG128,
FEAT_SYSINSTR128 Enable Armv9.4-A 128-bit Page Table Descriptors, System
Registers and instructions
// CHECK-NEXT: dit FEAT_DIT
Enable Armv8.4-A Data Independent Timing instructions
// CHECK-NEXT: dotprod FEAT_DotProd
Enable dot product support
+// CHECK-NEXT: f16mm FEAT_F16MM
Enable Armv9.7-A non-widening half-precision matrix
multiply-accumulate
// CHECK-NEXT: f32mm FEAT_F32MM
Enable Matrix Multiply FP32 Extension
// CHECK-NEXT: f64mm FEAT_F64MM
Enable Matrix Multiply FP64 Extension
// CHECK-NEXT: f8f16mm FEAT_F8
[llvm-branch-commits] [llvm] [AArch64][llvm] Armv9.7-A: Add support for SVE2p3 CVT operations (PR #163162)
https://github.com/jthackray updated
https://github.com/llvm/llvm-project/pull/163162
>From 2b38c52b3ce236c3751a8add0da9b9da7ef3a15e Mon Sep 17 00:00:00 2001
From: Jonathan Thackray
Date: Fri, 5 Sep 2025 23:47:55 +0100
Subject: [PATCH 1/3] [AArch64][llvm] Armv9.7-A: Add support for SVE2p3 CVT
operations
Add instructions for SVE2p3 CVT operations:
- FCVTZSN
- FCVTZUN
- SCVTF
- SCVTFLT
- UCVTF
- UCVTFLT
as documented here:
* https://developer.arm.com/documentation/ddi0602/2025-09/
*
https://developer.arm.com/documentation/109697/2025_09/2025-Architecture-Extensions
---
.../lib/Target/AArch64/AArch64SVEInstrInfo.td | 9 +
llvm/lib/Target/AArch64/SVEInstrFormats.td| 46 +
.../MC/AArch64/SVE2p3/fcvtz-diagnostics.s | 55 ++
llvm/test/MC/AArch64/SVE2p3/fcvtz.s | 165 ++
.../MC/AArch64/SVE2p3/scvtf-diagnostics.s | 65 +++
llvm/test/MC/AArch64/SVE2p3/scvtf.s | 93 ++
.../MC/AArch64/SVE2p3/ucvtf-diagnostics.s | 65 +++
llvm/test/MC/AArch64/SVE2p3/ucvtf.s | 93 ++
8 files changed, 591 insertions(+)
create mode 100644 llvm/test/MC/AArch64/SVE2p3/fcvtz-diagnostics.s
create mode 100644 llvm/test/MC/AArch64/SVE2p3/fcvtz.s
create mode 100644 llvm/test/MC/AArch64/SVE2p3/scvtf-diagnostics.s
create mode 100644 llvm/test/MC/AArch64/SVE2p3/scvtf.s
create mode 100644 llvm/test/MC/AArch64/SVE2p3/ucvtf-diagnostics.s
create mode 100644 llvm/test/MC/AArch64/SVE2p3/ucvtf.s
diff --git a/llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
b/llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
index 2607a5d0c53a1..dfb7bd348e0e0 100644
--- a/llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
+++ b/llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
@@ -4639,6 +4639,15 @@ let Predicates = [HasSVE2p3_or_SME2p3] in {
def SDOT_ZZZI_BtoH : sve_intx_dot_by_indexed_elem_x<0b0, "sdot">;
def UDOT_ZZZI_BtoH : sve_intx_dot_by_indexed_elem_x<0b1, "udot">;
+ // SVE2 fp convert, narrow and interleave to integer, rounding toward zero
+ defm FCVTZSN_Z2Z : sve2_fp_to_int_downcvt<"fcvtzsn", 0b0>;
+ defm FCVTZUN_Z2Z : sve2_fp_to_int_downcvt<"fcvtzun", 0b1>;
+
+ // SVE2 signed/unsigned integer convert to floating-point
+ defm SCVTF_ZZ : sve2_int_to_fp_upcvt<"scvtf", 0b00>;
+ defm SCVTFLT_ZZ : sve2_int_to_fp_upcvt<"scvtflt", 0b10>;
+ defm UCVTF_ZZ : sve2_int_to_fp_upcvt<"ucvtf", 0b01>;
+ defm UCVTFLT_ZZ : sve2_int_to_fp_upcvt<"ucvtflt", 0b11>;
} // End HasSME2p3orSVE2p3
//===--===//
diff --git a/llvm/lib/Target/AArch64/SVEInstrFormats.td
b/llvm/lib/Target/AArch64/SVEInstrFormats.td
index 290a86971aff7..24f4aed5b2bd3 100644
--- a/llvm/lib/Target/AArch64/SVEInstrFormats.td
+++ b/llvm/lib/Target/AArch64/SVEInstrFormats.td
@@ -11300,3 +11300,49 @@ class sve_int_mla_cpa
let ElementSize = ZPR64.ElementSize;
}
+
+//===--===//
+// FCVTZSN
+//===--===//
+class sve2_fp_to_int_downcvt size, bit U>
+ : I<(outs ZdRC:$Zd), (ins ZSrcOp:$Zn),
+ asm, "\t$Zd, $Zn", "", []>, Sched<[]> {
+ bits<5> Zd;
+ bits<4> Zn;
+ let Inst{31-24} = 0b01100101;
+ let Inst{23-22} = size;
+ let Inst{21-11} = 0b00110100110;
+ let Inst{10}= U;
+ let Inst{9-6} = Zn;
+ let Inst{5} = 0b0;
+ let Inst{4-0} = Zd;
+}
+
+multiclass sve2_fp_to_int_downcvt {
+ def _HtoB : sve2_fp_to_int_downcvt;
+ def _StoH : sve2_fp_to_int_downcvt;
+ def _DtoS : sve2_fp_to_int_downcvt;
+}
+
+//===--===//
+// SCVTF
+//===--===//
+class sve2_int_to_fp_upcvt size, bits<2> U>
+ : I<(outs ZdRC:$Zd), (ins ZnRC:$Zn),
+ asm, "\t$Zd, $Zn", "", []>, Sched<[]> {
+ bits<5> Zd;
+ bits<5> Zn;
+ let Inst{31-24} = 0b01100101;
+ let Inst{23-22} = size;
+ let Inst{21-12} = 0b001111;
+ let Inst{11-10} = U;
+ let Inst{9-5} = Zn;
+ let Inst{4-0} = Zd;
+}
+
+multiclass sve2_int_to_fp_upcvt U> {
+ def _BtoH : sve2_int_to_fp_upcvt;
+ def _HtoS : sve2_int_to_fp_upcvt;
+ def _StoD : sve2_int_to_fp_upcvt;
+}
diff --git a/llvm/test/MC/AArch64/SVE2p3/fcvtz-diagnostics.s
b/llvm/test/MC/AArch64/SVE2p3/fcvtz-diagnostics.s
new file mode 100644
index 0..bd182e8713e18
--- /dev/null
+++ b/llvm/test/MC/AArch64/SVE2p3/fcvtz-diagnostics.s
@@ -0,0 +1,55 @@
+// RUN: not llvm-mc -triple=aarch64 -show-encoding -mattr=+sve2p3 2>&1 < %s|
FileCheck %s
+
+// --//
+// Invalid operand for instruction
+
+fcvtzsn z0.b, { z0.b, z1.b }
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand for instruction
+// CHECK-NEXT: fcvtzsn z0.b, { z0.b, z1.b }
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+fcvtzsn z0.h, { z0.h, z1.h }
+// CHECK: [[@LINE-1]]:{{[0-9
[llvm-branch-commits] [clang] [FlowSensitive] [StatusOr] [9/N] Make sure all StatusOr are initialized (PR #163898)
https://github.com/fmayer updated
https://github.com/llvm/llvm-project/pull/163898
>From d2cabb899579b191507ab841063ae29d95cce74f Mon Sep 17 00:00:00 2001
From: Florian Mayer
Date: Thu, 16 Oct 2025 17:29:13 -0700
Subject: [PATCH] leftover
Created using spr 1.3.7
---
...ncheckedStatusOrAccessModelTestFixture.cpp | 121 --
1 file changed, 121 deletions(-)
diff --git
a/clang/unittests/Analysis/FlowSensitive/UncheckedStatusOrAccessModelTestFixture.cpp
b/clang/unittests/Analysis/FlowSensitive/UncheckedStatusOrAccessModelTestFixture.cpp
index ee700f706fc53..67c37e1e0f77f 100644
---
a/clang/unittests/Analysis/FlowSensitive/UncheckedStatusOrAccessModelTestFixture.cpp
+++
b/clang/unittests/Analysis/FlowSensitive/UncheckedStatusOrAccessModelTestFixture.cpp
@@ -3174,127 +3174,6 @@ TEST_P(UncheckedStatusOrAccessModelTest,
ConstructStatusFromReference) {
)cc");
}
-/*
-
-TEST_P(UncheckedStatusOrAccessModelTest, OperatorIndex) {
- ExpectDiagnosticsFor(R"cc(
-#include "unchecked_statusor_access_test_defs.h"
-
-class Foo {
- public:
- const STATUSOR_INT& operator[](size_t n) const;
- STATUSOR_INT& operator[](size_t n);
-};
-
-void target() {
- Foo foo;
- const auto sor1 = foo[0];
- const auto sor2 = foo[1];
- if (!sor1.ok() && !sor2.ok()) return;
- if (sor1.ok() && !sor2.ok()) {
- } else if (!sor1.ok() && sor2.ok()) {
- } else {
-sor1.value();
-sor2.value();
- }
-}
- )cc");
-}
-
-TEST_P(UncheckedStatusOrAccessModelTest, OperatorAt) {
- ExpectDiagnosticsFor(R"cc(
-#include "unchecked_statusor_access_test_defs.h"
-
-class Foo {
- public:
- const STATUSOR_INT& at(size_t n) const;
- STATUSOR_INT& at(size_t n);
-};
-
-void target() {
- Foo foo;
- const auto sor1 = foo.at(0);
- const auto sor2 = foo.at(1);
- if (!sor1.ok() && !sor2.ok()) return;
- if (sor1.ok() && !sor2.ok()) {
- } else if (!sor1.ok() && sor2.ok()) {
- } else {
-sor1.value();
-sor2.value();
- }
-}
- )cc");
-}
-
-TEST_P(UncheckedStatusOrAccessModelTest, OperatorIndexWithStatus) {
- ExpectDiagnosticsFor(R"cc(
-#include "unchecked_statusor_access_test_defs.h"
-
-class Foo {
- public:
- const STATUSOR_INT& operator[](size_t n) const;
- STATUSOR_INT& operator[](size_t n);
-};
-class Bar {
- public:
- const STATUS& operator[](size_t n) const;
- STATUS& operator[](size_t n);
-};
-
-void target() {
- Foo foo;
- const auto sor1 = foo[0];
- const auto sor2 = foo[1];
- Bar bar;
- const auto s1 = bar[0];
- const auto s2 = bar[1];
- if (!s1.ok() && !s2.ok()) return;
- if (s1.ok() && !s2.ok()) {
- } else if (!s1.ok() && s2.ok()) {
- } else {
-if (s1 != sor1.status() || s2 != sor2.status()) return;
-sor1.value();
-sor2.value();
- }
-}
- )cc");
-}
-TEST_P(UncheckedStatusOrAccessModelTest, OperatorAtWithStatus) {
- ExpectDiagnosticsFor(R"cc(
-#include "unchecked_statusor_access_test_defs.h"
-
-class Foo {
- public:
- const STATUSOR_INT& at(size_t n) const;
- STATUSOR_INT& at(size_t n);
-};
-
-class Bar {
- public:
- const STATUS& at(size_t n) const;
- STATUS& at(size_t n);
-};
-
-void target() {
- Foo foo;
- const auto sor1 = foo.at(0);
- const auto sor2 = foo.at(1);
- Bar bar;
- const auto s1 = bar.at(0);
- const auto s2 = bar.at(1);
- if (!s1.ok() && !s2.ok()) return;
- if (s1.ok() && !s2.ok()) {
- } else if (!s1.ok() && s2.ok()) {
- } else {
-if (s1 != sor1.status() || s2 != sor2.status()) return;
-sor1.value();
-sor2.value();
- }
-}
- )cc");
-}
- */
-
} // namespace
std::string
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [outliners] Turn nooutline into an Enum Attribute (PR #163665)
https://github.com/lenary updated
https://github.com/llvm/llvm-project/pull/163665
>From ed1193ff7d938d3ff49315e72bdf2d4f91f85670 Mon Sep 17 00:00:00 2001
From: Sam Elliott
Date: Wed, 15 Oct 2025 17:24:04 -0700
Subject: [PATCH 1/2] [outliners] Turn nooutline into an Enum Attribute
This change turns the `"nooutline"` attribute into an enum attribute
called `nooutline`, and adds an auto-upgrader for bitcode to make the
same change to existing IR.
This IR attribute disables both the Machine Outliner (enabled at Oz for
some targets), and the IR Outliner (disabled by default).
---
llvm/docs/LangRef.rst| 2 +-
llvm/include/llvm/Bitcode/LLVMBitCodes.h | 1 +
llvm/include/llvm/IR/Attributes.td | 3 +++
llvm/lib/Bitcode/Reader/BitcodeReader.cpp| 2 ++
llvm/lib/Bitcode/Writer/BitcodeWriter.cpp| 2 ++
llvm/lib/CodeGen/MachineOutliner.cpp | 2 +-
llvm/lib/IR/AutoUpgrade.cpp | 6 ++
llvm/lib/Transforms/IPO/IROutliner.cpp | 2 +-
llvm/lib/Transforms/Utils/CodeExtractor.cpp | 4
llvm/test/Bitcode/upgrade-nooutline.ll | 12
.../AArch64/machine-outliner-mapper-debug-output.mir | 2 +-
.../Transforms/IROutliner/nooutline-attribute.ll | 4 ++--
12 files changed, 36 insertions(+), 6 deletions(-)
create mode 100644 llvm/test/Bitcode/upgrade-nooutline.ll
diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index 4884e2dcbbe00..73887d1039488 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -2738,7 +2738,7 @@ For example:
to signify an unbounded maximum. The syntax `vscale_range()` can be
used to set both `min` and `max` to the same value. Functions that don't
include this attribute make no assumptions about the value of `vscale`.
-``"nooutline"``
+``nooutline``
This attribute indicates that outlining passes should not modify the
function.
diff --git a/llvm/include/llvm/Bitcode/LLVMBitCodes.h
b/llvm/include/llvm/Bitcode/LLVMBitCodes.h
index 464f475098ec5..95596273aad69 100644
--- a/llvm/include/llvm/Bitcode/LLVMBitCodes.h
+++ b/llvm/include/llvm/Bitcode/LLVMBitCodes.h
@@ -801,6 +801,7 @@ enum AttributeKindCodes {
ATTR_KIND_CAPTURES = 102,
ATTR_KIND_DEAD_ON_RETURN = 103,
ATTR_KIND_SANITIZE_ALLOC_TOKEN = 104,
+ ATTR_KIND_NOOUTLINE = 105,
};
enum ComdatSelectionKindCodes {
diff --git a/llvm/include/llvm/IR/Attributes.td
b/llvm/include/llvm/IR/Attributes.td
index 8e7d9dcebfe2a..46a77ec121039 100644
--- a/llvm/include/llvm/IR/Attributes.td
+++ b/llvm/include/llvm/IR/Attributes.td
@@ -207,6 +207,9 @@ def NoImplicitFloat : EnumAttr<"noimplicitfloat",
IntersectPreserve, [FnAttr]>;
/// inline=never.
def NoInline : EnumAttr<"noinline", IntersectPreserve, [FnAttr]>;
+/// nooutline
+def NoOutline : EnumAttr<"nooutline", IntersectPreserve, [FnAttr]>;
+
/// Function is called early and/or often, so lazy binding isn't worthwhile.
def NonLazyBind : EnumAttr<"nonlazybind", IntersectPreserve, [FnAttr]>;
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index aaee1f0a7687c..ab80da376fdf8 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -2257,6 +2257,8 @@ static Attribute::AttrKind getAttrFromCode(uint64_t Code)
{
return Attribute::Captures;
case bitc::ATTR_KIND_DEAD_ON_RETURN:
return Attribute::DeadOnReturn;
+ case bitc::ATTR_KIND_NOOUTLINE:
+return Attribute::NoOutline;
}
}
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
index 54e916e2dcfe1..0efe7e030e0dc 100644
--- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -956,6 +956,8 @@ static uint64_t getAttrKindEncoding(Attribute::AttrKind
Kind) {
return bitc::ATTR_KIND_CAPTURES;
case Attribute::DeadOnReturn:
return bitc::ATTR_KIND_DEAD_ON_RETURN;
+ case Attribute::NoOutline:
+return bitc::ATTR_KIND_NOOUTLINE;
case Attribute::EndAttrKinds:
llvm_unreachable("Can not encode end-attribute kinds marker.");
case Attribute::None:
diff --git a/llvm/lib/CodeGen/MachineOutliner.cpp
b/llvm/lib/CodeGen/MachineOutliner.cpp
index 9feb9740de126..d6f7305278f38 100644
--- a/llvm/lib/CodeGen/MachineOutliner.cpp
+++ b/llvm/lib/CodeGen/MachineOutliner.cpp
@@ -1257,7 +1257,7 @@ void MachineOutliner::populateMapper(InstructionMapper
&Mapper, Module &M) {
for (Function &F : M) {
LLVM_DEBUG(dbgs() << "MAPPING FUNCTION: " << F.getName() << "\n");
-if (F.hasFnAttribute("nooutline")) {
+if (F.hasFnAttribute(Attribute::NoOutline)) {
LLVM_DEBUG(dbgs() << "SKIP: Function has nooutline attribute\n");
continue;
}
diff --git a/llvm/lib/IR/AutoUpgrade.cpp b/llvm/lib/IR/AutoUpgrade.cpp
index f28b98957cae4..f3b164e5d0603 100644
--- a/llvm/lib/IR/AutoUpgrade.cpp
+
