[clang] [HLSL] Codegen for `cbuffer` declarations without embedded arrays or structs (PR #119755)

2024-12-13 Thread Helena Kotas via cfe-commits

https://github.com/hekota edited 
https://github.com/llvm/llvm-project/pull/119755
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [NVPTX] Auto-Upgrade some nvvm.annotations to attributes (PR #119261)

2024-12-13 Thread Alex MacLean via cfe-commits


@@ -1270,77 +1270,21 @@ exit:
 ; MODULE: attributes #[[ATTR1:[0-9]+]] = { convergent nocallback nounwind }
 ; MODULE: attributes #[[ATTR2:[0-9]+]] = { convergent nocallback nofree 
nounwind willreturn }
 ; MODULE: attributes #[[ATTR3:[0-9]+]] = { nocallback nofree nosync nounwind 
willreturn memory(inaccessiblemem: write) }
-; MODULE: attributes #[[ATTR4]] = { "kernel" }
-; MODULE: attributes #[[ATTR5]] = { nosync memory(none) }
+; MODULE: attributes #[[ATTR4]] = { "kernel" "nvvm.kernel" }
+; MODULE: attributes #[[ATTR5]] = { "kernel" }
+; MODULE: attributes #[[ATTR6]] = { nosync memory(none) }
 ;.
 ; CGSCC: attributes #[[ATTR0]] = { "llvm.assume"="ompx_aligned_barrier" }
 ; CGSCC: attributes #[[ATTR1:[0-9]+]] = { convergent nocallback nounwind }
 ; CGSCC: attributes #[[ATTR2:[0-9]+]] = { convergent nocallback nofree 
nounwind willreturn }
 ; CGSCC: attributes #[[ATTR3:[0-9]+]] = { nocallback nofree nosync nounwind 
willreturn memory(inaccessiblemem: write) }
-; CGSCC: attributes #[[ATTR4]] = { "kernel" }
-; CGSCC: attributes #[[ATTR5]] = { nosync memory(none) }
+; CGSCC: attributes #[[ATTR4]] = { "kernel" "nvvm.kernel" }

AlexMaclean wrote:

There is a `ptx_kernel` calling convention which is an alternative to 
`nvvm.annoations` `!"kernel"` already. However, I don't think we can safely 
auto-upgrade to this in all cases, in the openMP example @jhuber6 provided 
above the function has both `amdgpu_kernel` and `"nvvm.kernel"` which would not 
be possible with `ptx_kernel` CC. Is there any way around this? if not an 
attribute seems like the only option. 

> The metadata use useful if we have cases where we really want fast lookup of 
> all the kernels in the TU.

I don't think there are any cases where we do this, there isn't even a function 
to traverse the metadata and find all the kernels (that I know of).  It's far 
more important to be able to quickly check if a function is a kernel, which the 
metadata solution is fairly slow for (there is a cache hacked on to try to 
mitigate this but that has other issues). In addition metadata should not be 
used to carry semantic information like this. 

https://github.com/llvm/llvm-project/pull/119261
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [NVPTX] Auto-Upgrade some nvvm.annotations to attributes (PR #119261)

2024-12-13 Thread Joseph Huber via cfe-commits


@@ -1270,77 +1270,21 @@ exit:
 ; MODULE: attributes #[[ATTR1:[0-9]+]] = { convergent nocallback nounwind }
 ; MODULE: attributes #[[ATTR2:[0-9]+]] = { convergent nocallback nofree 
nounwind willreturn }
 ; MODULE: attributes #[[ATTR3:[0-9]+]] = { nocallback nofree nosync nounwind 
willreturn memory(inaccessiblemem: write) }
-; MODULE: attributes #[[ATTR4]] = { "kernel" }
-; MODULE: attributes #[[ATTR5]] = { nosync memory(none) }
+; MODULE: attributes #[[ATTR4]] = { "kernel" "nvvm.kernel" }
+; MODULE: attributes #[[ATTR5]] = { "kernel" }
+; MODULE: attributes #[[ATTR6]] = { nosync memory(none) }
 ;.
 ; CGSCC: attributes #[[ATTR0]] = { "llvm.assume"="ompx_aligned_barrier" }
 ; CGSCC: attributes #[[ATTR1:[0-9]+]] = { convergent nocallback nounwind }
 ; CGSCC: attributes #[[ATTR2:[0-9]+]] = { convergent nocallback nofree 
nounwind willreturn }
 ; CGSCC: attributes #[[ATTR3:[0-9]+]] = { nocallback nofree nosync nounwind 
willreturn memory(inaccessiblemem: write) }
-; CGSCC: attributes #[[ATTR4]] = { "kernel" }
-; CGSCC: attributes #[[ATTR5]] = { nosync memory(none) }
+; CGSCC: attributes #[[ATTR4]] = { "kernel" "nvvm.kernel" }

jhuber6 wrote:

Honestly, us putting `nvvm.kernel` on everything should be fixed. AFAIK it's 
used in some OpenMPOpt code to quickly determine kernel entry points, but could 
easily be replaced by a more generic name. I think that's what `"kernel"` also 
does? I'd need to look into it more.

https://github.com/llvm/llvm-project/pull/119261
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang][Driver][Darwin] Optionally use xcselect to find macOS SDK (PR #119670)

2024-12-13 Thread Carlo Cabrera via cfe-commits

https://github.com/carlocab edited 
https://github.com/llvm/llvm-project/pull/119670
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Clang][Xtensa] Add Xtensa target. (PR #118008)

2024-12-13 Thread Eli Friedman via cfe-commits

https://github.com/efriedma-quic edited 
https://github.com/llvm/llvm-project/pull/118008
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Clang][Xtensa] Add Xtensa target. (PR #118008)

2024-12-13 Thread Eli Friedman via cfe-commits

https://github.com/efriedma-quic approved this pull request.

LGTM with one very minor comment

https://github.com/llvm/llvm-project/pull/118008
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Clang][Xtensa] Add Xtensa target. (PR #118008)

2024-12-13 Thread Eli Friedman via cfe-commits


@@ -0,0 +1,112 @@
+//===--- Xtensa.h - Declare Xtensa target feature support ---*- C++ 
-*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+//
+// This file declares Xtensa TargetInfo objects.
+//
+//===--===//
+
+#ifndef LLVM_CLANG_LIB_BASIC_TARGETS_XTENSA_H
+#define LLVM_CLANG_LIB_BASIC_TARGETS_XTENSA_H
+
+#include "clang/Basic/TargetInfo.h"
+#include "clang/Basic/TargetOptions.h"
+#include "llvm/ADT/StringSwitch.h"
+#include "llvm/Support/Compiler.h"
+#include "llvm/TargetParser/Triple.h"
+
+#include "clang/Basic/Builtins.h"
+#include "clang/Basic/MacroBuilder.h"
+#include "clang/Basic/TargetBuiltins.h"
+
+namespace clang {
+namespace targets {
+
+class LLVM_LIBRARY_VISIBILITY XtensaTargetInfo : public TargetInfo {
+  static const Builtin::Info BuiltinInfo[];
+
+protected:
+  std::string CPU;
+
+public:
+  XtensaTargetInfo(const llvm::Triple &Triple, const TargetOptions &)
+  : TargetInfo(Triple) {
+// no big-endianess support yet
+BigEndian = false;
+NoAsmVariants = true;
+LongLongAlign = 64;
+SuitableAlign = 32;
+DoubleAlign = LongDoubleAlign = 64;
+SizeType = UnsignedInt;
+PtrDiffType = SignedInt;
+IntPtrType = SignedInt;
+WCharType = SignedInt;
+WIntType = UnsignedInt;
+UseZeroLengthBitfieldAlignment = true;
+MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 32;
+resetDataLayout("e-m:e-p:32:32-i8:8:32-i16:16:32-i64:64-n32");
+  }
+
+  void getTargetDefines(const LangOptions &Opts,
+MacroBuilder &Builder) const override;
+
+  ArrayRef getTargetBuiltins() const override {
+return std::nullopt;
+  }
+
+  BuiltinVaListKind getBuiltinVaListKind() const override {
+

efriedma-quic wrote:

Extra newline

https://github.com/llvm/llvm-project/pull/118008
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [NVPTX] Auto-Upgrade some nvvm.annotations to attributes (PR #119261)

2024-12-13 Thread Shilei Tian via cfe-commits

https://github.com/shiltian edited 
https://github.com/llvm/llvm-project/pull/119261
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [webkit.UncountedLambdaCapturesChecker] Detect protectedThis pattern. (PR #119932)

2024-12-13 Thread via cfe-commits

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 dd8d85dba6e8f74a55fb5053107797e21894a0c6 
5c032267f263fb6b7f10d25745d14e63b2f7af59 --extensions cpp -- 
clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedLambdaCapturesChecker.cpp 
clang/test/Analysis/Checkers/WebKit/uncounted-lambda-captures.cpp
``





View the diff from clang-format here.


``diff
diff --git 
a/clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedLambdaCapturesChecker.cpp 
b/clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedLambdaCapturesChecker.cpp
index 299038262b..201b8770ad 100644
--- 
a/clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedLambdaCapturesChecker.cpp
+++ 
b/clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedLambdaCapturesChecker.cpp
@@ -105,7 +105,7 @@ public:
 return true;
   }
 
-  LambdaExpr* findLambdaInArg(Expr* E) {
+  LambdaExpr *findLambdaInArg(Expr *E) {
 if (auto *Lambda = dyn_cast_or_null(E))
   return Lambda;
 auto *TempExpr = dyn_cast_or_null(E);
@@ -130,7 +130,7 @@ public:
 auto *VD = dyn_cast_or_null(DRE->getDecl());
 if (!VD)
   return nullptr;
-auto* Init = VD->getInit();
+auto *Init = VD->getInit();
 if (!Init)
   return nullptr;
 TempExpr = dyn_cast(Init->IgnoreParenCasts());
@@ -202,7 +202,7 @@ public:
   }
 
   bool protectThis(const ValueDecl *ValueDecl) const {
-auto* VD = dyn_cast(ValueDecl);
+auto *VD = dyn_cast(ValueDecl);
 if (!VD)
   return false;
 auto *Init = VD->getInit()->IgnoreParenCasts();
@@ -214,7 +214,7 @@ public:
 auto *CE = dyn_cast_or_null(BTE->getSubExpr());
 if (!CE)
   return false;
-auto* Ctor = CE->getConstructor();
+auto *Ctor = CE->getConstructor();
 if (!Ctor)
   return false;
 auto clsName = safeGetName(Ctor->getParent());

``




https://github.com/llvm/llvm-project/pull/119932
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] Fix sub-integer __builtin_elementwise_(add|sub)_sat (PR #119423)

2024-12-13 Thread Eli Friedman via cfe-commits

efriedma-quic wrote:

If people aren't using the edge cases, they won't notice if we start error'ing 
out.  If they are, it's pretty easy to adapt the code to build with both old 
and new compilers.  A quick GitHub search shows exactly one user of the 
builtins outside of clang itself, and that code uses a vector input.

Maybe makes sense to RFC it for wider exposure, but I doubt anyone will object.

We should probably write a release note for this in any case.

https://github.com/llvm/llvm-project/pull/119423
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Clang] Fix crash for incompatible types in inline assembly (PR #119098)

2024-12-13 Thread via cfe-commits

https://github.com/AdUhTkJm updated 
https://github.com/llvm/llvm-project/pull/119098

>From 37b8121ea94fa5fd6ec275caf5984f18f25ba081 Mon Sep 17 00:00:00 2001
From: AdUhTkJm <2292398...@qq.com>
Date: Sun, 8 Dec 2024 08:07:59 +0800
Subject: [PATCH] [Clang] Fix crash for incompatible types in inline assembly

---
 clang/lib/Sema/SemaStmtAsm.cpp |  7 ++-
 clang/test/Sema/asm.c  | 21 +
 2 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Sema/SemaStmtAsm.cpp b/clang/lib/Sema/SemaStmtAsm.cpp
index 0b272b806391c4..a0b203fbdfec21 100644
--- a/clang/lib/Sema/SemaStmtAsm.cpp
+++ b/clang/lib/Sema/SemaStmtAsm.cpp
@@ -664,11 +664,16 @@ StmtResult Sema::ActOnGCCAsmStmt(SourceLocation AsmLoc, 
bool IsSimple,
   SmallerValueMentioned |= OutSize < InSize;
 }
 
+// If the input is an integer register while the output is floating point,
+// or vice-versa, there is no way they can work together.
+bool FPTiedToInt = (InputDomain == AD_FP) ^ (OutputDomain == AD_FP);
+
 // If the smaller value wasn't mentioned in the asm string, and if the
 // output was a register, just extend the shorter one to the size of the
 // larger one.
-if (!SmallerValueMentioned && InputDomain != AD_Other &&
+if (!SmallerValueMentioned && !FPTiedToInt && InputDomain != AD_Other &&
 OutputConstraintInfos[TiedTo].allowsRegister()) {
+
   // FIXME: GCC supports the OutSize to be 128 at maximum. Currently 
codegen
   // crash when the size larger than the register size. So we limit it 
here.
   if (OutTy->isStructureType() &&
diff --git a/clang/test/Sema/asm.c b/clang/test/Sema/asm.c
index a9cff5947ef5d0..88f85bc3ed9720 100644
--- a/clang/test/Sema/asm.c
+++ b/clang/test/Sema/asm.c
@@ -365,3 +365,24 @@ void test19(long long x)
   // FIXME: This case should be supported by codegen, but it fails now.
   asm ("" : "=rm" (x): "0" (e)); // expected-error {{unsupported inline asm: 
input with type 'st_size128' (aka 'struct _st_size128') matching output with 
type 'long long'}}
 }
+
+typedef int int2 __attribute__((ext_vector_type(2)));
+
+// GH118892
+void test20(char x) {
+  double d;
+  float f;
+
+  asm ("fabs" : "=t" (d): "0" (x)); // expected-error {{unsupported inline 
asm: input with type 'char' matching output with type 'double'}}
+  asm ("fabs" : "=t" (x): "0" (d)); // expected-error {{unsupported inline 
asm: input with type 'double' matching output with type 'char'}}
+  asm ("fabs" : "=t" (f): "0" (d)); // no-error
+  asm ("fabs" : "=t" (d): "0" (f)); // no-error
+
+  st_size64 a;
+  asm ("fabs" : "=t" (d): "0" (a)); // expected-error {{unsupported inline 
asm: input with type 'st_size64' (aka 'struct _st_size64') matching output with 
type 'double'}}
+  asm ("fabs" : "=t" (a): "0" (d)); // expected-error {{unsupported inline 
asm: input with type 'double' matching output with type 'st_size64' (aka 
'struct _st_size64')}}
+
+  int2 v;
+  asm ("fabs" : "=t" (d): "0" (v)); // expected-error {{error: unsupported 
inline asm: input with type 'int2' (vector of 2 'int' values) matching output 
with type 'double'}}
+  asm ("fabs" : "=t" (v): "0" (d)); // expected-error {{unsupported inline 
asm: input with type 'double' matching output with type 'int2' (vector of 2 
'int' values)}}
+}

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] d7a8e09 - [clang-format] Add --strip-trailing-cr to diff in docs_updated.test (#119666)

2024-12-13 Thread via cfe-commits

Author: Owen Pan
Date: 2024-12-13T00:03:03-08:00
New Revision: d7a8e09893c43ad1169ff34989c3bec721d8b1a9

URL: 
https://github.com/llvm/llvm-project/commit/d7a8e09893c43ad1169ff34989c3bec721d8b1a9
DIFF: 
https://github.com/llvm/llvm-project/commit/d7a8e09893c43ad1169ff34989c3bec721d8b1a9.diff

LOG: [clang-format] Add --strip-trailing-cr to diff in docs_updated.test 
(#119666)

Fixes #119517.

Added: 


Modified: 
clang/test/Format/docs_updated.test

Removed: 




diff  --git a/clang/test/Format/docs_updated.test 
b/clang/test/Format/docs_updated.test
index 17066650a12677..98d330e37ef450 100644
--- a/clang/test/Format/docs_updated.test
+++ b/clang/test/Format/docs_updated.test
@@ -1,5 +1,6 @@
 // RUN: %python %S/../../docs/tools/dump_format_style.py -o %t.style
-// RUN: 
diff  %t.style %S/../../docs/ClangFormatStyleOptions.rst
+// RUN: 
diff  --strip-trailing-cr %t.style \
+// RUN:   %S/../../docs/ClangFormatStyleOptions.rst
 
 // RUN: %python %S/../../docs/tools/dump_format_help.py -o %t.help
-// RUN: 
diff  %t.help %S/../../docs/ClangFormat.rst
+// RUN: 
diff  --strip-trailing-cr %t.help %S/../../docs/ClangFormat.rst



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-format] Add --strip-trailing-cr to diff in docs_updated.test (PR #119666)

2024-12-13 Thread Owen Pan via cfe-commits

https://github.com/owenca closed 
https://github.com/llvm/llvm-project/pull/119666
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Clang][Parser] Add a warning to ambiguous uses of T...[N] types (PR #116332)

2024-12-13 Thread LLVM Continuous Integration via cfe-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `lldb-aarch64-ubuntu` 
running on `linaro-lldb-aarch64-ubuntu` while building `clang` at step 6 "test".

Full details are available at: 
https://lab.llvm.org/buildbot/#/builders/59/builds/9751


Here is the relevant piece of the build log for the reference

```
Step 6 (test) failure: build (failure)
...
PASS: lldb-unit :: Utility/./UtilityTests/4/8 (2050 of 2059)
PASS: lldb-unit :: ValueObject/./LLDBValueObjectTests/1/3 (2051 of 2059)
PASS: lldb-unit :: ValueObject/./LLDBValueObjectTests/2/3 (2052 of 2059)
PASS: lldb-unit :: Utility/./UtilityTests/1/8 (2053 of 2059)
PASS: lldb-unit :: tools/lldb-server/tests/./LLDBServerTests/1/2 (2054 of 2059)
PASS: lldb-unit :: tools/lldb-server/tests/./LLDBServerTests/0/2 (2055 of 2059)
PASS: lldb-unit :: Target/./TargetTests/11/14 (2056 of 2059)
PASS: lldb-unit :: Host/./HostTests/2/13 (2057 of 2059)
PASS: lldb-unit :: Process/gdb-remote/./ProcessGdbRemoteTests/8/9 (2058 of 2059)
UNRESOLVED: lldb-api :: tools/lldb-server/TestLldbGdbServer.py (2059 of 2059)
 TEST 'lldb-api :: tools/lldb-server/TestLldbGdbServer.py' 
FAILED 
Script:
--
/usr/bin/python3.10 
/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/dotest.py
 -u CXXFLAGS -u CFLAGS --env 
LLVM_LIBS_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./lib --env 
LLVM_INCLUDE_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/include 
--env LLVM_TOOLS_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin 
--arch aarch64 --build-dir 
/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex 
--lldb-module-cache-dir 
/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex/module-cache-lldb/lldb-api
 --clang-module-cache-dir 
/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex/module-cache-clang/lldb-api
 --executable /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/lldb 
--compiler /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/clang 
--dsymutil /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/dsymutil 
--make /usr/bin/make --llvm-tools-dir 
/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin --lldb-obj-root 
/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/tools/lldb --lldb-libs-dir 
/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./lib 
/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/tools/lldb-server
 -p TestLldbGdbServer.py
--
Exit Code: 1

Command Output (stdout):
--
lldb version 20.0.0git (https://github.com/llvm/llvm-project.git revision 
28c3bf5c6dad0974f9f15b58afd0935c0c6cb3e4)
  clang revision 28c3bf5c6dad0974f9f15b58afd0935c0c6cb3e4
  llvm revision 28c3bf5c6dad0974f9f15b58afd0935c0c6cb3e4
Skipping the following test categories: ['libc++', 'dsym', 'gmodules', 
'debugserver', 'objc']

--
Command Output (stderr):
--
UNSUPPORTED: LLDB 
(/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: 
test_Hc_then_Csignal_signals_correct_thread_launch_debugserver 
(TestLldbGdbServer.LldbGdbServerTestCase) (test case does not fall in any 
category of interest for this run) 
PASS: LLDB 
(/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: 
test_Hc_then_Csignal_signals_correct_thread_launch_llgs 
(TestLldbGdbServer.LldbGdbServerTestCase)
PASS: LLDB 
(/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: 
test_Hg_fails_on_another_pid_llgs (TestLldbGdbServer.LldbGdbServerTestCase)
PASS: LLDB 
(/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: 
test_Hg_fails_on_minus_one_pid_llgs (TestLldbGdbServer.LldbGdbServerTestCase)
PASS: LLDB 
(/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: 
test_Hg_fails_on_zero_pid_llgs (TestLldbGdbServer.LldbGdbServerTestCase)
UNSUPPORTED: LLDB 
(/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: 
test_Hg_switches_to_3_threads_launch_debugserver 
(TestLldbGdbServer.LldbGdbServerTestCase) (test case does not fall in any 
category of interest for this run) 
PASS: LLDB 
(/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: 
test_Hg_switches_to_3_threads_launch_llgs 
(TestLldbGdbServer.LldbGdbServerTestCase)
UNSUPPORTED: LLDB 
(/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: 
test_P_and_p_thread_suffix_work_debugserver 
(TestLldbGdbServer.LldbGdbServerTestCase) (test case does not fall in any 
category of interest for this run) 
PASS: LLDB 
(/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: 
test_P_and_p_thread_suffix_work_llgs (TestLldbGdbServer.LldbGdbServerTestCase)
UNSUPPORTED: LLDB 
(/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: 
test_P_writes_all_gpr_registers_debugserver 
(TestLldbGdbServer.LldbGdbServerTestCase) (test case does not fall in any 
category of interest for th

[libclc] 06789cc - [libclc] Optimize ceil/fabs/floor/rint/trunc (#119596)

2024-12-13 Thread via cfe-commits

Author: Fraser Cormack
Date: 2024-12-13T08:47:13Z
New Revision: 06789ccb1695214f787cd471a300522973d33375

URL: 
https://github.com/llvm/llvm-project/commit/06789ccb1695214f787cd471a300522973d33375
DIFF: 
https://github.com/llvm/llvm-project/commit/06789ccb1695214f787cd471a300522973d33375.diff

LOG: [libclc] Optimize ceil/fabs/floor/rint/trunc (#119596)

These functions all map to the corresponding LLVM intrinsics, but the
vector intrinsics weren't being generated. The intrinsic mapping from
CLC vector function to vector intrinsic was working correctly, but the
mapping from OpenCL builtin to CLC function was suboptimally recursively
splitting vectors in halves.

For example, with this change, `ceil(float16)` calls `llvm.ceil.v16f32`
directly once optimizations are applied.

Now also, instead of generating LLVM intrinsics through `__asm` we now
call clang elementwise builtins for each CLC builtin. This should be a
more standard way of achieving the same result

The CLC versions of each of these builtins are also now built and
enabled for SPIR-V targets. The LLVM -> SPIR-V translator maps the
intrinsics to the appropriate OpExtInst, so there should be no
difference in semantics, despite the newly introduced indirection from
OpenCL builtin through the CLC builtin to the intrinsic.

The AMDGPU targets make use of the same `_CLC_DEFINE_UNARY_BUILTIN`
macro to override `sqrt`, so those functions also appear more optimal
with this change, calling the vector `llvm.sqrt.vXf32` intrinsics
directly.

Added: 
libclc/clc/include/clc/math/unary_builtin.inc
libclc/clc/lib/generic/math/clc_ceil.cl
libclc/clc/lib/generic/math/clc_fabs.cl
libclc/clc/lib/generic/math/clc_floor.cl
libclc/clc/lib/generic/math/clc_rint.cl
libclc/clc/lib/generic/math/clc_trunc.cl

Modified: 
libclc/clc/include/clc/clcmacro.h
libclc/clc/include/clc/math/clc_ceil.h
libclc/clc/include/clc/math/clc_fabs.h
libclc/clc/include/clc/math/clc_floor.h
libclc/clc/include/clc/math/clc_rint.h
libclc/clc/include/clc/math/clc_trunc.h
libclc/clc/lib/clspv/SOURCES
libclc/clc/lib/generic/SOURCES
libclc/clc/lib/spirv/SOURCES
libclc/clc/lib/spirv64/SOURCES
libclc/generic/lib/math/ceil.cl
libclc/generic/lib/math/fabs.cl
libclc/generic/lib/math/floor.cl
libclc/generic/lib/math/rint.cl
libclc/generic/lib/math/round.cl
libclc/generic/lib/math/sqrt.cl
libclc/generic/lib/math/trunc.cl

Removed: 
libclc/clc/lib/clspv/dummy.cl
libclc/generic/lib/math/unary_builtin.inc



diff  --git a/libclc/clc/include/clc/clcmacro.h 
b/libclc/clc/include/clc/clcmacro.h
index 244239284ecabc..c6583749eca661 100644
--- a/libclc/clc/include/clc/clcmacro.h
+++ b/libclc/clc/include/clc/clcmacro.h
@@ -191,7 +191,21 @@
 
 #define _CLC_DEFINE_UNARY_BUILTIN(RET_TYPE, FUNCTION, BUILTIN, ARG1_TYPE)  
\
   _CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG1_TYPE x) { return BUILTIN(x); } 
\
-  _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, RET_TYPE, FUNCTION, ARG1_TYPE)
+  _CLC_DEF _CLC_OVERLOAD RET_TYPE##2 FUNCTION(ARG1_TYPE##2 x) {
\
+return BUILTIN(x); 
\
+  }
\
+  _CLC_DEF _CLC_OVERLOAD RET_TYPE##3 FUNCTION(ARG1_TYPE##3 x) {
\
+return BUILTIN(x); 
\
+  }
\
+  _CLC_DEF _CLC_OVERLOAD RET_TYPE##4 FUNCTION(ARG1_TYPE##4 x) {
\
+return BUILTIN(x); 
\
+  }
\
+  _CLC_DEF _CLC_OVERLOAD RET_TYPE##8 FUNCTION(ARG1_TYPE##8 x) {
\
+return BUILTIN(x); 
\
+  }
\
+  _CLC_DEF _CLC_OVERLOAD RET_TYPE##16 FUNCTION(ARG1_TYPE##16 x) {  
\
+return BUILTIN(x); 
\
+  }
 
 #ifdef cl_khr_fp16
 

diff  --git a/libclc/clc/include/clc/math/clc_ceil.h 
b/libclc/clc/include/clc/math/clc_ceil.h
index 66590687c34220..20adc6d81d863f 100644
--- a/libclc/clc/include/clc/math/clc_ceil.h
+++ b/libclc/clc/include/clc/math/clc_ceil.h
@@ -1,19 +1,12 @@
 #ifndef __CLC_MATH_CLC_CEIL_H__
 #define __CLC_MATH_CLC_CEIL_H__
 
-#if defined(CLC_CLSPV) || defined(CLC_SPIRV)
-// clspv and spir-v targets provide their own OpenCL-compatible ceil
-#define __clc_ceil ceil
-#else
-
-// Map the function to an LLVM intrinsic
+#define __CLC_BODY 
 #define __CLC_FUNCTION __clc_ceil
-#define __CLC_INTRINSIC "llvm.ceil"
-#include 
 
-#undef __CLC_INTRINSIC
-#undef __CLC_FUNCTION
+#include 
 
-#endif
+#undef __CLC_BODY
+#u

[libclc] [libclc] Optimize ceil/fabs/floor/rint/trunc (PR #119596)

2024-12-13 Thread Fraser Cormack via cfe-commits

https://github.com/frasercrmck closed 
https://github.com/llvm/llvm-project/pull/119596
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [BasicAA] Do not decompose past casts with different index width (PR #119365)

2024-12-13 Thread Nikita Popov via cfe-commits

https://github.com/nikic closed https://github.com/llvm/llvm-project/pull/119365
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] a30e50f - [BasicAA] Do not decompose past casts with different index width (#119365)

2024-12-13 Thread via cfe-commits

Author: Nikita Popov
Date: 2024-12-13T12:58:59+01:00
New Revision: a30e50fcb3119cc1f84f0398d229a929f296188d

URL: 
https://github.com/llvm/llvm-project/commit/a30e50fcb3119cc1f84f0398d229a929f296188d
DIFF: 
https://github.com/llvm/llvm-project/commit/a30e50fcb3119cc1f84f0398d229a929f296188d.diff

LOG: [BasicAA] Do not decompose past casts with different index width (#119365)

BasicAA currently tries to support addrspacecasts that change the index
width by performing the decomposition in the maximum of all index widths
and then trying to fix this up with in-place sign extends to get correct
overflow behavior if the actual index width is smaller.

However, even in the case where we don't mix different index widths and
just have an index width that is smaller than the maximum, the behavior
is incorrect (see test), because we only perform the index width
adjustment during decomposition and not any of the later logic -- and we
don't do anything at all for variable offsets. I'm sure that the case
where we actually mix different index widths is even more broken than
that.

Fix this by not allowing decomposition through index width changes. If
the pointers have different index widths, fall back to a base object
comparison, ignoring the offsets.

Added: 


Modified: 
clang/test/CodeGen/SystemZ/zos-mixed-ptr-sizes-malloc.c
llvm/lib/Analysis/BasicAliasAnalysis.cpp
llvm/test/Analysis/BasicAA/smaller-index-size-overflow.ll

Removed: 




diff  --git a/clang/test/CodeGen/SystemZ/zos-mixed-ptr-sizes-malloc.c 
b/clang/test/CodeGen/SystemZ/zos-mixed-ptr-sizes-malloc.c
index 1b05e8aa5052af..c0ca3dab512584 100644
--- a/clang/test/CodeGen/SystemZ/zos-mixed-ptr-sizes-malloc.c
+++ b/clang/test/CodeGen/SystemZ/zos-mixed-ptr-sizes-malloc.c
@@ -4,7 +4,7 @@ void *__malloc31(size_t);
 
 int test_1() {
   // X64-LABEL: define {{.*}} i32 @test_1()
-  // X64: ret i32 135
+  // X64: ret i32 %add20
   int *__ptr32 a;
   int *b;
   int i;

diff  --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp 
b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
index dc54d566e55b12..b2a3f3390e000d 100644
--- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp
+++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
@@ -494,20 +494,6 @@ static LinearExpression GetLinearExpression(
   return Val;
 }
 
-/// To ensure a pointer offset fits in an integer of size IndexSize
-/// (in bits) when that size is smaller than the maximum index size. This is
-/// an issue, for example, in particular for 32b pointers with negative indices
-/// that rely on two's complement wrap-arounds for precise alias information
-/// where the maximum index size is 64b.
-static void adjustToIndexSize(APInt &Offset, unsigned IndexSize) {
-  assert(IndexSize <= Offset.getBitWidth() && "Invalid IndexSize!");
-  unsigned ShiftBits = Offset.getBitWidth() - IndexSize;
-  if (ShiftBits != 0) {
-Offset <<= ShiftBits;
-Offset.ashrInPlace(ShiftBits);
-  }
-}
-
 namespace {
 // A linear transformation of a Value; this class represents
 // ZExt(SExt(Trunc(V, TruncBits), SExtBits), ZExtBits) * Scale.
@@ -594,9 +580,9 @@ BasicAAResult::DecomposeGEPExpression(const Value *V, const 
DataLayout &DL,
   SearchTimes++;
   const Instruction *CxtI = dyn_cast(V);
 
-  unsigned MaxIndexSize = DL.getMaxIndexSizeInBits();
+  unsigned IndexSize = DL.getIndexTypeSizeInBits(V->getType());
   DecomposedGEP Decomposed;
-  Decomposed.Offset = APInt(MaxIndexSize, 0);
+  Decomposed.Offset = APInt(IndexSize, 0);
   do {
 // See if this is a bitcast or GEP.
 const Operator *Op = dyn_cast(V);
@@ -614,7 +600,14 @@ BasicAAResult::DecomposeGEPExpression(const Value *V, 
const DataLayout &DL,
 
 if (Op->getOpcode() == Instruction::BitCast ||
 Op->getOpcode() == Instruction::AddrSpaceCast) {
-  V = Op->getOperand(0);
+  Value *NewV = Op->getOperand(0);
+  // Don't look through casts between address spaces with 
diff ering index
+  // widths.
+  if (DL.getIndexTypeSizeInBits(NewV->getType()) != IndexSize) {
+Decomposed.Base = V;
+return Decomposed;
+  }
+  V = NewV;
   continue;
 }
 
@@ -651,12 +644,8 @@ BasicAAResult::DecomposeGEPExpression(const Value *V, 
const DataLayout &DL,
 
 assert(GEPOp->getSourceElementType()->isSized() && "GEP must be sized");
 
-unsigned AS = GEPOp->getPointerAddressSpace();
 // Walk the indices of the GEP, accumulating them into BaseOff/VarIndices.
 gep_type_iterator GTI = gep_type_begin(GEPOp);
-unsigned IndexSize = DL.getIndexSizeInBits(AS);
-// Assume all GEP operands are constants until proven otherwise.
-bool GepHasConstantOffset = true;
 for (User::const_op_iterator I = GEPOp->op_begin() + 1, E = 
GEPOp->op_end();
  I != E; ++I, ++GTI) {
   const Value *Index = *I;
@@ -684,7 +673,7 @@ BasicAAResult::DecomposeGEPExpression(const Value *V, const 
DataLayout &DL,
 }
 
 Decomposed.Off

[clang] [llvm] [BasicAA] Do not decompose past casts with different index width (PR #119365)

2024-12-13 Thread Nikita Popov via cfe-commits


@@ -594,9 +580,9 @@ BasicAAResult::DecomposeGEPExpression(const Value *V, const 
DataLayout &DL,
   SearchTimes++;
   const Instruction *CxtI = dyn_cast(V);
 
-  unsigned MaxIndexSize = DL.getMaxIndexSizeInBits();

nikic wrote:

Dropped the API in 
https://github.com/llvm/llvm-project/commit/07aab4a3cdab3d46caab270845413c5ba4546b50.

https://github.com/llvm/llvm-project/pull/119365
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [AArch64] Implement intrinsics for FP8 SME FMLAL/FMLALL (multi) (PR #119546)

2024-12-13 Thread Jonathan Thackray via cfe-commits


@@ -827,11 +827,21 @@ let SMETargetGuard = "sme-lutv2" in {
 let SMETargetGuard = "sme-f8f32" in {
   def SVMOPA_FP8_ZA32 : Inst<"svmopa_za32[_mf8]_m_fpm", "viPPdd>", "m", 
MergeNone, "aarch64_sme_fp8_fmopa_za32",
  [IsStreaming, IsInOutZA, SetsFPMR, 
IsOverloadNone], [ImmCheck<0, ImmCheck0_3>]>;
+  // FMLALL (mutliple)

jthackray wrote:

```suggestion
  // FMLALL (multiple)
```

https://github.com/llvm/llvm-project/pull/119546
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [AArch64] Implement intrinsics for FP8 SME FMLAL/FMLALL (multi) (PR #119546)

2024-12-13 Thread Jonathan Thackray via cfe-commits

https://github.com/jthackray approved this pull request.

LGTM

https://github.com/llvm/llvm-project/pull/119546
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [AArch64] Implement intrinsics for FP8 SME FMLAL/FMLALL (multi) (PR #119546)

2024-12-13 Thread Jonathan Thackray via cfe-commits


@@ -827,11 +827,21 @@ let SMETargetGuard = "sme-lutv2" in {
 let SMETargetGuard = "sme-f8f32" in {
   def SVMOPA_FP8_ZA32 : Inst<"svmopa_za32[_mf8]_m_fpm", "viPPdd>", "m", 
MergeNone, "aarch64_sme_fp8_fmopa_za32",
  [IsStreaming, IsInOutZA, SetsFPMR, 
IsOverloadNone], [ImmCheck<0, ImmCheck0_3>]>;
+  // FMLALL (mutliple)
+  def SVMLA_FP8_MULTI_ZA32_VG4x2 : Inst<"svmla_za32[_mf8]_vg4x2_fpm", "vm22>", 
"m", MergeNone, "aarch64_sme_fp8_fmlall_multi_za32_vg4x2",
+[IsStreaming, IsInOutZA, SetsFPMR, 
IsOverloadNone], []>;
+  def SVMLA_FP8_MULTI_ZA32_VG4x4 : Inst<"svmla_za32[_mf8]_vg4x4_fpm", "vm44>", 
"m", MergeNone, "aarch64_sme_fp8_fmlall_multi_za32_vg4x4",
+[IsStreaming, IsInOutZA, SetsFPMR, 
IsOverloadNone], []>;
 }
 
 let SMETargetGuard = "sme-f8f16" in {
   def SVMOPA_FP8_ZA16 : Inst<"svmopa_za16[_mf8]_m_fpm", "viPPdd>", "m", 
MergeNone, "aarch64_sme_fp8_fmopa_za16",
  [IsStreaming, IsInOutZA, SetsFPMR, 
IsOverloadNone], [ImmCheck<0, ImmCheck0_1>]>;
+  // FMLAL (mutliple)

jthackray wrote:

```suggestion
  // FMLAL (multiple)
```

https://github.com/llvm/llvm-project/pull/119546
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [AArch64] Implement intrinsics for FMLAL/FMLALL (single) (PR #119568)

2024-12-13 Thread via cfe-commits

https://github.com/Lukacma deleted 
https://github.com/llvm/llvm-project/pull/119568
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [TargetLibraryInfo] Add libmvec support for risc-v (PR #119844)

2024-12-13 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-llvm-ir

Author: Zhijin Zeng (zengdage)


Changes

1. Rename LIBMVEC_X86 into LIBMVEC to support libmvec (glibc vector match 
library) in risc-v.
2. Add RVVM1/2/4/8 in VFISAKind to distingusih the LMUL value, so we can take 
full advantage of  risc-v vector extension.
3. Declare some RVV vector math functions in VecFuncs.def.

In VecFuncs.def, I add the LI_DEFINE_VECFUNC of LIBMVEC_RVV as follow:

```
TLI_DEFINE_VECFUNC("sin", "_ZGV1Nxv_sin", SCALABLE(1), "_ZGVr1Nxv")
TLI_DEFINE_VECFUNC("sin", "_ZGV2Nxv_sin", SCALABLE(2), "_ZGVr2Nxv")
TLI_DEFINE_VECFUNC("llvm.exp.f32", "_ZGV1Nxv_expf", SCALABLE(2), 
"_ZGVr1Nxv")
TLI_DEFINE_VECFUNC("llvm.exp.f32", "_ZGV2Nxv_expf", SCALABLE(4), 
"_ZGVr2Nxv")
```

The `VEC` of TLI_DEFINE_VECFUNC (e.g., `_ZGV2Nxv_sin`), its name mangling rules 
defined in https://github.com/riscv-non-isa/riscv-elf-psabi-doc/pull/455 . Now 
it's  still under review.

The` VF` (e.g., ` SCALABLE(2)`) should be `vscale x (LMUL * 64 / sizeof(Type)`. 
For example, the type of the parameter of sin is double, so for `_ZGV2Nxv_sin`, 
its VF is `vscale x 2`.

In the `VABI_PREFIX`  (e.g., `_ZGVr1Nxv`), `r` means RISC-V vector extension, 
`1` is LMUL value.
```
_ZGVr1Nxv  --> RISC-V Vector Extension with LMUL=1
_ZGVr2Nxv  --> RISC-V Vector Extension with LMUL=2
_ZGVr4Nxv  --> RISC-V Vector Extension with LMUL=4
_ZGVr8Nxv  --> RISC-V Vector Extension with LMUL=8

```


---

Patch is 57.62 KiB, truncated to 20.00 KiB below, full version: 
https://github.com/llvm/llvm-project/pull/119844.diff


17 Files Affected:

- (modified) clang/lib/Driver/ToolChains/Clang.cpp (+4-2) 
- (modified) clang/lib/Driver/ToolChains/CommonArgs.cpp (+1-1) 
- (modified) clang/lib/Driver/ToolChains/Flang.cpp (+4-2) 
- (modified) clang/test/Driver/fveclib.c (+7-3) 
- (modified) llvm/include/llvm/Analysis/TargetLibraryInfo.h (+1-1) 
- (modified) llvm/include/llvm/Analysis/VecFuncs.def (+73) 
- (modified) llvm/include/llvm/IR/VFABIDemangler.h (+4) 
- (modified) llvm/lib/Analysis/TargetLibraryInfo.cpp (+20-3) 
- (modified) llvm/lib/Frontend/Driver/CodeGenOptions.cpp (+1-1) 
- (modified) llvm/lib/IR/VFABIDemangler.cpp (+57-12) 
- (modified) llvm/lib/Transforms/Utils/InjectTLIMappings.cpp (+2-2) 
- (modified) llvm/test/CodeGen/Generic/replace-intrinsics-with-veclib.ll (+9-9) 
- (added) llvm/test/Transforms/LoopVectorize/RISCV/libm-vector-calls.ll (+493) 
- (modified) 
llvm/test/Transforms/LoopVectorize/X86/libm-vector-calls-VF2-VF8.ll (+1-1) 
- (modified) llvm/test/Transforms/LoopVectorize/X86/libm-vector-calls-finite.ll 
(+1-1) 
- (modified) llvm/test/Transforms/LoopVectorize/X86/libm-vector-calls.ll (+1-1) 
- (modified) llvm/test/Transforms/Util/add-TLI-mappings.ll (+12-12) 


``diff
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index a020e00cd17392..1fdc1c66e9750e 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -5805,9 +5805,11 @@ void Clang::ConstructJob(Compilation &C, const JobAction 
&JA,
   Triple.getArch() != llvm::Triple::x86_64)
 D.Diag(diag::err_drv_unsupported_opt_for_target)
 << Name << Triple.getArchName();
-} else if (Name == "LIBMVEC-X86") {
+} else if (Name == "LIBMVEC") {
   if (Triple.getArch() != llvm::Triple::x86 &&
-  Triple.getArch() != llvm::Triple::x86_64)
+  Triple.getArch() != llvm::Triple::x86_64 &&
+  Triple.getArch() != llvm::Triple::riscv32 &&
+  Triple.getArch() != llvm::Triple::riscv64)
 D.Diag(diag::err_drv_unsupported_opt_for_target)
 << Name << Triple.getArchName();
 } else if (Name == "SLEEF" || Name == "ArmPL") {
diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp 
b/clang/lib/Driver/ToolChains/CommonArgs.cpp
index 0d851314a89539..2a4c298cfdeafb 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -909,7 +909,7 @@ void tools::addLTOOptions(const ToolChain &ToolChain, const 
ArgList &Args,
 std::optional OptVal =
 llvm::StringSwitch>(ArgVecLib->getValue())
 .Case("Accelerate", "Accelerate")
-.Case("LIBMVEC", "LIBMVEC-X86")
+.Case("LIBMVEC", "LIBMVEC")
 .Case("MASSV", "MASSV")
 .Case("SVML", "SVML")
 .Case("SLEEF", "sleefgnuabi")
diff --git a/clang/lib/Driver/ToolChains/Flang.cpp 
b/clang/lib/Driver/ToolChains/Flang.cpp
index c98fdbd157bac8..5d630d6edf 100644
--- a/clang/lib/Driver/ToolChains/Flang.cpp
+++ b/clang/lib/Driver/ToolChains/Flang.cpp
@@ -446,9 +446,11 @@ void Flang::addTargetOptions(const ArgList &Args,
   Triple.getArch() != llvm::Triple::x86_64)
 D.Diag(diag::err_drv_unsupported_opt_for_target)
 << Name << Triple.getArchName();
-} else if (Name == "LIBMVEC-X86") {
+} else if (Name == "LIBMVEC") {
   if (Triple.getArch() != llvm::Triple:

[clang] [llvm] [TargetLibraryInfo] Add libmvec support for risc-v (PR #119844)

2024-12-13 Thread via cfe-commits

llvmbot wrote:



@llvm/pr-subscribers-llvm-transforms

@llvm/pr-subscribers-clang-driver

Author: Zhijin Zeng (zengdage)


Changes

1. Rename LIBMVEC_X86 into LIBMVEC to support libmvec (glibc vector match 
library) in risc-v.
2. Add RVVM1/2/4/8 in VFISAKind to distingusih the LMUL value, so we can take 
full advantage of  risc-v vector extension.
3. Declare some RVV vector math functions in VecFuncs.def.

In VecFuncs.def, I add the LI_DEFINE_VECFUNC of LIBMVEC_RVV as follow:

```
TLI_DEFINE_VECFUNC("sin", "_ZGV1Nxv_sin", SCALABLE(1), "_ZGVr1Nxv")
TLI_DEFINE_VECFUNC("sin", "_ZGV2Nxv_sin", SCALABLE(2), "_ZGVr2Nxv")
TLI_DEFINE_VECFUNC("llvm.exp.f32", "_ZGV1Nxv_expf", SCALABLE(2), 
"_ZGVr1Nxv")
TLI_DEFINE_VECFUNC("llvm.exp.f32", "_ZGV2Nxv_expf", SCALABLE(4), 
"_ZGVr2Nxv")
```

The `VEC` of TLI_DEFINE_VECFUNC (e.g., `_ZGV2Nxv_sin`), its name mangling rules 
defined in https://github.com/riscv-non-isa/riscv-elf-psabi-doc/pull/455 . Now 
it's  still under review.

The` VF` (e.g., ` SCALABLE(2)`) should be `vscale x (LMUL * 64 / sizeof(Type)`. 
For example, the type of the parameter of sin is double, so for `_ZGV2Nxv_sin`, 
its VF is `vscale x 2`.

In the `VABI_PREFIX`  (e.g., `_ZGVr1Nxv`), `r` means RISC-V vector extension, 
`1` is LMUL value.
```
_ZGVr1Nxv  --> RISC-V Vector Extension with LMUL=1
_ZGVr2Nxv  --> RISC-V Vector Extension with LMUL=2
_ZGVr4Nxv  --> RISC-V Vector Extension with LMUL=4
_ZGVr8Nxv  --> RISC-V Vector Extension with LMUL=8

```


---

Patch is 57.62 KiB, truncated to 20.00 KiB below, full version: 
https://github.com/llvm/llvm-project/pull/119844.diff


17 Files Affected:

- (modified) clang/lib/Driver/ToolChains/Clang.cpp (+4-2) 
- (modified) clang/lib/Driver/ToolChains/CommonArgs.cpp (+1-1) 
- (modified) clang/lib/Driver/ToolChains/Flang.cpp (+4-2) 
- (modified) clang/test/Driver/fveclib.c (+7-3) 
- (modified) llvm/include/llvm/Analysis/TargetLibraryInfo.h (+1-1) 
- (modified) llvm/include/llvm/Analysis/VecFuncs.def (+73) 
- (modified) llvm/include/llvm/IR/VFABIDemangler.h (+4) 
- (modified) llvm/lib/Analysis/TargetLibraryInfo.cpp (+20-3) 
- (modified) llvm/lib/Frontend/Driver/CodeGenOptions.cpp (+1-1) 
- (modified) llvm/lib/IR/VFABIDemangler.cpp (+57-12) 
- (modified) llvm/lib/Transforms/Utils/InjectTLIMappings.cpp (+2-2) 
- (modified) llvm/test/CodeGen/Generic/replace-intrinsics-with-veclib.ll (+9-9) 
- (added) llvm/test/Transforms/LoopVectorize/RISCV/libm-vector-calls.ll (+493) 
- (modified) 
llvm/test/Transforms/LoopVectorize/X86/libm-vector-calls-VF2-VF8.ll (+1-1) 
- (modified) llvm/test/Transforms/LoopVectorize/X86/libm-vector-calls-finite.ll 
(+1-1) 
- (modified) llvm/test/Transforms/LoopVectorize/X86/libm-vector-calls.ll (+1-1) 
- (modified) llvm/test/Transforms/Util/add-TLI-mappings.ll (+12-12) 


``diff
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index a020e00cd17392..1fdc1c66e9750e 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -5805,9 +5805,11 @@ void Clang::ConstructJob(Compilation &C, const JobAction 
&JA,
   Triple.getArch() != llvm::Triple::x86_64)
 D.Diag(diag::err_drv_unsupported_opt_for_target)
 << Name << Triple.getArchName();
-} else if (Name == "LIBMVEC-X86") {
+} else if (Name == "LIBMVEC") {
   if (Triple.getArch() != llvm::Triple::x86 &&
-  Triple.getArch() != llvm::Triple::x86_64)
+  Triple.getArch() != llvm::Triple::x86_64 &&
+  Triple.getArch() != llvm::Triple::riscv32 &&
+  Triple.getArch() != llvm::Triple::riscv64)
 D.Diag(diag::err_drv_unsupported_opt_for_target)
 << Name << Triple.getArchName();
 } else if (Name == "SLEEF" || Name == "ArmPL") {
diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp 
b/clang/lib/Driver/ToolChains/CommonArgs.cpp
index 0d851314a89539..2a4c298cfdeafb 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -909,7 +909,7 @@ void tools::addLTOOptions(const ToolChain &ToolChain, const 
ArgList &Args,
 std::optional OptVal =
 llvm::StringSwitch>(ArgVecLib->getValue())
 .Case("Accelerate", "Accelerate")
-.Case("LIBMVEC", "LIBMVEC-X86")
+.Case("LIBMVEC", "LIBMVEC")
 .Case("MASSV", "MASSV")
 .Case("SVML", "SVML")
 .Case("SLEEF", "sleefgnuabi")
diff --git a/clang/lib/Driver/ToolChains/Flang.cpp 
b/clang/lib/Driver/ToolChains/Flang.cpp
index c98fdbd157bac8..5d630d6edf 100644
--- a/clang/lib/Driver/ToolChains/Flang.cpp
+++ b/clang/lib/Driver/ToolChains/Flang.cpp
@@ -446,9 +446,11 @@ void Flang::addTargetOptions(const ArgList &Args,
   Triple.getArch() != llvm::Triple::x86_64)
 D.Diag(diag::err_drv_unsupported_opt_for_target)
 << Name << Triple.getArchName();
-} else if (Name == "LIBMVEC-X86") {
+} else if (Name == "LIBMVEC") {
  

[clang] [llvm] [AArch64] Implement intrinsics for FMLAL/FMLALL (single) (PR #119568)

2024-12-13 Thread via cfe-commits


@@ -564,50 +564,50 @@ defm SMLALL_MZZI_BtoS  : 
sme2_mla_ll_array_index_32b<"smlall", 0b00, 0b000,
 defm SMLALL_VG2_M2ZZI_BtoS : sme2_mla_ll_array_vg2_index_32b<"smlall", 0b00, 
0b000, int_aarch64_sme_smla_za32_lane_vg4x2>;
 defm SMLALL_VG4_M4ZZI_BtoS : sme2_mla_ll_array_vg4_index_32b<"smlall", 0b00, 
0b, int_aarch64_sme_smla_za32_lane_vg4x4>;
 defm SMLALL_MZZ_BtoS   : sme2_mla_ll_array_single<"smlall", 0b0, 
MatrixOp32, ZPR8, ZPR4b8, nxv16i8, int_aarch64_sme_smla_za32_single_vg4x1>;
-defm SMLALL_VG2_M2ZZ_BtoS  : sme2_mla_ll_array_vg2_single<"smlall", 0b0, 
MatrixOp32, ZZ_b, ZPR4b8, nxv16i8, int_aarch64_sme_smla_za32_single_vg4x2>;
-defm SMLALL_VG4_M4ZZ_BtoS  : sme2_mla_ll_array_vg4_single<"smlall", 0b01000, 
MatrixOp32, _b, ZPR4b8, nxv16i8, int_aarch64_sme_smla_za32_single_vg4x4>;
+defm SMLALL_VG2_M2ZZ_BtoS  : sme2_mla_ll_array_vg2_single<"smlall", 0b00, 
MatrixOp32, ZZ_b, ZPR4b8, nxv16i8, int_aarch64_sme_smla_za32_single_vg4x2>;

Lukacma wrote:

I think it is fine as is.

https://github.com/llvm/llvm-project/pull/119568
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [AArch64] Implement intrinsics for FMLAL/FMLALL (single) (PR #119568)

2024-12-13 Thread via cfe-commits


@@ -2180,10 +2191,11 @@ multiclass sme2_int_mla_long_array_vg2_single op, SDPat
 
 multiclass sme2_fp_mla_long_array_vg4_single op, 
MatrixOperand matrix_ty,
  RegisterOperand multi_vector_ty, 
ZPRRegOp vector_ty,
- ValueType zpr_ty, 
SDPatternOperator intrinsic> {
+ ValueType zpr_ty, 
SDPatternOperator intrinsic, list uses=[]> {

Lukacma wrote:

Instead of adding uses as extra argument, I think it would be better to use:
`let Uses = [FPMR, FPCR] in {
...intrinsics
}`

https://github.com/llvm/llvm-project/pull/119568
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [AArch64] Implement intrinsics for FMLAL/FMLALL (single) (PR #119568)

2024-12-13 Thread via cfe-commits


@@ -3888,6 +3888,24 @@ let TargetPrefix = "aarch64" in {
   llvm_nxv16i1_ty, llvm_nxv16i1_ty,
   llvm_nxv16i8_ty, llvm_nxv16i8_ty],
   [ImmArg>, IntrInaccessibleMemOnly, IntrHasSideEffects]>;
+
+  class SME_FP8_ZA_SINGLE_VGx1_Intrinsic
+: DefaultAttrsIntrinsic<[], [llvm_i32_ty,
+llvm_nxv16i8_ty,
+llvm_nxv16i8_ty],
+[IntrInaccessibleMemOnly, IntrHasSideEffects]>;
+
+  class SME_FP8_ZA_SINGLE_VGx2_Intrinsic
+: DefaultAttrsIntrinsic<[], [llvm_i32_ty,
+llvm_nxv16i8_ty, llvm_nxv16i8_ty,
+llvm_nxv16i8_ty],
+[IntrInaccessibleMemOnly, IntrHasSideEffects]>;
+
+  class SME_FP8_ZA_SINGLE_VGx4_Intrinsic
+: DefaultAttrsIntrinsic<[], [llvm_i32_ty,
+llvm_nxv16i8_ty, llvm_nxv16i8_ty, 
llvm_nxv16i8_ty, llvm_nxv16i8_ty,
+llvm_nxv16i8_ty],
+[IntrInaccessibleMemOnly, IntrHasSideEffects]>;

Lukacma wrote:

Could you explain whhy are new intrinsics defined with side effects?

https://github.com/llvm/llvm-project/pull/119568
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 1fd3d1d - [AArch64] Add intrinsics for SME FP8 FDOT LANE instructions (#118492)

2024-12-13 Thread via cfe-commits

Author: Jonathan Thackray
Date: 2024-12-13T09:09:36Z
New Revision: 1fd3d1d04e6339fff7ef5b8b172ed4954885dde1

URL: 
https://github.com/llvm/llvm-project/commit/1fd3d1d04e6339fff7ef5b8b172ed4954885dde1
DIFF: 
https://github.com/llvm/llvm-project/commit/1fd3d1d04e6339fff7ef5b8b172ed4954885dde1.diff

LOG: [AArch64] Add intrinsics for SME FP8 FDOT LANE instructions (#118492)

Add support for the following SME 8 bit floating-point dot-product
intrinsics:
* void svdot_lane_za16_mf8_vg1x2_fpm(uint32_t slice, svmfloat8x2_t zn,
svmfloat8_t zm, uint64_t imm_idx, fpm_t fpm);
* void svdot_lane_za16_mf8_vg1x4_fpm(uint32_t slice, svmfloat8x4_t zn,
svmfloat8_t zm, uint64_t imm_idx, fpm_t fpm);
* void svdot_lane_za32_mf8_vg1x2_fpm(uint32_t slice, svmfloat8x2_t zn,
svmfloat8_t zm, uint64_t imm_idx, fpm_t fpm);
* void svdot_lane_za32_mf8_vg1x4_fpm(uint32_t slice, svmfloat8x4_t zn,
svmfloat8_t zm, uint64_t imm_idx, fpm_t fpm);

-

Co-authored-by: Momchil Velikov 
Co-authored-by: Marian Lukac 
Co-authored-by: Caroline Concatto 
Co-authored-by: SpencerAbson 

Added: 
clang/test/CodeGen/AArch64/sme2-intrinsics/acle_sme2_fp8_fdot.c
clang/test/Sema/aarch64-sme2-intrinsics/acle_sme2_fp8_fdot.c
llvm/test/CodeGen/AArch64/sme2-intrinsics-fp8-fdot.ll

Modified: 
clang/include/clang/Basic/arm_sme.td
clang/include/clang/Basic/arm_sve_sme_incl.td
llvm/include/llvm/IR/IntrinsicsAArch64.td
llvm/lib/Target/AArch64/AArch64SMEInstrInfo.td
llvm/lib/Target/AArch64/SMEInstrFormats.td

Removed: 




diff  --git a/clang/include/clang/Basic/arm_sme.td 
b/clang/include/clang/Basic/arm_sme.td
index 71b2c7cdd04f93..0fae70866cd55e 100644
--- a/clang/include/clang/Basic/arm_sme.td
+++ b/clang/include/clang/Basic/arm_sme.td
@@ -740,6 +740,21 @@ let SMETargetGuard = "sme2" in {
   def SVLUTI4_LANE_ZT_X2 : Inst<"svluti4_lane_zt_{d}_x2", "2.di[i", 
"cUcsUsiUibhf", MergeNone, "aarch64_sme_luti4_lane_zt_x2", [IsStreaming, 
IsInZT0], [ImmCheck<0, ImmCheck0_0>, ImmCheck<2, ImmCheck0_3>]>;
 }
 
+//
+// SME2 FP8 instructions
+//
+
+// FDOT
+let SMETargetGuard = "sme-f8f32" in {
+  def SVDOT_LANE_FP8_ZA32_VG1x2 : Inst<"svdot_lane_za32[_mf8]_vg1x2_fpm", 
"vm2di>", "m", MergeNone, "aarch64_sme_fp8_fdot_lane_za32_vg1x2", [IsStreaming, 
IsInOutZA, SetsFPMR, IsOverloadNone], [ImmCheck<3, ImmCheck0_3>]>;
+  def SVDOT_LANE_FP8_ZA32_VG1x4 : Inst<"svdot_lane_za32[_mf8]_vg1x4_fpm", 
"vm4di>", "m", MergeNone, "aarch64_sme_fp8_fdot_lane_za32_vg1x4", [IsStreaming, 
IsInOutZA, SetsFPMR, IsOverloadNone], [ImmCheck<3, ImmCheck0_3>]>;
+}
+
+let SMETargetGuard = "sme-f8f16" in {
+  def SVDOT_LANE_FP8_ZA16_VG1x2 : Inst<"svdot_lane_za16[_mf8]_vg1x2_fpm", 
"vm2di>", "m", MergeNone, "aarch64_sme_fp8_fdot_lane_za16_vg1x2", [IsStreaming, 
IsInOutZA, SetsFPMR, IsOverloadNone], [ImmCheck<3, ImmCheck0_7>]>;
+  def SVDOT_LANE_FP8_ZA16_VG1x4 : Inst<"svdot_lane_za16[_mf8]_vg1x4_fpm", 
"vm4di>", "m", MergeNone, "aarch64_sme_fp8_fdot_lane_za16_vg1x4", [IsStreaming, 
IsInOutZA, SetsFPMR, IsOverloadNone], [ImmCheck<3, ImmCheck0_7>]>;
+}
+
 

 // SME2p1 - FMOPA, FMOPS (non-widening)
 let SMETargetGuard = "sme-b16b16" in {

diff  --git a/clang/include/clang/Basic/arm_sve_sme_incl.td 
b/clang/include/clang/Basic/arm_sve_sme_incl.td
index de10be7bdce0db..e7cc40db7dca6c 100644
--- a/clang/include/clang/Basic/arm_sve_sme_incl.td
+++ b/clang/include/clang/Basic/arm_sve_sme_incl.td
@@ -52,6 +52,7 @@ include "arm_immcheck_incl.td"
 // h: half-float
 // d: double
 // b: bfloat
+// m: mfloat8
 
 // Typespec modifiers
 // --

diff  --git a/clang/test/CodeGen/AArch64/sme2-intrinsics/acle_sme2_fp8_fdot.c 
b/clang/test/CodeGen/AArch64/sme2-intrinsics/acle_sme2_fp8_fdot.c
new file mode 100644
index 00..74d18c32d5b3ab
--- /dev/null
+++ b/clang/test/CodeGen/AArch64/sme2-intrinsics/acle_sme2_fp8_fdot.c
@@ -0,0 +1,96 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py 
UTC_ARGS: --version 5
+// REQUIRES: aarch64-registered-target
+#include 
+
+// RUN: %clang_cc1 -triple aarch64 -target-feature +sme -target-feature +sme2 
-target-feature +sme-f8f16 -target-feature +sme-f8f32 -disable-O0-optnone 
-Werror -Wall -emit-llvm -o - %s | opt -S -passes 
mem2reg,instcombine,tailcallelim | FileCheck %s
+// RUN: %clang_cc1 -triple aarch64 -target-feature +sme -target-feature +sme2 
-target-feature +sme-f8f16 -target-feature +sme-f8f32 -disable-O0-optnone 
-Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -passes 
mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK
+// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64 -target-feature +sme 
-target-feature +sme2 -target-feature +sme-f8f16 -target-feature +sme-f8f32 
-disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -passes 
mem2reg,instcombine,tailcallelim | FileCheck %s
+// RUN: %clang_c

[clang] [llvm] [AArch64] Implement FP8 SVE intrinsics for fused multiply-add (PR #118126)

2024-12-13 Thread Momchil Velikov via cfe-commits


@@ -0,0 +1,114 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 
UTC_ARGS: --version 5
+; RUN: llc -mattr=+sve2,+fp8,+fp8fma  < %s | FileCheck %s
+; RUN: llc -mattr=+sme,+fp8,+ssve-fp8fma --force-streaming < %s | FileCheck %s
+
+target triple = "aarch64-linux"
+
+define  @fmla_2way_bot( %a,  %s1,  %s2) {
+; CHECK-LABEL: fmla_2way_bot:
+; CHECK:   // %bb.0:
+; CHECK-NEXT:fmlalb z0.h, z1.b, z2.b
+; CHECK-NEXT:ret
+%r = call  @llvm.aarch64.sve.fp8.fmlalb.nxv8f16( %a,  %s1,  %s2)
+ret  %r
+}
+
+define  @fmla_2way_top( %a,  %s1,  %s2) {
+; CHECK-LABEL: fmla_2way_top:
+; CHECK:   // %bb.0:
+; CHECK-NEXT:fmlalt z0.h, z1.b, z2.b
+; CHECK-NEXT:ret
+%r = call  @llvm.aarch64.sve.fp8.fmlalt.nxv8f16( %a,  %s1,  %s2)
+ret  %r
+}
+
+define  @fdot_2way_bot_lane( %a,  %s1,  %s2) {
+; CHECK-LABEL: fdot_2way_bot_lane:
+; CHECK:   // %bb.0:
+; CHECK-NEXT:fmlalb z0.h, z1.b, z2.b[3]
+; CHECK-NEXT:ret
+%r = call  
@llvm.aarch64.sve.fp8.fmlalb.lane.nxv8f16( %a,  %s1,  %s2, i32 3)
+ret  %r
+}
+
+define  @fdot_2way_top_lane( %a,  %s1,  %s2) {

momchil-velikov wrote:

Done

https://github.com/llvm/llvm-project/pull/118126
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy][doc][NFC] extract common global options in doc (PR #119842)

2024-12-13 Thread Congcong Cai via cfe-commits

https://github.com/HerrCai0907 created 
https://github.com/llvm/llvm-project/pull/119842

None

>From efe9cd9e78988a531dfbb6387691819ec5c18ac3 Mon Sep 17 00:00:00 2001
From: Congcong Cai 
Date: Thu, 12 Dec 2024 00:30:25 +0800
Subject: [PATCH] [clang-tidy][doc][NFC] extract common global options in doc

---
 .../docs/clang-tidy/GlobalOptions.rst | 21 +++
 .../checks/abseil/string-find-startswith.rst  |  3 +--
 .../abseil/string-find-str-contains.rst   |  3 +--
 .../clang-tidy/checks/boost/use-ranges.rst|  3 +--
 .../cppcoreguidelines/avoid-do-while.rst  |  3 ++-
 .../cppcoreguidelines/init-variables.rst  |  3 +--
 .../pro-bounds-constant-array-index.rst   |  3 +--
 .../checks/misc/uniqueptr-reset-release.rst   |  3 +--
 .../checks/modernize/loop-convert.rst |  3 +--
 .../checks/modernize/make-shared.rst  |  6 ++
 .../checks/modernize/make-unique.rst  |  6 ++
 .../min-max-use-initializer-list.rst  |  3 +--
 .../checks/modernize/pass-by-value.rst|  3 +--
 .../checks/modernize/replace-auto-ptr.rst |  3 +--
 .../checks/modernize/type-traits.rst  |  2 +-
 .../checks/modernize/use-bool-literals.rst|  3 +--
 .../modernize/use-default-member-init.rst |  3 +--
 .../checks/modernize/use-equals-default.rst   |  1 +
 .../checks/modernize/use-equals-delete.rst|  3 +--
 .../checks/modernize/use-ranges.rst   |  3 +--
 .../checks/modernize/use-std-numbers.rst  |  3 +--
 .../clang-tidy/checks/modernize/use-using.rst |  3 +--
 .../performance/unnecessary-value-param.rst   |  3 +--
 .../avoid-const-params-in-decls.rst   |  3 +--
 .../checks/readability/const-return-type.rst  |  3 +--
 .../function-cognitive-complexity.rst |  5 +++--
 ...nconsistent-declaration-parameter-name.rst |  3 +--
 .../checks/readability/redundant-casting.rst  |  3 +--
 .../readability/redundant-declaration.rst |  3 +--
 .../readability/redundant-smartptr-get.rst|  4 ++--
 .../readability/simplify-boolean-expr.rst |  3 +--
 .../readability/uppercase-literal-suffix.rst  |  3 +--
 clang-tools-extra/docs/clang-tidy/index.rst   |  1 +
 33 files changed, 59 insertions(+), 62 deletions(-)
 create mode 100644 clang-tools-extra/docs/clang-tidy/GlobalOptions.rst

diff --git a/clang-tools-extra/docs/clang-tidy/GlobalOptions.rst 
b/clang-tools-extra/docs/clang-tidy/GlobalOptions.rst
new file mode 100644
index 00..c717784eb2dff3
--- /dev/null
+++ b/clang-tools-extra/docs/clang-tidy/GlobalOptions.rst
@@ -0,0 +1,21 @@
+==
+Global Options
+==
+
+Some options apply to multiple checks. This page lists all the available
+globally options.
+
+.. option:: IncludeStyle
+
+   A string specifying which include-style is used, `llvm` or `google`. Default
+   is `llvm`.
+
+.. option:: IgnoreMacros
+
+   If set to `true`, the check will not give warnings inside macros. Default
+   is `true`.
+
+.. option:: StrictMode
+
+  When `true`, some checkers will be more stringent. The default value depends
+  on the checks.
diff --git 
a/clang-tools-extra/docs/clang-tidy/checks/abseil/string-find-startswith.rst 
b/clang-tools-extra/docs/clang-tidy/checks/abseil/string-find-startswith.rst
index 41a7ab500d7ce0..a8b7b234cc7c23 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/abseil/string-find-startswith.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/abseil/string-find-startswith.rst
@@ -39,8 +39,7 @@ Options
 
 .. option:: IncludeStyle
 
-   A string specifying which include-style is used, `llvm` or `google`. Default
-   is `llvm`.
+   See :doc:`global options `.
 
 .. option:: AbseilStringsMatchHeader
 
diff --git 
a/clang-tools-extra/docs/clang-tidy/checks/abseil/string-find-str-contains.rst 
b/clang-tools-extra/docs/clang-tidy/checks/abseil/string-find-str-contains.rst
index 042fbdb3f29a94..4eedd8c0b57f0a 100644
--- 
a/clang-tools-extra/docs/clang-tidy/checks/abseil/string-find-str-contains.rst
+++ 
b/clang-tools-extra/docs/clang-tidy/checks/abseil/string-find-str-contains.rst
@@ -43,8 +43,7 @@ Options
 
 .. option:: IncludeStyle
 
-   A string specifying which include-style is used, `llvm` or `google`. Default
-   is `llvm`.
+   See :doc:`global options `.
 
 .. option:: AbseilStringsMatchHeader
 
diff --git a/clang-tools-extra/docs/clang-tidy/checks/boost/use-ranges.rst 
b/clang-tools-extra/docs/clang-tidy/checks/boost/use-ranges.rst
index 4c032ad32f4fd8..847875b4df3b63 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/boost/use-ranges.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/boost/use-ranges.rst
@@ -162,8 +162,7 @@ Options
 
 .. option:: IncludeStyle
 
-   A string specifying which include-style is used, `llvm` or `google`. Default
-   is `llvm`.
+   See :doc:`global options `.
 
 .. option:: IncludeBoostSystem

diff --git 
a/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/avoid-do-while.rst 
b/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/avoi

[clang-tools-extra] [clang-tidy][doc][NFC] extract common global options in doc (PR #119842)

2024-12-13 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang-tools-extra

Author: Congcong Cai (HerrCai0907)


Changes



---

Patch is 20.60 KiB, truncated to 20.00 KiB below, full version: 
https://github.com/llvm/llvm-project/pull/119842.diff


33 Files Affected:

- (added) clang-tools-extra/docs/clang-tidy/GlobalOptions.rst (+21) 
- (modified) 
clang-tools-extra/docs/clang-tidy/checks/abseil/string-find-startswith.rst 
(+1-2) 
- (modified) 
clang-tools-extra/docs/clang-tidy/checks/abseil/string-find-str-contains.rst 
(+1-2) 
- (modified) clang-tools-extra/docs/clang-tidy/checks/boost/use-ranges.rst 
(+1-2) 
- (modified) 
clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/avoid-do-while.rst 
(+2-1) 
- (modified) 
clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/init-variables.rst 
(+1-2) 
- (modified) 
clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/pro-bounds-constant-array-index.rst
 (+1-2) 
- (modified) 
clang-tools-extra/docs/clang-tidy/checks/misc/uniqueptr-reset-release.rst 
(+1-2) 
- (modified) 
clang-tools-extra/docs/clang-tidy/checks/modernize/loop-convert.rst (+1-2) 
- (modified) clang-tools-extra/docs/clang-tidy/checks/modernize/make-shared.rst 
(+2-4) 
- (modified) clang-tools-extra/docs/clang-tidy/checks/modernize/make-unique.rst 
(+2-4) 
- (modified) 
clang-tools-extra/docs/clang-tidy/checks/modernize/min-max-use-initializer-list.rst
 (+1-2) 
- (modified) 
clang-tools-extra/docs/clang-tidy/checks/modernize/pass-by-value.rst (+1-2) 
- (modified) 
clang-tools-extra/docs/clang-tidy/checks/modernize/replace-auto-ptr.rst (+1-2) 
- (modified) clang-tools-extra/docs/clang-tidy/checks/modernize/type-traits.rst 
(+1-1) 
- (modified) 
clang-tools-extra/docs/clang-tidy/checks/modernize/use-bool-literals.rst (+1-2) 
- (modified) 
clang-tools-extra/docs/clang-tidy/checks/modernize/use-default-member-init.rst 
(+1-2) 
- (modified) 
clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-default.rst (+1) 
- (modified) 
clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst (+1-2) 
- (modified) clang-tools-extra/docs/clang-tidy/checks/modernize/use-ranges.rst 
(+1-2) 
- (modified) 
clang-tools-extra/docs/clang-tidy/checks/modernize/use-std-numbers.rst (+1-2) 
- (modified) clang-tools-extra/docs/clang-tidy/checks/modernize/use-using.rst 
(+1-2) 
- (modified) 
clang-tools-extra/docs/clang-tidy/checks/performance/unnecessary-value-param.rst
 (+1-2) 
- (modified) 
clang-tools-extra/docs/clang-tidy/checks/readability/avoid-const-params-in-decls.rst
 (+1-2) 
- (modified) 
clang-tools-extra/docs/clang-tidy/checks/readability/const-return-type.rst 
(+1-2) 
- (modified) 
clang-tools-extra/docs/clang-tidy/checks/readability/function-cognitive-complexity.rst
 (+3-2) 
- (modified) 
clang-tools-extra/docs/clang-tidy/checks/readability/inconsistent-declaration-parameter-name.rst
 (+1-2) 
- (modified) 
clang-tools-extra/docs/clang-tidy/checks/readability/redundant-casting.rst 
(+1-2) 
- (modified) 
clang-tools-extra/docs/clang-tidy/checks/readability/redundant-declaration.rst 
(+1-2) 
- (modified) 
clang-tools-extra/docs/clang-tidy/checks/readability/redundant-smartptr-get.rst 
(+2-2) 
- (modified) 
clang-tools-extra/docs/clang-tidy/checks/readability/simplify-boolean-expr.rst 
(+1-2) 
- (modified) 
clang-tools-extra/docs/clang-tidy/checks/readability/uppercase-literal-suffix.rst
 (+1-2) 
- (modified) clang-tools-extra/docs/clang-tidy/index.rst (+1) 


``diff
diff --git a/clang-tools-extra/docs/clang-tidy/GlobalOptions.rst 
b/clang-tools-extra/docs/clang-tidy/GlobalOptions.rst
new file mode 100644
index 00..c717784eb2dff3
--- /dev/null
+++ b/clang-tools-extra/docs/clang-tidy/GlobalOptions.rst
@@ -0,0 +1,21 @@
+==
+Global Options
+==
+
+Some options apply to multiple checks. This page lists all the available
+globally options.
+
+.. option:: IncludeStyle
+
+   A string specifying which include-style is used, `llvm` or `google`. Default
+   is `llvm`.
+
+.. option:: IgnoreMacros
+
+   If set to `true`, the check will not give warnings inside macros. Default
+   is `true`.
+
+.. option:: StrictMode
+
+  When `true`, some checkers will be more stringent. The default value depends
+  on the checks.
diff --git 
a/clang-tools-extra/docs/clang-tidy/checks/abseil/string-find-startswith.rst 
b/clang-tools-extra/docs/clang-tidy/checks/abseil/string-find-startswith.rst
index 41a7ab500d7ce0..a8b7b234cc7c23 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/abseil/string-find-startswith.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/abseil/string-find-startswith.rst
@@ -39,8 +39,7 @@ Options
 
 .. option:: IncludeStyle
 
-   A string specifying which include-style is used, `llvm` or `google`. Default
-   is `llvm`.
+   See :doc:`global options `.
 
 .. option:: AbseilStringsMatchHeader
 
diff --git 
a/clang-tools-extra/docs/clang-tidy/checks/abseil/string-find-str-contains.rst 
b/clang-tools-extra/docs/clang-tidy/checks/abseil/string-find-str-co

[clang-tools-extra] 7da4b6b - [clang-tidy][doc][NFC] format doc for misc-unused-parameters (#119839)

2024-12-13 Thread via cfe-commits

Author: Congcong Cai
Date: 2024-12-13T17:10:30+08:00
New Revision: 7da4b6b7a5beba9ff2589c8ecdc141316acdad12

URL: 
https://github.com/llvm/llvm-project/commit/7da4b6b7a5beba9ff2589c8ecdc141316acdad12
DIFF: 
https://github.com/llvm/llvm-project/commit/7da4b6b7a5beba9ff2589c8ecdc141316acdad12.diff

LOG: [clang-tidy][doc][NFC] format doc for misc-unused-parameters (#119839)

Added: 


Modified: 
clang-tools-extra/docs/clang-tidy/checks/misc/unused-parameters.rst

Removed: 




diff  --git 
a/clang-tools-extra/docs/clang-tidy/checks/misc/unused-parameters.rst 
b/clang-tools-extra/docs/clang-tidy/checks/misc/unused-parameters.rst
index 87b75579d97a7c..9321f651fd7054 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/misc/unused-parameters.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/misc/unused-parameters.rst
@@ -35,13 +35,13 @@ Options
 
 .. option:: StrictMode
 
-   When `false` (default value), the check will ignore trivially unused 
parameters,
-   i.e. when the corresponding function has an empty body (and in case of
-   constructors - no constructor initializers). When the function body is 
empty,
-   an unused parameter is unlikely to be unnoticed by a human reader, and
-   there's basically no place for a bug to hide.
+  When `false` (default value), the check will ignore trivially unused 
parameters,
+  i.e. when the corresponding function has an empty body (and in case of
+  constructors - no constructor initializers). When the function body is empty,
+  an unused parameter is unlikely to be unnoticed by a human reader, and
+  there's basically no place for a bug to hide.
 
 .. option:: IgnoreVirtual
 
-   Determines whether virtual method parameters should be inspected.
-   Set to `true` to ignore them. Default is `false`.
+  Determines whether virtual method parameters should be inspected.
+  Set to `true` to ignore them. Default is `false`.



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy][doc][NFC] format doc for misc-unused-parameters (PR #119839)

2024-12-13 Thread Congcong Cai via cfe-commits

https://github.com/HerrCai0907 closed 
https://github.com/llvm/llvm-project/pull/119839
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [AArch64] Add intrinsics for SME FP8 FDOT LANE instructions (PR #118492)

2024-12-13 Thread Jonathan Thackray via cfe-commits

https://github.com/jthackray closed 
https://github.com/llvm/llvm-project/pull/118492
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [AArch64] Implement FP8 SVE intrinsics for fused multiply-add (PR #118126)

2024-12-13 Thread Momchil Velikov via cfe-commits

https://github.com/momchil-velikov updated 
https://github.com/llvm/llvm-project/pull/118126

>From 5bc5078af32cda3dbcf3ca8dd53b01996ad34ea1 Mon Sep 17 00:00:00 2001
From: Momchil Velikov 
Date: Mon, 25 Nov 2024 17:21:55 +
Subject: [PATCH 1/4] [AArch64] Implements FP8 SVE intrinsics for dot-product

This patch adds the following intrinsics:

* 8-bit floating-point dot product to single-precision.

  // Only if (__ARM_FEATURE_SVE2  && __ARM_FEATURE_FP8DOT4) || 
__ARM_FEATURE_SSVE_FP8DOT4
  svfloat32_t svdot[_f32_mf8]_fpm(svfloat32_t zda, svmfloat8_t zn, svmfloat8_t 
zm, fpm_t fpm);
  svfloat32_t svdot[_n_f32_mf8]_fpm(svfloat32_t zda, svmfloat8_t zn, mfloat8_t 
zm, fpm_t fpm);

* 8-bit floating-point indexed dot product to single-precision.

  // Only if (__ARM_FEATURE_SVE2  && __ARM_FEATURE_FP8DOT4) || 
__ARM_FEATURE_SSVE_FP8DOT4
  svfloat32_t svdot_lane[_f32_mf8]_fpm(svfloat32_t zda, svmfloat8_t zn, 
svmfloat8_t zm,
   uint64_t imm0_3, fpm_t fpm);

* 8-bit floating-point dot product to half-precision.

  // Only if (__ARM_FEATURE_SVE2  && __ARM_FEATURE_FP8DOT2) || 
__ARM_FEATURE_SSVE_FP8DOT2
  svfloat16_t svdot[_f16_mf8]_fpm(svfloat16_t zda, svmfloat8_t zn, svmfloat8_t 
zm, fpm_t fpm);
  svfloat16_t svdot[_n_f16_mf8]_fpm(svfloat16_t zda, svmfloat8_t zn, mfloat8_t 
zm, fpm_t fpm);

* 8-bit floating-point indexed dot product to half-precision.

  // Only if (__ARM_FEATURE_SVE2  && __ARM_FEATURE_FP8DOT2) || 
__ARM_FEATURE_SSVE_FP8DOT2
  svfloat16_t svdot_lane[_f16_mf8]_fpm(svfloat16_t zda, svmfloat8_t zn, 
svmfloat8_t zm,
   uint64_t imm0_7, fpm_t fpm);
---
 clang/include/clang/Basic/arm_sve.td  |  19 +++
 clang/include/clang/Basic/arm_sve_sme_incl.td |   1 +
 clang/lib/CodeGen/CGBuiltin.cpp   |  11 +-
 .../fp8-intrinsics/acle_sve2_fp8_fdot.c   | 149 ++
 .../aarch64-sve2-intrinsics/acle_sve2_fp8.c   |  23 ++-
 clang/utils/TableGen/SveEmitter.cpp   |   9 +-
 llvm/include/llvm/IR/IntrinsicsAArch64.td |  16 ++
 .../lib/Target/AArch64/AArch64SVEInstrInfo.td |   9 +-
 llvm/lib/Target/AArch64/SVEInstrFormats.td|  29 +++-
 llvm/test/CodeGen/AArch64/fp8-sve-fdot.ll |  41 +
 10 files changed, 293 insertions(+), 14 deletions(-)
 create mode 100644 
clang/test/CodeGen/AArch64/fp8-intrinsics/acle_sve2_fp8_fdot.c
 create mode 100644 llvm/test/CodeGen/AArch64/fp8-sve-fdot.ll

diff --git a/clang/include/clang/Basic/arm_sve.td 
b/clang/include/clang/Basic/arm_sve.td
index b9f40faf0b18e6..2c8ca8014387d3 100644
--- a/clang/include/clang/Basic/arm_sve.td
+++ b/clang/include/clang/Basic/arm_sve.td
@@ -2476,3 +2476,22 @@ let SVETargetGuard = "sve2,fp8", SMETargetGuard = 
"sme2,fp8" in {
   def SVFCVTNB : SInst<"svcvtnb_mf8[_f32_x2]_fpm", "~2>",  "f", MergeNone, 
"aarch64_sve_fp8_cvtnb", [VerifyRuntimeMode, SetsFPMR]>;
   def SVFCVTNT : SInst<"svcvtnt_mf8[_f32_x2]_fpm", "~~2>", "f", MergeNone, 
"aarch64_sve_fp8_cvtnt", [VerifyRuntimeMode, SetsFPMR]>;
 }
+
+let SVETargetGuard = "sve2,fp8dot2", SMETargetGuard ="sme,ssve-fp8dot2" in {
+  // 8-bit floating-point dot product to half-precision (vectors)
+  def SVFDOT_2WAY   :  SInst<"svdot[_f16_mf8]_fpm",   "dd~~>", "h", MergeNone, 
"aarch64_sve_fp8_fdot", [VerifyRuntimeMode, SetsFPMR]>;
+  def SVFDOT_N_2WAY :  SInst<"svdot[_n_f16_mf8]_fpm", "dd~!>", "h", MergeNone, 
"aarch64_sve_fp8_fdot", [VerifyRuntimeMode, SetsFPMR]>;
+
+  // 8-bit floating-point dot product to half-precision (indexed)
+  def SVFDOT_LANE_2WAY :  SInst<"svdot_lane[_f16_mf8]_fpm", "dd~~i>", "h", 
MergeNone, "aarch64_sve_fp8_fdot_lane", [VerifyRuntimeMode, SetsFPMR], 
[ImmCheck<3, ImmCheck0_7>]>;
+}
+
+let SVETargetGuard = "sve2,fp8dot4", SMETargetGuard ="sme,ssve-fp8dot4" in {
+  // 8-bit floating-point dot product to single-precision (vectors)
+  def SVFDOT_4WAY   : SInst<"svdot[_f32_mf8]_fpm",   "dd~~>", "f", MergeNone, 
"aarch64_sve_fp8_fdot", [VerifyRuntimeMode, SetsFPMR]>;
+  def SVFDOT_N_4WAY : SInst<"svdot[_n_f32_mf8]_fpm", "dd~!>", "f", MergeNone, 
"aarch64_sve_fp8_fdot", [VerifyRuntimeMode, SetsFPMR]>;
+
+  // 8-bit floating-point dot product to single-precision (indexed)
+  def SVFDOT_LANE_4WAY :  SInst<"svdot_lane[_f32_mf8]_fpm", "dd~~i>", "f", 
MergeNone, "aarch64_sve_fp8_fdot_lane", [VerifyRuntimeMode, SetsFPMR], 
[ImmCheck<3, ImmCheck0_3>]>;
+}
+
diff --git a/clang/include/clang/Basic/arm_sve_sme_incl.td 
b/clang/include/clang/Basic/arm_sve_sme_incl.td
index de10be7bdce0db..44201b15505599 100644
--- a/clang/include/clang/Basic/arm_sve_sme_incl.td
+++ b/clang/include/clang/Basic/arm_sve_sme_incl.td
@@ -105,6 +105,7 @@ include "arm_immcheck_incl.td"
 // N: svfloat64_t
 // $: svbfloat16_t
 // ~: svmfloat8_t
+// !: mfloat8_t (splat to svmfloat8_t)
 
 // J: Prefetch type (sv_prfop)
 
diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index 49a4c1ecc825e7..84048a4beac2c5 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBui

[clang] [llvm] [AArch64] Implement FP8 SVE intrinsics for fused multiply-add (PR #118126)

2024-12-13 Thread Momchil Velikov via cfe-commits


@@ -0,0 +1,114 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 
UTC_ARGS: --version 5
+; RUN: llc -mattr=+sve2,+fp8,+fp8fma  < %s | FileCheck %s
+; RUN: llc -mattr=+sme,+fp8,+ssve-fp8fma --force-streaming < %s | FileCheck %s
+
+target triple = "aarch64-linux"
+
+define  @fmla_2way_bot( %a,  %s1,  %s2) {
+; CHECK-LABEL: fmla_2way_bot:
+; CHECK:   // %bb.0:
+; CHECK-NEXT:fmlalb z0.h, z1.b, z2.b
+; CHECK-NEXT:ret
+%r = call  @llvm.aarch64.sve.fp8.fmlalb.nxv8f16( %a,  %s1,  %s2)
+ret  %r
+}
+
+define  @fmla_2way_top( %a,  %s1,  %s2) {
+; CHECK-LABEL: fmla_2way_top:
+; CHECK:   // %bb.0:
+; CHECK-NEXT:fmlalt z0.h, z1.b, z2.b
+; CHECK-NEXT:ret
+%r = call  @llvm.aarch64.sve.fp8.fmlalt.nxv8f16( %a,  %s1,  %s2)
+ret  %r
+}
+
+define  @fdot_2way_bot_lane( %a,  %s1,  %s2) {

momchil-velikov wrote:

Done

https://github.com/llvm/llvm-project/pull/118126
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] Generate appropriate assume in presence of libc's memcpy (PR #119704)

2024-12-13 Thread via cfe-commits

https://github.com/serge-sans-paille updated 
https://github.com/llvm/llvm-project/pull/119704

>From 9d013f37df124fde0ed637d4b979de5ab01cbc22 Mon Sep 17 00:00:00 2001
From: serge-sans-paille 
Date: Thu, 12 Dec 2024 14:45:31 +0100
Subject: [PATCH 1/2] [clang] Generate appropriate assume in presence of libc's
 memcpy

It is an undefined behavior to pass null arguments as memcpy source or
destination parameter, so generate the appropriate llvm.assume call to
communicate this to the backend.

Don't do it for builtin memcpy as they don't suffer the same behavior in
case of null size.
---
 clang/lib/CodeGen/CGBuiltin.cpp   | 6 ++
 clang/test/CodeGen/catch-undef-behavior.c | 4 
 2 files changed, 10 insertions(+)

diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index 497a0b3952af8c..50cd8529120d36 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -4531,6 +4531,12 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl 
GD, unsigned BuiltinID,
 Value *SizeVal = EmitScalarExpr(E->getArg(2));
 EmitArgCheck(TCK_Store, Dest, E->getArg(0), 0);
 EmitArgCheck(TCK_Load, Src, E->getArg(1), 1);
+if (BuiltinID == Builtin::BImemcpy || BuiltinID == Builtin::BImempcpy) {
+  Builder.CreateAssumption(
+  Builder.CreateIsNotNull(Dest.emitRawPointer(*this)));
+  Builder.CreateAssumption(
+  Builder.CreateIsNotNull(Src.emitRawPointer(*this)));
+}
 Builder.CreateMemCpy(Dest, Src, SizeVal, false);
 if (BuiltinID == Builtin::BImempcpy ||
 BuiltinID == Builtin::BI__builtin_mempcpy)
diff --git a/clang/test/CodeGen/catch-undef-behavior.c 
b/clang/test/CodeGen/catch-undef-behavior.c
index 7580290b0b0333..7ef7c78f1cebb7 100644
--- a/clang/test/CodeGen/catch-undef-behavior.c
+++ b/clang/test/CodeGen/catch-undef-behavior.c
@@ -371,6 +371,10 @@ void call_memcpy_nonnull(void *p, void *q, int sz) {
   // CHECK-TRAP: call void @llvm.ubsantrap(i8 16)
   // CHECK-COMMON-NOT: call
 
+  // CHECK-COMMON: %5 = icmp ne ptr %0, null
+  // CHECK-COMMON: call void @llvm.assume(i1 %5)
+  // CHECK-COMMON: %6 = icmp ne ptr %0, null
+  // CHECK-COMMON: call void @llvm.assume(i1 %6)
   // CHECK-COMMON: call void @llvm.memcpy.p0.p0.i64(ptr align 1 %0, ptr align 
1 %1, i64 %conv, i1 false)
   memcpy(p, q, sz);
 }

>From 55f33c4edc2448b2573b89b6710959aae071f0ea Mon Sep 17 00:00:00 2001
From: serge-sans-paille 
Date: Fri, 13 Dec 2024 10:26:45 +0100
Subject: [PATCH 2/2] fixup! [clang] Generate appropriate assume in presence of
 libc's memcpy

---
 clang/lib/CodeGen/CGBuiltin.cpp   |  9 +
 clang/test/CodeGen/catch-undef-behavior.c | 16 +---
 2 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index 50cd8529120d36..20324515256678 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -4532,10 +4532,11 @@ RValue CodeGenFunction::EmitBuiltinExpr(const 
GlobalDecl GD, unsigned BuiltinID,
 EmitArgCheck(TCK_Store, Dest, E->getArg(0), 0);
 EmitArgCheck(TCK_Load, Src, E->getArg(1), 1);
 if (BuiltinID == Builtin::BImemcpy || BuiltinID == Builtin::BImempcpy) {
-  Builder.CreateAssumption(
-  Builder.CreateIsNotNull(Dest.emitRawPointer(*this)));
-  Builder.CreateAssumption(
-  Builder.CreateIsNotNull(Src.emitRawPointer(*this)));
+  Value *NullSize = Builder.CreateIsNull(SizeVal);
+  Builder.CreateAssumption(Builder.CreateOr(
+  NullSize, Builder.CreateIsNotNull(Dest.emitRawPointer(*this;
+  Builder.CreateAssumption(Builder.CreateOr(
+  NullSize, Builder.CreateIsNotNull(Src.emitRawPointer(*this;
 }
 Builder.CreateMemCpy(Dest, Src, SizeVal, false);
 if (BuiltinID == Builtin::BImempcpy ||
diff --git a/clang/test/CodeGen/catch-undef-behavior.c 
b/clang/test/CodeGen/catch-undef-behavior.c
index 7ef7c78f1cebb7..22161141acf4ad 100644
--- a/clang/test/CodeGen/catch-undef-behavior.c
+++ b/clang/test/CodeGen/catch-undef-behavior.c
@@ -366,15 +366,17 @@ void call_memcpy_nonnull(void *p, void *q, int sz) {
   // CHECK-TRAP: call void @llvm.ubsantrap(i8 16)
   // CHECK-COMMON-NOT: call
 
-  // CHECK-COMMON: icmp ne ptr {{.*}}, null
+  // CHECK-COMMON: icmp ne ptr %[[#]], null
   // CHECK-UBSAN: call void @__ubsan_handle_nonnull_arg
   // CHECK-TRAP: call void @llvm.ubsantrap(i8 16)
-  // CHECK-COMMON-NOT: call
-
-  // CHECK-COMMON: %5 = icmp ne ptr %0, null
-  // CHECK-COMMON: call void @llvm.assume(i1 %5)
-  // CHECK-COMMON: %6 = icmp ne ptr %0, null
-  // CHECK-COMMON: call void @llvm.assume(i1 %6)
+  //
+  // CHECK-COMMON: icmp eq i64 %conv, 0
+  // CHECK-COMMON: icmp ne ptr %0, null
+  // CHECK-COMMON: or i1 %[[#]], %[[#]]
+  // CHECK-COMMON: call void @llvm.assume(i1 %[[#]])
+  // CHECK-COMMON: icmp ne ptr %1, null
+  // CHECK-COMMON: or i1 %[[#]], %[[#]]
+  // CHECK-COMMON: call void @llvm.assume(i1 %[[#]])
   // CHECK-CO

[clang] [llvm] [TargetLibraryInfo] Add libmvec support for risc-v (PR #119844)

2024-12-13 Thread Zhijin Zeng via cfe-commits

https://github.com/zengdage created 
https://github.com/llvm/llvm-project/pull/119844

1. Rename LIBMVEC_X86 into LIBMVEC to support libmvec (glibc vector match 
library) in risc-v.
2. Add RVVM1/2/4/8 in VFISAKind to distingusih the LMUL value, so we can take 
full advantage of  risc-v vector extension.
3. Declare some RVV vector math functions in VecFuncs.def.

In VecFuncs.def, I add the LI_DEFINE_VECFUNC of LIBMVEC_RVV as follow:

```
TLI_DEFINE_VECFUNC("sin", "_ZGV1Nxv_sin", SCALABLE(1), "_ZGVr1Nxv")
TLI_DEFINE_VECFUNC("sin", "_ZGV2Nxv_sin", SCALABLE(2), "_ZGVr2Nxv")
TLI_DEFINE_VECFUNC("llvm.exp.f32", "_ZGV1Nxv_expf", SCALABLE(2), 
"_ZGVr1Nxv")
TLI_DEFINE_VECFUNC("llvm.exp.f32", "_ZGV2Nxv_expf", SCALABLE(4), 
"_ZGVr2Nxv")
```

The `VEC` of TLI_DEFINE_VECFUNC (e.g., `_ZGV2Nxv_sin`), its name mangling rules 
defined in https://github.com/riscv-non-isa/riscv-elf-psabi-doc/pull/455 . Now 
it's  still under review.

The` VF` (e.g., ` SCALABLE(2)`) should be `vscale x (LMUL * 64 / sizeof(Type)`. 
For example, the type of the parameter of sin is double, so for `_ZGV2Nxv_sin`, 
its VF is `vscale x 2`.

In the `VABI_PREFIX`  (e.g., `_ZGVr1Nxv`), `r` means RISC-V vector extension, 
`1` is LMUL value.
```
_ZGVr1Nxv  --> RISC-V Vector Extension with LMUL=1
_ZGVr2Nxv  --> RISC-V Vector Extension with LMUL=2
_ZGVr4Nxv  --> RISC-V Vector Extension with LMUL=4
_ZGVr8Nxv  --> RISC-V Vector Extension with LMUL=8

```


>From 101d7cb3749f0e3d892a7bf0bf797e40a334882f Mon Sep 17 00:00:00 2001
From: Zhijin Zeng 
Date: Thu, 12 Dec 2024 11:42:32 +0800
Subject: [PATCH 1/2] [NFC] Add vector call tests if use vector-library in
 risc-v

---
 .../LoopVectorize/RISCV/libm-vector-calls.ll  | 415 ++
 1 file changed, 415 insertions(+)
 create mode 100644 
llvm/test/Transforms/LoopVectorize/RISCV/libm-vector-calls.ll

diff --git a/llvm/test/Transforms/LoopVectorize/RISCV/libm-vector-calls.ll 
b/llvm/test/Transforms/LoopVectorize/RISCV/libm-vector-calls.ll
new file mode 100644
index 00..75fdd00e25f988
--- /dev/null
+++ b/llvm/test/Transforms/LoopVectorize/RISCV/libm-vector-calls.ll
@@ -0,0 +1,415 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 
UTC_ARGS: --version 5
+; RUN: opt -mtriple=riscv64 -mattr=+v -vector-library=LIBMVEC-X86 
-passes=inject-tli-mappings,loop-vectorize -S < %s | FileCheck %s
+
+target datalayout = "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128"
+target triple = "riscv64-unknown-linux-gnu"
+
+define void @sin_f64(ptr nocapture %varray) {
+; CHECK-LABEL: define void @sin_f64(
+; CHECK-SAME: ptr nocapture [[VARRAY:%.*]]) #[[ATTR0:[0-9]+]] {
+; CHECK-NEXT:  [[ENTRY:.*]]:
+; CHECK-NEXT:br i1 false, label %[[SCALAR_PH:.*]], label %[[VECTOR_PH:.*]]
+; CHECK:   [[VECTOR_PH]]:
+; CHECK-NEXT:br label %[[VECTOR_BODY:.*]]
+; CHECK:   [[VECTOR_BODY]]:
+; CHECK-NEXT:[[INDEX:%.*]] = phi i64 [ 0, %[[VECTOR_PH]] ], [ 
[[INDEX_NEXT:%.*]], %[[VECTOR_BODY]] ]
+; CHECK-NEXT:[[VEC_IND:%.*]] = phi <4 x i32> [ , %[[VECTOR_PH]] ], [ [[VEC_IND_NEXT:%.*]], %[[VECTOR_BODY]] ]
+; CHECK-NEXT:[[STEP_ADD:%.*]] = add <4 x i32> [[VEC_IND]], splat (i32 4)
+; CHECK-NEXT:[[TMP11:%.*]] = add i64 [[INDEX]], 0
+; CHECK-NEXT:[[TMP1:%.*]] = sitofp <4 x i32> [[VEC_IND]] to <4 x double>
+; CHECK-NEXT:[[TMP2:%.*]] = sitofp <4 x i32> [[STEP_ADD]] to <4 x double>
+; CHECK-NEXT:[[TMP3:%.*]] = call <4 x double> @_ZGVdN4v_sin(<4 x double> 
[[TMP1]])
+; CHECK-NEXT:[[TMP4:%.*]] = call <4 x double> @_ZGVdN4v_sin(<4 x double> 
[[TMP2]])
+; CHECK-NEXT:[[TMP14:%.*]] = getelementptr inbounds double, ptr 
[[VARRAY]], i64 [[TMP11]]
+; CHECK-NEXT:[[TMP15:%.*]] = getelementptr inbounds double, ptr [[TMP14]], 
i32 0
+; CHECK-NEXT:[[TMP7:%.*]] = getelementptr inbounds double, ptr [[TMP14]], 
i32 4
+; CHECK-NEXT:store <4 x double> [[TMP3]], ptr [[TMP15]], align 4
+; CHECK-NEXT:store <4 x double> [[TMP4]], ptr [[TMP7]], align 4
+; CHECK-NEXT:[[INDEX_NEXT]] = add nuw i64 [[INDEX]], 8
+; CHECK-NEXT:[[VEC_IND_NEXT]] = add <4 x i32> [[STEP_ADD]], splat (i32 4)
+; CHECK-NEXT:[[TMP5:%.*]] = icmp eq i64 [[INDEX_NEXT]], 1000
+; CHECK-NEXT:br i1 [[TMP5]], label %[[MIDDLE_BLOCK:.*]], label 
%[[VECTOR_BODY]], !llvm.loop [[LOOP0:![0-9]+]]
+; CHECK:   [[MIDDLE_BLOCK]]:
+; CHECK-NEXT:br i1 true, label %[[FOR_END:.*]], label %[[SCALAR_PH]]
+; CHECK:   [[SCALAR_PH]]:
+; CHECK-NEXT:[[BC_RESUME_VAL:%.*]] = phi i64 [ 1000, %[[MIDDLE_BLOCK]] ], 
[ 0, %[[ENTRY]] ]
+; CHECK-NEXT:br label %[[FOR_BODY:.*]]
+; CHECK:   [[FOR_BODY]]:
+; CHECK-NEXT:[[IV:%.*]] = phi i64 [ [[BC_RESUME_VAL]], %[[SCALAR_PH]] ], [ 
[[IV_NEXT:%.*]], %[[FOR_BODY]] ]
+; CHECK-NEXT:[[TMP:%.*]] = trunc i64 [[IV]] to i32
+; CHECK-NEXT:[[CONV:%.*]] = sitofp i32 [[TMP]] to double
+; CHECK-NEXT:[[CALL:%.*]] = tail call double @sin(double [[CONV]]) 
#[[ATTR3:[0-9]+]]
+; CHECK-NEXT:[[ARRAYIDX:%.*]] = getelementptr inbounds dou

[clang-tools-extra] [clang-tidy][doc][NFC] format doc for misc-unused-parameters (PR #119839)

2024-12-13 Thread Congcong Cai via cfe-commits

https://github.com/HerrCai0907 created 
https://github.com/llvm/llvm-project/pull/119839

None

>From ad6d38fd22d65f06d4a807e39da25352d9c42f23 Mon Sep 17 00:00:00 2001
From: Congcong Cai 
Date: Fri, 13 Dec 2024 16:52:54 +0800
Subject: [PATCH] [clang-tidy][doc][NFC] format doc for misc-unused-parameters

---
 .../clang-tidy/checks/misc/unused-parameters.rst   | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git 
a/clang-tools-extra/docs/clang-tidy/checks/misc/unused-parameters.rst 
b/clang-tools-extra/docs/clang-tidy/checks/misc/unused-parameters.rst
index 87b75579d97a7c..9321f651fd7054 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/misc/unused-parameters.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/misc/unused-parameters.rst
@@ -35,13 +35,13 @@ Options
 
 .. option:: StrictMode
 
-   When `false` (default value), the check will ignore trivially unused 
parameters,
-   i.e. when the corresponding function has an empty body (and in case of
-   constructors - no constructor initializers). When the function body is 
empty,
-   an unused parameter is unlikely to be unnoticed by a human reader, and
-   there's basically no place for a bug to hide.
+  When `false` (default value), the check will ignore trivially unused 
parameters,
+  i.e. when the corresponding function has an empty body (and in case of
+  constructors - no constructor initializers). When the function body is empty,
+  an unused parameter is unlikely to be unnoticed by a human reader, and
+  there's basically no place for a bug to hide.
 
 .. option:: IgnoreVirtual
 
-   Determines whether virtual method parameters should be inspected.
-   Set to `true` to ignore them. Default is `false`.
+  Determines whether virtual method parameters should be inspected.
+  Set to `true` to ignore them. Default is `false`.

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy][doc][NFC] format doc for misc-unused-parameters (PR #119839)

2024-12-13 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang-tools-extra

Author: Congcong Cai (HerrCai0907)


Changes



---
Full diff: https://github.com/llvm/llvm-project/pull/119839.diff


1 Files Affected:

- (modified) 
clang-tools-extra/docs/clang-tidy/checks/misc/unused-parameters.rst (+7-7) 


``diff
diff --git 
a/clang-tools-extra/docs/clang-tidy/checks/misc/unused-parameters.rst 
b/clang-tools-extra/docs/clang-tidy/checks/misc/unused-parameters.rst
index 87b75579d97a7c..9321f651fd7054 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/misc/unused-parameters.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/misc/unused-parameters.rst
@@ -35,13 +35,13 @@ Options
 
 .. option:: StrictMode
 
-   When `false` (default value), the check will ignore trivially unused 
parameters,
-   i.e. when the corresponding function has an empty body (and in case of
-   constructors - no constructor initializers). When the function body is 
empty,
-   an unused parameter is unlikely to be unnoticed by a human reader, and
-   there's basically no place for a bug to hide.
+  When `false` (default value), the check will ignore trivially unused 
parameters,
+  i.e. when the corresponding function has an empty body (and in case of
+  constructors - no constructor initializers). When the function body is empty,
+  an unused parameter is unlikely to be unnoticed by a human reader, and
+  there's basically no place for a bug to hide.
 
 .. option:: IgnoreVirtual
 
-   Determines whether virtual method parameters should be inspected.
-   Set to `true` to ignore them. Default is `false`.
+  Determines whether virtual method parameters should be inspected.
+  Set to `true` to ignore them. Default is `false`.

``




https://github.com/llvm/llvm-project/pull/119839
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [TargetLibraryInfo] Add libmvec support for risc-v (PR #119844)

2024-12-13 Thread Zhijin Zeng via cfe-commits

https://github.com/zengdage updated 
https://github.com/llvm/llvm-project/pull/119844

>From 101d7cb3749f0e3d892a7bf0bf797e40a334882f Mon Sep 17 00:00:00 2001
From: Zhijin Zeng 
Date: Thu, 12 Dec 2024 11:42:32 +0800
Subject: [PATCH 1/2] [NFC] Add vector call tests if use vector-library in
 risc-v

---
 .../LoopVectorize/RISCV/libm-vector-calls.ll  | 415 ++
 1 file changed, 415 insertions(+)
 create mode 100644 
llvm/test/Transforms/LoopVectorize/RISCV/libm-vector-calls.ll

diff --git a/llvm/test/Transforms/LoopVectorize/RISCV/libm-vector-calls.ll 
b/llvm/test/Transforms/LoopVectorize/RISCV/libm-vector-calls.ll
new file mode 100644
index 00..75fdd00e25f988
--- /dev/null
+++ b/llvm/test/Transforms/LoopVectorize/RISCV/libm-vector-calls.ll
@@ -0,0 +1,415 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 
UTC_ARGS: --version 5
+; RUN: opt -mtriple=riscv64 -mattr=+v -vector-library=LIBMVEC-X86 
-passes=inject-tli-mappings,loop-vectorize -S < %s | FileCheck %s
+
+target datalayout = "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128"
+target triple = "riscv64-unknown-linux-gnu"
+
+define void @sin_f64(ptr nocapture %varray) {
+; CHECK-LABEL: define void @sin_f64(
+; CHECK-SAME: ptr nocapture [[VARRAY:%.*]]) #[[ATTR0:[0-9]+]] {
+; CHECK-NEXT:  [[ENTRY:.*]]:
+; CHECK-NEXT:br i1 false, label %[[SCALAR_PH:.*]], label %[[VECTOR_PH:.*]]
+; CHECK:   [[VECTOR_PH]]:
+; CHECK-NEXT:br label %[[VECTOR_BODY:.*]]
+; CHECK:   [[VECTOR_BODY]]:
+; CHECK-NEXT:[[INDEX:%.*]] = phi i64 [ 0, %[[VECTOR_PH]] ], [ 
[[INDEX_NEXT:%.*]], %[[VECTOR_BODY]] ]
+; CHECK-NEXT:[[VEC_IND:%.*]] = phi <4 x i32> [ , %[[VECTOR_PH]] ], [ [[VEC_IND_NEXT:%.*]], %[[VECTOR_BODY]] ]
+; CHECK-NEXT:[[STEP_ADD:%.*]] = add <4 x i32> [[VEC_IND]], splat (i32 4)
+; CHECK-NEXT:[[TMP11:%.*]] = add i64 [[INDEX]], 0
+; CHECK-NEXT:[[TMP1:%.*]] = sitofp <4 x i32> [[VEC_IND]] to <4 x double>
+; CHECK-NEXT:[[TMP2:%.*]] = sitofp <4 x i32> [[STEP_ADD]] to <4 x double>
+; CHECK-NEXT:[[TMP3:%.*]] = call <4 x double> @_ZGVdN4v_sin(<4 x double> 
[[TMP1]])
+; CHECK-NEXT:[[TMP4:%.*]] = call <4 x double> @_ZGVdN4v_sin(<4 x double> 
[[TMP2]])
+; CHECK-NEXT:[[TMP14:%.*]] = getelementptr inbounds double, ptr 
[[VARRAY]], i64 [[TMP11]]
+; CHECK-NEXT:[[TMP15:%.*]] = getelementptr inbounds double, ptr [[TMP14]], 
i32 0
+; CHECK-NEXT:[[TMP7:%.*]] = getelementptr inbounds double, ptr [[TMP14]], 
i32 4
+; CHECK-NEXT:store <4 x double> [[TMP3]], ptr [[TMP15]], align 4
+; CHECK-NEXT:store <4 x double> [[TMP4]], ptr [[TMP7]], align 4
+; CHECK-NEXT:[[INDEX_NEXT]] = add nuw i64 [[INDEX]], 8
+; CHECK-NEXT:[[VEC_IND_NEXT]] = add <4 x i32> [[STEP_ADD]], splat (i32 4)
+; CHECK-NEXT:[[TMP5:%.*]] = icmp eq i64 [[INDEX_NEXT]], 1000
+; CHECK-NEXT:br i1 [[TMP5]], label %[[MIDDLE_BLOCK:.*]], label 
%[[VECTOR_BODY]], !llvm.loop [[LOOP0:![0-9]+]]
+; CHECK:   [[MIDDLE_BLOCK]]:
+; CHECK-NEXT:br i1 true, label %[[FOR_END:.*]], label %[[SCALAR_PH]]
+; CHECK:   [[SCALAR_PH]]:
+; CHECK-NEXT:[[BC_RESUME_VAL:%.*]] = phi i64 [ 1000, %[[MIDDLE_BLOCK]] ], 
[ 0, %[[ENTRY]] ]
+; CHECK-NEXT:br label %[[FOR_BODY:.*]]
+; CHECK:   [[FOR_BODY]]:
+; CHECK-NEXT:[[IV:%.*]] = phi i64 [ [[BC_RESUME_VAL]], %[[SCALAR_PH]] ], [ 
[[IV_NEXT:%.*]], %[[FOR_BODY]] ]
+; CHECK-NEXT:[[TMP:%.*]] = trunc i64 [[IV]] to i32
+; CHECK-NEXT:[[CONV:%.*]] = sitofp i32 [[TMP]] to double
+; CHECK-NEXT:[[CALL:%.*]] = tail call double @sin(double [[CONV]]) 
#[[ATTR3:[0-9]+]]
+; CHECK-NEXT:[[ARRAYIDX:%.*]] = getelementptr inbounds double, ptr 
[[VARRAY]], i64 [[IV]]
+; CHECK-NEXT:store double [[CALL]], ptr [[ARRAYIDX]], align 4
+; CHECK-NEXT:[[IV_NEXT]] = add nuw nsw i64 [[IV]], 1
+; CHECK-NEXT:[[EXITCOND:%.*]] = icmp eq i64 [[IV_NEXT]], 1000
+; CHECK-NEXT:br i1 [[EXITCOND]], label %[[FOR_END]], label %[[FOR_BODY]], 
!llvm.loop [[LOOP3:![0-9]+]]
+; CHECK:   [[FOR_END]]:
+; CHECK-NEXT:ret void
+;
+entry:
+  br label %for.body
+
+for.body:
+  %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
+  %tmp = trunc i64 %iv to i32
+  %conv = sitofp i32 %tmp to double
+  %call = tail call double @sin(double %conv)
+  %arrayidx = getelementptr inbounds double, ptr %varray, i64 %iv
+  store double %call, ptr %arrayidx, align 4
+  %iv.next = add nuw nsw i64 %iv, 1
+  %exitcond = icmp eq i64 %iv.next, 1000
+  br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !1
+
+for.end:
+  ret void
+}
+
+!1 = distinct !{!1, !2}
+!2 = !{!"llvm.loop.vectorize.enable", i1 true}
+
+
+define void @sin_f64_intrinsic(ptr nocapture %varray) {
+; CHECK-LABEL: define void @sin_f64_intrinsic(
+; CHECK-SAME: ptr nocapture [[VARRAY:%.*]]) #[[ATTR0]] {
+; CHECK-NEXT:  [[ENTRY:.*]]:
+; CHECK-NEXT:br i1 false, label %[[SCALAR_PH:.*]], label %[[VECTOR_PH:.*]]
+; CHECK:   [[VECTOR_PH]]:
+; CHECK-NEXT:br label %[[VECTOR_BODY:.*]]
+; CHECK:   [[VECTOR_BODY]]:
+; CHECK-NEXT:   

[clang] [Clang][Parser] Add a warning to ambiguous uses of T...[N] types (PR #116332)

2024-12-13 Thread LLVM Continuous Integration via cfe-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `llvm-clang-aarch64-darwin` 
running on `doug-worker-4` while building `clang` at step 6 
"test-build-unified-tree-check-all".

Full details are available at: 
https://lab.llvm.org/buildbot/#/builders/190/builds/11288


Here is the relevant piece of the build log for the reference

```
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
 TEST 'lld :: MachO/arm64-thunk-starvation.s' FAILED 

Exit Code: 1

Command Output (stderr):
--
RUN: at line 2: /Users/buildbot/buildbot-root/aarch64-darwin/build/bin/llvm-mc 
-filetype=obj -triple=arm64-apple-darwin 
/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/lld/test/MachO/arm64-thunk-starvation.s
 -o 
/Users/buildbot/buildbot-root/aarch64-darwin/build/tools/lld/test/MachO/Output/arm64-thunk-starvation.s.tmp.o
+ /Users/buildbot/buildbot-root/aarch64-darwin/build/bin/llvm-mc -filetype=obj 
-triple=arm64-apple-darwin 
/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/lld/test/MachO/arm64-thunk-starvation.s
 -o 
/Users/buildbot/buildbot-root/aarch64-darwin/build/tools/lld/test/MachO/Output/arm64-thunk-starvation.s.tmp.o
error: No space left on device

--




```



https://github.com/llvm/llvm-project/pull/116332
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang][bytecode] Handle __builtin_memcmp (PR #119544)

2024-12-13 Thread Nikita Popov via cfe-commits

nikic wrote:

We're seeing the same issue on s390x. Big endian not handled correctly?

https://github.com/llvm/llvm-project/pull/119544
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-cl] Don't add implicit NoBuiltinAttr to deleted or defaulted functions (PR #119719)

2024-12-13 Thread via cfe-commits

https://github.com/VScigolevs edited 
https://github.com/llvm/llvm-project/pull/119719
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang][bytecode] Fix memcmp/bcmp failures on big-endian hosts (PR #119851)

2024-12-13 Thread Timm Baeder via cfe-commits

https://github.com/tbaederr created 
https://github.com/llvm/llvm-project/pull/119851

See the discussion in
https://github.com/llvm/llvm-project/pull/119678#issuecomment-2539680746 and
https://github.com/llvm/llvm-project/pull/119544#issuecomment-2539678561

>From 0cf9d2b6bb83de7db94411a5a325ba4c83be6274 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= 
Date: Fri, 13 Dec 2024 11:05:09 +0100
Subject: [PATCH] [clang][bytecode] Fix memcmp/bcmp failures on big-endian
 hosts

See the discussion in
https://github.com/llvm/llvm-project/pull/119678#issuecomment-2539680746
and
https://github.com/llvm/llvm-project/pull/119544#issuecomment-2539678561
---
 clang/lib/AST/ByteCode/InterpBuiltin.cpp| 8 
 clang/lib/AST/ByteCode/InterpBuiltinBitCast.cpp | 5 -
 clang/lib/AST/ByteCode/InterpBuiltinBitCast.h   | 5 +
 3 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/clang/lib/AST/ByteCode/InterpBuiltin.cpp 
b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
index a343280b5ce50f..172e26332474c0 100644
--- a/clang/lib/AST/ByteCode/InterpBuiltin.cpp
+++ b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
@@ -1943,10 +1943,18 @@ static bool interp__builtin_memcmp(InterpState &S, 
CodePtr OpPC,
   BitcastBuffer BufferA(
   Bits(S.getASTContext().getTypeSize(PtrA.getFieldDesc()->getType(;
   readPointerToBuffer(S.getContext(), PtrA, BufferA, false);
+  // FIXME: The swapping here is UNDOING something we do when reading the
+  // data into the buffer.
+  if (S.getASTContext().getTargetInfo().isBigEndian())
+swapBytes(BufferA.Data.get(), BufferA.byteSize().getQuantity());
 
   BitcastBuffer BufferB(
   Bits(S.getASTContext().getTypeSize(PtrB.getFieldDesc()->getType(;
   readPointerToBuffer(S.getContext(), PtrB, BufferB, false);
+  // FIXME: The swapping here is UNDOING something we do when reading the
+  // data into the buffer.
+  if (S.getASTContext().getTargetInfo().isBigEndian())
+swapBytes(BufferB.Data.get(), BufferB.byteSize().getQuantity());
 
   size_t MinBufferSize = std::min(BufferA.byteSize().getQuantity(),
   BufferB.byteSize().getQuantity());
diff --git a/clang/lib/AST/ByteCode/InterpBuiltinBitCast.cpp 
b/clang/lib/AST/ByteCode/InterpBuiltinBitCast.cpp
index c87993b8739a77..07f76943708216 100644
--- a/clang/lib/AST/ByteCode/InterpBuiltinBitCast.cpp
+++ b/clang/lib/AST/ByteCode/InterpBuiltinBitCast.cpp
@@ -73,11 +73,6 @@ using DataFunc =
 }  
\
   } while (0)
 
-static void swapBytes(std::byte *M, size_t N) {
-  for (size_t I = 0; I != (N / 2); ++I)
-std::swap(M[I], M[N - 1 - I]);
-}
-
 /// We use this to recursively iterate over all fields and elements of a 
pointer
 /// and extract relevant data for a bitcast.
 static bool enumerateData(const Pointer &P, const Context &Ctx, Bits Offset,
diff --git a/clang/lib/AST/ByteCode/InterpBuiltinBitCast.h 
b/clang/lib/AST/ByteCode/InterpBuiltinBitCast.h
index 08c207c7415dfa..b45613b2f21e20 100644
--- a/clang/lib/AST/ByteCode/InterpBuiltinBitCast.h
+++ b/clang/lib/AST/ByteCode/InterpBuiltinBitCast.h
@@ -19,6 +19,11 @@ class InterpState;
 class CodePtr;
 class Context;
 
+inline static void swapBytes(std::byte *M, size_t N) {
+  for (size_t I = 0; I != (N / 2); ++I)
+std::swap(M[I], M[N - 1 - I]);
+}
+
 bool DoBitCast(InterpState &S, CodePtr OpPC, const Pointer &Ptr,
std::byte *Buff, Bits BitWidth, Bits FullBitWidth,
bool &HasIndeterminateBits);

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang][bytecode] Fix memcmp/bcmp failures on big-endian hosts (PR #119851)

2024-12-13 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: Timm Baeder (tbaederr)


Changes

See the discussion in
https://github.com/llvm/llvm-project/pull/119678#issuecomment-2539680746 and
https://github.com/llvm/llvm-project/pull/119544#issuecomment-2539678561

---
Full diff: https://github.com/llvm/llvm-project/pull/119851.diff


3 Files Affected:

- (modified) clang/lib/AST/ByteCode/InterpBuiltin.cpp (+8) 
- (modified) clang/lib/AST/ByteCode/InterpBuiltinBitCast.cpp (-5) 
- (modified) clang/lib/AST/ByteCode/InterpBuiltinBitCast.h (+5) 


``diff
diff --git a/clang/lib/AST/ByteCode/InterpBuiltin.cpp 
b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
index a343280b5ce50f..172e26332474c0 100644
--- a/clang/lib/AST/ByteCode/InterpBuiltin.cpp
+++ b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
@@ -1943,10 +1943,18 @@ static bool interp__builtin_memcmp(InterpState &S, 
CodePtr OpPC,
   BitcastBuffer BufferA(
   Bits(S.getASTContext().getTypeSize(PtrA.getFieldDesc()->getType(;
   readPointerToBuffer(S.getContext(), PtrA, BufferA, false);
+  // FIXME: The swapping here is UNDOING something we do when reading the
+  // data into the buffer.
+  if (S.getASTContext().getTargetInfo().isBigEndian())
+swapBytes(BufferA.Data.get(), BufferA.byteSize().getQuantity());
 
   BitcastBuffer BufferB(
   Bits(S.getASTContext().getTypeSize(PtrB.getFieldDesc()->getType(;
   readPointerToBuffer(S.getContext(), PtrB, BufferB, false);
+  // FIXME: The swapping here is UNDOING something we do when reading the
+  // data into the buffer.
+  if (S.getASTContext().getTargetInfo().isBigEndian())
+swapBytes(BufferB.Data.get(), BufferB.byteSize().getQuantity());
 
   size_t MinBufferSize = std::min(BufferA.byteSize().getQuantity(),
   BufferB.byteSize().getQuantity());
diff --git a/clang/lib/AST/ByteCode/InterpBuiltinBitCast.cpp 
b/clang/lib/AST/ByteCode/InterpBuiltinBitCast.cpp
index c87993b8739a77..07f76943708216 100644
--- a/clang/lib/AST/ByteCode/InterpBuiltinBitCast.cpp
+++ b/clang/lib/AST/ByteCode/InterpBuiltinBitCast.cpp
@@ -73,11 +73,6 @@ using DataFunc =
 }  
\
   } while (0)
 
-static void swapBytes(std::byte *M, size_t N) {
-  for (size_t I = 0; I != (N / 2); ++I)
-std::swap(M[I], M[N - 1 - I]);
-}
-
 /// We use this to recursively iterate over all fields and elements of a 
pointer
 /// and extract relevant data for a bitcast.
 static bool enumerateData(const Pointer &P, const Context &Ctx, Bits Offset,
diff --git a/clang/lib/AST/ByteCode/InterpBuiltinBitCast.h 
b/clang/lib/AST/ByteCode/InterpBuiltinBitCast.h
index 08c207c7415dfa..b45613b2f21e20 100644
--- a/clang/lib/AST/ByteCode/InterpBuiltinBitCast.h
+++ b/clang/lib/AST/ByteCode/InterpBuiltinBitCast.h
@@ -19,6 +19,11 @@ class InterpState;
 class CodePtr;
 class Context;
 
+inline static void swapBytes(std::byte *M, size_t N) {
+  for (size_t I = 0; I != (N / 2); ++I)
+std::swap(M[I], M[N - 1 - I]);
+}
+
 bool DoBitCast(InterpState &S, CodePtr OpPC, const Pointer &Ptr,
std::byte *Buff, Bits BitWidth, Bits FullBitWidth,
bool &HasIndeterminateBits);

``




https://github.com/llvm/llvm-project/pull/119851
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] Generate appropriate assume in presence of libc's memcpy (PR #119704)

2024-12-13 Thread Nikita Popov via cfe-commits

nikic wrote:

Yes, I'd expect this to more likely be a regression than an improvement. What 
was you original motivation for this?

https://github.com/llvm/llvm-project/pull/119704
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [flang] [flang] Add -f[no-]vectorize flags (PR #119718)

2024-12-13 Thread Tom Eccles via cfe-commits


@@ -6980,3 +6980,37 @@ void driver::applyOverrideOptions(SmallVectorImpl &Args,
   ++S;
   }
 }
+
+/// Vectorize at all optimization levels greater than 1 except for -Oz.
+/// For -Oz the loop vectorizer is disabled, while the slp vectorizer is
+/// enabled.
+bool driver::shouldEnableVectorizerAtOLevel(const ArgList &Args,

tblah wrote:

We have made some attempts to move shared logic out of `clang/` into 
`llvm/lib/Frontend/Driver`. Maybe this should go there too?

https://github.com/llvm/llvm-project/pull/119718
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [AArch64] Implement FP8 SVE intrinsics for fused multiply-add (PR #118126)

2024-12-13 Thread Momchil Velikov via cfe-commits

https://github.com/momchil-velikov updated 
https://github.com/llvm/llvm-project/pull/118126

>From 5bc5078af32cda3dbcf3ca8dd53b01996ad34ea1 Mon Sep 17 00:00:00 2001
From: Momchil Velikov 
Date: Mon, 25 Nov 2024 17:21:55 +
Subject: [PATCH 1/5] [AArch64] Implements FP8 SVE intrinsics for dot-product

This patch adds the following intrinsics:

* 8-bit floating-point dot product to single-precision.

  // Only if (__ARM_FEATURE_SVE2  && __ARM_FEATURE_FP8DOT4) || 
__ARM_FEATURE_SSVE_FP8DOT4
  svfloat32_t svdot[_f32_mf8]_fpm(svfloat32_t zda, svmfloat8_t zn, svmfloat8_t 
zm, fpm_t fpm);
  svfloat32_t svdot[_n_f32_mf8]_fpm(svfloat32_t zda, svmfloat8_t zn, mfloat8_t 
zm, fpm_t fpm);

* 8-bit floating-point indexed dot product to single-precision.

  // Only if (__ARM_FEATURE_SVE2  && __ARM_FEATURE_FP8DOT4) || 
__ARM_FEATURE_SSVE_FP8DOT4
  svfloat32_t svdot_lane[_f32_mf8]_fpm(svfloat32_t zda, svmfloat8_t zn, 
svmfloat8_t zm,
   uint64_t imm0_3, fpm_t fpm);

* 8-bit floating-point dot product to half-precision.

  // Only if (__ARM_FEATURE_SVE2  && __ARM_FEATURE_FP8DOT2) || 
__ARM_FEATURE_SSVE_FP8DOT2
  svfloat16_t svdot[_f16_mf8]_fpm(svfloat16_t zda, svmfloat8_t zn, svmfloat8_t 
zm, fpm_t fpm);
  svfloat16_t svdot[_n_f16_mf8]_fpm(svfloat16_t zda, svmfloat8_t zn, mfloat8_t 
zm, fpm_t fpm);

* 8-bit floating-point indexed dot product to half-precision.

  // Only if (__ARM_FEATURE_SVE2  && __ARM_FEATURE_FP8DOT2) || 
__ARM_FEATURE_SSVE_FP8DOT2
  svfloat16_t svdot_lane[_f16_mf8]_fpm(svfloat16_t zda, svmfloat8_t zn, 
svmfloat8_t zm,
   uint64_t imm0_7, fpm_t fpm);
---
 clang/include/clang/Basic/arm_sve.td  |  19 +++
 clang/include/clang/Basic/arm_sve_sme_incl.td |   1 +
 clang/lib/CodeGen/CGBuiltin.cpp   |  11 +-
 .../fp8-intrinsics/acle_sve2_fp8_fdot.c   | 149 ++
 .../aarch64-sve2-intrinsics/acle_sve2_fp8.c   |  23 ++-
 clang/utils/TableGen/SveEmitter.cpp   |   9 +-
 llvm/include/llvm/IR/IntrinsicsAArch64.td |  16 ++
 .../lib/Target/AArch64/AArch64SVEInstrInfo.td |   9 +-
 llvm/lib/Target/AArch64/SVEInstrFormats.td|  29 +++-
 llvm/test/CodeGen/AArch64/fp8-sve-fdot.ll |  41 +
 10 files changed, 293 insertions(+), 14 deletions(-)
 create mode 100644 
clang/test/CodeGen/AArch64/fp8-intrinsics/acle_sve2_fp8_fdot.c
 create mode 100644 llvm/test/CodeGen/AArch64/fp8-sve-fdot.ll

diff --git a/clang/include/clang/Basic/arm_sve.td 
b/clang/include/clang/Basic/arm_sve.td
index b9f40faf0b18e6..2c8ca8014387d3 100644
--- a/clang/include/clang/Basic/arm_sve.td
+++ b/clang/include/clang/Basic/arm_sve.td
@@ -2476,3 +2476,22 @@ let SVETargetGuard = "sve2,fp8", SMETargetGuard = 
"sme2,fp8" in {
   def SVFCVTNB : SInst<"svcvtnb_mf8[_f32_x2]_fpm", "~2>",  "f", MergeNone, 
"aarch64_sve_fp8_cvtnb", [VerifyRuntimeMode, SetsFPMR]>;
   def SVFCVTNT : SInst<"svcvtnt_mf8[_f32_x2]_fpm", "~~2>", "f", MergeNone, 
"aarch64_sve_fp8_cvtnt", [VerifyRuntimeMode, SetsFPMR]>;
 }
+
+let SVETargetGuard = "sve2,fp8dot2", SMETargetGuard ="sme,ssve-fp8dot2" in {
+  // 8-bit floating-point dot product to half-precision (vectors)
+  def SVFDOT_2WAY   :  SInst<"svdot[_f16_mf8]_fpm",   "dd~~>", "h", MergeNone, 
"aarch64_sve_fp8_fdot", [VerifyRuntimeMode, SetsFPMR]>;
+  def SVFDOT_N_2WAY :  SInst<"svdot[_n_f16_mf8]_fpm", "dd~!>", "h", MergeNone, 
"aarch64_sve_fp8_fdot", [VerifyRuntimeMode, SetsFPMR]>;
+
+  // 8-bit floating-point dot product to half-precision (indexed)
+  def SVFDOT_LANE_2WAY :  SInst<"svdot_lane[_f16_mf8]_fpm", "dd~~i>", "h", 
MergeNone, "aarch64_sve_fp8_fdot_lane", [VerifyRuntimeMode, SetsFPMR], 
[ImmCheck<3, ImmCheck0_7>]>;
+}
+
+let SVETargetGuard = "sve2,fp8dot4", SMETargetGuard ="sme,ssve-fp8dot4" in {
+  // 8-bit floating-point dot product to single-precision (vectors)
+  def SVFDOT_4WAY   : SInst<"svdot[_f32_mf8]_fpm",   "dd~~>", "f", MergeNone, 
"aarch64_sve_fp8_fdot", [VerifyRuntimeMode, SetsFPMR]>;
+  def SVFDOT_N_4WAY : SInst<"svdot[_n_f32_mf8]_fpm", "dd~!>", "f", MergeNone, 
"aarch64_sve_fp8_fdot", [VerifyRuntimeMode, SetsFPMR]>;
+
+  // 8-bit floating-point dot product to single-precision (indexed)
+  def SVFDOT_LANE_4WAY :  SInst<"svdot_lane[_f32_mf8]_fpm", "dd~~i>", "f", 
MergeNone, "aarch64_sve_fp8_fdot_lane", [VerifyRuntimeMode, SetsFPMR], 
[ImmCheck<3, ImmCheck0_3>]>;
+}
+
diff --git a/clang/include/clang/Basic/arm_sve_sme_incl.td 
b/clang/include/clang/Basic/arm_sve_sme_incl.td
index de10be7bdce0db..44201b15505599 100644
--- a/clang/include/clang/Basic/arm_sve_sme_incl.td
+++ b/clang/include/clang/Basic/arm_sve_sme_incl.td
@@ -105,6 +105,7 @@ include "arm_immcheck_incl.td"
 // N: svfloat64_t
 // $: svbfloat16_t
 // ~: svmfloat8_t
+// !: mfloat8_t (splat to svmfloat8_t)
 
 // J: Prefetch type (sv_prfop)
 
diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index 49a4c1ecc825e7..84048a4beac2c5 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBui

[clang] [clang][bytecode] Handle __builtin_memcmp (PR #119544)

2024-12-13 Thread Timm Baeder via cfe-commits

tbaederr wrote:

Yup, see https://github.com/llvm/llvm-project/pull/119851

https://github.com/llvm/llvm-project/pull/119544
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-cl] Don't add implicit NoBuiltinAttr to deleted or defaulted functions (PR #119719)

2024-12-13 Thread via cfe-commits

VScigolevs wrote:

I don't have write access. Please merge on my behalf

https://github.com/llvm/llvm-project/pull/119719
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang][bytecode] Fix memcmp/bcmp failures on big-endian hosts (PR #119851)

2024-12-13 Thread Timm Baeder via cfe-commits

https://github.com/tbaederr closed 
https://github.com/llvm/llvm-project/pull/119851
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 84b0f01 - [clang-cl] Don't add implicit NoBuiltinAttr to deleted or defaulted functions (#119719)

2024-12-13 Thread via cfe-commits

Author: VScigolevs
Date: 2024-12-13T12:24:31+01:00
New Revision: 84b0f0145887bbfe49fd4dc85490b14108a72cee

URL: 
https://github.com/llvm/llvm-project/commit/84b0f0145887bbfe49fd4dc85490b14108a72cee
DIFF: 
https://github.com/llvm/llvm-project/commit/84b0f0145887bbfe49fd4dc85490b14108a72cee.diff

LOG: [clang-cl] Don't add implicit NoBuiltinAttr to deleted or defaulted 
functions (#119719)

In Clang `#pragma function` is implemented by adding an implicit
NoBuiltin Attribute to all function definitions after the pragma. This
(wrongly) includes also defaulted or deleted functions, which results in
the error, shown in #116256.

As this attribute has no effect on the deleted or defaulted functions,
this commit fixes the previously mentioned issue by simply not adding
the attribute in such cases.

Fixes #116256

Added: 
clang/test/SemaCXX/msvc-pragma-function-no-builtin-attr.cpp

Modified: 
clang/lib/Sema/SemaAttr.cpp

Removed: 




diff  --git a/clang/lib/Sema/SemaAttr.cpp b/clang/lib/Sema/SemaAttr.cpp
index 479f47962a7c3d..44485e71d57a01 100644
--- a/clang/lib/Sema/SemaAttr.cpp
+++ b/clang/lib/Sema/SemaAttr.cpp
@@ -1310,6 +1310,8 @@ void Sema::AddOptnoneAttributeIfNoConflicts(FunctionDecl 
*FD,
 }
 
 void Sema::AddImplicitMSFunctionNoBuiltinAttr(FunctionDecl *FD) {
+  if (FD->isDeleted() || FD->isDefaulted())
+return;
   SmallVector V(MSFunctionNoBuiltins.begin(),
MSFunctionNoBuiltins.end());
   if (!MSFunctionNoBuiltins.empty())

diff  --git a/clang/test/SemaCXX/msvc-pragma-function-no-builtin-attr.cpp 
b/clang/test/SemaCXX/msvc-pragma-function-no-builtin-attr.cpp
new file mode 100644
index 00..cd2ac7d1edbefb
--- /dev/null
+++ b/clang/test/SemaCXX/msvc-pragma-function-no-builtin-attr.cpp
@@ -0,0 +1,32 @@
+// RUN: %clang_cl -fms-compatibility -Xclang -ast-dump -fsyntax-only %s | 
FileCheck %s
+
+extern "C" __inline float __cdecl fabsf(  float _X);
+// CHECK: FunctionDecl {{.*}} fabsf
+#pragma function(fabsf)
+  __inline float __cdecl fabsf(  float _X)
+{
+return 0;
+}
+// CHECK: FunctionDecl {{.*}} fabsf
+// CHECK: NoBuiltinAttr {{.*}} <> Implicit fabsf
+
+int bar() {
+  return 0;
+}
+// CHECK: FunctionDecl {{.*}} bar
+// CHECK: NoBuiltinAttr {{.*}} <> Implicit fabsf
+
+struct A {
+int foo() = delete;
+// CHECK: CXXMethodDecl {{.*}} foo 'int ()' delete
+// CHECK-NOT: NoBuiltinAttr
+A() = default;
+// CHECK: CXXConstructorDecl {{.*}} A 'void ()' default
+// CHECK-NOT: NoBuiltinAttr
+};
+
+int main() {
+return 0;
+}
+// CHECK: FunctionDecl {{.*}} main
+// CHECK: NoBuiltinAttr {{.*}} <> Implicit fabsf



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-cl] Don't add implicit NoBuiltinAttr to deleted or defaulted functions (PR #119719)

2024-12-13 Thread via cfe-commits

https://github.com/cor3ntin closed 
https://github.com/llvm/llvm-project/pull/119719
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-cl] Don't add implicit NoBuiltinAttr to deleted or defaulted functions (PR #119719)

2024-12-13 Thread via cfe-commits

github-actions[bot] wrote:



@VScigolevs Congratulations on having your first Pull Request (PR) merged into 
the LLVM Project!

Your changes will be combined with recent changes from other authors, then 
tested by our [build bots](https://lab.llvm.org/buildbot/). If there is a 
problem with a build, you may receive a report in an email or a comment on this 
PR.

Please check whether problems have been caused by your change specifically, as 
the builds can include changes from many authors. It is not uncommon for your 
change to be included in a build that fails due to someone else's changes, or 
infrastructure issues.

How to do this, and the rest of the post-merge process, is covered in detail 
[here](https://llvm.org/docs/MyFirstTypoFix.html#myfirsttypofix-issues-after-landing-your-pr).

If your change does cause a problem, it may be reverted, or you can revert it 
yourself. This is a normal part of [LLVM 
development](https://llvm.org/docs/DeveloperPolicy.html#patch-reversion-policy).
 You can fix your changes and open a new PR to merge them again.

If you don't get any reports, no action is required from you. Your changes are 
working as expected, well done!


https://github.com/llvm/llvm-project/pull/119719
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 8bf19ec - [clang] Fix use of dangling ptr in CommandLineTest (#119798)

2024-12-13 Thread via cfe-commits

Author: macurtis-amd
Date: 2024-12-13T05:27:00-06:00
New Revision: 8bf19ec444593b3076a446a8eeb5042bbf79dc65

URL: 
https://github.com/llvm/llvm-project/commit/8bf19ec444593b3076a446a8eeb5042bbf79dc65
DIFF: 
https://github.com/llvm/llvm-project/commit/8bf19ec444593b3076a446a8eeb5042bbf79dc65.diff

LOG: [clang] Fix use of dangling ptr in CommandLineTest (#119798)

If 'GeneratedArgsStorage' ever grows, contained strings may get copied
and data pointers stored in 'GeneratedArgs' may become invalid, pointing
to deallocated memory.

Added: 


Modified: 
clang/unittests/Frontend/CompilerInvocationTest.cpp

Removed: 




diff  --git a/clang/unittests/Frontend/CompilerInvocationTest.cpp 
b/clang/unittests/Frontend/CompilerInvocationTest.cpp
index 4ff6824f1e21e3..94ab9fe8451e0a 100644
--- a/clang/unittests/Frontend/CompilerInvocationTest.cpp
+++ b/clang/unittests/Frontend/CompilerInvocationTest.cpp
@@ -31,17 +31,19 @@ class CommandLineTest : public ::testing::Test {
 public:
   IntrusiveRefCntPtr Diags;
   SmallVector GeneratedArgs;
-  SmallVector GeneratedArgsStorage;
+  BumpPtrAllocator Alloc;
+  StringSaver StringPool;
   CompilerInvocation Invocation;
 
   const char *operator()(const Twine &Arg) {
-return GeneratedArgsStorage.emplace_back(Arg.str()).c_str();
+return StringPool.save(Arg).data();
   }
 
   CommandLineTest()
   : Diags(CompilerInstance::createDiagnostics(
 *llvm::vfs::getRealFileSystem(), new DiagnosticOptions(),
-new TextDiagnosticBuffer())) {}
+new TextDiagnosticBuffer())),
+StringPool(Alloc) {}
 };
 
 template 



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] Fix use of dangling ptr in CommandLineTest (PR #119798)

2024-12-13 Thread via cfe-commits

https://github.com/macurtis-amd closed 
https://github.com/llvm/llvm-project/pull/119798
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 30cbd09 - [clang][bytecode] Fix memcmp/bcmp failures on big-endian hosts (#119851)

2024-12-13 Thread via cfe-commits

Author: Timm Baeder
Date: 2024-12-13T12:19:27+01:00
New Revision: 30cbd09f4b8f7e94663631f0240d11bb754ea25b

URL: 
https://github.com/llvm/llvm-project/commit/30cbd09f4b8f7e94663631f0240d11bb754ea25b
DIFF: 
https://github.com/llvm/llvm-project/commit/30cbd09f4b8f7e94663631f0240d11bb754ea25b.diff

LOG: [clang][bytecode] Fix memcmp/bcmp failures on big-endian hosts (#119851)

See the discussion in

https://github.com/llvm/llvm-project/pull/119678#issuecomment-2539680746
and
https://github.com/llvm/llvm-project/pull/119544#issuecomment-2539678561

Added: 


Modified: 
clang/lib/AST/ByteCode/InterpBuiltin.cpp
clang/lib/AST/ByteCode/InterpBuiltinBitCast.cpp
clang/lib/AST/ByteCode/InterpBuiltinBitCast.h

Removed: 




diff  --git a/clang/lib/AST/ByteCode/InterpBuiltin.cpp 
b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
index 21baedf832eeac..c1c43672176add 100644
--- a/clang/lib/AST/ByteCode/InterpBuiltin.cpp
+++ b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
@@ -1943,10 +1943,18 @@ static bool interp__builtin_memcmp(InterpState &S, 
CodePtr OpPC,
   BitcastBuffer BufferA(
   Bits(S.getASTContext().getTypeSize(PtrA.getFieldDesc()->getType(;
   readPointerToBuffer(S.getContext(), PtrA, BufferA, false);
+  // FIXME: The swapping here is UNDOING something we do when reading the
+  // data into the buffer.
+  if (S.getASTContext().getTargetInfo().isBigEndian())
+swapBytes(BufferA.Data.get(), BufferA.byteSize().getQuantity());
 
   BitcastBuffer BufferB(
   Bits(S.getASTContext().getTypeSize(PtrB.getFieldDesc()->getType(;
   readPointerToBuffer(S.getContext(), PtrB, BufferB, false);
+  // FIXME: The swapping here is UNDOING something we do when reading the
+  // data into the buffer.
+  if (S.getASTContext().getTargetInfo().isBigEndian())
+swapBytes(BufferB.Data.get(), BufferB.byteSize().getQuantity());
 
   size_t MinBufferSize = std::min(BufferA.byteSize().getQuantity(),
   BufferB.byteSize().getQuantity());

diff  --git a/clang/lib/AST/ByteCode/InterpBuiltinBitCast.cpp 
b/clang/lib/AST/ByteCode/InterpBuiltinBitCast.cpp
index c87993b8739a77..07f76943708216 100644
--- a/clang/lib/AST/ByteCode/InterpBuiltinBitCast.cpp
+++ b/clang/lib/AST/ByteCode/InterpBuiltinBitCast.cpp
@@ -73,11 +73,6 @@ using DataFunc =
 }  
\
   } while (0)
 
-static void swapBytes(std::byte *M, size_t N) {
-  for (size_t I = 0; I != (N / 2); ++I)
-std::swap(M[I], M[N - 1 - I]);
-}
-
 /// We use this to recursively iterate over all fields and elements of a 
pointer
 /// and extract relevant data for a bitcast.
 static bool enumerateData(const Pointer &P, const Context &Ctx, Bits Offset,

diff  --git a/clang/lib/AST/ByteCode/InterpBuiltinBitCast.h 
b/clang/lib/AST/ByteCode/InterpBuiltinBitCast.h
index 08c207c7415dfa..b45613b2f21e20 100644
--- a/clang/lib/AST/ByteCode/InterpBuiltinBitCast.h
+++ b/clang/lib/AST/ByteCode/InterpBuiltinBitCast.h
@@ -19,6 +19,11 @@ class InterpState;
 class CodePtr;
 class Context;
 
+inline static void swapBytes(std::byte *M, size_t N) {
+  for (size_t I = 0; I != (N / 2); ++I)
+std::swap(M[I], M[N - 1 - I]);
+}
+
 bool DoBitCast(InterpState &S, CodePtr OpPC, const Pointer &Ptr,
std::byte *Buff, Bits BitWidth, Bits FullBitWidth,
bool &HasIndeterminateBits);



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [flang] [llvm] [mlir] [flang][OpenMP] Add frontend support for ompx_bare clause (PR #111106)

2024-12-13 Thread Ivan R. Ivanov via cfe-commits

https://github.com/ivanradanov updated 
https://github.com/llvm/llvm-project/pull/06

>From 4ac56a8ee42881f8abf60e69eb5ffdeb447fe910 Mon Sep 17 00:00:00 2001
From: Ivan Radanov Ivanov 
Date: Fri, 4 Oct 2024 16:20:36 +0900
Subject: [PATCH] [flang] Add frontend support for OpenMP extension bare clause

Fix ompx_bare printing

Add test

test

Order

Only accept ompx_bare on a combined "TARGET TEAMS" construct

Alphabetical ordering

Fail in the backend if we find ompx_bare

Fix test

Fix `omp target` error in clang

Add one more test

Fix rebase error

%openmp_flags is only available when omprt is built

Update mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp

Co-authored-by: Sergio Afonso 

Address review comments

fix rebase

Remove stray include
---
 clang/lib/Parse/ParseOpenMP.cpp   | 10 +++
 flang/lib/Lower/OpenMP/ClauseProcessor.cpp|  4 +++
 flang/lib/Lower/OpenMP/ClauseProcessor.h  |  1 +
 flang/lib/Lower/OpenMP/OpenMP.cpp |  2 ++
 flang/lib/Parser/openmp-parsers.cpp   |  1 +
 flang/lib/Semantics/check-omp-structure.cpp   | 12 +++-
 .../OpenMP/KernelLanguage/bare-clause.f90 | 10 +++
 flang/test/Semantics/OpenMP/ompx-bare.f90 | 30 +++
 .../Frontend/OpenMP/ConstructDecompositionT.h |  9 ++
 llvm/include/llvm/Frontend/OpenMP/OMP.td  |  1 +
 .../mlir/Dialect/OpenMP/OpenMPClauses.td  | 26 
 mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td |  9 +++---
 mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp  | 14 -
 .../OpenMP/OpenMPToLLVMIRTranslation.cpp  |  5 
 14 files changed, 122 insertions(+), 12 deletions(-)
 create mode 100644 flang/test/Lower/OpenMP/KernelLanguage/bare-clause.f90
 create mode 100644 flang/test/Semantics/OpenMP/ompx-bare.f90

diff --git a/clang/lib/Parse/ParseOpenMP.cpp b/clang/lib/Parse/ParseOpenMP.cpp
index b91928063169ee3..b4e973bc84a7b0a 100644
--- a/clang/lib/Parse/ParseOpenMP.cpp
+++ b/clang/lib/Parse/ParseOpenMP.cpp
@@ -3474,6 +3474,16 @@ OMPClause *Parser::ParseOpenMPClause(OpenMPDirectiveKind 
DKind,
 Clause = ParseOpenMPOMPXAttributesClause(WrongDirective);
 break;
   case OMPC_ompx_bare:
+if (DKind == llvm::omp::Directive::OMPD_target) {
+  // Flang splits the combined directives which requires OMPD_target to be
+  // marked as accepting the `ompx_bare` clause in `OMP.td`. Thus, we need
+  // to explicitly check whether this clause is applied to an `omp target`
+  // without `teams` and emit an error.
+  Diag(Tok, diag::err_omp_unexpected_clause)
+  << getOpenMPClauseName(CKind) << getOpenMPDirectiveName(DKind);
+  ErrorFound = true;
+  WrongDirective = true;
+}
 if (WrongDirective)
   Diag(Tok, diag::note_ompx_bare_clause)
   << getOpenMPClauseName(CKind) << "target teams";
diff --git a/flang/lib/Lower/OpenMP/ClauseProcessor.cpp 
b/flang/lib/Lower/OpenMP/ClauseProcessor.cpp
index 48c559a78b9bc4f..3c9831120351ee8 100644
--- a/flang/lib/Lower/OpenMP/ClauseProcessor.cpp
+++ b/flang/lib/Lower/OpenMP/ClauseProcessor.cpp
@@ -220,6 +220,10 @@ static void convertLoopBounds(lower::AbstractConverter 
&converter,
 // ClauseProcessor unique clauses
 
//===--===//
 
+bool ClauseProcessor::processBare(mlir::omp::BareClauseOps &result) const {
+  return markClauseOccurrence(result.bare);
+}
+
 bool ClauseProcessor::processBind(mlir::omp::BindClauseOps &result) const {
   if (auto *clause = findUniqueClause()) {
 fir::FirOpBuilder &firOpBuilder = converter.getFirOpBuilder();
diff --git a/flang/lib/Lower/OpenMP/ClauseProcessor.h 
b/flang/lib/Lower/OpenMP/ClauseProcessor.h
index e0fe917c50e8f8b..3942c54e6e935dc 100644
--- a/flang/lib/Lower/OpenMP/ClauseProcessor.h
+++ b/flang/lib/Lower/OpenMP/ClauseProcessor.h
@@ -53,6 +53,7 @@ class ClauseProcessor {
   : converter(converter), semaCtx(semaCtx), clauses(clauses) {}
 
   // 'Unique' clauses: They can appear at most once in the clause list.
+  bool processBare(mlir::omp::BareClauseOps &result) const;
   bool processBind(mlir::omp::BindClauseOps &result) const;
   bool
   processCollapse(mlir::Location currentLocation, lower::pft::Evaluation &eval,
diff --git a/flang/lib/Lower/OpenMP/OpenMP.cpp 
b/flang/lib/Lower/OpenMP/OpenMP.cpp
index c167d347b43159a..f30d2687682c8df 100644
--- a/flang/lib/Lower/OpenMP/OpenMP.cpp
+++ b/flang/lib/Lower/OpenMP/OpenMP.cpp
@@ -1184,6 +1184,7 @@ static void genTargetClauses(
 llvm::SmallVectorImpl &isDevicePtrSyms,
 llvm::SmallVectorImpl &mapSyms) {
   ClauseProcessor cp(converter, semaCtx, clauses);
+  cp.processBare(clauseOps);
   cp.processDepend(clauseOps);
   cp.processDevice(stmtCtx, clauseOps);
   cp.processHasDeviceAddr(clauseOps, hasDeviceAddrSyms);
@@ -2860,6 +2861,7 @@ static void genOMP(lower::AbstractConverter &converter, 
lower::SymMap &symTable,
 !std::holds_alternative(clause.u) &&
 !std::holds_alternative(clause.u) &&
  

[clang] 05860f9 - [WebKit checkers] Recognize ensureFoo functions (#119681)

2024-12-13 Thread via cfe-commits

Author: Ryosuke Niwa
Date: 2024-12-13T01:48:29-08:00
New Revision: 05860f9b384b9b8f8bb01fa8984dbc2833669a27

URL: 
https://github.com/llvm/llvm-project/commit/05860f9b384b9b8f8bb01fa8984dbc2833669a27
DIFF: 
https://github.com/llvm/llvm-project/commit/05860f9b384b9b8f8bb01fa8984dbc2833669a27.diff

LOG: [WebKit checkers] Recognize ensureFoo functions (#119681)

In WebKit, we often write Foo::ensureBar function which lazily
initializes m_bar and returns a raw pointer or a raw reference to m_bar.
Such a return value is safe to use for the duration of a member function
call in Foo so long as m_bar is const so that it never gets unset or
updated with a new value once it's initialized.

This PR adds support for recognizing these types of functions and
treating its return value as a safe origin of a function argument
(including "this") or a local variable.

Added: 


Modified: 
clang/lib/StaticAnalyzer/Checkers/WebKit/ASTUtils.cpp
clang/lib/StaticAnalyzer/Checkers/WebKit/ASTUtils.h
clang/lib/StaticAnalyzer/Checkers/WebKit/RawPtrRefCallArgsChecker.cpp
clang/lib/StaticAnalyzer/Checkers/WebKit/RawPtrRefLocalVarsChecker.cpp
clang/test/Analysis/Checkers/WebKit/call-args-checked-const-member.cpp
clang/test/Analysis/Checkers/WebKit/call-args-checked-ptr.cpp
clang/test/Analysis/Checkers/WebKit/call-args-counted-const-member.cpp
clang/test/Analysis/Checkers/WebKit/call-args.cpp
clang/test/Analysis/Checkers/WebKit/local-vars-checked-const-member.cpp
clang/test/Analysis/Checkers/WebKit/local-vars-counted-const-member.cpp
clang/test/Analysis/Checkers/WebKit/mock-types.h

Removed: 




diff  --git a/clang/lib/StaticAnalyzer/Checkers/WebKit/ASTUtils.cpp 
b/clang/lib/StaticAnalyzer/Checkers/WebKit/ASTUtils.cpp
index 69b63240d2075e..abf5d3ec193a41 100644
--- a/clang/lib/StaticAnalyzer/Checkers/WebKit/ASTUtils.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/WebKit/ASTUtils.cpp
@@ -13,6 +13,7 @@
 #include "clang/AST/DeclCXX.h"
 #include "clang/AST/ExprCXX.h"
 #include "clang/AST/ExprObjC.h"
+#include "clang/AST/StmtVisitor.h"
 #include 
 
 namespace clang {
@@ -158,6 +159,9 @@ bool isConstOwnerPtrMemberExpr(const clang::Expr *E) {
 E = ThisArg;
   }
 }
+  } else if (auto *OCE = dyn_cast(E)) {
+if (OCE->getOperator() == OO_Star && OCE->getNumArgs() == 1)
+  E = OCE->getArg(0);
   }
   auto *ME = dyn_cast(E);
   if (!ME)
@@ -169,4 +173,42 @@ bool isConstOwnerPtrMemberExpr(const clang::Expr *E) {
   return isOwnerPtrType(T) && T.isConstQualified();
 }
 
+class EnsureFunctionVisitor
+: public ConstStmtVisitor {
+public:
+  bool VisitStmt(const Stmt *S) {
+for (const Stmt *Child : S->children()) {
+  if (Child && !Visit(Child))
+return false;
+}
+return true;
+  }
+
+  bool VisitReturnStmt(const ReturnStmt *RS) {
+if (auto *RV = RS->getRetValue()) {
+  RV = RV->IgnoreParenCasts();
+  if (isa(RV))
+return true;
+  return isConstOwnerPtrMemberExpr(RV);
+}
+return false;
+  }
+};
+
+bool EnsureFunctionAnalysis::isACallToEnsureFn(const clang::Expr *E) const {
+  auto *MCE = dyn_cast(E);
+  if (!MCE)
+return false;
+  auto *Callee = MCE->getDirectCallee();
+  if (!Callee)
+return false;
+  auto *Body = Callee->getBody();
+  if (!Body)
+return false;
+  auto [CacheIt, IsNew] = Cache.insert(std::make_pair(Callee, false));
+  if (IsNew)
+CacheIt->second = EnsureFunctionVisitor().Visit(Body);
+  return CacheIt->second;
+}
+
 } // namespace clang

diff  --git a/clang/lib/StaticAnalyzer/Checkers/WebKit/ASTUtils.h 
b/clang/lib/StaticAnalyzer/Checkers/WebKit/ASTUtils.h
index ddbef0fba04489..b508043d0f37fd 100644
--- a/clang/lib/StaticAnalyzer/Checkers/WebKit/ASTUtils.h
+++ b/clang/lib/StaticAnalyzer/Checkers/WebKit/ASTUtils.h
@@ -67,6 +67,16 @@ bool isASafeCallArg(const clang::Expr *E);
 /// \returns true if E is a MemberExpr accessing a const smart pointer type.
 bool isConstOwnerPtrMemberExpr(const clang::Expr *E);
 
+/// \returns true if E is a CXXMemberCallExpr which returns a const smart
+/// pointer type.
+class EnsureFunctionAnalysis {
+  using CacheTy = llvm::DenseMap;
+  mutable CacheTy Cache{};
+
+public:
+  bool isACallToEnsureFn(const Expr *E) const;
+};
+
 /// \returns name of AST node or empty string.
 template  std::string safeGetName(const T *ASTNode) {
   const auto *const ND = llvm::dyn_cast_or_null(ASTNode);

diff  --git 
a/clang/lib/StaticAnalyzer/Checkers/WebKit/RawPtrRefCallArgsChecker.cpp 
b/clang/lib/StaticAnalyzer/Checkers/WebKit/RawPtrRefCallArgsChecker.cpp
index ef2d42ccada65c..56fa72c100ec8c 100644
--- a/clang/lib/StaticAnalyzer/Checkers/WebKit/RawPtrRefCallArgsChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/WebKit/RawPtrRefCallArgsChecker.cpp
@@ -33,6 +33,7 @@ class RawPtrRefCallArgsChecker
   mutable BugReporter *BR;
 
   TrivialFunctionAnalysis TFA;
+  EnsureFunctionAnalysis EFA;
 
 public:

[clang] [llvm] [TargetLibraryInfo] Add libmvec support for risc-v (PR #119844)

2024-12-13 Thread Zhijin Zeng via cfe-commits

zengdage wrote:

@mga-sc Hi, can you help to review the pr? I add RVVM1/2/4/8 in VFISAKind to 
support multiple LMUL value, maybe it can take full advantage of rvv register 
group. Your pr (https://github.com/llvm/llvm-project/pull/114014) looks like 
just support LMUL=2.

https://github.com/llvm/llvm-project/pull/119844
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [WebKit checkers] Recognize ensureFoo functions (PR #119681)

2024-12-13 Thread Ryosuke Niwa via cfe-commits

https://github.com/rniwa closed https://github.com/llvm/llvm-project/pull/119681
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] Document the return value of __builtin_COLUMN (PR #118360)

2024-12-13 Thread via cfe-commits

https://github.com/cor3ntin closed 
https://github.com/llvm/llvm-project/pull/118360
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] Document the return value of __builtin_COLUMN (PR #118360)

2024-12-13 Thread via cfe-commits

github-actions[bot] wrote:



@GeorgeKA Congratulations on having your first Pull Request (PR) merged into 
the LLVM Project!

Your changes will be combined with recent changes from other authors, then 
tested by our [build bots](https://lab.llvm.org/buildbot/). If there is a 
problem with a build, you may receive a report in an email or a comment on this 
PR.

Please check whether problems have been caused by your change specifically, as 
the builds can include changes from many authors. It is not uncommon for your 
change to be included in a build that fails due to someone else's changes, or 
infrastructure issues.

How to do this, and the rest of the post-merge process, is covered in detail 
[here](https://llvm.org/docs/MyFirstTypoFix.html#myfirsttypofix-issues-after-landing-your-pr).

If your change does cause a problem, it may be reverted, or you can revert it 
yourself. This is a normal part of [LLVM 
development](https://llvm.org/docs/DeveloperPolicy.html#patch-reversion-policy).
 You can fix your changes and open a new PR to merge them again.

If you don't get any reports, no action is required from you. Your changes are 
working as expected, well done!


https://github.com/llvm/llvm-project/pull/118360
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [WebKit checkers] Recognize adoptRef as a safe function (PR #119846)

2024-12-13 Thread Ryosuke Niwa via cfe-commits

https://github.com/rniwa created 
https://github.com/llvm/llvm-project/pull/119846

adoptRef in WebKit constructs Ref/RefPtr so treat it as such in 
isCtorOfRefCounted. Also removed the support for makeRef and makeRefPtr as they 
don't exist any more.

>From 6b4a6b832f61efc26396f60309744c2e7264156d Mon Sep 17 00:00:00 2001
From: Ryosuke Niwa 
Date: Fri, 13 Dec 2024 01:49:21 -0800
Subject: [PATCH] [WebKit checkers] Recognize adoptRef as a safe function

adoptRef in WebKit constructs Ref/RefPtr so treat it as such in 
isCtorOfRefCounted.
Also removed the support for makeRef and makeRefPtr as they don't exist any 
more.
---
 .../Checkers/WebKit/PtrTypesSemantics.cpp |  5 ++--
 .../Analysis/Checkers/WebKit/call-args.cpp| 17 +++
 .../Analysis/Checkers/WebKit/mock-types.h | 28 ++-
 3 files changed, 46 insertions(+), 4 deletions(-)

diff --git a/clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.cpp 
b/clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.cpp
index 797f3e1f3fba5a..5487fea1b956c8 100644
--- a/clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.cpp
@@ -125,9 +125,8 @@ bool isCtorOfRefCounted(const clang::FunctionDecl *F) {
   assert(F);
   const std::string &FunctionName = safeGetName(F);
 
-  return isRefType(FunctionName) || FunctionName == "makeRef" ||
- FunctionName == "makeRefPtr" || FunctionName == "UniqueRef" ||
- FunctionName == "makeUniqueRef" ||
+  return isRefType(FunctionName) || FunctionName == "adoptRef" ||
+ FunctionName == "UniqueRef" || FunctionName == "makeUniqueRef" ||
  FunctionName == "makeUniqueRefWithoutFastMallocCheck"
 
  || FunctionName == "String" || FunctionName == "AtomString" ||
diff --git a/clang/test/Analysis/Checkers/WebKit/call-args.cpp 
b/clang/test/Analysis/Checkers/WebKit/call-args.cpp
index 94efddeaf66cd8..574e3aa6ef476a 100644
--- a/clang/test/Analysis/Checkers/WebKit/call-args.cpp
+++ b/clang/test/Analysis/Checkers/WebKit/call-args.cpp
@@ -365,3 +365,20 @@ namespace call_with_explicit_temporary_obj {
 RefPtr { provide() }->method();
   }
 }
+
+namespace call_with_adopt_ref {
+  class Obj {
+  public:
+void ref() const;
+void deref() const;
+void method();
+  };
+
+  struct dummy {
+RefPtr any;
+  };
+
+  void foo() {
+adoptRef(new Obj)->method();
+  }
+}
diff --git a/clang/test/Analysis/Checkers/WebKit/mock-types.h 
b/clang/test/Analysis/Checkers/WebKit/mock-types.h
index fb1ee51c7ec1de..17c449b6c2ec26 100644
--- a/clang/test/Analysis/Checkers/WebKit/mock-types.h
+++ b/clang/test/Analysis/Checkers/WebKit/mock-types.h
@@ -46,7 +46,10 @@ template struct DefaultRefDerefTraits {
 template , typename 
RefDerefTraits = DefaultRefDerefTraits> struct Ref {
   typename PtrTraits::StorageType t;
 
+  enum AdoptTag { Adopt };
+
   Ref() : t{} {};
+  Ref(T &t, AdoptTag) : t(&t) { }
   Ref(T &t) : t(&RefDerefTraits::ref(t)) { }
   Ref(const Ref& o) : t(RefDerefTraits::refIfNotNull(PtrTraits::unwrap(o.t))) 
{ }
   Ref(Ref&& o) : t(o.leakRef()) { }
@@ -73,10 +76,19 @@ template , 
typename RefDerefTra
   T* leakRef() { return PtrTraits::exchange(t, nullptr); }
 };
 
+template  Ref adoptRef(T& t) {
+  using Ref = Ref;
+  return Ref(t, Ref::Adopt);
+}
+
+template class RefPtr;
+template RefPtr adoptRef(T*);
+
 template  struct RefPtr {
   T *t;
 
-  RefPtr() : t(new T) {}
+  RefPtr() : t(nullptr) { }
+
   RefPtr(T *t)
 : t(t) {
 if (t)
@@ -85,6 +97,9 @@ template  struct RefPtr {
   RefPtr(Ref&& o)
 : t(o.leakRef())
   { }
+  RefPtr(RefPtr&& o)
+: t(o.leakRef())
+  { }
   ~RefPtr() {
 if (t)
   t->deref();
@@ -110,8 +125,19 @@ template  struct RefPtr {
 return *this;
   }
   operator bool() const { return t; }
+
+private:
+  friend RefPtr adoptRef(T*);
+
+  // call_with_adopt_ref in call-args.cpp requires this method to be private.
+  enum AdoptTag { Adopt };
+  RefPtr(T *t, AdoptTag) : t(t) { }
 };
 
+template  RefPtr adoptRef(T* t) {
+  return RefPtr(t, RefPtr::Adopt);
+}
+
 template  bool operator==(const RefPtr &, const RefPtr &) {
   return false;
 }

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] Informative error for lifetimebound in decl-spec (PR #118567)

2024-12-13 Thread via cfe-commits

https://github.com/cor3ntin approved this pull request.

LGTM as long as there is a follow up :)

https://github.com/llvm/llvm-project/pull/118567
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [AArch64] Add intrinsics for SME FP8 FDOT single and multi instructions (PR #119845)

2024-12-13 Thread Jonathan Thackray via cfe-commits

https://github.com/jthackray created 
https://github.com/llvm/llvm-project/pull/119845

Add support for the following SME 8 bit floating-point dot-product intrinsics:

* svdot_single_za16_mf8_vg1x2_fpm(uint32_t slice, svmfloat8x2_t f8x2, 
svmfloat8_t f8, fpm_t fpm);
* svdot_single_za16_mf8_vg1x4_fpm(uint32_t slice, svmfloat8x2_t f8x2, 
svmfloat8_t f8, fpm_t fpm);
* svdot_single_za32_mf8_vg1x2_fpm(uint32_t slice, svmfloat8x2_t f8x2, 
svmfloat8_t f8, fpm_t fpm);
* svdot_single_za32_mf8_vg1x4_fpm(uint32_t slice, svmfloat8x2_t f8x2, 
svmfloat8_t f8, fpm_t fpm);
* svdot_za16_mf8_vg1x2_fpm(uint32_t slice, svmfloat8x2_t f8x2, svmfloat8_t f8, 
fpm_t fpm);
* svdot_za16_mf8_vg1x4_fpm(uint32_t slice, svmfloat8x2_t f8x2, svmfloat8_t f8, 
fpm_t fpm);
* svdot_za32_mf8_vg1x2_fpm(uint32_t slice, svmfloat8x2_t f8x2, svmfloat8_t f8, 
fpm_t fpm);
* svdot_za32_mf8_vg1x4_fpm(uint32_t slice, svmfloat8x2_t f8x2, svmfloat8_t f8, 
fpm_t fpm);

>From 6dcf15164f66467ad6e4cd6075d03e9f75331e5d Mon Sep 17 00:00:00 2001
From: Jonathan Thackray 
Date: Thu, 5 Dec 2024 21:13:46 +
Subject: [PATCH] [AArch64] Add intrinsics for SME FP8 FDOT single and multi
 instructions

Add support for the following SME 8 bit floating-point dot-product intrinsics:

* svdot_single_za16_mf8_vg1x2_fpm(uint32_t slice, svmfloat8x2_t f8x2, 
svmfloat8_t f8, fpm_t fpm);
* svdot_single_za16_mf8_vg1x4_fpm(uint32_t slice, svmfloat8x2_t f8x2, 
svmfloat8_t f8, fpm_t fpm);
* svdot_single_za32_mf8_vg1x2_fpm(uint32_t slice, svmfloat8x2_t f8x2, 
svmfloat8_t f8, fpm_t fpm);
* svdot_single_za32_mf8_vg1x4_fpm(uint32_t slice, svmfloat8x2_t f8x2, 
svmfloat8_t f8, fpm_t fpm);
* svdot_za16_mf8_vg1x2_fpm(uint32_t slice, svmfloat8x2_t f8x2, svmfloat8_t f8, 
fpm_t fpm);
* svdot_za16_mf8_vg1x4_fpm(uint32_t slice, svmfloat8x2_t f8x2, svmfloat8_t f8, 
fpm_t fpm);
* svdot_za32_mf8_vg1x2_fpm(uint32_t slice, svmfloat8x2_t f8x2, svmfloat8_t f8, 
fpm_t fpm);
* svdot_za32_mf8_vg1x4_fpm(uint32_t slice, svmfloat8x2_t f8x2, svmfloat8_t f8, 
fpm_t fpm);

Co-authored-by: Momchil Velikov 
Co-authored-by: Marian Lukac 
---
 clang/include/clang/Basic/arm_sme.td  |  12 ++
 .../sme2-intrinsics/acle_sme2_fp8_fdot.c  | 174 +-
 .../acle_sme2_fp8_fdot.c  |  16 ++
 llvm/include/llvm/IR/IntrinsicsAArch64.td |  36 
 .../lib/Target/AArch64/AArch64SMEInstrInfo.td |  17 +-
 llvm/lib/Target/AArch64/SMEInstrFormats.td|  64 +++
 .../AArch64/sme2-intrinsics-fp8-fdot.ll   | 112 +++
 7 files changed, 415 insertions(+), 16 deletions(-)

diff --git a/clang/include/clang/Basic/arm_sme.td 
b/clang/include/clang/Basic/arm_sme.td
index 0fae70866cd55e..e7625d8d3e0b8a 100644
--- a/clang/include/clang/Basic/arm_sme.td
+++ b/clang/include/clang/Basic/arm_sme.td
@@ -748,11 +748,23 @@ let SMETargetGuard = "sme2" in {
 let SMETargetGuard = "sme-f8f32" in {
   def SVDOT_LANE_FP8_ZA32_VG1x2 : Inst<"svdot_lane_za32[_mf8]_vg1x2_fpm", 
"vm2di>", "m", MergeNone, "aarch64_sme_fp8_fdot_lane_za32_vg1x2", [IsStreaming, 
IsInOutZA, SetsFPMR, IsOverloadNone], [ImmCheck<3, ImmCheck0_3>]>;
   def SVDOT_LANE_FP8_ZA32_VG1x4 : Inst<"svdot_lane_za32[_mf8]_vg1x4_fpm", 
"vm4di>", "m", MergeNone, "aarch64_sme_fp8_fdot_lane_za32_vg1x4", [IsStreaming, 
IsInOutZA, SetsFPMR, IsOverloadNone], [ImmCheck<3, ImmCheck0_3>]>;
+
+  def SVDOT_SINGLE_FP8_ZA32_VG1x2 : 
Inst<"svdot[_single]_za32[_mf8]_vg1x2_fpm", "vm2d>", "m", MergeNone, 
"aarch64_sme_fp8_fdot_single_za32_vg1x2", [IsStreaming, IsInOutZA, SetsFPMR, 
IsOverloadNone], []>;
+  def SVDOT_SINGLE_FP8_ZA32_VG1x4 : 
Inst<"svdot[_single]_za32[_mf8]_vg1x4_fpm", "vm4d>", "m", MergeNone, 
"aarch64_sme_fp8_fdot_single_za32_vg1x4", [IsStreaming, IsInOutZA, SetsFPMR, 
IsOverloadNone], []>;
+
+  def SVDOT_MULTI_FP8_ZA32_VG1x2 : Inst<"svdot_za32[_mf8]_vg1x2_fpm", "vm22>", 
"m", MergeNone, "aarch64_sme_fp8_fdot_multi_za32_vg1x2", [IsStreaming, 
IsInOutZA, SetsFPMR, IsOverloadNone], []>;
+  def SVDOT_MULTI_FP8_ZA32_VG1x4 : Inst<"svdot_za32[_mf8]_vg1x4_fpm", "vm44>", 
"m", MergeNone, "aarch64_sme_fp8_fdot_multi_za32_vg1x4", [IsStreaming, 
IsInOutZA, SetsFPMR, IsOverloadNone], []>;
 }
 
 let SMETargetGuard = "sme-f8f16" in {
   def SVDOT_LANE_FP8_ZA16_VG1x2 : Inst<"svdot_lane_za16[_mf8]_vg1x2_fpm", 
"vm2di>", "m", MergeNone, "aarch64_sme_fp8_fdot_lane_za16_vg1x2", [IsStreaming, 
IsInOutZA, SetsFPMR, IsOverloadNone], [ImmCheck<3, ImmCheck0_7>]>;
   def SVDOT_LANE_FP8_ZA16_VG1x4 : Inst<"svdot_lane_za16[_mf8]_vg1x4_fpm", 
"vm4di>", "m", MergeNone, "aarch64_sme_fp8_fdot_lane_za16_vg1x4", [IsStreaming, 
IsInOutZA, SetsFPMR, IsOverloadNone], [ImmCheck<3, ImmCheck0_7>]>;
+
+  def SVDOT_SINGLE_FP8_ZA16_VG1x2 : 
Inst<"svdot[_single]_za16[_mf8]_vg1x2_fpm", "vm2d>", "m", MergeNone, 
"aarch64_sme_fp8_fdot_single_za16_vg1x2", [IsStreaming, IsInOutZA, SetsFPMR, 
IsOverloadNone], []>;
+  def SVDOT_SINGLE_FP8_ZA16_VG1x4 : 
Inst<"svdot[_single]_za16[_mf8]_vg1x4_fpm", "vm4d>", "m", MergeNone, 
"aarch64_sme_fp8_fdot_single_za16_vg1x4", [IsStreaming, IsInOutZA,

[clang] [llvm] [AArch64] Add intrinsics for SME FP8 FDOT single and multi instructions (PR #119845)

2024-12-13 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: Jonathan Thackray (jthackray)


Changes

Add support for the following SME 8 bit floating-point dot-product intrinsics:

* svdot_single_za16_mf8_vg1x2_fpm(uint32_t slice, svmfloat8x2_t f8x2, 
svmfloat8_t f8, fpm_t fpm);
* svdot_single_za16_mf8_vg1x4_fpm(uint32_t slice, svmfloat8x2_t f8x2, 
svmfloat8_t f8, fpm_t fpm);
* svdot_single_za32_mf8_vg1x2_fpm(uint32_t slice, svmfloat8x2_t f8x2, 
svmfloat8_t f8, fpm_t fpm);
* svdot_single_za32_mf8_vg1x4_fpm(uint32_t slice, svmfloat8x2_t f8x2, 
svmfloat8_t f8, fpm_t fpm);
* svdot_za16_mf8_vg1x2_fpm(uint32_t slice, svmfloat8x2_t f8x2, svmfloat8_t f8, 
fpm_t fpm);
* svdot_za16_mf8_vg1x4_fpm(uint32_t slice, svmfloat8x2_t f8x2, svmfloat8_t f8, 
fpm_t fpm);
* svdot_za32_mf8_vg1x2_fpm(uint32_t slice, svmfloat8x2_t f8x2, svmfloat8_t f8, 
fpm_t fpm);
* svdot_za32_mf8_vg1x4_fpm(uint32_t slice, svmfloat8x2_t f8x2, svmfloat8_t f8, 
fpm_t fpm);

---

Patch is 38.49 KiB, truncated to 20.00 KiB below, full version: 
https://github.com/llvm/llvm-project/pull/119845.diff


7 Files Affected:

- (modified) clang/include/clang/Basic/arm_sme.td (+12) 
- (modified) clang/test/CodeGen/AArch64/sme2-intrinsics/acle_sme2_fp8_fdot.c 
(+167-7) 
- (modified) clang/test/Sema/aarch64-sme2-intrinsics/acle_sme2_fp8_fdot.c (+16) 
- (modified) llvm/include/llvm/IR/IntrinsicsAArch64.td (+36) 
- (modified) llvm/lib/Target/AArch64/AArch64SMEInstrInfo.td (+8-9) 
- (modified) llvm/lib/Target/AArch64/SMEInstrFormats.td (+64) 
- (modified) llvm/test/CodeGen/AArch64/sme2-intrinsics-fp8-fdot.ll (+112) 


``diff
diff --git a/clang/include/clang/Basic/arm_sme.td 
b/clang/include/clang/Basic/arm_sme.td
index 0fae70866cd55e..e7625d8d3e0b8a 100644
--- a/clang/include/clang/Basic/arm_sme.td
+++ b/clang/include/clang/Basic/arm_sme.td
@@ -748,11 +748,23 @@ let SMETargetGuard = "sme2" in {
 let SMETargetGuard = "sme-f8f32" in {
   def SVDOT_LANE_FP8_ZA32_VG1x2 : Inst<"svdot_lane_za32[_mf8]_vg1x2_fpm", 
"vm2di>", "m", MergeNone, "aarch64_sme_fp8_fdot_lane_za32_vg1x2", [IsStreaming, 
IsInOutZA, SetsFPMR, IsOverloadNone], [ImmCheck<3, ImmCheck0_3>]>;
   def SVDOT_LANE_FP8_ZA32_VG1x4 : Inst<"svdot_lane_za32[_mf8]_vg1x4_fpm", 
"vm4di>", "m", MergeNone, "aarch64_sme_fp8_fdot_lane_za32_vg1x4", [IsStreaming, 
IsInOutZA, SetsFPMR, IsOverloadNone], [ImmCheck<3, ImmCheck0_3>]>;
+
+  def SVDOT_SINGLE_FP8_ZA32_VG1x2 : 
Inst<"svdot[_single]_za32[_mf8]_vg1x2_fpm", "vm2d>", "m", MergeNone, 
"aarch64_sme_fp8_fdot_single_za32_vg1x2", [IsStreaming, IsInOutZA, SetsFPMR, 
IsOverloadNone], []>;
+  def SVDOT_SINGLE_FP8_ZA32_VG1x4 : 
Inst<"svdot[_single]_za32[_mf8]_vg1x4_fpm", "vm4d>", "m", MergeNone, 
"aarch64_sme_fp8_fdot_single_za32_vg1x4", [IsStreaming, IsInOutZA, SetsFPMR, 
IsOverloadNone], []>;
+
+  def SVDOT_MULTI_FP8_ZA32_VG1x2 : Inst<"svdot_za32[_mf8]_vg1x2_fpm", "vm22>", 
"m", MergeNone, "aarch64_sme_fp8_fdot_multi_za32_vg1x2", [IsStreaming, 
IsInOutZA, SetsFPMR, IsOverloadNone], []>;
+  def SVDOT_MULTI_FP8_ZA32_VG1x4 : Inst<"svdot_za32[_mf8]_vg1x4_fpm", "vm44>", 
"m", MergeNone, "aarch64_sme_fp8_fdot_multi_za32_vg1x4", [IsStreaming, 
IsInOutZA, SetsFPMR, IsOverloadNone], []>;
 }
 
 let SMETargetGuard = "sme-f8f16" in {
   def SVDOT_LANE_FP8_ZA16_VG1x2 : Inst<"svdot_lane_za16[_mf8]_vg1x2_fpm", 
"vm2di>", "m", MergeNone, "aarch64_sme_fp8_fdot_lane_za16_vg1x2", [IsStreaming, 
IsInOutZA, SetsFPMR, IsOverloadNone], [ImmCheck<3, ImmCheck0_7>]>;
   def SVDOT_LANE_FP8_ZA16_VG1x4 : Inst<"svdot_lane_za16[_mf8]_vg1x4_fpm", 
"vm4di>", "m", MergeNone, "aarch64_sme_fp8_fdot_lane_za16_vg1x4", [IsStreaming, 
IsInOutZA, SetsFPMR, IsOverloadNone], [ImmCheck<3, ImmCheck0_7>]>;
+
+  def SVDOT_SINGLE_FP8_ZA16_VG1x2 : 
Inst<"svdot[_single]_za16[_mf8]_vg1x2_fpm", "vm2d>", "m", MergeNone, 
"aarch64_sme_fp8_fdot_single_za16_vg1x2", [IsStreaming, IsInOutZA, SetsFPMR, 
IsOverloadNone], []>;
+  def SVDOT_SINGLE_FP8_ZA16_VG1x4 : 
Inst<"svdot[_single]_za16[_mf8]_vg1x4_fpm", "vm4d>", "m", MergeNone, 
"aarch64_sme_fp8_fdot_single_za16_vg1x4", [IsStreaming, IsInOutZA, SetsFPMR, 
IsOverloadNone], []>;
+
+  def SVDOT_MULTI_FP8_ZA16_VG1x2 : Inst<"svdot_za16[_mf8]_vg1x2_fpm", "vm22>", 
"m", MergeNone, "aarch64_sme_fp8_fdot_multi_za16_vg1x2", [IsStreaming, 
IsInOutZA, SetsFPMR, IsOverloadNone], []>;
+  def SVDOT_MULTI_FP8_ZA16_VG1x4 : Inst<"svdot_za16[_mf8]_vg1x4_fpm", "vm44>", 
"m", MergeNone, "aarch64_sme_fp8_fdot_multi_za16_vg1x4", [IsStreaming, 
IsInOutZA, SetsFPMR, IsOverloadNone], []>;
 }
 
 

diff --git a/clang/test/CodeGen/AArch64/sme2-intrinsics/acle_sme2_fp8_fdot.c 
b/clang/test/CodeGen/AArch64/sme2-intrinsics/acle_sme2_fp8_fdot.c
index 74d18c32d5b3ab..a151d162e01085 100644
--- a/clang/test/CodeGen/AArch64/sme2-intrinsics/acle_sme2_fp8_fdot.c
+++ b/clang/test/CodeGen/AArch64/sme2-intrinsics/acle_sme2_fp8_fdot.c
@@ -1,18 +1,18 @@
 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py 
UTC_ARGS:

[clang] [clang] Generate appropriate assume in presence of libc's memcpy (PR #119704)

2024-12-13 Thread via cfe-commits

serge-sans-paille wrote:

For the record, I've added the assumption that seems to correctly capture 
current UB. I'm not 100% sure it's worth generating them now though?

https://github.com/llvm/llvm-project/pull/119704
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [WebKit checkers] Recognize adoptRef as a safe function (PR #119846)

2024-12-13 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang-static-analyzer-1

Author: Ryosuke Niwa (rniwa)


Changes

adoptRef in WebKit constructs Ref/RefPtr so treat it as such in 
isCtorOfRefCounted. Also removed the support for makeRef and makeRefPtr as they 
don't exist any more.

---
Full diff: https://github.com/llvm/llvm-project/pull/119846.diff


3 Files Affected:

- (modified) clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.cpp 
(+2-3) 
- (modified) clang/test/Analysis/Checkers/WebKit/call-args.cpp (+17) 
- (modified) clang/test/Analysis/Checkers/WebKit/mock-types.h (+27-1) 


``diff
diff --git a/clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.cpp 
b/clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.cpp
index 797f3e1f3fba5a..5487fea1b956c8 100644
--- a/clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.cpp
@@ -125,9 +125,8 @@ bool isCtorOfRefCounted(const clang::FunctionDecl *F) {
   assert(F);
   const std::string &FunctionName = safeGetName(F);
 
-  return isRefType(FunctionName) || FunctionName == "makeRef" ||
- FunctionName == "makeRefPtr" || FunctionName == "UniqueRef" ||
- FunctionName == "makeUniqueRef" ||
+  return isRefType(FunctionName) || FunctionName == "adoptRef" ||
+ FunctionName == "UniqueRef" || FunctionName == "makeUniqueRef" ||
  FunctionName == "makeUniqueRefWithoutFastMallocCheck"
 
  || FunctionName == "String" || FunctionName == "AtomString" ||
diff --git a/clang/test/Analysis/Checkers/WebKit/call-args.cpp 
b/clang/test/Analysis/Checkers/WebKit/call-args.cpp
index 94efddeaf66cd8..574e3aa6ef476a 100644
--- a/clang/test/Analysis/Checkers/WebKit/call-args.cpp
+++ b/clang/test/Analysis/Checkers/WebKit/call-args.cpp
@@ -365,3 +365,20 @@ namespace call_with_explicit_temporary_obj {
 RefPtr { provide() }->method();
   }
 }
+
+namespace call_with_adopt_ref {
+  class Obj {
+  public:
+void ref() const;
+void deref() const;
+void method();
+  };
+
+  struct dummy {
+RefPtr any;
+  };
+
+  void foo() {
+adoptRef(new Obj)->method();
+  }
+}
diff --git a/clang/test/Analysis/Checkers/WebKit/mock-types.h 
b/clang/test/Analysis/Checkers/WebKit/mock-types.h
index fb1ee51c7ec1de..17c449b6c2ec26 100644
--- a/clang/test/Analysis/Checkers/WebKit/mock-types.h
+++ b/clang/test/Analysis/Checkers/WebKit/mock-types.h
@@ -46,7 +46,10 @@ template struct DefaultRefDerefTraits {
 template , typename 
RefDerefTraits = DefaultRefDerefTraits> struct Ref {
   typename PtrTraits::StorageType t;
 
+  enum AdoptTag { Adopt };
+
   Ref() : t{} {};
+  Ref(T &t, AdoptTag) : t(&t) { }
   Ref(T &t) : t(&RefDerefTraits::ref(t)) { }
   Ref(const Ref& o) : t(RefDerefTraits::refIfNotNull(PtrTraits::unwrap(o.t))) 
{ }
   Ref(Ref&& o) : t(o.leakRef()) { }
@@ -73,10 +76,19 @@ template , 
typename RefDerefTra
   T* leakRef() { return PtrTraits::exchange(t, nullptr); }
 };
 
+template  Ref adoptRef(T& t) {
+  using Ref = Ref;
+  return Ref(t, Ref::Adopt);
+}
+
+template class RefPtr;
+template RefPtr adoptRef(T*);
+
 template  struct RefPtr {
   T *t;
 
-  RefPtr() : t(new T) {}
+  RefPtr() : t(nullptr) { }
+
   RefPtr(T *t)
 : t(t) {
 if (t)
@@ -85,6 +97,9 @@ template  struct RefPtr {
   RefPtr(Ref&& o)
 : t(o.leakRef())
   { }
+  RefPtr(RefPtr&& o)
+: t(o.leakRef())
+  { }
   ~RefPtr() {
 if (t)
   t->deref();
@@ -110,8 +125,19 @@ template  struct RefPtr {
 return *this;
   }
   operator bool() const { return t; }
+
+private:
+  friend RefPtr adoptRef(T*);
+
+  // call_with_adopt_ref in call-args.cpp requires this method to be private.
+  enum AdoptTag { Adopt };
+  RefPtr(T *t, AdoptTag) : t(t) { }
 };
 
+template  RefPtr adoptRef(T* t) {
+  return RefPtr(t, RefPtr::Adopt);
+}
+
 template  bool operator==(const RefPtr &, const RefPtr &) {
   return false;
 }

``




https://github.com/llvm/llvm-project/pull/119846
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [WebKit checkers] Recognize adoptRef as a safe function (PR #119846)

2024-12-13 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: Ryosuke Niwa (rniwa)


Changes

adoptRef in WebKit constructs Ref/RefPtr so treat it as such in 
isCtorOfRefCounted. Also removed the support for makeRef and makeRefPtr as they 
don't exist any more.

---
Full diff: https://github.com/llvm/llvm-project/pull/119846.diff


3 Files Affected:

- (modified) clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.cpp 
(+2-3) 
- (modified) clang/test/Analysis/Checkers/WebKit/call-args.cpp (+17) 
- (modified) clang/test/Analysis/Checkers/WebKit/mock-types.h (+27-1) 


``diff
diff --git a/clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.cpp 
b/clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.cpp
index 797f3e1f3fba5a..5487fea1b956c8 100644
--- a/clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.cpp
@@ -125,9 +125,8 @@ bool isCtorOfRefCounted(const clang::FunctionDecl *F) {
   assert(F);
   const std::string &FunctionName = safeGetName(F);
 
-  return isRefType(FunctionName) || FunctionName == "makeRef" ||
- FunctionName == "makeRefPtr" || FunctionName == "UniqueRef" ||
- FunctionName == "makeUniqueRef" ||
+  return isRefType(FunctionName) || FunctionName == "adoptRef" ||
+ FunctionName == "UniqueRef" || FunctionName == "makeUniqueRef" ||
  FunctionName == "makeUniqueRefWithoutFastMallocCheck"
 
  || FunctionName == "String" || FunctionName == "AtomString" ||
diff --git a/clang/test/Analysis/Checkers/WebKit/call-args.cpp 
b/clang/test/Analysis/Checkers/WebKit/call-args.cpp
index 94efddeaf66cd8..574e3aa6ef476a 100644
--- a/clang/test/Analysis/Checkers/WebKit/call-args.cpp
+++ b/clang/test/Analysis/Checkers/WebKit/call-args.cpp
@@ -365,3 +365,20 @@ namespace call_with_explicit_temporary_obj {
 RefPtr { provide() }->method();
   }
 }
+
+namespace call_with_adopt_ref {
+  class Obj {
+  public:
+void ref() const;
+void deref() const;
+void method();
+  };
+
+  struct dummy {
+RefPtr any;
+  };
+
+  void foo() {
+adoptRef(new Obj)->method();
+  }
+}
diff --git a/clang/test/Analysis/Checkers/WebKit/mock-types.h 
b/clang/test/Analysis/Checkers/WebKit/mock-types.h
index fb1ee51c7ec1de..17c449b6c2ec26 100644
--- a/clang/test/Analysis/Checkers/WebKit/mock-types.h
+++ b/clang/test/Analysis/Checkers/WebKit/mock-types.h
@@ -46,7 +46,10 @@ template struct DefaultRefDerefTraits {
 template , typename 
RefDerefTraits = DefaultRefDerefTraits> struct Ref {
   typename PtrTraits::StorageType t;
 
+  enum AdoptTag { Adopt };
+
   Ref() : t{} {};
+  Ref(T &t, AdoptTag) : t(&t) { }
   Ref(T &t) : t(&RefDerefTraits::ref(t)) { }
   Ref(const Ref& o) : t(RefDerefTraits::refIfNotNull(PtrTraits::unwrap(o.t))) 
{ }
   Ref(Ref&& o) : t(o.leakRef()) { }
@@ -73,10 +76,19 @@ template , 
typename RefDerefTra
   T* leakRef() { return PtrTraits::exchange(t, nullptr); }
 };
 
+template  Ref adoptRef(T& t) {
+  using Ref = Ref;
+  return Ref(t, Ref::Adopt);
+}
+
+template class RefPtr;
+template RefPtr adoptRef(T*);
+
 template  struct RefPtr {
   T *t;
 
-  RefPtr() : t(new T) {}
+  RefPtr() : t(nullptr) { }
+
   RefPtr(T *t)
 : t(t) {
 if (t)
@@ -85,6 +97,9 @@ template  struct RefPtr {
   RefPtr(Ref&& o)
 : t(o.leakRef())
   { }
+  RefPtr(RefPtr&& o)
+: t(o.leakRef())
+  { }
   ~RefPtr() {
 if (t)
   t->deref();
@@ -110,8 +125,19 @@ template  struct RefPtr {
 return *this;
   }
   operator bool() const { return t; }
+
+private:
+  friend RefPtr adoptRef(T*);
+
+  // call_with_adopt_ref in call-args.cpp requires this method to be private.
+  enum AdoptTag { Adopt };
+  RefPtr(T *t, AdoptTag) : t(t) { }
 };
 
+template  RefPtr adoptRef(T* t) {
+  return RefPtr(t, RefPtr::Adopt);
+}
+
 template  bool operator==(const RefPtr &, const RefPtr &) {
   return false;
 }

``




https://github.com/llvm/llvm-project/pull/119846
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [WebKit checkers] Recognize adoptRef as a safe function (PR #119846)

2024-12-13 Thread Ryosuke Niwa via cfe-commits


@@ -365,3 +365,20 @@ namespace call_with_explicit_temporary_obj {
 RefPtr { provide() }->method();
   }
 }
+
+namespace call_with_adopt_ref {
+  class Obj {
+  public:
+void ref() const;
+void deref() const;
+void method();
+  };
+
+  struct dummy {
+RefPtr any;

rniwa wrote:

For whatever reason, this must exist for the bug to reproduce.

https://github.com/llvm/llvm-project/pull/119846
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [WebKit checkers] Recognize adoptRef as a safe function (PR #119846)

2024-12-13 Thread Ryosuke Niwa via cfe-commits

https://github.com/rniwa updated 
https://github.com/llvm/llvm-project/pull/119846

>From 6b4a6b832f61efc26396f60309744c2e7264156d Mon Sep 17 00:00:00 2001
From: Ryosuke Niwa 
Date: Fri, 13 Dec 2024 01:49:21 -0800
Subject: [PATCH 1/2] [WebKit checkers] Recognize adoptRef as a safe function

adoptRef in WebKit constructs Ref/RefPtr so treat it as such in 
isCtorOfRefCounted.
Also removed the support for makeRef and makeRefPtr as they don't exist any 
more.
---
 .../Checkers/WebKit/PtrTypesSemantics.cpp |  5 ++--
 .../Analysis/Checkers/WebKit/call-args.cpp| 17 +++
 .../Analysis/Checkers/WebKit/mock-types.h | 28 ++-
 3 files changed, 46 insertions(+), 4 deletions(-)

diff --git a/clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.cpp 
b/clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.cpp
index 797f3e1f3fba5a..5487fea1b956c8 100644
--- a/clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.cpp
@@ -125,9 +125,8 @@ bool isCtorOfRefCounted(const clang::FunctionDecl *F) {
   assert(F);
   const std::string &FunctionName = safeGetName(F);
 
-  return isRefType(FunctionName) || FunctionName == "makeRef" ||
- FunctionName == "makeRefPtr" || FunctionName == "UniqueRef" ||
- FunctionName == "makeUniqueRef" ||
+  return isRefType(FunctionName) || FunctionName == "adoptRef" ||
+ FunctionName == "UniqueRef" || FunctionName == "makeUniqueRef" ||
  FunctionName == "makeUniqueRefWithoutFastMallocCheck"
 
  || FunctionName == "String" || FunctionName == "AtomString" ||
diff --git a/clang/test/Analysis/Checkers/WebKit/call-args.cpp 
b/clang/test/Analysis/Checkers/WebKit/call-args.cpp
index 94efddeaf66cd8..574e3aa6ef476a 100644
--- a/clang/test/Analysis/Checkers/WebKit/call-args.cpp
+++ b/clang/test/Analysis/Checkers/WebKit/call-args.cpp
@@ -365,3 +365,20 @@ namespace call_with_explicit_temporary_obj {
 RefPtr { provide() }->method();
   }
 }
+
+namespace call_with_adopt_ref {
+  class Obj {
+  public:
+void ref() const;
+void deref() const;
+void method();
+  };
+
+  struct dummy {
+RefPtr any;
+  };
+
+  void foo() {
+adoptRef(new Obj)->method();
+  }
+}
diff --git a/clang/test/Analysis/Checkers/WebKit/mock-types.h 
b/clang/test/Analysis/Checkers/WebKit/mock-types.h
index fb1ee51c7ec1de..17c449b6c2ec26 100644
--- a/clang/test/Analysis/Checkers/WebKit/mock-types.h
+++ b/clang/test/Analysis/Checkers/WebKit/mock-types.h
@@ -46,7 +46,10 @@ template struct DefaultRefDerefTraits {
 template , typename 
RefDerefTraits = DefaultRefDerefTraits> struct Ref {
   typename PtrTraits::StorageType t;
 
+  enum AdoptTag { Adopt };
+
   Ref() : t{} {};
+  Ref(T &t, AdoptTag) : t(&t) { }
   Ref(T &t) : t(&RefDerefTraits::ref(t)) { }
   Ref(const Ref& o) : t(RefDerefTraits::refIfNotNull(PtrTraits::unwrap(o.t))) 
{ }
   Ref(Ref&& o) : t(o.leakRef()) { }
@@ -73,10 +76,19 @@ template , 
typename RefDerefTra
   T* leakRef() { return PtrTraits::exchange(t, nullptr); }
 };
 
+template  Ref adoptRef(T& t) {
+  using Ref = Ref;
+  return Ref(t, Ref::Adopt);
+}
+
+template class RefPtr;
+template RefPtr adoptRef(T*);
+
 template  struct RefPtr {
   T *t;
 
-  RefPtr() : t(new T) {}
+  RefPtr() : t(nullptr) { }
+
   RefPtr(T *t)
 : t(t) {
 if (t)
@@ -85,6 +97,9 @@ template  struct RefPtr {
   RefPtr(Ref&& o)
 : t(o.leakRef())
   { }
+  RefPtr(RefPtr&& o)
+: t(o.leakRef())
+  { }
   ~RefPtr() {
 if (t)
   t->deref();
@@ -110,8 +125,19 @@ template  struct RefPtr {
 return *this;
   }
   operator bool() const { return t; }
+
+private:
+  friend RefPtr adoptRef(T*);
+
+  // call_with_adopt_ref in call-args.cpp requires this method to be private.
+  enum AdoptTag { Adopt };
+  RefPtr(T *t, AdoptTag) : t(t) { }
 };
 
+template  RefPtr adoptRef(T* t) {
+  return RefPtr(t, RefPtr::Adopt);
+}
+
 template  bool operator==(const RefPtr &, const RefPtr &) {
   return false;
 }

>From 0cdeb5676251a3c8d832baf1de800fe8a535b600 Mon Sep 17 00:00:00 2001
From: Ryosuke Niwa 
Date: Fri, 13 Dec 2024 01:58:00 -0800
Subject: [PATCH 2/2] Fix the mock RefPtr

---
 clang/test/Analysis/Checkers/WebKit/mock-types.h | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/clang/test/Analysis/Checkers/WebKit/mock-types.h 
b/clang/test/Analysis/Checkers/WebKit/mock-types.h
index 17c449b6c2ec26..9625ae6128883c 100644
--- a/clang/test/Analysis/Checkers/WebKit/mock-types.h
+++ b/clang/test/Analysis/Checkers/WebKit/mock-types.h
@@ -95,11 +95,13 @@ template  struct RefPtr {
   t->ref();
   }
   RefPtr(Ref&& o)
-: t(o.leakRef())
+: t(o.leafkRef())
   { }
   RefPtr(RefPtr&& o)
-: t(o.leakRef())
-  { }
+: t(o.t)
+  {
+o.t = nullptr;
+  }
   ~RefPtr() {
 if (t)
   t->deref();

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cf

[clang] 473e251 - [clang] Document the return value of __builtin_COLUMN (#118360)

2024-12-13 Thread via cfe-commits

Author: GeorgeKA
Date: 2024-12-13T10:50:12+01:00
New Revision: 473e2518e850598feae62916ebef4b4dbc88a0ee

URL: 
https://github.com/llvm/llvm-project/commit/473e2518e850598feae62916ebef4b4dbc88a0ee
DIFF: 
https://github.com/llvm/llvm-project/commit/473e2518e850598feae62916ebef4b4dbc88a0ee.diff

LOG: [clang] Document the return value of __builtin_COLUMN (#118360)

PR for issue #78657

Updated clang/docs/LanguageExtensions.rst to detail the return value of
__builtin_COLUMN for this implementation.

--

Fyi, this is my first contribution, so please bear with me.

There already appears to be a unit test for __builtin_COLUMN in
clang/test/SemaCXX/source_location.cpp.

Added: 


Modified: 
clang/docs/LanguageExtensions.rst

Removed: 




diff  --git a/clang/docs/LanguageExtensions.rst 
b/clang/docs/LanguageExtensions.rst
index 54b6f947a6a5a5..3d4f68b818bce7 100644
--- a/clang/docs/LanguageExtensions.rst
+++ b/clang/docs/LanguageExtensions.rst
@@ -4526,9 +4526,13 @@ default member initializer, the invocation point is the 
location of the
 constructor or aggregate initialization used to create the object. Otherwise
 the invocation point is the same as the location of the builtin.
 
-When the invocation point of ``__builtin_FUNCTION`` is not a function scope the
+When the invocation point of ``__builtin_FUNCTION`` is not a function scope, 
the
 empty string is returned.
 
+The builtin ``__builtin_COLUMN`` returns the offset from the start of the line,
+beginning from column 1. `This may 
diff er from other implementations.
+`_
+
 The builtin ``__builtin_source_location`` returns a pointer to constant static
 data of type ``std::source_location::__impl``. This type must have already been
 defined, and must contain exactly four fields: ``const char *_M_file_name``,



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] Generate appropriate assume in presence of libc's memcpy (PR #119704)

2024-12-13 Thread via cfe-commits

serge-sans-paille wrote:

My original motivation was a colleague pointing me at 
https://godbolt.org/z/cPdx6v13r which was specific to gcc but an interesting 
situation and I wanted clang to be on-par with GCC on that behavior.

https://github.com/llvm/llvm-project/pull/119704
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [flang] [llvm] [mlir] [flang][OpenMP] Add frontend support for ompx_bare clause (PR #111106)

2024-12-13 Thread Ivan R. Ivanov via cfe-commits

https://github.com/ivanradanov closed 
https://github.com/llvm/llvm-project/pull/06
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] Fix SemaCXX/msvc-pragma-function-no-builtin-attr.cpp test (PR #119873)

2024-12-13 Thread via cfe-commits

https://github.com/VScigolevs created 
https://github.com/llvm/llvm-project/pull/119873

Fix test failure from 84b0f0145887bbfe49fd4dc85490b14108a72cee

>From 0def02261cc8e5f3f3711832093efa7f56437745 Mon Sep 17 00:00:00 2001
From: Vladimirs Scigolevs 
Date: Fri, 13 Dec 2024 14:47:04 +0200
Subject: [PATCH] Fix SemaCXX/msvc-pragma-function-no-builtin-attr.cpp test

Fix test failure from 84b0f0145887bbfe49fd4dc85490b14108a72cee
---
 clang/test/SemaCXX/msvc-pragma-function-no-builtin-attr.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/test/SemaCXX/msvc-pragma-function-no-builtin-attr.cpp 
b/clang/test/SemaCXX/msvc-pragma-function-no-builtin-attr.cpp
index cd2ac7d1edbefb..066c66884e33c1 100644
--- a/clang/test/SemaCXX/msvc-pragma-function-no-builtin-attr.cpp
+++ b/clang/test/SemaCXX/msvc-pragma-function-no-builtin-attr.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cl -fms-compatibility -Xclang -ast-dump -fsyntax-only %s | 
FileCheck %s
+// RUN: %clang_cl -fms-compatibility -Xclang -ast-dump -fsyntax-only -- %s | 
FileCheck %s
 
 extern "C" __inline float __cdecl fabsf(  float _X);
 // CHECK: FunctionDecl {{.*}} fabsf

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] Fix SemaCXX/msvc-pragma-function-no-builtin-attr.cpp test (PR #119873)

2024-12-13 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: None (VScigolevs)


Changes

Fix test failure from 84b0f0145887bbfe49fd4dc85490b14108a72cee

---
Full diff: https://github.com/llvm/llvm-project/pull/119873.diff


1 Files Affected:

- (modified) clang/test/SemaCXX/msvc-pragma-function-no-builtin-attr.cpp (+1-1) 


``diff
diff --git a/clang/test/SemaCXX/msvc-pragma-function-no-builtin-attr.cpp 
b/clang/test/SemaCXX/msvc-pragma-function-no-builtin-attr.cpp
index cd2ac7d1edbefb..066c66884e33c1 100644
--- a/clang/test/SemaCXX/msvc-pragma-function-no-builtin-attr.cpp
+++ b/clang/test/SemaCXX/msvc-pragma-function-no-builtin-attr.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cl -fms-compatibility -Xclang -ast-dump -fsyntax-only %s | 
FileCheck %s
+// RUN: %clang_cl -fms-compatibility -Xclang -ast-dump -fsyntax-only -- %s | 
FileCheck %s
 
 extern "C" __inline float __cdecl fabsf(  float _X);
 // CHECK: FunctionDecl {{.*}} fabsf

``




https://github.com/llvm/llvm-project/pull/119873
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] Fix SemaCXX/msvc-pragma-function-no-builtin-attr.cpp test (PR #119873)

2024-12-13 Thread Paul Osmialowski via cfe-commits

pawosm-arm wrote:

I suppose this is the reason check-clang fails today.


https://github.com/llvm/llvm-project/pull/119873
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [analyzer] Don't assume third iteration in loops (PR #119388)

2024-12-13 Thread Balazs Benics via cfe-commits


@@ -2801,8 +2799,35 @@ void ExprEngine::processBranch(const Stmt *Condition,
 if (StTrue && StFalse)
   assert(!isa(Condition));
 
-if (StTrue)
-  Builder.generateNode(StTrue, true, PredN);
+if (StTrue) {
+  // If we are processing a loop condition where two iterations have
+  // already been completed and the the false branch is also feasible, then

steakhal wrote:

```suggestion
  // already been completed and the false branch is also feasible, then
```

https://github.com/llvm/llvm-project/pull/119388
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [analyzer] Don't assume third iteration in loops (PR #119388)

2024-12-13 Thread Balazs Benics via cfe-commits


@@ -3724,6 +3749,10 @@ ExprEngine::getEagerlyAssumeBifurcationTags() {
   return std::make_pair(&TrueTag, &FalseTag);
 }
 
+/// The last expression where EagerlyAssume produced two transitions (i.e. it
+/// activated and the true and false case were both feasible).

steakhal wrote:

```suggestion
/// activated and the true and false cases were both feasible).
```

https://github.com/llvm/llvm-project/pull/119388
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [analyzer] Don't assume third iteration in loops (PR #119388)

2024-12-13 Thread Balazs Benics via cfe-commits


@@ -2801,8 +2799,35 @@ void ExprEngine::processBranch(const Stmt *Condition,
 if (StTrue && StFalse)
   assert(!isa(Condition));
 
-if (StTrue)
-  Builder.generateNode(StTrue, true, PredN);
+if (StTrue) {
+  // If we are processing a loop condition where two iterations have
+  // already been completed and the the false branch is also feasible, then
+  // don't assume a third iteration, because it is a redundant execution
+  // path (unlikely to be different from earlier loop exits) and can cause
+  // false positives if e.g. the loop iterates over a two-element structure
+  // with an opaque condition.
+  //
+  // The iteration count "2" is hardcoded because it's the natural limit:
+  // * the fact that the programmer wrote a loop (and not just an `if`)
+  //   implies that they thought that the loop body may be executed twice;
+  // * however, there are situations where the programmer knows that there
+  //   are at most two iterations, but writes a loop that appears to be
+  //   generic, because there is no special syntax for "loop with at most
+  //   two iterations". (This pattern is common in FFMPEG and appears in
+  //   many other projects as well.)
+  bool CompletedTwoIterations = IterationsCompletedInLoop.value_or(0) >= 2;
+  bool FalseAlsoFeasible =
+  StFalse ||
+  didEagerlyAssumeBifurcateAt(PrevState, dyn_cast(Condition));
+  bool SkipTrueBranch = CompletedTwoIterations && FalseAlsoFeasible;
+
+  // FIXME: This "don't assume third iteration" heuristic partially
+  // conflicts with the widen-loop analysis option (which is off by
+  // default). If we intend to support and stabilize the loop widening,
+  // we'll need to ensure that it 'plays nicely' with this logic.

steakhal wrote:

```suggestion
  // we must ensure that it 'plays nicely' with this logic.
```

https://github.com/llvm/llvm-project/pull/119388
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [analyzer] Don't assume third iteration in loops (PR #119388)

2024-12-13 Thread Balazs Benics via cfe-commits


@@ -2801,8 +2799,35 @@ void ExprEngine::processBranch(const Stmt *Condition,
 if (StTrue && StFalse)
   assert(!isa(Condition));
 
-if (StTrue)
-  Builder.generateNode(StTrue, true, PredN);
+if (StTrue) {
+  // If we are processing a loop condition where two iterations have
+  // already been completed and the the false branch is also feasible, then
+  // don't assume a third iteration, because it is a redundant execution
+  // path (unlikely to be different from earlier loop exits) and can cause
+  // false positives if e.g. the loop iterates over a two-element structure
+  // with an opaque condition.
+  //
+  // The iteration count "2" is hardcoded because it's the natural limit:
+  // * the fact that the programmer wrote a loop (and not just an `if`)
+  //   implies that they thought that the loop body may be executed twice;

steakhal wrote:

```suggestion
  //   implies that they thought that the loop body might be executed twice;
```

https://github.com/llvm/llvm-project/pull/119388
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [analyzer] Don't assume third iteration in loops (PR #119388)

2024-12-13 Thread Balazs Benics via cfe-commits


@@ -2801,8 +2799,35 @@ void ExprEngine::processBranch(const Stmt *Condition,
 if (StTrue && StFalse)
   assert(!isa(Condition));
 
-if (StTrue)
-  Builder.generateNode(StTrue, true, PredN);
+if (StTrue) {
+  // If we are processing a loop condition where two iterations have
+  // already been completed and the the false branch is also feasible, then
+  // don't assume a third iteration, because it is a redundant execution

steakhal wrote:

```suggestion
  // don't assume a third iteration because it is a redundant execution
```
IDK, but Grammarly told me so :D

https://github.com/llvm/llvm-project/pull/119388
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [analyzer] Don't assume third iteration in loops (PR #119388)

2024-12-13 Thread Balazs Benics via cfe-commits


@@ -2801,8 +2799,35 @@ void ExprEngine::processBranch(const Stmt *Condition,
 if (StTrue && StFalse)
   assert(!isa(Condition));
 
-if (StTrue)
-  Builder.generateNode(StTrue, true, PredN);
+if (StTrue) {
+  // If we are processing a loop condition where two iterations have
+  // already been completed and the the false branch is also feasible, then
+  // don't assume a third iteration, because it is a redundant execution
+  // path (unlikely to be different from earlier loop exits) and can cause
+  // false positives if e.g. the loop iterates over a two-element structure
+  // with an opaque condition.
+  //
+  // The iteration count "2" is hardcoded because it's the natural limit:
+  // * the fact that the programmer wrote a loop (and not just an `if`)
+  //   implies that they thought that the loop body may be executed twice;
+  // * however, there are situations where the programmer knows that there
+  //   are at most two iterations, but writes a loop that appears to be

steakhal wrote:

```suggestion
  //   are at most two iterations but writes a loop that appears to be
```

https://github.com/llvm/llvm-project/pull/119388
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [analyzer] Don't assume third iteration in loops (PR #119388)

2024-12-13 Thread Balazs Benics via cfe-commits

https://github.com/steakhal commented:

Thank you for the ping. I'm really busy lately with stabilizing Z3 refutation.

I really liked the extensive evaluation, which helped a lot forming my opinion 
here.
The diffs look all right. I only spotchecked some places the reports. I agree 
with your evaluation.

The content of the patch looks also correct. I only found a couple Grammarly 
spellings, but that's it.
I wonder how you found out that loop widening may conflict with this heuristic, 
were any tests broken that raised your awareness?

I have one concern with `didEagerlyAssumeBifurcateAt`, that it is bound and 
overwritten at the most recent eager split - which to my knowledge may not be 
the loop condition if we have something like this:
```c++
while (coin()) {
  if (coin()) { // #inner_coin
++num;
  }
}
```
Each time the `inner_coin` would spoil the `LastEagerlyAssumeBifurcationAt` 
trait between the loop iterations, right?

Storing `const Expr *` pointers is brittle for recursive functions too, where 
the same expression could appear in different LocationContexts. I wonder if we 
could make an example where it would confuse this heuristic.

I'm also not entirely convinced about nested loops - if this heuristic would 
kick in. This is basically a variant of the `coin` case I showed an example.

I don't have a counter example just yet, but I'm not sure I can spare the time 
to craft one.

Once again, big kudos for the extensive data. And I have no objections overall, 
I only have these minor questions before I'd approve this.

https://github.com/llvm/llvm-project/pull/119388
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [analyzer] Don't assume third iteration in loops (PR #119388)

2024-12-13 Thread Balazs Benics via cfe-commits

https://github.com/steakhal edited 
https://github.com/llvm/llvm-project/pull/119388
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [AArch64] Implement intrinsics for FMLAL/FMLALL (single) (PR #119568)

2024-12-13 Thread via cfe-commits


@@ -3888,6 +3888,24 @@ let TargetPrefix = "aarch64" in {
   llvm_nxv16i1_ty, llvm_nxv16i1_ty,
   llvm_nxv16i8_ty, llvm_nxv16i8_ty],
   [ImmArg>, IntrInaccessibleMemOnly, IntrHasSideEffects]>;
+
+  class SME_FP8_ZA_SINGLE_VGx1_Intrinsic
+: DefaultAttrsIntrinsic<[], [llvm_i32_ty,
+llvm_nxv16i8_ty,
+llvm_nxv16i8_ty],
+[IntrInaccessibleMemOnly, IntrHasSideEffects]>;
+
+  class SME_FP8_ZA_SINGLE_VGx2_Intrinsic
+: DefaultAttrsIntrinsic<[], [llvm_i32_ty,
+llvm_nxv16i8_ty, llvm_nxv16i8_ty,
+llvm_nxv16i8_ty],
+[IntrInaccessibleMemOnly, IntrHasSideEffects]>;
+
+  class SME_FP8_ZA_SINGLE_VGx4_Intrinsic
+: DefaultAttrsIntrinsic<[], [llvm_i32_ty,
+llvm_nxv16i8_ty, llvm_nxv16i8_ty, 
llvm_nxv16i8_ty, llvm_nxv16i8_ty,
+llvm_nxv16i8_ty],
+[IntrInaccessibleMemOnly, IntrHasSideEffects]>;

SpencerAbson wrote:

My understanding is that `IntrHasSideEffects` is how we describe the use of the 
non-operand `ZA` register - these intrinsics write to `ZA` and also read the 
FPMR, so we need to explicitly declare that they have side effects other than 
`IntrInaccessibleMemOnly`.

https://github.com/llvm/llvm-project/pull/119568
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [AArch64] Implement intrinsics for FMLAL/FMLALL (single) (PR #119568)

2024-12-13 Thread via cfe-commits


@@ -3888,6 +3888,24 @@ let TargetPrefix = "aarch64" in {
   llvm_nxv16i1_ty, llvm_nxv16i1_ty,
   llvm_nxv16i8_ty, llvm_nxv16i8_ty],
   [ImmArg>, IntrInaccessibleMemOnly, IntrHasSideEffects]>;
+
+  class SME_FP8_ZA_SINGLE_VGx1_Intrinsic
+: DefaultAttrsIntrinsic<[], [llvm_i32_ty,
+llvm_nxv16i8_ty,
+llvm_nxv16i8_ty],
+[IntrInaccessibleMemOnly, IntrHasSideEffects]>;
+
+  class SME_FP8_ZA_SINGLE_VGx2_Intrinsic
+: DefaultAttrsIntrinsic<[], [llvm_i32_ty,
+llvm_nxv16i8_ty, llvm_nxv16i8_ty,
+llvm_nxv16i8_ty],
+[IntrInaccessibleMemOnly, IntrHasSideEffects]>;
+
+  class SME_FP8_ZA_SINGLE_VGx4_Intrinsic
+: DefaultAttrsIntrinsic<[], [llvm_i32_ty,
+llvm_nxv16i8_ty, llvm_nxv16i8_ty, 
llvm_nxv16i8_ty, llvm_nxv16i8_ty,
+llvm_nxv16i8_ty],
+[IntrInaccessibleMemOnly, IntrHasSideEffects]>;

Lukacma wrote:

I see ! That makes sense

https://github.com/llvm/llvm-project/pull/119568
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [AArch64] Implement intrinsics for FMLAL/FMLALL (single) (PR #119568)

2024-12-13 Thread via cfe-commits

https://github.com/Lukacma approved this pull request.

LGTM

https://github.com/llvm/llvm-project/pull/119568
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-cl] Don't add implicit NoBuiltinAttr to deleted or defaulted functions (PR #119719)

2024-12-13 Thread via cfe-commits

VScigolevs wrote:

I'm aware of the test failure, and know how to fix it. Will create a PR soon

https://github.com/llvm/llvm-project/pull/119719
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 7c9404c - [flang][OpenMP] Add frontend support for ompx_bare clause (#111106)

2024-12-13 Thread via cfe-commits

Author: Ivan R. Ivanov
Date: 2024-12-13T21:44:43+09:00
New Revision: 7c9404c279cfa13e24a043e6357cc85bd12f55f1

URL: 
https://github.com/llvm/llvm-project/commit/7c9404c279cfa13e24a043e6357cc85bd12f55f1
DIFF: 
https://github.com/llvm/llvm-project/commit/7c9404c279cfa13e24a043e6357cc85bd12f55f1.diff

LOG: [flang][OpenMP] Add frontend support for ompx_bare clause (#06)

Added: 
flang/test/Lower/OpenMP/KernelLanguage/bare-clause.f90
flang/test/Semantics/OpenMP/ompx-bare.f90

Modified: 
clang/lib/Parse/ParseOpenMP.cpp
flang/lib/Lower/OpenMP/ClauseProcessor.cpp
flang/lib/Lower/OpenMP/ClauseProcessor.h
flang/lib/Lower/OpenMP/OpenMP.cpp
flang/lib/Parser/openmp-parsers.cpp
flang/lib/Semantics/check-omp-structure.cpp
llvm/include/llvm/Frontend/OpenMP/ConstructDecompositionT.h
llvm/include/llvm/Frontend/OpenMP/OMP.td
mlir/include/mlir/Dialect/OpenMP/OpenMPClauses.td
mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp
mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp

Removed: 




diff  --git a/clang/lib/Parse/ParseOpenMP.cpp b/clang/lib/Parse/ParseOpenMP.cpp
index b91928063169ee..b4e973bc84a7b0 100644
--- a/clang/lib/Parse/ParseOpenMP.cpp
+++ b/clang/lib/Parse/ParseOpenMP.cpp
@@ -3474,6 +3474,16 @@ OMPClause *Parser::ParseOpenMPClause(OpenMPDirectiveKind 
DKind,
 Clause = ParseOpenMPOMPXAttributesClause(WrongDirective);
 break;
   case OMPC_ompx_bare:
+if (DKind == llvm::omp::Directive::OMPD_target) {
+  // Flang splits the combined directives which requires OMPD_target to be
+  // marked as accepting the `ompx_bare` clause in `OMP.td`. Thus, we need
+  // to explicitly check whether this clause is applied to an `omp target`
+  // without `teams` and emit an error.
+  Diag(Tok, diag::err_omp_unexpected_clause)
+  << getOpenMPClauseName(CKind) << getOpenMPDirectiveName(DKind);
+  ErrorFound = true;
+  WrongDirective = true;
+}
 if (WrongDirective)
   Diag(Tok, diag::note_ompx_bare_clause)
   << getOpenMPClauseName(CKind) << "target teams";

diff  --git a/flang/lib/Lower/OpenMP/ClauseProcessor.cpp 
b/flang/lib/Lower/OpenMP/ClauseProcessor.cpp
index 48c559a78b9bc4..3c9831120351ee 100644
--- a/flang/lib/Lower/OpenMP/ClauseProcessor.cpp
+++ b/flang/lib/Lower/OpenMP/ClauseProcessor.cpp
@@ -220,6 +220,10 @@ static void convertLoopBounds(lower::AbstractConverter 
&converter,
 // ClauseProcessor unique clauses
 
//===--===//
 
+bool ClauseProcessor::processBare(mlir::omp::BareClauseOps &result) const {
+  return markClauseOccurrence(result.bare);
+}
+
 bool ClauseProcessor::processBind(mlir::omp::BindClauseOps &result) const {
   if (auto *clause = findUniqueClause()) {
 fir::FirOpBuilder &firOpBuilder = converter.getFirOpBuilder();

diff  --git a/flang/lib/Lower/OpenMP/ClauseProcessor.h 
b/flang/lib/Lower/OpenMP/ClauseProcessor.h
index e0fe917c50e8f8..3942c54e6e935d 100644
--- a/flang/lib/Lower/OpenMP/ClauseProcessor.h
+++ b/flang/lib/Lower/OpenMP/ClauseProcessor.h
@@ -53,6 +53,7 @@ class ClauseProcessor {
   : converter(converter), semaCtx(semaCtx), clauses(clauses) {}
 
   // 'Unique' clauses: They can appear at most once in the clause list.
+  bool processBare(mlir::omp::BareClauseOps &result) const;
   bool processBind(mlir::omp::BindClauseOps &result) const;
   bool
   processCollapse(mlir::Location currentLocation, lower::pft::Evaluation &eval,

diff  --git a/flang/lib/Lower/OpenMP/OpenMP.cpp 
b/flang/lib/Lower/OpenMP/OpenMP.cpp
index c167d347b43159..f30d2687682c8d 100644
--- a/flang/lib/Lower/OpenMP/OpenMP.cpp
+++ b/flang/lib/Lower/OpenMP/OpenMP.cpp
@@ -1184,6 +1184,7 @@ static void genTargetClauses(
 llvm::SmallVectorImpl &isDevicePtrSyms,
 llvm::SmallVectorImpl &mapSyms) {
   ClauseProcessor cp(converter, semaCtx, clauses);
+  cp.processBare(clauseOps);
   cp.processDepend(clauseOps);
   cp.processDevice(stmtCtx, clauseOps);
   cp.processHasDeviceAddr(clauseOps, hasDeviceAddrSyms);
@@ -2860,6 +2861,7 @@ static void genOMP(lower::AbstractConverter &converter, 
lower::SymMap &symTable,
 !std::holds_alternative(clause.u) &&
 !std::holds_alternative(clause.u) &&
 !std::holds_alternative(clause.u) &&
+!std::holds_alternative(clause.u) &&
 !std::holds_alternative(clause.u) &&
 !std::holds_alternative(clause.u) &&
 !std::holds_alternative(clause.u) &&

diff  --git a/flang/lib/Parser/openmp-parsers.cpp 
b/flang/lib/Parser/openmp-parsers.cpp
index 7d10de8c60977f..791fee3507b441 100644
--- a/flang/lib/Parser/openmp-parsers.cpp
+++ b/flang/lib/Parser/openmp-parsers.cpp
@@ -657,6 +657,7 @@ TYPE_PARSER(
parenthesized(scalarIntExpr))) ||
 "NUM_THREADS" >> construct(construct(
   

[clang] [llvm] [AArch64] Implement FP8 SVE intrinsics for fused multiply-add (PR #118126)

2024-12-13 Thread Momchil Velikov via cfe-commits

https://github.com/momchil-velikov updated 
https://github.com/llvm/llvm-project/pull/118126

>From 15478424a10e531d42f197dae5e2083e8d183c23 Mon Sep 17 00:00:00 2001
From: Momchil Velikov 
Date: Tue, 26 Nov 2024 18:01:03 +
Subject: [PATCH 1/3] [AArch64] Implement FP8 SVE intrinsics for fused
 multiply-add

This patch adds the following intrinsics:

* 8-bit floating-point multiply-add long to half-precision (bottom).

  // Only if (__ARM_FEATURE_SVE2  && __ARM_FEATURE_FP8FMA) || 
__ARM_FEATURE_SSVE_FP8FMA
  svfloat16_t svmlalb[_f16_mf8]_fpm(svfloat16_t zda, svmfloat8_t zn, 
svmfloat8_t zm, fpm_t fpm);
  svfloat16_t svmlalb[_n_f16_mf8]_fpm(svfloat16_t zda, svmfloat8_t zn, 
mfloat8_t zm, fpm_t fpm);

* 8-bit floating-point multiply-add long to half-precision (bottom, indexed).

  // Only if (__ARM_FEATURE_SVE2  && __ARM_FEATURE_FP8FMA) || 
__ARM_FEATURE_SSVE_FP8FMA
  svfloat16_t svmlalb_lane[_f16_mf8]_fpm(svfloat16_t zda, svmfloat8_t zn, 
svmfloat8_t zm,
 uint64_t imm0_15, fpm_t fpm);

* 8-bit floating-point multiply-add long to half-precision (top).

  // Only if (__ARM_FEATURE_SVE2  && __ARM_FEATURE_FP8FMA) || 
__ARM_FEATURE_SSVE_FP8FMA
  svfloat16_t svmlalt[_f16_mf8]_fpm(svfloat16_t zda, svmfloat8_t zn, 
svmfloat8_t zm, fpm_t fpm);
  svfloat16_t svmlalt[_n_f16_mf8]_fpm(svfloat16_t zda, svmfloat8_t zn, 
mfloat8_t zm, fpm_t fpm);

* 8-bit floating-point multiply-add long to half-precision (top, indexed).

  // Only if (__ARM_FEATURE_SVE2  && __ARM_FEATURE_FP8FMA) || 
__ARM_FEATURE_SSVE_FP8FMA
  svfloat16_t svmlalt_lane[_f16_mf8]_fpm(svfloat16_t zda, svmfloat8_t zn, 
svmfloat8_t zm,
 uint64_t imm0_15, fpm_t fpm);

* 8-bit floating-point multiply-add long long to single-precision (bottom 
bottom).

  // Only if (__ARM_FEATURE_SVE2  && __ARM_FEATURE_FP8FMA) || 
__ARM_FEATURE_SSVE_FP8FMA
  svfloat32_t svmlallbb[_f32_mf8]_fpm(svfloat32_t zda, svmfloat8_t zn, 
svmfloat8_t zm, fpm_t fpm);
  svfloat32_t svmlallbb[_n_f32_mf8]_fpm(svfloat32_t zda, svmfloat8_t zn, 
mfloat8_t zm, fpm_t fpm);

* 8-bit floating-point multiply-add long long to single-precision (bottom 
bottom, indexed).

  // Only if (__ARM_FEATURE_SVE2  && __ARM_FEATURE_FP8FMA) || 
__ARM_FEATURE_SSVE_FP8FMA
  svfloat32_t svmlallbb_lane[_f32_mf8]_fpm(svfloat32_t zda, svmfloat8_t zn, 
svmfloat8_t zm,
   uint64_t imm0_15, fpm_t fpm);

* 8-bit floating-point multiply-add long long to single-precision (bottom top).

  // Only if (__ARM_FEATURE_SVE2  && __ARM_FEATURE_FP8FMA) || 
__ARM_FEATURE_SSVE_FP8FMA
  svfloat32_t svmlallbt[_f32_mf8]_fpm(svfloat32_t zda, svmfloat8_t zn, 
svmfloat8_t zm, fpm_t fpm);
  svfloat32_t svmlallbt[_n_f32_mf8]_fpm(svfloat32_t zda, svmfloat8_t zn, 
mfloat8_t zm, fpm_t fpm);

* 8-bit floating-point multiply-add long long to single-precision (bottom top, 
indexed).

  // Only if (__ARM_FEATURE_SVE2  && __ARM_FEATURE_FP8FMA) || 
__ARM_FEATURE_SSVE_FP8FMA
  svfloat32_t svmlallbt_lane[_f32_mf8]_fpm(svfloat32_t zda, svmfloat8_t zn, 
svmfloat8_t zm,
   uint64_t imm0_15, fpm_t fpm);
* 8-bit floating-point multiply-add long long to single-precision (top bottom).

  // Only if (__ARM_FEATURE_SVE2  && __ARM_FEATURE_FP8FMA) || 
__ARM_FEATURE_SSVE_FP8FMA
  svfloat32_t svmlalltb[_f32_mf8]_fpm(svfloat32_t zda, svmfloat8_t zn, 
svmfloat8_t zm, fpm_t fpm);
  svfloat32_t svmlalltb[_n_f32_mf8]_fpm(svfloat32_t zda, svmfloat8_t zn, 
mfloat8_t zm, fpm_t fpm);

* 8-bit floating-point multiply-add long long to single-precision (top bottom, 
indexed).

  // Only if (__ARM_FEATURE_SVE2  && __ARM_FEATURE_FP8FMA) || 
__ARM_FEATURE_SSVE_FP8FMA
  svfloat32_t svmlalltb_lane[_f32_mf8]_fpm(svfloat32_t zda, svmfloat8_t zn, 
svmfloat8_t zm,
   uint64_t imm0_15, fpm_t fpm);
* 8-bit floating-point multiply-add long long to single-precision (top top).

  // Only if (__ARM_FEATURE_SVE2  && __ARM_FEATURE_FP8FMA) || 
__ARM_FEATURE_SSVE_FP8FMA
  svfloat32_t svmlalltt[_f32_mf8]_fpm(svfloat32_t zda, svmfloat8_t zn, 
svmfloat8_t zm, fpm_t fpm);
  svfloat32_t svmlalltt[_n_f32_mf8]_fpm(svfloat32_t zda, svmfloat8_t zn, 
mfloat8_t zm, fpm_t fpm);

* 8-bit floating-point multiply-add long long to single-precision (top top, 
indexed).

  // Only if (__ARM_FEATURE_SVE2  && __ARM_FEATURE_FP8FMA) || 
__ARM_FEATURE_SSVE_FP8FMA
  svfloat32_t svmlalltt_lane[_f32_mf8]_fpm(svfloat32_t zda, svmfloat8_t zn, 
svmfloat8_t zm,
   uint64_t imm0_15, fpm_t fpm);
---
 clang/include/clang/Basic/arm_sve.td  |  31 ++
 .../fp8-intrinsics/acle_sve2_fp8_fmla.c   | 389 ++
 .../aarch64-sve2-intrinsics/acle_sve2_fp8.c   |  53 ++-
 llvm/include/llvm/IR/IntrinsicsAArch64.td |  19 +
 .../lib/Target/AArch64/AArch64SVEInstrInfo.td |  24 +-
 llvm/lib/Target/AArch64/SVEInstrFormats.td|  22 +-
 llvm/test/CodeGen/AArch64/fp8-sve-fmla.ll | 

[clang] [clang][Driver][Darwin] Optionally use xcselect to find macOS SDK (PR #119670)

2024-12-13 Thread Carlo Cabrera via cfe-commits

carlocab wrote:

After excluding the `-darwin*` spelling from using `xcselect`, most of the 
failures go away, but one remains. I'll investigate it tomorrow.

I've left it as `XFAIL` for now, since it seems to be the least bad option 
(compared to `CLANG_NO_XCSELECT` or `UNSUPPORTED`), given:

> > I'm wondering if it's worth reviving the CLANG_NO_XCSELECT environment 
> > variable and then just setting them in these tests (and slowly getting rid 
> > of instances of CLANG_NO_XCSELECT as we find better fixes).
> 
> The downside here is that when investigating running each command, it might 
> be confusing that the error is not reproducing unless an env is set.
> 
> Alternative is just `UNSUPPORTED:` but that will reduce the coverage when 
> XCSELECT is configured.

https://github.com/llvm/llvm-project/pull/119670
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang][Driver][Darwin] Optionally use xcselect to find macOS SDK (PR #119670)

2024-12-13 Thread Carlo Cabrera via cfe-commits

carlocab wrote:

For reference, the failure from dropping `XFAIL` from 
`darwin-ld-platform-version-macos.c`:


Failure Log

```
+ /Users/carlocab/github/llvm-project/build-xcselect/bin/FileCheck 
--check-prefix=NOSDK 
/Users/carlocab/github/llvm-project/clang/test/Driver/darwin-ld-platform-version-macos.c
/Users/carlocab/github/llvm-project/clang/test/Driver/darwin-ld-platform-version-macos.c:50:11:
 error: NOSDK: expected string not found in input
// NOSDK: "-platform_version" "macos" "10.13.0" "10.13.0"
  ^
:1:1: note: scanning from here
clang version 20.0.0git (https://github.com/carlocab/llvm-project.git 
dc195bd7668c09b7ec94abf771b618170cfd4b78)
^
:6:141: note: possible intended match here
 "/usr/bin/ld" "-demangle" "-lto_library" 
"/Users/carlocab/github/llvm-project/build-xcselect/lib/libLTO.dylib" 
"-dynamic" "-arch" "x86_64" "-platform_version" "macos" "10.13.0" "15.2" 
"-syslibroot" 
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.2.sdk"
 "-mllvm" "-enable-linkonceodr-outlining" "-o" "a.out" 
"/Users/carlocab/github/llvm-project/build-xcselect/tools/clang/test/Driver/Output/darwin-ld-platform-version-macos.c.tmp.o"
 "-lSystem" 
"/Users/carlocab/github/llvm-project/build-xcselect/lib/clang/20/lib/darwin/libclang_rt.osx.a"

^

Input file: 
Check file: 
/Users/carlocab/github/llvm-project/clang/test/Driver/darwin-ld-platform-version-macos.c

-dump-input=help explains the following input dump.

Input was:
<<
1: clang version 20.0.0git 
(https://github.com/carlocab/llvm-project.git 
dc195bd7668c09b7ec94abf771b618170cfd4b78)
check:50'0 
X~~~
 error: no match found
2: Target: x86_64-apple-macos10.13
check:50'0 
3: Thread model: posix
check:50'0 
4: InstalledDir: 
/Users/carlocab/github/llvm-project/build-xcselect/bin
check:50'0 
~
5: Build config: +assertions
check:50'0 ~~
6:  "/usr/bin/ld" "-demangle" "-lto_library" 
"/Users/carlocab/github/llvm-project/build-xcselect/lib/libLTO.dylib" 
"-dynamic" "-arch" "x86_64" "-platform_version" "macos" "10.13.0" "15.2" 
"-syslibroot" 
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.2.sdk"
 "-mllvm" "-enable-linkonceodr-outlining" "-o" "a.out" 
"/Users/carlocab/github/llvm-project/build-xcselect/tools/clang/test/Driver/Output/darwin-ld-platform-version-macos.c.tmp.o"
 "-lSystem" 
"/Users/carlocab/github/llvm-project/build-xcselect/lib/clang/20/lib/darwin/libclang_rt.osx.a"
check:50'0 
~
check:50'1  
   ?





 possible intended match
>>
```



https://github.com/llvm/llvm-project/pull/119670
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [AArch64] Add FP8 Neon intrinsics for dot-product (PR #119911)

2024-12-13 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-backend-aarch64

Author: Momchil Velikov (momchil-velikov)


Changes


This patch adds the following intrinsics:

float16x4_t vdot_f16_mf8_fpm(float16x4_t vd, mfloat8x8_t vn, mfloat8x8_t 
vm, fpm_t fpm)
float16x8_t vdotq_f16_mf8_fpm(float16x8_t vd, mfloat8x16_t vn, mfloat8x16_t 
vm, fpm_t fpm)

float16x4_t vdot_lane_f16_mf8_fpm(float16x4_t vd, mfloat8x8_t vn, 
mfloat8x8_t vm, __builtin_constant_p(lane), fpm_t fpm)
float16x4_t vdot_laneq_f16_mf8_fpm(float16x4_t vd, mfloat8x8_t vn, 
mfloat8x16_t vm, __builtin_constant_p(lane), fpm_t fpm)
float16x8_t vdotq_lane_f16_mf8_fpm(float16x8_t vd, mfloat8x16_t vn, 
mfloat8x8_t vm, __builtin_constant_p(lane), fpm_t fpm)
float16x8_t vdotq_laneq_f16_mf8_fpm(float16x8_t vd, mfloat8x16_t vn, 
mfloat8x16_t vm, __builtin_constant_p(lane), fpm_t fpm)

---

Patch is 107.21 KiB, truncated to 20.00 KiB below, full version: 
https://github.com/llvm/llvm-project/pull/119911.diff


25 Files Affected:

- (modified) clang/include/clang/AST/Type.h (+9) 
- (modified) clang/include/clang/Basic/AArch64SVEACLETypes.def (+18-6) 
- (modified) clang/include/clang/Basic/DiagnosticSemaKinds.td (+5) 
- (modified) clang/include/clang/Basic/arm_neon.td (+46-1) 
- (modified) clang/include/clang/Basic/arm_neon_incl.td (+2) 
- (modified) clang/lib/AST/ASTContext.cpp (+30-7) 
- (modified) clang/lib/AST/ItaniumMangle.cpp (+5) 
- (modified) clang/lib/AST/Type.cpp (+14-3) 
- (modified) clang/lib/CodeGen/CGBuiltin.cpp (+166-1) 
- (modified) clang/lib/CodeGen/CodeGenFunction.h (+8) 
- (modified) clang/lib/CodeGen/CodeGenTypes.cpp (+10-3) 
- (modified) clang/lib/CodeGen/Targets/AArch64.cpp (+5-2) 
- (modified) clang/lib/Sema/SemaChecking.cpp (+33-6) 
- (added) clang/test/CodeGen/AArch64/builtin-shufflevector-fp8.c (+123) 
- (added) clang/test/CodeGen/AArch64/fp8-intrinsics/acle_neon_fp8_cvt.c (+308) 
- (added) clang/test/CodeGen/AArch64/fp8-intrinsics/acle_neon_fp8_fdot.c (+143) 
- (added) clang/test/Sema/aarch64-fp8-intrinsics/acle_neon_fp8.c (+57) 
- (added) clang/test/Sema/builtin-shufflevector.c (+30) 
- (modified) clang/utils/TableGen/NeonEmitter.cpp (+22-2) 
- (modified) clang/utils/TableGen/SveEmitter.cpp (+2-2) 
- (modified) llvm/include/llvm/IR/IntrinsicsAArch64.td (+43) 
- (modified) llvm/lib/Target/AArch64/AArch64InstrFormats.td (+83-45) 
- (modified) llvm/lib/Target/AArch64/AArch64InstrInfo.td (+14-14) 
- (added) llvm/test/CodeGen/AArch64/fp8-neon-fdot.ll (+74) 
- (added) llvm/test/CodeGen/AArch64/neon-fp8-cvt.ll (+112) 


``diff
diff --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h
index f0eee77c73ef06d..cacd3d75ffcd8de 100644
--- a/clang/include/clang/AST/Type.h
+++ b/clang/include/clang/AST/Type.h
@@ -2404,6 +2404,10 @@ class alignas(TypeAlignment) Type : public 
ExtQualsTypeCommonBase {
   /// SVE vector or predicate, excluding tuple types such as svint32x4_t.
   bool isSveVLSBuiltinType() const;
 
+  /// Determines if this is a *builtin* NEON vector type, a type not built with
+  /// `neon_vector_type`
+  bool isNeonVectorBuiltinType() const;
+
   /// Returns the representative type for the element of an SVE builtin type.
   /// This is used to represent fixed-length SVE vectors created with the
   /// 'arm_sve_vector_bits' type attribute as VectorType.
@@ -2518,6 +2522,7 @@ class alignas(TypeAlignment) Type : public 
ExtQualsTypeCommonBase {
   bool isFloat32Type() const;
   bool isDoubleType() const;
   bool isBFloat16Type() const;
+  bool isMFloat8Type() const;
   bool isFloat128Type() const;
   bool isIbm128Type() const;
   bool isRealType() const; // C99 6.2.5p17 (real floating + integer)
@@ -8532,6 +8537,10 @@ inline bool Type::isBFloat16Type() const {
   return isSpecificBuiltinType(BuiltinType::BFloat16);
 }
 
+inline bool Type::isMFloat8Type() const {
+  return isSpecificBuiltinType(BuiltinType::MFloat8);
+}
+
 inline bool Type::isFloat128Type() const {
   return isSpecificBuiltinType(BuiltinType::Float128);
 }
diff --git a/clang/include/clang/Basic/AArch64SVEACLETypes.def 
b/clang/include/clang/Basic/AArch64SVEACLETypes.def
index 063cac1f4a58ee7..6b704b386536c9b 100644
--- a/clang/include/clang/Basic/AArch64SVEACLETypes.def
+++ b/clang/include/clang/Basic/AArch64SVEACLETypes.def
@@ -57,6 +57,11 @@
 //  - IsBF true for vector of brain float elements.
 
//===--===//
 
+#ifndef SVE_SCALAR_TYPE
+#define SVE_SCALAR_TYPE(Name, MangledName, Id, SingletonId, Bits) \
+  SVE_TYPE(Name, Id, SingletonId)
+#endif
+
 #ifndef SVE_VECTOR_TYPE
 #define SVE_VECTOR_TYPE(Name, MangledName, Id, SingletonId) \
   SVE_TYPE(Name, Id, SingletonId)
@@ -72,6 +77,11 @@
   SVE_VECTOR_TYPE_DETAILS(Name, MangledName, Id, SingletonId, NumEls, ElBits, 
NF, false, false, true)
 #endif
 
+#ifndef SVE_VECTOR_TYPE_MFLOAT
+#define SVE_VECTOR_TYPE_MFLOAT(Name, MangledName, Id, SingletonId, NumEls, 
ElBits, NF) \
+  SVE_VECTOR_TYPE_DETAILS(Name, 

[clang] [llvm] [AArch64] Add FP8 Neon intrinsics for dot-product (PR #119911)

2024-12-13 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang-codegen

Author: Momchil Velikov (momchil-velikov)


Changes


This patch adds the following intrinsics:

float16x4_t vdot_f16_mf8_fpm(float16x4_t vd, mfloat8x8_t vn, mfloat8x8_t 
vm, fpm_t fpm)
float16x8_t vdotq_f16_mf8_fpm(float16x8_t vd, mfloat8x16_t vn, mfloat8x16_t 
vm, fpm_t fpm)

float16x4_t vdot_lane_f16_mf8_fpm(float16x4_t vd, mfloat8x8_t vn, 
mfloat8x8_t vm, __builtin_constant_p(lane), fpm_t fpm)
float16x4_t vdot_laneq_f16_mf8_fpm(float16x4_t vd, mfloat8x8_t vn, 
mfloat8x16_t vm, __builtin_constant_p(lane), fpm_t fpm)
float16x8_t vdotq_lane_f16_mf8_fpm(float16x8_t vd, mfloat8x16_t vn, 
mfloat8x8_t vm, __builtin_constant_p(lane), fpm_t fpm)
float16x8_t vdotq_laneq_f16_mf8_fpm(float16x8_t vd, mfloat8x16_t vn, 
mfloat8x16_t vm, __builtin_constant_p(lane), fpm_t fpm)

---

Patch is 107.21 KiB, truncated to 20.00 KiB below, full version: 
https://github.com/llvm/llvm-project/pull/119911.diff


25 Files Affected:

- (modified) clang/include/clang/AST/Type.h (+9) 
- (modified) clang/include/clang/Basic/AArch64SVEACLETypes.def (+18-6) 
- (modified) clang/include/clang/Basic/DiagnosticSemaKinds.td (+5) 
- (modified) clang/include/clang/Basic/arm_neon.td (+46-1) 
- (modified) clang/include/clang/Basic/arm_neon_incl.td (+2) 
- (modified) clang/lib/AST/ASTContext.cpp (+30-7) 
- (modified) clang/lib/AST/ItaniumMangle.cpp (+5) 
- (modified) clang/lib/AST/Type.cpp (+14-3) 
- (modified) clang/lib/CodeGen/CGBuiltin.cpp (+166-1) 
- (modified) clang/lib/CodeGen/CodeGenFunction.h (+8) 
- (modified) clang/lib/CodeGen/CodeGenTypes.cpp (+10-3) 
- (modified) clang/lib/CodeGen/Targets/AArch64.cpp (+5-2) 
- (modified) clang/lib/Sema/SemaChecking.cpp (+33-6) 
- (added) clang/test/CodeGen/AArch64/builtin-shufflevector-fp8.c (+123) 
- (added) clang/test/CodeGen/AArch64/fp8-intrinsics/acle_neon_fp8_cvt.c (+308) 
- (added) clang/test/CodeGen/AArch64/fp8-intrinsics/acle_neon_fp8_fdot.c (+143) 
- (added) clang/test/Sema/aarch64-fp8-intrinsics/acle_neon_fp8.c (+57) 
- (added) clang/test/Sema/builtin-shufflevector.c (+30) 
- (modified) clang/utils/TableGen/NeonEmitter.cpp (+22-2) 
- (modified) clang/utils/TableGen/SveEmitter.cpp (+2-2) 
- (modified) llvm/include/llvm/IR/IntrinsicsAArch64.td (+43) 
- (modified) llvm/lib/Target/AArch64/AArch64InstrFormats.td (+83-45) 
- (modified) llvm/lib/Target/AArch64/AArch64InstrInfo.td (+14-14) 
- (added) llvm/test/CodeGen/AArch64/fp8-neon-fdot.ll (+74) 
- (added) llvm/test/CodeGen/AArch64/neon-fp8-cvt.ll (+112) 


``diff
diff --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h
index f0eee77c73ef06d..cacd3d75ffcd8de 100644
--- a/clang/include/clang/AST/Type.h
+++ b/clang/include/clang/AST/Type.h
@@ -2404,6 +2404,10 @@ class alignas(TypeAlignment) Type : public 
ExtQualsTypeCommonBase {
   /// SVE vector or predicate, excluding tuple types such as svint32x4_t.
   bool isSveVLSBuiltinType() const;
 
+  /// Determines if this is a *builtin* NEON vector type, a type not built with
+  /// `neon_vector_type`
+  bool isNeonVectorBuiltinType() const;
+
   /// Returns the representative type for the element of an SVE builtin type.
   /// This is used to represent fixed-length SVE vectors created with the
   /// 'arm_sve_vector_bits' type attribute as VectorType.
@@ -2518,6 +2522,7 @@ class alignas(TypeAlignment) Type : public 
ExtQualsTypeCommonBase {
   bool isFloat32Type() const;
   bool isDoubleType() const;
   bool isBFloat16Type() const;
+  bool isMFloat8Type() const;
   bool isFloat128Type() const;
   bool isIbm128Type() const;
   bool isRealType() const; // C99 6.2.5p17 (real floating + integer)
@@ -8532,6 +8537,10 @@ inline bool Type::isBFloat16Type() const {
   return isSpecificBuiltinType(BuiltinType::BFloat16);
 }
 
+inline bool Type::isMFloat8Type() const {
+  return isSpecificBuiltinType(BuiltinType::MFloat8);
+}
+
 inline bool Type::isFloat128Type() const {
   return isSpecificBuiltinType(BuiltinType::Float128);
 }
diff --git a/clang/include/clang/Basic/AArch64SVEACLETypes.def 
b/clang/include/clang/Basic/AArch64SVEACLETypes.def
index 063cac1f4a58ee7..6b704b386536c9b 100644
--- a/clang/include/clang/Basic/AArch64SVEACLETypes.def
+++ b/clang/include/clang/Basic/AArch64SVEACLETypes.def
@@ -57,6 +57,11 @@
 //  - IsBF true for vector of brain float elements.
 
//===--===//
 
+#ifndef SVE_SCALAR_TYPE
+#define SVE_SCALAR_TYPE(Name, MangledName, Id, SingletonId, Bits) \
+  SVE_TYPE(Name, Id, SingletonId)
+#endif
+
 #ifndef SVE_VECTOR_TYPE
 #define SVE_VECTOR_TYPE(Name, MangledName, Id, SingletonId) \
   SVE_TYPE(Name, Id, SingletonId)
@@ -72,6 +77,11 @@
   SVE_VECTOR_TYPE_DETAILS(Name, MangledName, Id, SingletonId, NumEls, ElBits, 
NF, false, false, true)
 #endif
 
+#ifndef SVE_VECTOR_TYPE_MFLOAT
+#define SVE_VECTOR_TYPE_MFLOAT(Name, MangledName, Id, SingletonId, NumEls, 
ElBits, NF) \
+  SVE_VECTOR_TYPE_DETAILS(Name, Ma

[clang] [llvm] [AArch64] Add FP8 Neon intrinsics for dot-product (PR #119911)

2024-12-13 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-llvm-ir

Author: Momchil Velikov (momchil-velikov)


Changes


This patch adds the following intrinsics:

float16x4_t vdot_f16_mf8_fpm(float16x4_t vd, mfloat8x8_t vn, mfloat8x8_t 
vm, fpm_t fpm)
float16x8_t vdotq_f16_mf8_fpm(float16x8_t vd, mfloat8x16_t vn, mfloat8x16_t 
vm, fpm_t fpm)

float16x4_t vdot_lane_f16_mf8_fpm(float16x4_t vd, mfloat8x8_t vn, 
mfloat8x8_t vm, __builtin_constant_p(lane), fpm_t fpm)
float16x4_t vdot_laneq_f16_mf8_fpm(float16x4_t vd, mfloat8x8_t vn, 
mfloat8x16_t vm, __builtin_constant_p(lane), fpm_t fpm)
float16x8_t vdotq_lane_f16_mf8_fpm(float16x8_t vd, mfloat8x16_t vn, 
mfloat8x8_t vm, __builtin_constant_p(lane), fpm_t fpm)
float16x8_t vdotq_laneq_f16_mf8_fpm(float16x8_t vd, mfloat8x16_t vn, 
mfloat8x16_t vm, __builtin_constant_p(lane), fpm_t fpm)

---

Patch is 107.21 KiB, truncated to 20.00 KiB below, full version: 
https://github.com/llvm/llvm-project/pull/119911.diff


25 Files Affected:

- (modified) clang/include/clang/AST/Type.h (+9) 
- (modified) clang/include/clang/Basic/AArch64SVEACLETypes.def (+18-6) 
- (modified) clang/include/clang/Basic/DiagnosticSemaKinds.td (+5) 
- (modified) clang/include/clang/Basic/arm_neon.td (+46-1) 
- (modified) clang/include/clang/Basic/arm_neon_incl.td (+2) 
- (modified) clang/lib/AST/ASTContext.cpp (+30-7) 
- (modified) clang/lib/AST/ItaniumMangle.cpp (+5) 
- (modified) clang/lib/AST/Type.cpp (+14-3) 
- (modified) clang/lib/CodeGen/CGBuiltin.cpp (+166-1) 
- (modified) clang/lib/CodeGen/CodeGenFunction.h (+8) 
- (modified) clang/lib/CodeGen/CodeGenTypes.cpp (+10-3) 
- (modified) clang/lib/CodeGen/Targets/AArch64.cpp (+5-2) 
- (modified) clang/lib/Sema/SemaChecking.cpp (+33-6) 
- (added) clang/test/CodeGen/AArch64/builtin-shufflevector-fp8.c (+123) 
- (added) clang/test/CodeGen/AArch64/fp8-intrinsics/acle_neon_fp8_cvt.c (+308) 
- (added) clang/test/CodeGen/AArch64/fp8-intrinsics/acle_neon_fp8_fdot.c (+143) 
- (added) clang/test/Sema/aarch64-fp8-intrinsics/acle_neon_fp8.c (+57) 
- (added) clang/test/Sema/builtin-shufflevector.c (+30) 
- (modified) clang/utils/TableGen/NeonEmitter.cpp (+22-2) 
- (modified) clang/utils/TableGen/SveEmitter.cpp (+2-2) 
- (modified) llvm/include/llvm/IR/IntrinsicsAArch64.td (+43) 
- (modified) llvm/lib/Target/AArch64/AArch64InstrFormats.td (+83-45) 
- (modified) llvm/lib/Target/AArch64/AArch64InstrInfo.td (+14-14) 
- (added) llvm/test/CodeGen/AArch64/fp8-neon-fdot.ll (+74) 
- (added) llvm/test/CodeGen/AArch64/neon-fp8-cvt.ll (+112) 


``diff
diff --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h
index f0eee77c73ef06d..cacd3d75ffcd8de 100644
--- a/clang/include/clang/AST/Type.h
+++ b/clang/include/clang/AST/Type.h
@@ -2404,6 +2404,10 @@ class alignas(TypeAlignment) Type : public 
ExtQualsTypeCommonBase {
   /// SVE vector or predicate, excluding tuple types such as svint32x4_t.
   bool isSveVLSBuiltinType() const;
 
+  /// Determines if this is a *builtin* NEON vector type, a type not built with
+  /// `neon_vector_type`
+  bool isNeonVectorBuiltinType() const;
+
   /// Returns the representative type for the element of an SVE builtin type.
   /// This is used to represent fixed-length SVE vectors created with the
   /// 'arm_sve_vector_bits' type attribute as VectorType.
@@ -2518,6 +2522,7 @@ class alignas(TypeAlignment) Type : public 
ExtQualsTypeCommonBase {
   bool isFloat32Type() const;
   bool isDoubleType() const;
   bool isBFloat16Type() const;
+  bool isMFloat8Type() const;
   bool isFloat128Type() const;
   bool isIbm128Type() const;
   bool isRealType() const; // C99 6.2.5p17 (real floating + integer)
@@ -8532,6 +8537,10 @@ inline bool Type::isBFloat16Type() const {
   return isSpecificBuiltinType(BuiltinType::BFloat16);
 }
 
+inline bool Type::isMFloat8Type() const {
+  return isSpecificBuiltinType(BuiltinType::MFloat8);
+}
+
 inline bool Type::isFloat128Type() const {
   return isSpecificBuiltinType(BuiltinType::Float128);
 }
diff --git a/clang/include/clang/Basic/AArch64SVEACLETypes.def 
b/clang/include/clang/Basic/AArch64SVEACLETypes.def
index 063cac1f4a58ee7..6b704b386536c9b 100644
--- a/clang/include/clang/Basic/AArch64SVEACLETypes.def
+++ b/clang/include/clang/Basic/AArch64SVEACLETypes.def
@@ -57,6 +57,11 @@
 //  - IsBF true for vector of brain float elements.
 
//===--===//
 
+#ifndef SVE_SCALAR_TYPE
+#define SVE_SCALAR_TYPE(Name, MangledName, Id, SingletonId, Bits) \
+  SVE_TYPE(Name, Id, SingletonId)
+#endif
+
 #ifndef SVE_VECTOR_TYPE
 #define SVE_VECTOR_TYPE(Name, MangledName, Id, SingletonId) \
   SVE_TYPE(Name, Id, SingletonId)
@@ -72,6 +77,11 @@
   SVE_VECTOR_TYPE_DETAILS(Name, MangledName, Id, SingletonId, NumEls, ElBits, 
NF, false, false, true)
 #endif
 
+#ifndef SVE_VECTOR_TYPE_MFLOAT
+#define SVE_VECTOR_TYPE_MFLOAT(Name, MangledName, Id, SingletonId, NumEls, 
ElBits, NF) \
+  SVE_VECTOR_TYPE_DETAILS(Name, MangledN

[clang] [Clang] Interpreter test should not depend on system header (PR #119903)

2024-12-13 Thread Yuxuan Chen via cfe-commits

https://github.com/yuxuanchen1997 edited 
https://github.com/llvm/llvm-project/pull/119903
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


  1   2   3   4   5   >