[clang] [llvm] [llvm][DebugInfo] DWARFv5: static data members declarations are DW_TAG_variable (PR #72234)

2023-11-15 Thread Paul T Robinson via cfe-commits

https://github.com/pogo59 commented:

@adrian-prantl We do have a pretty strong guarantee of compatibility in the 
llvm-c API. A new parameter pretty much means you need to define a new function.

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


[lldb] [clang] Reland "[clang][DebugInfo] Emit global variable definitions for static data members with constant initializers" (PR #71780)

2023-11-15 Thread Paul T Robinson via cfe-commits

pogo59 wrote:

The member is const with an initializer in-class. How is the constant value not 
available for the definition?

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


[lldb] [clang] Reland "[clang][DebugInfo] Emit global variable definitions for static data members with constant initializers" (PR #71780)

2023-11-15 Thread Paul T Robinson via cfe-commits

pogo59 wrote:

I think it is a valuable bit of information for the debugger, to know the 
constant value without having to read it from memory. I think we should emit 
both the location and the value.

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


[clang] [llvm] [clang-tools-extra] Dont alter cold function alignment unless using Os (PR #72387)

2023-11-20 Thread Paul T Robinson via cfe-commits

pogo59 wrote:

> We already have a way to set alignment: it's the "align" attribute.

Is clang aware of the target's default function alignment? I'd thought not, in 
which case deferring to LLVM (as this new attribute does) is correct. Happy to 
be corrected on this point.

> there isn't any obvious reason to special-case "cold" functions.

I'd thought that was clear. Cold implies opt-for-size, which implies align(1). 
We want cold not to imply align(1), directly or indirectly; but, if 
opt-for-size was requested explicitly, that should still imply align(1). The 
implied align(1) does interfere with a useful feature for PS4/PS5, and has for 
some time. If the tweak to the definition of "cold" should be specific to our 
targets, we can certainly do that.

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


[clang] [clang][DebugInfo] Attach DW_AT_const_value to static data-member definitions if available (PR #72730)

2023-11-20 Thread Paul T Robinson via cfe-commits

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

One comment, otherwise LGTM.

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


[clang] [clang][DebugInfo] Attach DW_AT_const_value to static data-member definitions if available (PR #72730)

2023-11-20 Thread Paul T Robinson via cfe-commits

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


[clang] [clang][DebugInfo] Attach DW_AT_const_value to static data-member definitions if available (PR #72730)

2023-11-20 Thread Paul T Robinson via cfe-commits


@@ -69,6 +69,29 @@ static uint32_t getDeclAlignIfRequired(const Decl *D, const 
ASTContext &Ctx) {
   return D->hasAttr() ? D->getMaxAlignment() : 0;
 }
 
+/// Given a VarDecl corresponding to either the definition or
+/// declaration of a C++ static data member, if it has a constant
+/// initializer and is evaluatable, return the evaluated value.
+/// Returns std::nullopt on failure.

pogo59 wrote:

Maybe instead of "on failure" say "otherwise." It's not really a _failure_ 
condition.

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


[clang-tools-extra] [clang] [llvm] Dont alter cold function alignment unless using Os (PR #72387)

2023-11-20 Thread Paul T Robinson via cfe-commits

pogo59 wrote:

I guess I'm a little confused still. Are you claiming that `cold` has a 
specified ABI effect? That if some pass decides a function is cold, that 
decision (correctly) affects its ABI? I'm not seeing any documentation to that 
effect, either on the clang attribute or the IR attribute. My admittedly aging 
copy of the psABI doesn't mention function alignment at all, either.

We're not inventing an ABI rule that `cold` functions are special and must have 
a specific alignment; we just want `cold` functions to have the same alignment 
as non-`cold` functions. (And if you specify `-Os` then that alignment changes 
to 1, for cold and non-cold functions alike.)

The only thing that makes `cold` functions special _in this implementation_ is 
that, as an implementation convenience, clang's `cold` attribute also sets 
`optsize` which has an effect that we are finding inconvenient. We just want 
`cold` not to have that particular effect. We played around with several 
different ways to make that happen, and this seemed the least intrusive.

I suppose another way to go at this would be for `-Os` or clang's `minsize` to 
add both `optsize` and align(1) to functions, and have LLVM's implementation of 
`optsize` stop implying align(1). This would make everything more orthogonal 
and disentangled, yes? And then clang's `cold` could set `optsize` without 
affecting alignment; if non-PS targets still wanted `cold` to mean align(1), we 
can set that as well. No new attributes, and that bit of code down in LLVM to 
compute alignment gets a wee bit cleaner. WDYT?

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


[clang] [clang-tools-extra] [llvm] Dont alter cold function alignment unless using Os (PR #72387)

2023-11-21 Thread Paul T Robinson via cfe-commits

pogo59 wrote:

The psABI doesn't say anything about function alignment, implying that align(1) 
is functionally correct, and anything more than that is either an optimization 
or functional dependency for our target. So, if we depend on anything more, we 
have to set alignment explicitly.

@FlameTop does that explanation sound reasonable to you? So PS4/PS5 should be 
explicitly setting alignment on all functions that don't have an alignment 
specified in source. No need for a new attribute.

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


[clang] [clang-repl] [test] Make an XFAIL more precise (PR #70991)

2023-11-02 Thread Paul T Robinson via cfe-commits

pogo59 wrote:

FTR, the "Worker" tab on that buildbot page will point you to the maintainer. 
But tagging me is also fine in general.
I'm unable to repro the problem locally because my local build doesn't seem to 
include clang-repl.exe, so the whole clang/test/Interpreter directory is 
Unsupported. Is there some cmake parameter to enable JIT?
In the meantime, tagging @dyung 

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


[clang] [clang-repl] [test] Make an XFAIL more precise (PR #70991)

2023-11-02 Thread Paul T Robinson via cfe-commits

pogo59 wrote:

If you want to XFAIL specifically for the Sony targets, what you suggested 
would work.
I'm unclear about the "MSVC C++ ABI" aspect, but if that gets the test to work, 
go for it.

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


[clang] [Sema] Provide `-fno-/-fvisibility-global-new-delete` option (PR #75364)

2023-12-18 Thread Paul T Robinson via cfe-commits

pogo59 wrote:

>From a UI perspective, "add a visibility attribute" doesn't seem all that 
>descriptive. What visibility does it add? Therefore, I suggest 
>`-fvisibility-global-new-delete[=]` so the user can ask for what 
>they want, and `-fvisibility-global-new-delete-hidden` equals 
>`-fvisibility-global-new-delete=hidden`. The help text can indicate that the 
>default is `default`.

I'm unclear what the `-fno` variant actually turns into. There's always a 
visibility, ultimately, right? So wouldn't that be equivalent to the `keep` 
option in #74629 ? Which suggests not having the `-fno` variant here, and 
allowing `=keep` instead.

(If the universe would implode given a visibility other than `default` or 
`hidden` for global new/delete, then constrain the argument to the option to be 
only `default/hidden/keep`.)

I hope this makes sense...

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


[clang] Add a "don't override" mapping for -fvisibility-from-dllstorageclass (PR #74629)

2023-12-18 Thread Paul T Robinson via cfe-commits

pogo59 wrote:

Ben and I talked about this offline. I was a little skittish about these 
power-user options letting you do whatever you wanted, and maybe a small number 
(2? 3?) of predefined combinations would be more straightforward. He convinced 
me that (a) these wouldn't be needed often, and (b) people who did want to use 
them would already be thinking in terms of visibility so adding predefined 
combinations would actually add _more_ complexity.

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


[clang] [clang][DebugInfo] Revert to attaching DW_AT_const_value on static member declarations (PR #73626)

2023-11-28 Thread Paul T Robinson via cfe-commits

pogo59 wrote:

> I do wonder how feasible it would be for the downstream tests to be adjusted 
> to look at the `DW_AT_location`..

As I mentioned on the other thread, the point is not to have to read the value 
from the process-under-debug. This is not efficient in a remote-debugging 
scenario.

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


[clang] [clang] Separate Intel ADC instrinsics from ADX intrinsics (PR #75992)

2023-12-20 Thread Paul T Robinson via cfe-commits

pogo59 wrote:

Thanks for adding the guard to the include adxintrin.h, now that it has only 
the ADX stuff it is the right way to go. As PS4 code owner I approve!

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


[clang] [Sema] Provide `-fno-/-fvisibility-global-new-delete` option (PR #75364)

2024-01-03 Thread Paul T Robinson via cfe-commits

pogo59 wrote:

Actually I kind of prefer all these options to have `-fvisibility-` as a 
prefix. Even if it doesn't read quite naturally, it strongly implies that the 
options are related (which is true) and any lexically sorted list of options 
will naturally group them together. WDYT @frobtech ?

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


[clang-tools-extra] [llvm] [clang] Dont alter cold function alignment unless using Os (PR #72387)

2024-01-08 Thread Paul T Robinson via cfe-commits

pogo59 wrote:

> Edit: Actually we still have the problem of when in LLVM not knowing if 
> optimze-by-size got set on the cold funtion by it being cold or if Os was 
> used.

Not sure I understand the question (sorry I missed this comment when it was 
made). The suggestion is that for our target, clang sets explicit alignment, so 
LLVM should not need to know where optsize came from. LLVM's handling of 
optsize will not reset an alignment that is already set. Is there a situation 
where the wrong thing still happens?

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


[clang] [Headers][X86] Reformat ia32intrin.h doc to match the other headers (PR #77525)

2024-01-09 Thread Paul T Robinson via cfe-commits

https://github.com/pogo59 created 
https://github.com/llvm/llvm-project/pull/77525

Doxygen comment style for every other intrinsic-function header uses /// 
comments, so change ia32intrin.h from the /** style to /// style. While I was 
in there, change ` INSTR ` to `\c INSTR` and toss in a few missing 
full-stops.

>From cd91a7f0e5cacb682cb6280655a8d1112cecaf6a Mon Sep 17 00:00:00 2001
From: Paul Robinson 
Date: Tue, 9 Jan 2024 13:22:36 -0800
Subject: [PATCH] [Headers][X86] Reformat ia32intrin.h doc to match the other
 headers

Doxygen comment style for every other intrinsic-function header uses
/// comments, so change ia32intrin.h from the /** style to /// style.
While I was in there, change ` INSTR ` to `\c INSTR` and toss
in a few missing full-stops.
---
 clang/lib/Headers/ia32intrin.h | 376 -
 1 file changed, 182 insertions(+), 194 deletions(-)

diff --git a/clang/lib/Headers/ia32intrin.h b/clang/lib/Headers/ia32intrin.h
index f1904efd71c4c7..04238d8f176ef4 100644
--- a/clang/lib/Headers/ia32intrin.h
+++ b/clang/lib/Headers/ia32intrin.h
@@ -26,51 +26,48 @@
 #define __DEFAULT_FN_ATTRS_CONSTEXPR __DEFAULT_FN_ATTRS
 #endif
 
-/** Find the first set bit starting from the lsb. Result is undefined if
- *  input is 0.
- *
- *  \headerfile 
- *
- *  This intrinsic corresponds to the  BSF  instruction or the
- *   TZCNT  instruction.
- *
- *  \param __A
- * A 32-bit integer operand.
- *  \returns A 32-bit integer containing the bit number.
- */
+/// Find the first set bit starting from the lsb. Result is undefined if
+///input is 0.
+///
+/// \headerfile 
+/// 
+/// This intrinsic corresponds to the \c BSF instruction or the
+///\c TZCNT instruction.
+///
+/// \param __A
+///A 32-bit integer operand.
+/// \returns A 32-bit integer containing the bit number.
 static __inline__ int __DEFAULT_FN_ATTRS_CONSTEXPR
 __bsfd(int __A) {
   return __builtin_ctz((unsigned int)__A);
 }
 
-/** Find the first set bit starting from the msb. Result is undefined if
- *  input is 0.
- *
- *  \headerfile 
- *
- *  This intrinsic corresponds to the  BSR  instruction or the
- *   LZCNT  instruction and an  XOR .
- *
- *  \param __A
- * A 32-bit integer operand.
- *  \returns A 32-bit integer containing the bit number.
- */
+/// Find the first set bit starting from the msb. Result is undefined if
+///input is 0.
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c BSR instruction or the
+///\c LZCNT instruction and an \c XOR.
+///
+/// \param __A
+///A 32-bit integer operand.
+/// \returns A 32-bit integer containing the bit number.
 static __inline__ int __DEFAULT_FN_ATTRS_CONSTEXPR
 __bsrd(int __A) {
   return 31 - __builtin_clz((unsigned int)__A);
 }
 
-/** Swaps the bytes in the input. Converting little endian to big endian or
- *  vice versa.
- *
- *  \headerfile 
- *
- *  This intrinsic corresponds to the  BSWAP  instruction.
- *
- *  \param __A
- * A 32-bit integer operand.
- *  \returns A 32-bit integer containing the swapped bytes.
- */
+/// Swaps the bytes in the input. Converting little endian to big endian or
+///vice versa.
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c BSWAP instruction.
+///
+/// \param __A
+///A 32-bit integer operand.
+/// \returns A 32-bit integer containing the swapped bytes.
 static __inline__ int __DEFAULT_FN_ATTRS_CONSTEXPR
 __bswapd(int __A) {
   return (int)__builtin_bswap32((unsigned int)__A);
@@ -85,51 +82,48 @@ _bswap(int __A) {
 #define _bit_scan_reverse(A) __bsrd((A))
 
 #ifdef __x86_64__
-/** Find the first set bit starting from the lsb. Result is undefined if
- *  input is 0.
- *
- *  \headerfile 
- *
- *  This intrinsic corresponds to the  BSF  instruction or the
- *   TZCNT  instruction.
- *
- *  \param __A
- * A 64-bit integer operand.
- *  \returns A 32-bit integer containing the bit number.
- */
+/// Find the first set bit starting from the lsb. Result is undefined if
+///input is 0.
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c BSF instruction or the
+///\c TZCNT instruction.
+///
+/// \param __A
+///A 64-bit integer operand.
+/// \returns A 32-bit integer containing the bit number.
 static __inline__ int __DEFAULT_FN_ATTRS_CONSTEXPR
 __bsfq(long long __A) {
   return (long long)__builtin_ctzll((unsigned long long)__A);
 }
 
-/** Find the first set bit starting from the msb. Result is undefined if
- *  input is 0.
- *
- *  \headerfile 
- *
- *  This intrinsic corresponds to the  BSR  instruction or the
- *   LZCNT  instruction and an  XOR .
- *
- *  \param __A
- * A 64-bit integer operand.
- *  \returns A 32-bit integer containing the bit number.
- */
+/// Find the first set bit starting from the msb. Result is undefined if
+///input is 0.
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c BSR instruction or the
+///\c LZCNT instruction and an \c XOR.
+///
+/// \param __A
+///A 64-bit intege

[clang] [Headers][X86] Reformat ia32intrin.h doc to match the other headers (PR #77525)

2024-01-09 Thread Paul T Robinson via cfe-commits

https://github.com/pogo59 updated 
https://github.com/llvm/llvm-project/pull/77525

>From cd91a7f0e5cacb682cb6280655a8d1112cecaf6a Mon Sep 17 00:00:00 2001
From: Paul Robinson 
Date: Tue, 9 Jan 2024 13:22:36 -0800
Subject: [PATCH 1/2] [Headers][X86] Reformat ia32intrin.h doc to match the
 other headers

Doxygen comment style for every other intrinsic-function header uses
/// comments, so change ia32intrin.h from the /** style to /// style.
While I was in there, change ` INSTR ` to `\c INSTR` and toss
in a few missing full-stops.
---
 clang/lib/Headers/ia32intrin.h | 376 -
 1 file changed, 182 insertions(+), 194 deletions(-)

diff --git a/clang/lib/Headers/ia32intrin.h b/clang/lib/Headers/ia32intrin.h
index f1904efd71c4c7..04238d8f176ef4 100644
--- a/clang/lib/Headers/ia32intrin.h
+++ b/clang/lib/Headers/ia32intrin.h
@@ -26,51 +26,48 @@
 #define __DEFAULT_FN_ATTRS_CONSTEXPR __DEFAULT_FN_ATTRS
 #endif
 
-/** Find the first set bit starting from the lsb. Result is undefined if
- *  input is 0.
- *
- *  \headerfile 
- *
- *  This intrinsic corresponds to the  BSF  instruction or the
- *   TZCNT  instruction.
- *
- *  \param __A
- * A 32-bit integer operand.
- *  \returns A 32-bit integer containing the bit number.
- */
+/// Find the first set bit starting from the lsb. Result is undefined if
+///input is 0.
+///
+/// \headerfile 
+/// 
+/// This intrinsic corresponds to the \c BSF instruction or the
+///\c TZCNT instruction.
+///
+/// \param __A
+///A 32-bit integer operand.
+/// \returns A 32-bit integer containing the bit number.
 static __inline__ int __DEFAULT_FN_ATTRS_CONSTEXPR
 __bsfd(int __A) {
   return __builtin_ctz((unsigned int)__A);
 }
 
-/** Find the first set bit starting from the msb. Result is undefined if
- *  input is 0.
- *
- *  \headerfile 
- *
- *  This intrinsic corresponds to the  BSR  instruction or the
- *   LZCNT  instruction and an  XOR .
- *
- *  \param __A
- * A 32-bit integer operand.
- *  \returns A 32-bit integer containing the bit number.
- */
+/// Find the first set bit starting from the msb. Result is undefined if
+///input is 0.
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c BSR instruction or the
+///\c LZCNT instruction and an \c XOR.
+///
+/// \param __A
+///A 32-bit integer operand.
+/// \returns A 32-bit integer containing the bit number.
 static __inline__ int __DEFAULT_FN_ATTRS_CONSTEXPR
 __bsrd(int __A) {
   return 31 - __builtin_clz((unsigned int)__A);
 }
 
-/** Swaps the bytes in the input. Converting little endian to big endian or
- *  vice versa.
- *
- *  \headerfile 
- *
- *  This intrinsic corresponds to the  BSWAP  instruction.
- *
- *  \param __A
- * A 32-bit integer operand.
- *  \returns A 32-bit integer containing the swapped bytes.
- */
+/// Swaps the bytes in the input. Converting little endian to big endian or
+///vice versa.
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c BSWAP instruction.
+///
+/// \param __A
+///A 32-bit integer operand.
+/// \returns A 32-bit integer containing the swapped bytes.
 static __inline__ int __DEFAULT_FN_ATTRS_CONSTEXPR
 __bswapd(int __A) {
   return (int)__builtin_bswap32((unsigned int)__A);
@@ -85,51 +82,48 @@ _bswap(int __A) {
 #define _bit_scan_reverse(A) __bsrd((A))
 
 #ifdef __x86_64__
-/** Find the first set bit starting from the lsb. Result is undefined if
- *  input is 0.
- *
- *  \headerfile 
- *
- *  This intrinsic corresponds to the  BSF  instruction or the
- *   TZCNT  instruction.
- *
- *  \param __A
- * A 64-bit integer operand.
- *  \returns A 32-bit integer containing the bit number.
- */
+/// Find the first set bit starting from the lsb. Result is undefined if
+///input is 0.
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c BSF instruction or the
+///\c TZCNT instruction.
+///
+/// \param __A
+///A 64-bit integer operand.
+/// \returns A 32-bit integer containing the bit number.
 static __inline__ int __DEFAULT_FN_ATTRS_CONSTEXPR
 __bsfq(long long __A) {
   return (long long)__builtin_ctzll((unsigned long long)__A);
 }
 
-/** Find the first set bit starting from the msb. Result is undefined if
- *  input is 0.
- *
- *  \headerfile 
- *
- *  This intrinsic corresponds to the  BSR  instruction or the
- *   LZCNT  instruction and an  XOR .
- *
- *  \param __A
- * A 64-bit integer operand.
- *  \returns A 32-bit integer containing the bit number.
- */
+/// Find the first set bit starting from the msb. Result is undefined if
+///input is 0.
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c BSR instruction or the
+///\c LZCNT instruction and an \c XOR.
+///
+/// \param __A
+///A 64-bit integer operand.
+/// \returns A 32-bit integer containing the bit number.
 static __inline__ int __DEFAULT_FN_ATTRS_CONSTEXPR
 __bsrq(long long __A) {
   return 63 - __builtin_clzll((unsigned long long)__A);
 }
 
-/** Swaps the bytes i

[clang] [Headers][X86] Reformat ia32intrin.h doc to match the other headers (PR #77525)

2024-01-09 Thread Paul T Robinson via cfe-commits

pogo59 wrote:

I'm going to be adding some new function descriptions to this file shortly, and 
figured I should get the formatting thing out of the way first.

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


[clang] [Headers][X86] Reformat ia32intrin.h doc to match the other headers (PR #77525)

2024-01-10 Thread Paul T Robinson via cfe-commits

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


[clang] [Headers][X86] Add more descriptions to ia32intrin.h and immintrin.h (PR #77686)

2024-01-10 Thread Paul T Robinson via cfe-commits

https://github.com/pogo59 created 
https://github.com/llvm/llvm-project/pull/77686

ia32intrin.h gets descriptions for all remaining non-privileged intrinsic 
functions; the macros providing alternate names are not described. immintrin.h 
ditto, except for the InterlockedExchange functions.

>From 39a884d27f56772a222d352665be95194716beff Mon Sep 17 00:00:00 2001
From: Paul Robinson 
Date: Wed, 10 Jan 2024 10:42:24 -0800
Subject: [PATCH] [Headers][X86] Add more descriptions to ia32intrin.h and
 immintrin.h

ia32intrin.h gets descriptions for all remaining non-privileged intrinsic
functions; the macros providing alternate names are not described.
immintrin.h ditto, except for the Interlocked Exchange functions.
---
 clang/lib/Headers/ia32intrin.h | 172 -
 clang/lib/Headers/immintrin.h  |  57 +++
 2 files changed, 227 insertions(+), 2 deletions(-)

diff --git a/clang/lib/Headers/ia32intrin.h b/clang/lib/Headers/ia32intrin.h
index a8b59dfaad8980..39013e1a5bd0dd 100644
--- a/clang/lib/Headers/ia32intrin.h
+++ b/clang/lib/Headers/ia32intrin.h
@@ -58,7 +58,7 @@ __bsrd(int __A) {
   return 31 - __builtin_clz((unsigned int)__A);
 }
 
-/// Swaps the bytes in the input. Converting little endian to big endian or
+/// Swaps the bytes in the input, converting little endian to big endian or
 ///vice versa.
 ///
 /// \headerfile 
@@ -73,6 +73,16 @@ __bswapd(int __A) {
   return (int)__builtin_bswap32((unsigned int)__A);
 }
 
+/// Swaps the bytes in the input, converting little endian to big endian or
+///vice versa.
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c BSWAP instruction.
+///
+/// \param __A
+///A 32-bit integer operand.
+/// \returns A 32-bit integer containing the swapped bytes.
 static __inline__ int __DEFAULT_FN_ATTRS_CONSTEXPR
 _bswap(int __A) {
   return (int)__builtin_bswap32((unsigned int)__A);
@@ -173,12 +183,29 @@ __popcntq(unsigned long long __A)
 #endif /* __x86_64__ */
 
 #ifdef __x86_64__
+/// Returns the program status and control \c RFLAGS register with the \c VM
+///and \c RF flags cleared.
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c PUSHFQ + \c POPQ instruction sequence.
+///
+/// \returns The 64-bit value of the RFLAGS register.
 static __inline__ unsigned long long __DEFAULT_FN_ATTRS
 __readeflags(void)
 {
   return __builtin_ia32_readeflags_u64();
 }
 
+/// Writes the specified value to the program status and control \c RFLAGS
+///register. Reserved bits are not affected.
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c PUSHQ + \c POPFQ instruction sequence.
+///
+/// \param __f
+///The 64-bit value to write to \c RFLAGS.
 static __inline__ void __DEFAULT_FN_ATTRS
 __writeeflags(unsigned long long __f)
 {
@@ -186,12 +213,29 @@ __writeeflags(unsigned long long __f)
 }
 
 #else /* !__x86_64__ */
+/// Returns the program status and control \c EFLAGS register with the \c VM
+///and \c RF flags cleared.
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c PUSHFD + \c POPD instruction sequence.
+///
+/// \returns The 32-bit value of the EFLAGS register.
 static __inline__ unsigned int __DEFAULT_FN_ATTRS
 __readeflags(void)
 {
   return __builtin_ia32_readeflags_u32();
 }
 
+/// Writes the specified value to the program status and control \c EFLAGS
+///register. Reserved bits are not affected.
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c PUSHD + \c POPFD instruction sequence.
+///
+/// \param __f
+///The 32-bit value to write to \c EFLAGS.
 static __inline__ void __DEFAULT_FN_ATTRS
 __writeeflags(unsigned int __f)
 {
@@ -341,12 +385,32 @@ __crc32q(unsigned long long __C, unsigned long long __D)
 }
 #endif /* __x86_64__ */
 
+/// Reads the specified performance monitoring counter. Refer to your
+///processor's documentation to determine which performance counters are
+///supported.
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c RDPMC instruction.
+///
+/// \param __A
+///The performance counter to read.
+/// \returns The 64-bit value read from the performance counter.
 static __inline__ unsigned long long __DEFAULT_FN_ATTRS
 __rdpmc(int __A) {
   return __builtin_ia32_rdpmc(__A);
 }
 
-/* __rdtscp */
+/// Reads the processor's time stamp counter and the \c IA32_TSC_AUX MSR
+///\c (0xc103).
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c RDTSCP instruction.
+///
+/// \param __A
+///Address of where to store the 32-bit \c IA32_TSC_AUX value.
+/// \returns The 64-bit value of the time stamp counter.
 static __inline__ unsigned long long __DEFAULT_FN_ATTRS
 __rdtscp(unsigned int *__A) {
   return __builtin_ia32_rdtscp(__A);
@@ -361,42 +425,146 @@ _wbinvd(void) {
   __builtin_ia32_wbinvd();
 }
 
+/// Rotates an 8-bit value to the left by the specified number of bits.
+///This operation is undefined if the number of bits exceeds the size of
+///   

[clang] [Headers][X86] Add rounding and exception notes to conversions (PR #83447)

2024-03-13 Thread Paul T Robinson via cfe-commits

https://github.com/pogo59 updated 
https://github.com/llvm/llvm-project/pull/83447

>From 64cdd358d0bf359383a5dd3d1da236a219644c9e Mon Sep 17 00:00:00 2001
From: Paul Robinson 
Date: Thu, 29 Feb 2024 08:59:26 -0800
Subject: [PATCH 1/3] [Headers][X86] Add rounding and exception notes to
 conversions

Consistently describe rounding/truncating on convert intrinsics.
Add notes where an out-of-range result can raise an exception.
---
 clang/lib/Headers/avxintrin.h |  36 +++---
 clang/lib/Headers/emmintrin.h |  91 ++---
 clang/lib/Headers/xmmintrin.h | 125 --
 3 files changed, 182 insertions(+), 70 deletions(-)

diff --git a/clang/lib/Headers/avxintrin.h b/clang/lib/Headers/avxintrin.h
index f116d8bc3a94c7..51c7d76e75ca1a 100644
--- a/clang/lib/Headers/avxintrin.h
+++ b/clang/lib/Headers/avxintrin.h
@@ -2180,7 +2180,8 @@ _mm256_cvtepi32_pd(__m128i __a)
   return (__m256d)__builtin_convertvector((__v4si)__a, __v4df);
 }
 
-/// Converts a vector of [8 x i32] into a vector of [8 x float].
+/// Converts a vector of [8 x i32] into a vector of [8 x float]. Rounds inexact
+///results according to the rounding control bits in the MXCSR register.
 ///
 /// \headerfile 
 ///
@@ -2196,7 +2197,8 @@ _mm256_cvtepi32_ps(__m256i __a)
 }
 
 /// Converts a 256-bit vector of [4 x double] into a 128-bit vector of
-///[4 x float].
+///[4 x float]. Rounds inexact results according to the rounding control
+///bits in the MXCSR register.
 ///
 /// \headerfile 
 ///
@@ -2211,7 +2213,12 @@ _mm256_cvtpd_ps(__m256d __a)
   return (__m128)__builtin_ia32_cvtpd2ps256((__v4df) __a);
 }
 
-/// Converts a vector of [8 x float] into a vector of [8 x i32].
+/// Converts a vector of [8 x float] into a vector of [8 x i32]. Rounds inexact
+///results according to the rounding control bits in the MXCSR register.
+///
+///If a converted value is larger than the maximum possible result,
+///raises a floating-point invalid exception. If the exception is
+///masked, returns the most negative integer.
 ///
 /// \headerfile 
 ///
@@ -2243,8 +2250,11 @@ _mm256_cvtps_pd(__m128 __a)
 }
 
 /// Converts a 256-bit vector of [4 x double] into a 128-bit vector of [4
-///x i32], truncating the result by rounding towards zero when it is
-///inexact.
+///x i32], truncating inexact results.
+///
+///If a converted value is larger than the maximum possible result,
+///raises a floating-point invalid exception. If the exception is
+///masked, returns the most negative integer.
 ///
 /// \headerfile 
 ///
@@ -2259,9 +2269,13 @@ _mm256_cvttpd_epi32(__m256d __a)
   return (__m128i)__builtin_ia32_cvttpd2dq256((__v4df) __a);
 }
 
-/// Converts a 256-bit vector of [4 x double] into a 128-bit vector of [4
-///x i32]. When a conversion is inexact, the value returned is rounded
-///according to the rounding control bits in the MXCSR register.
+/// Converts a 256-bit vector of [4 x double] into a 128-bit vector of
+///[4 x i32]. Rounds inexact results according to the rounding control bits
+///in the MXCSR register.
+///
+///If a converted value is larger than the maximum possible result,
+///raises a floating-point invalid exception. If the exception is
+///masked, returns the most negative integer.
 ///
 /// \headerfile 
 ///
@@ -2277,7 +2291,11 @@ _mm256_cvtpd_epi32(__m256d __a)
 }
 
 /// Converts a vector of [8 x float] into a vector of [8 x i32],
-///truncating the result by rounding towards zero when it is inexact.
+///truncating inexact results.
+///
+///If a converted value is larger than the maximum possible result,
+///raises a floating-point invalid exception. If the exception is
+///masked, returns the most negative integer.
 ///
 /// \headerfile 
 ///
diff --git a/clang/lib/Headers/emmintrin.h b/clang/lib/Headers/emmintrin.h
index 96e3ebdecbdf83..9ae7fe2c809ac6 100644
--- a/clang/lib/Headers/emmintrin.h
+++ b/clang/lib/Headers/emmintrin.h
@@ -1245,7 +1245,8 @@ static __inline__ int __DEFAULT_FN_ATTRS 
_mm_ucomineq_sd(__m128d __a,
 /// Converts the two double-precision floating-point elements of a
 ///128-bit vector of [2 x double] into two single-precision floating-point
 ///values, returned in the lower 64 bits of a 128-bit vector of [4 x 
float].
-///The upper 64 bits of the result vector are set to zero.
+///Rounds inexact results according to the rounding control bits in the
+///MXCSR register. The upper 64 bits of the result vector are set to zero.
 ///
 /// \headerfile 
 ///
@@ -1300,9 +1301,13 @@ static __inline__ __m128d __DEFAULT_FN_ATTRS 
_mm_cvtepi32_pd(__m128i __a) {
 }
 
 /// Converts the two double-precision floating-point elements of a
-///128-bit vector of [2 x double] into two signed 32-bit integer values,
-///returned in the lower 64 bits of a 128-bit vector of [4 x i32]. The 
upper
-///64 bits of the result vector are set to zero.
+///128-bit vector of [2 

[clang] [Headers][X86] Add rounding and exception notes to conversions (PR #83447)

2024-03-13 Thread Paul T Robinson via cfe-commits

pogo59 wrote:

Reworded the parts about truncating results.

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


[clang] [Headers][X86] Add rounding and exception notes to conversions (PR #83447)

2024-03-13 Thread Paul T Robinson via cfe-commits

https://github.com/pogo59 updated 
https://github.com/llvm/llvm-project/pull/83447

>From 64cdd358d0bf359383a5dd3d1da236a219644c9e Mon Sep 17 00:00:00 2001
From: Paul Robinson 
Date: Thu, 29 Feb 2024 08:59:26 -0800
Subject: [PATCH 1/4] [Headers][X86] Add rounding and exception notes to
 conversions

Consistently describe rounding/truncating on convert intrinsics.
Add notes where an out-of-range result can raise an exception.
---
 clang/lib/Headers/avxintrin.h |  36 +++---
 clang/lib/Headers/emmintrin.h |  91 ++---
 clang/lib/Headers/xmmintrin.h | 125 --
 3 files changed, 182 insertions(+), 70 deletions(-)

diff --git a/clang/lib/Headers/avxintrin.h b/clang/lib/Headers/avxintrin.h
index f116d8bc3a94c7..51c7d76e75ca1a 100644
--- a/clang/lib/Headers/avxintrin.h
+++ b/clang/lib/Headers/avxintrin.h
@@ -2180,7 +2180,8 @@ _mm256_cvtepi32_pd(__m128i __a)
   return (__m256d)__builtin_convertvector((__v4si)__a, __v4df);
 }
 
-/// Converts a vector of [8 x i32] into a vector of [8 x float].
+/// Converts a vector of [8 x i32] into a vector of [8 x float]. Rounds inexact
+///results according to the rounding control bits in the MXCSR register.
 ///
 /// \headerfile 
 ///
@@ -2196,7 +2197,8 @@ _mm256_cvtepi32_ps(__m256i __a)
 }
 
 /// Converts a 256-bit vector of [4 x double] into a 128-bit vector of
-///[4 x float].
+///[4 x float]. Rounds inexact results according to the rounding control
+///bits in the MXCSR register.
 ///
 /// \headerfile 
 ///
@@ -2211,7 +2213,12 @@ _mm256_cvtpd_ps(__m256d __a)
   return (__m128)__builtin_ia32_cvtpd2ps256((__v4df) __a);
 }
 
-/// Converts a vector of [8 x float] into a vector of [8 x i32].
+/// Converts a vector of [8 x float] into a vector of [8 x i32]. Rounds inexact
+///results according to the rounding control bits in the MXCSR register.
+///
+///If a converted value is larger than the maximum possible result,
+///raises a floating-point invalid exception. If the exception is
+///masked, returns the most negative integer.
 ///
 /// \headerfile 
 ///
@@ -2243,8 +2250,11 @@ _mm256_cvtps_pd(__m128 __a)
 }
 
 /// Converts a 256-bit vector of [4 x double] into a 128-bit vector of [4
-///x i32], truncating the result by rounding towards zero when it is
-///inexact.
+///x i32], truncating inexact results.
+///
+///If a converted value is larger than the maximum possible result,
+///raises a floating-point invalid exception. If the exception is
+///masked, returns the most negative integer.
 ///
 /// \headerfile 
 ///
@@ -2259,9 +2269,13 @@ _mm256_cvttpd_epi32(__m256d __a)
   return (__m128i)__builtin_ia32_cvttpd2dq256((__v4df) __a);
 }
 
-/// Converts a 256-bit vector of [4 x double] into a 128-bit vector of [4
-///x i32]. When a conversion is inexact, the value returned is rounded
-///according to the rounding control bits in the MXCSR register.
+/// Converts a 256-bit vector of [4 x double] into a 128-bit vector of
+///[4 x i32]. Rounds inexact results according to the rounding control bits
+///in the MXCSR register.
+///
+///If a converted value is larger than the maximum possible result,
+///raises a floating-point invalid exception. If the exception is
+///masked, returns the most negative integer.
 ///
 /// \headerfile 
 ///
@@ -2277,7 +2291,11 @@ _mm256_cvtpd_epi32(__m256d __a)
 }
 
 /// Converts a vector of [8 x float] into a vector of [8 x i32],
-///truncating the result by rounding towards zero when it is inexact.
+///truncating inexact results.
+///
+///If a converted value is larger than the maximum possible result,
+///raises a floating-point invalid exception. If the exception is
+///masked, returns the most negative integer.
 ///
 /// \headerfile 
 ///
diff --git a/clang/lib/Headers/emmintrin.h b/clang/lib/Headers/emmintrin.h
index 96e3ebdecbdf83..9ae7fe2c809ac6 100644
--- a/clang/lib/Headers/emmintrin.h
+++ b/clang/lib/Headers/emmintrin.h
@@ -1245,7 +1245,8 @@ static __inline__ int __DEFAULT_FN_ATTRS 
_mm_ucomineq_sd(__m128d __a,
 /// Converts the two double-precision floating-point elements of a
 ///128-bit vector of [2 x double] into two single-precision floating-point
 ///values, returned in the lower 64 bits of a 128-bit vector of [4 x 
float].
-///The upper 64 bits of the result vector are set to zero.
+///Rounds inexact results according to the rounding control bits in the
+///MXCSR register. The upper 64 bits of the result vector are set to zero.
 ///
 /// \headerfile 
 ///
@@ -1300,9 +1301,13 @@ static __inline__ __m128d __DEFAULT_FN_ATTRS 
_mm_cvtepi32_pd(__m128i __a) {
 }
 
 /// Converts the two double-precision floating-point elements of a
-///128-bit vector of [2 x double] into two signed 32-bit integer values,
-///returned in the lower 64 bits of a 128-bit vector of [4 x i32]. The 
upper
-///64 bits of the result vector are set to zero.
+///128-bit vector of [2 

[clang] [Driver,CrossWindows] Remove -isystem-after (PR #84121)

2024-03-14 Thread Paul T Robinson via cfe-commits

pogo59 wrote:

> Do we know the users of *-windows-itanium triples?

I think @bd1976bris might have been using that triple for testing the 
dllimport/visibility intersection. I've lost track and don't know what state 
that's in now, and whether the triple is still used by us.

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


[clang] [llvm] [SpecialCaseList] Use glob by default (PR #74809)

2024-03-14 Thread Paul T Robinson via cfe-commits

pogo59 wrote:

> CC @llvm/clang-vendors


Thank you for that! I don't know whether our sanitizer guys were aware of this, 
I've filed an internal ticket to find out.

+1 to the complaint about no Release Note.

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


[clang] Add support for builtin_verbose_trap (PR #79230)

2024-03-19 Thread Paul T Robinson via cfe-commits


@@ -0,0 +1,49 @@
+// RUN: %clang_cc1 -triple arm64-apple-ios -std=c++20 -emit-llvm 
-debug-info-kind=limited %s -o - | FileCheck %s

pogo59 wrote:

If you want to test optimization behavior, that would be an LLVM test starting 
from IR. Clang itself does not optimize and so should not test optimization 
behavior.

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


[clang] [Headers][X86] Add rounding and exception notes to conversions (PR #83447)

2024-03-19 Thread Paul T Robinson via cfe-commits

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


[clang] [X86][Headers] Specify result of NaN comparisons (PR #85862)

2024-03-19 Thread Paul T Robinson via cfe-commits

https://github.com/pogo59 created 
https://github.com/llvm/llvm-project/pull/85862

Make sure all float/double comparison intrinsics specify what happens with a 
NaN input. Update some existing descriptions of comparison results to make them 
all consistent.

Also replace "yields" with "returns" throughout.

>From 5ed257ea248a5868cd3190bd1ad89413a1606370 Mon Sep 17 00:00:00 2001
From: Paul Robinson 
Date: Tue, 19 Mar 2024 13:20:14 -0700
Subject: [PATCH] [X86][Headers] Specify result of NaN comparisons

Make sure all float/double comparison intrinsics specify what happens with a 
NaN input. Update some existing descriptions of comparison results to make them 
all consistent.

Also replace "yields" with "returns" throughout.
---
 clang/lib/Headers/avxintrin.h |  42 ++
 clang/lib/Headers/emmintrin.h | 154 --
 clang/lib/Headers/xmmintrin.h |  98 +++---
 3 files changed, 187 insertions(+), 107 deletions(-)

diff --git a/clang/lib/Headers/avxintrin.h b/clang/lib/Headers/avxintrin.h
index ecd9bf18a41ca0..16f13a3fdfaf76 100644
--- a/clang/lib/Headers/avxintrin.h
+++ b/clang/lib/Headers/avxintrin.h
@@ -207,6 +207,8 @@ _mm256_div_ps(__m256 __a, __m256 __b)
 /// Compares two 256-bit vectors of [4 x double] and returns the greater
 ///of each pair of values.
 ///
+///If either value in a comparison is NaN, returns the value from \a __b.
+///
 /// \headerfile 
 ///
 /// This intrinsic corresponds to the  VMAXPD  instruction.
@@ -226,6 +228,8 @@ _mm256_max_pd(__m256d __a, __m256d __b)
 /// Compares two 256-bit vectors of [8 x float] and returns the greater
 ///of each pair of values.
 ///
+///If either value in a comparison is NaN, returns the value from \a __b.
+///
 /// \headerfile 
 ///
 /// This intrinsic corresponds to the  VMAXPS  instruction.
@@ -245,6 +249,8 @@ _mm256_max_ps(__m256 __a, __m256 __b)
 /// Compares two 256-bit vectors of [4 x double] and returns the lesser
 ///of each pair of values.
 ///
+///If either value in a comparison is NaN, returns the value from \a __b.
+///
 /// \headerfile 
 ///
 /// This intrinsic corresponds to the  VMINPD  instruction.
@@ -264,6 +270,8 @@ _mm256_min_pd(__m256d __a, __m256d __b)
 /// Compares two 256-bit vectors of [8 x float] and returns the lesser
 ///of each pair of values.
 ///
+///If either value in a comparison is NaN, returns the value from \a __b.
+///
 /// \headerfile 
 ///
 /// This intrinsic corresponds to the  VMINPS  instruction.
@@ -1604,9 +1612,9 @@ _mm256_blendv_ps(__m256 __a, __m256 __b, __m256 __c)
 ///128-bit vectors of [2 x double], using the operation specified by the
 ///immediate integer operand.
 ///
-///Returns a [2 x double] vector consisting of two doubles corresponding to
-///the two comparison results: zero if the comparison is false, and all 1's
-///if the comparison is true.
+///Each comparison returns 0x0 for false, 0x for true.
+///If either value in a comparison is NaN, comparisons marked as ordered
+///return false, and comparisons marked as unordered return true.
 ///
 /// \headerfile 
 ///
@@ -1663,9 +1671,9 @@ _mm256_blendv_ps(__m256 __a, __m256 __b, __m256 __c)
 ///[4 x float], using the operation specified by the immediate integer
 ///operand.
 ///
-///Returns a [4 x float] vector consisting of four floats corresponding to
-///the four comparison results: zero if the comparison is false, and all 
1's
-///if the comparison is true.
+///Each comparison returns 0x0 for false, 0x for true.
+///If either value in a comparison is NaN, comparisons marked as ordered
+///return false, and comparisons marked as unordered return true.
 ///
 /// \headerfile 
 ///
@@ -1721,9 +1729,9 @@ _mm256_blendv_ps(__m256 __a, __m256 __b, __m256 __c)
 ///256-bit vectors of [4 x double], using the operation specified by the
 ///immediate integer operand.
 ///
-///Returns a [4 x double] vector consisting of four doubles corresponding 
to
-///the four comparison results: zero if the comparison is false, and all 
1's
-///if the comparison is true.
+///Each comparison returns 0x0 for false, 0x for true.
+///If either value in a comparison is NaN, comparisons marked as ordered
+///return false, and comparisons marked as unordered return true.
 ///
 /// \headerfile 
 ///
@@ -1781,9 +1789,9 @@ _mm256_blendv_ps(__m256 __a, __m256 __b, __m256 __c)
 ///[8 x float], using the operation specified by the immediate integer
 ///operand.
 ///
-///Returns a [8 x float] vector consisting of eight floats corresponding to
-///the eight comparison results: zero if the comparison is false, and all
-///1's if the comparison is true.
+///Each comparison returns 0x0 for false, 0x for true.
+///If either value in a comparison is NaN, comparisons marked as ordered
+///return false, and comparisons marked as unordered retur

[clang] [X86][Headers] Specify result of NaN comparisons (PR #85862)

2024-03-19 Thread Paul T Robinson via cfe-commits

pogo59 wrote:

cc @craigflores

I have resisted the temptation to do a general editorial pass over these 
headers. This patch is "functional" in that it (mostly) adds information that 
was not provided before. There's a lot that could be done to make the 
descriptions more consistent with each other but I'll save that for another 
"nonfunctional" patch. The one editorial thing I did this time around was 
replace "yields" with "returns" since I was often touching those sentences 
anyway.

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


[clang] [X86][Headers] Specify result of NaN comparisons (PR #85862)

2024-03-20 Thread Paul T Robinson via cfe-commits


@@ -4743,7 +4771,9 @@ static __inline__ __m128d __DEFAULT_FN_ATTRS 
_mm_castsi128_pd(__m128i __a) {
 ///128-bit vectors of [2 x double], using the operation specified by the
 ///immediate integer operand.
 ///
-///Each comparison yields 0x0 for false, 0x for true.
+///Each comparison returns 0x0 for false, 0x for true.
+///If either value in a comparison is NaN, comparisons marked as ordered

pogo59 wrote:

Done. I didn't like "marked" either, but couldn't come up with anything better.

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


[clang] [X86][Headers] Specify result of NaN comparisons (PR #85862)

2024-03-20 Thread Paul T Robinson via cfe-commits


@@ -1168,8 +1202,8 @@ _mm_comige_ss(__m128 __a, __m128 __b)
 ///operands to determine if the first operand is not equal to the second
 ///operand.
 ///
-///The comparison returns 0 for false, 1 for true. If either of the two
-///lower floating-point values is NaN, returns 0.

pogo59 wrote:

That was an existing mistake, but I agree, thanks!

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


[clang] [X86][Headers] Specify result of NaN comparisons (PR #85862)

2024-03-20 Thread Paul T Robinson via cfe-commits


@@ -207,6 +207,8 @@ _mm256_div_ps(__m256 __a, __m256 __b)
 /// Compares two 256-bit vectors of [4 x double] and returns the greater
 ///of each pair of values.
 ///
+///If either value in a comparison is NaN, returns the value from \a __b.

pogo59 wrote:

I didn't think so; @RKSimon ?

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


[clang] [X86][Headers] Specify result of NaN comparisons (PR #85862)

2024-03-20 Thread Paul T Robinson via cfe-commits

https://github.com/pogo59 updated 
https://github.com/llvm/llvm-project/pull/85862

>From 5ed257ea248a5868cd3190bd1ad89413a1606370 Mon Sep 17 00:00:00 2001
From: Paul Robinson 
Date: Tue, 19 Mar 2024 13:20:14 -0700
Subject: [PATCH 1/2] [X86][Headers] Specify result of NaN comparisons

Make sure all float/double comparison intrinsics specify what happens with a 
NaN input. Update some existing descriptions of comparison results to make them 
all consistent.

Also replace "yields" with "returns" throughout.
---
 clang/lib/Headers/avxintrin.h |  42 ++
 clang/lib/Headers/emmintrin.h | 154 --
 clang/lib/Headers/xmmintrin.h |  98 +++---
 3 files changed, 187 insertions(+), 107 deletions(-)

diff --git a/clang/lib/Headers/avxintrin.h b/clang/lib/Headers/avxintrin.h
index ecd9bf18a41ca0..16f13a3fdfaf76 100644
--- a/clang/lib/Headers/avxintrin.h
+++ b/clang/lib/Headers/avxintrin.h
@@ -207,6 +207,8 @@ _mm256_div_ps(__m256 __a, __m256 __b)
 /// Compares two 256-bit vectors of [4 x double] and returns the greater
 ///of each pair of values.
 ///
+///If either value in a comparison is NaN, returns the value from \a __b.
+///
 /// \headerfile 
 ///
 /// This intrinsic corresponds to the  VMAXPD  instruction.
@@ -226,6 +228,8 @@ _mm256_max_pd(__m256d __a, __m256d __b)
 /// Compares two 256-bit vectors of [8 x float] and returns the greater
 ///of each pair of values.
 ///
+///If either value in a comparison is NaN, returns the value from \a __b.
+///
 /// \headerfile 
 ///
 /// This intrinsic corresponds to the  VMAXPS  instruction.
@@ -245,6 +249,8 @@ _mm256_max_ps(__m256 __a, __m256 __b)
 /// Compares two 256-bit vectors of [4 x double] and returns the lesser
 ///of each pair of values.
 ///
+///If either value in a comparison is NaN, returns the value from \a __b.
+///
 /// \headerfile 
 ///
 /// This intrinsic corresponds to the  VMINPD  instruction.
@@ -264,6 +270,8 @@ _mm256_min_pd(__m256d __a, __m256d __b)
 /// Compares two 256-bit vectors of [8 x float] and returns the lesser
 ///of each pair of values.
 ///
+///If either value in a comparison is NaN, returns the value from \a __b.
+///
 /// \headerfile 
 ///
 /// This intrinsic corresponds to the  VMINPS  instruction.
@@ -1604,9 +1612,9 @@ _mm256_blendv_ps(__m256 __a, __m256 __b, __m256 __c)
 ///128-bit vectors of [2 x double], using the operation specified by the
 ///immediate integer operand.
 ///
-///Returns a [2 x double] vector consisting of two doubles corresponding to
-///the two comparison results: zero if the comparison is false, and all 1's
-///if the comparison is true.
+///Each comparison returns 0x0 for false, 0x for true.
+///If either value in a comparison is NaN, comparisons marked as ordered
+///return false, and comparisons marked as unordered return true.
 ///
 /// \headerfile 
 ///
@@ -1663,9 +1671,9 @@ _mm256_blendv_ps(__m256 __a, __m256 __b, __m256 __c)
 ///[4 x float], using the operation specified by the immediate integer
 ///operand.
 ///
-///Returns a [4 x float] vector consisting of four floats corresponding to
-///the four comparison results: zero if the comparison is false, and all 
1's
-///if the comparison is true.
+///Each comparison returns 0x0 for false, 0x for true.
+///If either value in a comparison is NaN, comparisons marked as ordered
+///return false, and comparisons marked as unordered return true.
 ///
 /// \headerfile 
 ///
@@ -1721,9 +1729,9 @@ _mm256_blendv_ps(__m256 __a, __m256 __b, __m256 __c)
 ///256-bit vectors of [4 x double], using the operation specified by the
 ///immediate integer operand.
 ///
-///Returns a [4 x double] vector consisting of four doubles corresponding 
to
-///the four comparison results: zero if the comparison is false, and all 
1's
-///if the comparison is true.
+///Each comparison returns 0x0 for false, 0x for true.
+///If either value in a comparison is NaN, comparisons marked as ordered
+///return false, and comparisons marked as unordered return true.
 ///
 /// \headerfile 
 ///
@@ -1781,9 +1789,9 @@ _mm256_blendv_ps(__m256 __a, __m256 __b, __m256 __c)
 ///[8 x float], using the operation specified by the immediate integer
 ///operand.
 ///
-///Returns a [8 x float] vector consisting of eight floats corresponding to
-///the eight comparison results: zero if the comparison is false, and all
-///1's if the comparison is true.
+///Each comparison returns 0x0 for false, 0x for true.
+///If either value in a comparison is NaN, comparisons marked as ordered
+///return false, and comparisons marked as unordered return true.
 ///
 /// \headerfile 
 ///
@@ -1842,8 +1850,9 @@ _mm256_blendv_ps(__m256 __a, __m256 __b, __m256 __c)
 ///two 128-bit vectors of [2 x double], using the operation specified by 
the
 ///immediate integer op

[clang] [X86][Headers] Specify result of NaN comparisons (PR #85862)

2024-03-20 Thread Paul T Robinson via cfe-commits


@@ -710,6 +728,7 @@ _mm_cmpge_ps(__m128 __a, __m128 __b)
 ///
 ///The comparison yields 0x0 for false, 0x for true, in the
 ///low-order bits of a vector of [4 x float].
+///If either value in a comparison is NaN, returns false.

pogo59 wrote:

Yes, thank you!

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


[clang] [X86][Headers] Specify result of NaN comparisons (PR #85862)

2024-03-20 Thread Paul T Robinson via cfe-commits


@@ -513,7 +526,7 @@ static __inline__ __m128d __DEFAULT_FN_ATTRS 
_mm_cmpge_pd(__m128d __a,
 ///operand are ordered with respect to those in the second operand.
 ///
 ///A pair of double-precision values are "ordered" with respect to each

pogo59 wrote:

Done

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


[clang] [X86][Headers] Specify result of NaN comparisons (PR #85862)

2024-03-21 Thread Paul T Robinson via cfe-commits

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


[clang] [clang-tools-extra] [compiler-rt] [flang] [lld] [lldb] [llvm] [mlir] [openmp] [pstl] Finally formalise our defacto line-ending policy (PR #86318)

2024-03-22 Thread Paul T Robinson via cfe-commits

pogo59 wrote:

As a data point, I've been setting `core.autocrlf=true` on Windows for years. 
I've been trained to make sure _new_ files have LF endings (usually I copy an 
existing file instead of creating a new file) but both Notepad and the Visual 
Studio editor are willing to preserve the line-ending mode of the file as they 
found it. (This was not always true, but is these days.)

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


[clang] [DebugInfo] Add flag to only emit referenced member functions (PR #87018)

2024-04-01 Thread Paul T Robinson via cfe-commits

pogo59 wrote:

Thanks for the link back to the Phab review, that was helpful. I didn't offhand 
recall the previous round of this. I'll trust the comments I made on that 
review. :)

s/members/methods/ in the option name to avoid the incorrect implication of 
suppressing data members?

I suggest _not_ omitting methods when generating type sections. If there's only 
one description (in the final executable) it ought to be complete. If you omit 
undefined methods, and the linker picks the section from a CU with no method 
definitions, you end up with a type description that has no methods at all, 
which is not especially useful.

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


[clang] [Headers][X86] Editorial fixes to ia32intrin.h descriptions (PR #80490)

2024-02-12 Thread Paul T Robinson via cfe-commits

https://github.com/pogo59 updated 
https://github.com/llvm/llvm-project/pull/80490

>From c068144b1e372aec29f268edf7184ee3d3dc7d54 Mon Sep 17 00:00:00 2001
From: Paul Robinson 
Date: Fri, 2 Feb 2024 12:38:16 -0800
Subject: [PATCH 1/2] [Headers][X86] Editorial fixes to ia32intrin.h
 descriptions

Use indicative not imperative; fix missing capitalization; spell out some 
abbreviations; "time-stamp" not "time stamp".
---
 clang/lib/Headers/ia32intrin.h | 60 +-
 1 file changed, 30 insertions(+), 30 deletions(-)

diff --git a/clang/lib/Headers/ia32intrin.h b/clang/lib/Headers/ia32intrin.h
index 1b979770e19623..fca502f1bd17ba 100644
--- a/clang/lib/Headers/ia32intrin.h
+++ b/clang/lib/Headers/ia32intrin.h
@@ -26,8 +26,8 @@
 #define __DEFAULT_FN_ATTRS_CONSTEXPR __DEFAULT_FN_ATTRS
 #endif
 
-/// Find the first set bit starting from the lsb. Result is undefined if
-///input is 0.
+/// Finds the first set bit starting from the least significant bit. Result is
+///undefined if input is 0.
 ///
 /// \headerfile 
 ///
@@ -43,8 +43,8 @@ __bsfd(int __A) {
   return __builtin_ctz((unsigned int)__A);
 }
 
-/// Find the first set bit starting from the msb. Result is undefined if
-///input is 0.
+/// Finds the first set bit starting from the most significant bit. Result is
+///undefined if input is 0.
 ///
 /// \headerfile 
 ///
@@ -90,8 +90,8 @@ _bswap(int __A) {
   return (int)__builtin_bswap32((unsigned int)__A);
 }
 
-/// Find the first set bit starting from the lsb. Result is undefined if
-///input is 0.
+/// Finds the first set bit starting from the least significant bit. Result is
+///undefined if input is 0.
 ///
 /// \headerfile 
 ///
@@ -108,8 +108,8 @@ _bswap(int __A) {
 /// \see __bsfd
 #define _bit_scan_forward(A) __bsfd((A))
 
-/// Find the first set bit starting from the msb. Result is undefined if
-///input is 0.
+/// Finds the first set bit starting from the most significant bit. Result is
+///undefined if input is 0.
 ///
 /// \headerfile 
 ///
@@ -127,8 +127,8 @@ _bswap(int __A) {
 #define _bit_scan_reverse(A) __bsrd((A))
 
 #ifdef __x86_64__
-/// Find the first set bit starting from the lsb. Result is undefined if
-///input is 0.
+/// Finds the first set bit starting from the least significant bit. Result is
+///undefined if input is 0.
 ///
 /// \headerfile 
 ///
@@ -143,8 +143,8 @@ __bsfq(long long __A) {
   return (long long)__builtin_ctzll((unsigned long long)__A);
 }
 
-/// Find the first set bit starting from the msb. Result is undefined if
-///input is 0.
+/// Finds the first set bit starting from the most significant bit. Result is
+///undefined if input is 0.
 ///
 /// \headerfile 
 ///
@@ -159,7 +159,7 @@ __bsrq(long long __A) {
   return 63 - __builtin_clzll((unsigned long long)__A);
 }
 
-/// Swaps the bytes in the input. Converting little endian to big endian or
+/// Swaps the bytes in the input, converting little endian to big endian or
 ///vice versa.
 ///
 /// \headerfile 
@@ -175,7 +175,7 @@ __bswapq(long long __A) {
   return (long long)__builtin_bswap64((unsigned long long)__A);
 }
 
-/// Swaps the bytes in the input. Converting little endian to big endian or
+/// Swaps the bytes in the input, converting little endian to big endian or
 ///vice versa.
 ///
 /// \headerfile 
@@ -198,7 +198,7 @@ __bswapq(long long __A) {
 /// \headerfile 
 ///
 /// This intrinsic corresponds to the \c POPCNT instruction or a
-///a sequence of arithmetic and logic ops to calculate it.
+///sequence of arithmetic and logic operations to calculate it.
 ///
 /// \param __A
 ///An unsigned 32-bit integer operand.
@@ -220,7 +220,7 @@ __popcntd(unsigned int __A)
 /// \endcode
 ///
 /// This intrinsic corresponds to the \c POPCNT instruction or a
-///a sequence of arithmetic and logic ops to calculate it.
+///sequence of arithmetic and logic operations to calculate it.
 ///
 /// \param A
 ///An unsigned 32-bit integer operand.
@@ -235,7 +235,7 @@ __popcntd(unsigned int __A)
 /// \headerfile 
 ///
 /// This intrinsic corresponds to the \c POPCNT instruction or a
-///a sequence of arithmetic and logic ops to calculate it.
+///sequence of arithmetic and logic operations to calculate it.
 ///
 /// \param __A
 ///An unsigned 64-bit integer operand.
@@ -257,7 +257,7 @@ __popcntq(unsigned long long __A)
 /// \endcode
 ///
 /// This intrinsic corresponds to the \c POPCNT instruction or a
-///a sequence of arithmetic and logic ops to calculate it.
+///sequence of arithmetic and logic operations to calculate it.
 ///
 /// \param A
 ///An unsigned 64-bit integer operand.
@@ -328,7 +328,7 @@ __writeeflags(unsigned int __f)
 }
 #endif /* !__x86_64__ */
 
-/// Cast a 32-bit float value to a 32-bit unsigned integer value.
+/// Casts a 32-bit float value to a 32-bit unsigned integer value.
 ///
 /// \headerfile 
 ///
@@ -337,13 +337,13 @@ __writeeflags(unsigned int __f)
 ///
 /// \param __A
 /// 

[clang] [Headers][X86] Editorial fixes to ia32intrin.h descriptions (PR #80490)

2024-02-12 Thread Paul T Robinson via cfe-commits

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


[clang] [clang][NFC] Trim license header comments to 81 characters (PR #82919)

2024-03-05 Thread Paul T Robinson via cfe-commits

pogo59 wrote:

I grepped `clang` for "^/+=[^/]*/.*\.(h|cpp) " and found only 35 files with 
directory components. So, the majority of files have only the filename in the 
header line. The example in the Coding Standard does not reflect common 
practice.

I think it's fine to remove everything but the filename.

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


[clang] [Headers][X86] Add rounding and exception notes to conversions (PR #83447)

2024-03-07 Thread Paul T Robinson via cfe-commits

https://github.com/pogo59 updated 
https://github.com/llvm/llvm-project/pull/83447

>From 64cdd358d0bf359383a5dd3d1da236a219644c9e Mon Sep 17 00:00:00 2001
From: Paul Robinson 
Date: Thu, 29 Feb 2024 08:59:26 -0800
Subject: [PATCH 1/2] [Headers][X86] Add rounding and exception notes to
 conversions

Consistently describe rounding/truncating on convert intrinsics.
Add notes where an out-of-range result can raise an exception.
---
 clang/lib/Headers/avxintrin.h |  36 +++---
 clang/lib/Headers/emmintrin.h |  91 ++---
 clang/lib/Headers/xmmintrin.h | 125 --
 3 files changed, 182 insertions(+), 70 deletions(-)

diff --git a/clang/lib/Headers/avxintrin.h b/clang/lib/Headers/avxintrin.h
index f116d8bc3a94c7..51c7d76e75ca1a 100644
--- a/clang/lib/Headers/avxintrin.h
+++ b/clang/lib/Headers/avxintrin.h
@@ -2180,7 +2180,8 @@ _mm256_cvtepi32_pd(__m128i __a)
   return (__m256d)__builtin_convertvector((__v4si)__a, __v4df);
 }
 
-/// Converts a vector of [8 x i32] into a vector of [8 x float].
+/// Converts a vector of [8 x i32] into a vector of [8 x float]. Rounds inexact
+///results according to the rounding control bits in the MXCSR register.
 ///
 /// \headerfile 
 ///
@@ -2196,7 +2197,8 @@ _mm256_cvtepi32_ps(__m256i __a)
 }
 
 /// Converts a 256-bit vector of [4 x double] into a 128-bit vector of
-///[4 x float].
+///[4 x float]. Rounds inexact results according to the rounding control
+///bits in the MXCSR register.
 ///
 /// \headerfile 
 ///
@@ -2211,7 +2213,12 @@ _mm256_cvtpd_ps(__m256d __a)
   return (__m128)__builtin_ia32_cvtpd2ps256((__v4df) __a);
 }
 
-/// Converts a vector of [8 x float] into a vector of [8 x i32].
+/// Converts a vector of [8 x float] into a vector of [8 x i32]. Rounds inexact
+///results according to the rounding control bits in the MXCSR register.
+///
+///If a converted value is larger than the maximum possible result,
+///raises a floating-point invalid exception. If the exception is
+///masked, returns the most negative integer.
 ///
 /// \headerfile 
 ///
@@ -2243,8 +2250,11 @@ _mm256_cvtps_pd(__m128 __a)
 }
 
 /// Converts a 256-bit vector of [4 x double] into a 128-bit vector of [4
-///x i32], truncating the result by rounding towards zero when it is
-///inexact.
+///x i32], truncating inexact results.
+///
+///If a converted value is larger than the maximum possible result,
+///raises a floating-point invalid exception. If the exception is
+///masked, returns the most negative integer.
 ///
 /// \headerfile 
 ///
@@ -2259,9 +2269,13 @@ _mm256_cvttpd_epi32(__m256d __a)
   return (__m128i)__builtin_ia32_cvttpd2dq256((__v4df) __a);
 }
 
-/// Converts a 256-bit vector of [4 x double] into a 128-bit vector of [4
-///x i32]. When a conversion is inexact, the value returned is rounded
-///according to the rounding control bits in the MXCSR register.
+/// Converts a 256-bit vector of [4 x double] into a 128-bit vector of
+///[4 x i32]. Rounds inexact results according to the rounding control bits
+///in the MXCSR register.
+///
+///If a converted value is larger than the maximum possible result,
+///raises a floating-point invalid exception. If the exception is
+///masked, returns the most negative integer.
 ///
 /// \headerfile 
 ///
@@ -2277,7 +2291,11 @@ _mm256_cvtpd_epi32(__m256d __a)
 }
 
 /// Converts a vector of [8 x float] into a vector of [8 x i32],
-///truncating the result by rounding towards zero when it is inexact.
+///truncating inexact results.
+///
+///If a converted value is larger than the maximum possible result,
+///raises a floating-point invalid exception. If the exception is
+///masked, returns the most negative integer.
 ///
 /// \headerfile 
 ///
diff --git a/clang/lib/Headers/emmintrin.h b/clang/lib/Headers/emmintrin.h
index 96e3ebdecbdf83..9ae7fe2c809ac6 100644
--- a/clang/lib/Headers/emmintrin.h
+++ b/clang/lib/Headers/emmintrin.h
@@ -1245,7 +1245,8 @@ static __inline__ int __DEFAULT_FN_ATTRS 
_mm_ucomineq_sd(__m128d __a,
 /// Converts the two double-precision floating-point elements of a
 ///128-bit vector of [2 x double] into two single-precision floating-point
 ///values, returned in the lower 64 bits of a 128-bit vector of [4 x 
float].
-///The upper 64 bits of the result vector are set to zero.
+///Rounds inexact results according to the rounding control bits in the
+///MXCSR register. The upper 64 bits of the result vector are set to zero.
 ///
 /// \headerfile 
 ///
@@ -1300,9 +1301,13 @@ static __inline__ __m128d __DEFAULT_FN_ATTRS 
_mm_cvtepi32_pd(__m128i __a) {
 }
 
 /// Converts the two double-precision floating-point elements of a
-///128-bit vector of [2 x double] into two signed 32-bit integer values,
-///returned in the lower 64 bits of a 128-bit vector of [4 x i32]. The 
upper
-///64 bits of the result vector are set to zero.
+///128-bit vector of [2 

[clang] [Headers][X86] Add rounding and exception notes to conversions (PR #83447)

2024-03-07 Thread Paul T Robinson via cfe-commits


@@ -2180,7 +2180,8 @@ _mm256_cvtepi32_pd(__m128i __a)
   return (__m256d)__builtin_convertvector((__v4si)__a, __v4df);
 }
 
-/// Converts a vector of [8 x i32] into a vector of [8 x float].
+/// Converts a vector of [8 x i32] into a vector of [8 x float]. Rounds inexact
+///results according to the rounding control bits in the MXCSR register.

pogo59 wrote:

Discussed this internally and agreed that it is not necessary.

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


[clang] [Headers][X86] Add specific results to comparisons (PR #83316)

2024-03-07 Thread Paul T Robinson via cfe-commits

pogo59 wrote:

@RKSimon I was not aware of the comparison intrinsics in emmintrin.h. I will 
follow that pattern.

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


[clang] [Headers][X86] Add specific results to comparisons (PR #83316)

2024-03-07 Thread Paul T Robinson via cfe-commits

https://github.com/pogo59 updated 
https://github.com/llvm/llvm-project/pull/83316

>From 2afca3e91d96cc77f43556bbf71b6e60a22e45f2 Mon Sep 17 00:00:00 2001
From: Paul Robinson 
Date: Wed, 28 Feb 2024 11:04:41 -0800
Subject: [PATCH 1/2] [Headers][X86] Add specific results to comparisons

Comparison intrinsics were described as returning the "result" without
specifying how. The "cmp" intrinsics return zero or all 1's in the
corresponding elements of a returned vector; the "com" intrinsics return
an integer 0 or 1.

Also removed some redundant information.
---
 clang/lib/Headers/smmintrin.h |   6 +-
 clang/lib/Headers/xmmintrin.h | 146 +++---
 2 files changed, 85 insertions(+), 67 deletions(-)

diff --git a/clang/lib/Headers/smmintrin.h b/clang/lib/Headers/smmintrin.h
index 005d7db9c3c308..ba593835b9b3dc 100644
--- a/clang/lib/Headers/smmintrin.h
+++ b/clang/lib/Headers/smmintrin.h
@@ -1186,7 +1186,8 @@ static __inline__ int __DEFAULT_FN_ATTRS 
_mm_testnzc_si128(__m128i __M,
 
 /* SSE4 64-bit Packed Integer Comparisons.  */
 /// Compares each of the corresponding 64-bit values of the 128-bit
-///integer vectors for equality.
+///integer vectors for equality. Returns zero for false and all 1's for
+///true in corresponding elements of the result.
 ///
 /// \headerfile 
 ///
@@ -2303,7 +2304,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS 
_mm_minpos_epu16(__m128i __V) {
 /* SSE4.2 Compare Packed Data -- Greater Than.  */
 /// Compares each of the corresponding 64-bit values of the 128-bit
 ///integer vectors to determine if the values in the first operand are
-///greater than those in the second operand.
+///greater than those in the second operand. Returns zero for false and
+///all 1's for true in corresponding elements of the result.
 ///
 /// \headerfile 
 ///
diff --git a/clang/lib/Headers/xmmintrin.h b/clang/lib/Headers/xmmintrin.h
index 47368f3c23d2d6..d8ad5ae526a45f 100644
--- a/clang/lib/Headers/xmmintrin.h
+++ b/clang/lib/Headers/xmmintrin.h
@@ -474,8 +474,8 @@ _mm_xor_ps(__m128 __a, __m128 __b)
 }
 
 /// Compares two 32-bit float values in the low-order bits of both
-///operands for equality and returns the result of the comparison in the
-///low-order bits of a vector [4 x float].
+///operands for equality and returns the result of the comparison (zero for
+///false, all 1's for true) in the low-order bits of a vector [4 x float].
 ///
 /// \headerfile 
 ///
@@ -496,7 +496,8 @@ _mm_cmpeq_ss(__m128 __a, __m128 __b)
 }
 
 /// Compares each of the corresponding 32-bit float values of the
-///128-bit vectors of [4 x float] for equality.
+///128-bit vectors of [4 x float] for equality. Returns zero for false and
+///all 1's for true in corresponding elements of the result.
 ///
 /// \headerfile 
 ///
@@ -516,7 +517,8 @@ _mm_cmpeq_ps(__m128 __a, __m128 __b)
 /// Compares two 32-bit float values in the low-order bits of both
 ///operands to determine if the value in the first operand is less than the
 ///corresponding value in the second operand and returns the result of the
-///comparison in the low-order bits of a vector of [4 x float].
+///comparison (zero for false, all 1's for true) in the low-order bits of a
+///vector of [4 x float].
 ///
 /// \headerfile 
 ///
@@ -538,7 +540,8 @@ _mm_cmplt_ss(__m128 __a, __m128 __b)
 
 /// Compares each of the corresponding 32-bit float values of the
 ///128-bit vectors of [4 x float] to determine if the values in the first
-///operand are less than those in the second operand.
+///operand are less than those in the second operand. Returns zero for
+///false and all 1's for true in corresponding elements of the result.
 ///
 /// \headerfile 
 ///
@@ -558,8 +561,8 @@ _mm_cmplt_ps(__m128 __a, __m128 __b)
 /// Compares two 32-bit float values in the low-order bits of both
 ///operands to determine if the value in the first operand is less than or
 ///equal to the corresponding value in the second operand and returns the
-///result of the comparison in the low-order bits of a vector of
-///[4 x float].
+///result of the comparison (zero for false, all 1's for true) in the
+///low-order bits of a vector of [4 x float].
 ///
 /// \headerfile 
 ///
@@ -581,7 +584,9 @@ _mm_cmple_ss(__m128 __a, __m128 __b)
 
 /// Compares each of the corresponding 32-bit float values of the
 ///128-bit vectors of [4 x float] to determine if the values in the first
-///operand are less than or equal to those in the second operand.
+///operand are less than or equal to those in the second operand. Returns
+///zero for false and all 1's for true in corresponding elements of the
+///result.
 ///
 /// \headerfile 
 ///
@@ -601,7 +606,8 @@ _mm_cmple_ps(__m128 __a, __m128 __b)
 /// Compares two 32-bit float values in the low-order bits of both
 ///operands to determine if the value in the first operand is greater than
 ///th

[clang] [Headers][X86] Add specific results to comparisons (PR #83316)

2024-03-07 Thread Paul T Robinson via cfe-commits

pogo59 wrote:

@RKSimon note this will affect what the tooltips show. Is that okay?

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


[clang] [Headers][X86] Add specific results to comparisons (PR #83316)

2024-03-07 Thread Paul T Robinson via cfe-commits

https://github.com/pogo59 updated 
https://github.com/llvm/llvm-project/pull/83316

>From 2afca3e91d96cc77f43556bbf71b6e60a22e45f2 Mon Sep 17 00:00:00 2001
From: Paul Robinson 
Date: Wed, 28 Feb 2024 11:04:41 -0800
Subject: [PATCH 1/3] [Headers][X86] Add specific results to comparisons

Comparison intrinsics were described as returning the "result" without
specifying how. The "cmp" intrinsics return zero or all 1's in the
corresponding elements of a returned vector; the "com" intrinsics return
an integer 0 or 1.

Also removed some redundant information.
---
 clang/lib/Headers/smmintrin.h |   6 +-
 clang/lib/Headers/xmmintrin.h | 146 +++---
 2 files changed, 85 insertions(+), 67 deletions(-)

diff --git a/clang/lib/Headers/smmintrin.h b/clang/lib/Headers/smmintrin.h
index 005d7db9c3c308..ba593835b9b3dc 100644
--- a/clang/lib/Headers/smmintrin.h
+++ b/clang/lib/Headers/smmintrin.h
@@ -1186,7 +1186,8 @@ static __inline__ int __DEFAULT_FN_ATTRS 
_mm_testnzc_si128(__m128i __M,
 
 /* SSE4 64-bit Packed Integer Comparisons.  */
 /// Compares each of the corresponding 64-bit values of the 128-bit
-///integer vectors for equality.
+///integer vectors for equality. Returns zero for false and all 1's for
+///true in corresponding elements of the result.
 ///
 /// \headerfile 
 ///
@@ -2303,7 +2304,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS 
_mm_minpos_epu16(__m128i __V) {
 /* SSE4.2 Compare Packed Data -- Greater Than.  */
 /// Compares each of the corresponding 64-bit values of the 128-bit
 ///integer vectors to determine if the values in the first operand are
-///greater than those in the second operand.
+///greater than those in the second operand. Returns zero for false and
+///all 1's for true in corresponding elements of the result.
 ///
 /// \headerfile 
 ///
diff --git a/clang/lib/Headers/xmmintrin.h b/clang/lib/Headers/xmmintrin.h
index 47368f3c23d2d6..d8ad5ae526a45f 100644
--- a/clang/lib/Headers/xmmintrin.h
+++ b/clang/lib/Headers/xmmintrin.h
@@ -474,8 +474,8 @@ _mm_xor_ps(__m128 __a, __m128 __b)
 }
 
 /// Compares two 32-bit float values in the low-order bits of both
-///operands for equality and returns the result of the comparison in the
-///low-order bits of a vector [4 x float].
+///operands for equality and returns the result of the comparison (zero for
+///false, all 1's for true) in the low-order bits of a vector [4 x float].
 ///
 /// \headerfile 
 ///
@@ -496,7 +496,8 @@ _mm_cmpeq_ss(__m128 __a, __m128 __b)
 }
 
 /// Compares each of the corresponding 32-bit float values of the
-///128-bit vectors of [4 x float] for equality.
+///128-bit vectors of [4 x float] for equality. Returns zero for false and
+///all 1's for true in corresponding elements of the result.
 ///
 /// \headerfile 
 ///
@@ -516,7 +517,8 @@ _mm_cmpeq_ps(__m128 __a, __m128 __b)
 /// Compares two 32-bit float values in the low-order bits of both
 ///operands to determine if the value in the first operand is less than the
 ///corresponding value in the second operand and returns the result of the
-///comparison in the low-order bits of a vector of [4 x float].
+///comparison (zero for false, all 1's for true) in the low-order bits of a
+///vector of [4 x float].
 ///
 /// \headerfile 
 ///
@@ -538,7 +540,8 @@ _mm_cmplt_ss(__m128 __a, __m128 __b)
 
 /// Compares each of the corresponding 32-bit float values of the
 ///128-bit vectors of [4 x float] to determine if the values in the first
-///operand are less than those in the second operand.
+///operand are less than those in the second operand. Returns zero for
+///false and all 1's for true in corresponding elements of the result.
 ///
 /// \headerfile 
 ///
@@ -558,8 +561,8 @@ _mm_cmplt_ps(__m128 __a, __m128 __b)
 /// Compares two 32-bit float values in the low-order bits of both
 ///operands to determine if the value in the first operand is less than or
 ///equal to the corresponding value in the second operand and returns the
-///result of the comparison in the low-order bits of a vector of
-///[4 x float].
+///result of the comparison (zero for false, all 1's for true) in the
+///low-order bits of a vector of [4 x float].
 ///
 /// \headerfile 
 ///
@@ -581,7 +584,9 @@ _mm_cmple_ss(__m128 __a, __m128 __b)
 
 /// Compares each of the corresponding 32-bit float values of the
 ///128-bit vectors of [4 x float] to determine if the values in the first
-///operand are less than or equal to those in the second operand.
+///operand are less than or equal to those in the second operand. Returns
+///zero for false and all 1's for true in corresponding elements of the
+///result.
 ///
 /// \headerfile 
 ///
@@ -601,7 +606,8 @@ _mm_cmple_ps(__m128 __a, __m128 __b)
 /// Compares two 32-bit float values in the low-order bits of both
 ///operands to determine if the value in the first operand is greater than
 ///th

[clang] [X86] Finally handle target of __builtin_ia32_cmp[p|s][s|d] from avx into sse/sse2/avx (PR #84136)

2024-03-08 Thread Paul T Robinson via cfe-commits

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


[clang] [X86] Finally handle target of __builtin_ia32_cmp[p|s][s|d] from avx into sse/sse2/avx (PR #84136)

2024-03-08 Thread Paul T Robinson via cfe-commits

https://github.com/pogo59 commented:

Thanks for the heads-up @RKSimon I've made suggestions for consistency with 
existing practice in emmintrin.h which I've adopted in the latest revision to 
#83316.

I'm unsure how replacing a function declaration with an \fn directive will play 
with our documentation tooling. But we can figure that out later.

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


[clang] [X86] Finally handle target of __builtin_ia32_cmp[p|s][s|d] from avx into sse/sse2/avx (PR #84136)

2024-03-08 Thread Paul T Robinson via cfe-commits


@@ -2940,6 +2940,84 @@ _mm_movemask_ps(__m128 __a)
   return __builtin_ia32_movmskps((__v4sf)__a);
 }
 
+/* Compare */
+#define _CMP_EQ_OQ0x00 /* Equal (ordered, non-signaling)  */
+#define _CMP_LT_OS0x01 /* Less-than (ordered, signaling)  */
+#define _CMP_LE_OS0x02 /* Less-than-or-equal (ordered, signaling)  */
+#define _CMP_UNORD_Q  0x03 /* Unordered (non-signaling)  */
+#define _CMP_NEQ_UQ   0x04 /* Not-equal (unordered, non-signaling)  */
+#define _CMP_NLT_US   0x05 /* Not-less-than (unordered, signaling)  */
+#define _CMP_NLE_US   0x06 /* Not-less-than-or-equal (unordered, signaling)  */
+#define _CMP_ORD_Q0x07 /* Ordered (non-signaling)   */
+
+/// Compares each of the corresponding values of two 128-bit vectors of
+///[4 x float], using the operation specified by the immediate integer
+///operand.
+///
+///Returns a [4 x float] vector consisting of four floats corresponding to
+///the four comparison results: zero if the comparison is false, and all 
1's
+///if the comparison is true.

pogo59 wrote:

```suggestion
///Each comparison yields 0x0 for false, 0x for true.
```

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


[clang] [X86] Finally handle target of __builtin_ia32_cmp[p|s][s|d] from avx into sse/sse2/avx (PR #84136)

2024-03-08 Thread Paul T Robinson via cfe-commits


@@ -4745,6 +4745,77 @@ static __inline__ __m128d __DEFAULT_FN_ATTRS 
_mm_castsi128_pd(__m128i __a) {
   return (__m128d)__a;
 }
 
+/// Compares each of the corresponding double-precision values of two
+///128-bit vectors of [2 x double], using the operation specified by the
+///immediate integer operand.
+///
+///Returns a [2 x double] vector consisting of two doubles corresponding to
+///the two comparison results: zero if the comparison is false, and all 1's
+///if the comparison is true.

pogo59 wrote:

```suggestion
///Each comparison yields 0x0 for false, 0x for true.
```
to be consistent with #83316 changes.

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


[clang] [X86] Finally handle target of __builtin_ia32_cmp[p|s][s|d] from avx into sse/sse2/avx (PR #84136)

2024-03-08 Thread Paul T Robinson via cfe-commits


@@ -2940,6 +2940,84 @@ _mm_movemask_ps(__m128 __a)
   return __builtin_ia32_movmskps((__v4sf)__a);
 }
 
+/* Compare */
+#define _CMP_EQ_OQ0x00 /* Equal (ordered, non-signaling)  */
+#define _CMP_LT_OS0x01 /* Less-than (ordered, signaling)  */
+#define _CMP_LE_OS0x02 /* Less-than-or-equal (ordered, signaling)  */
+#define _CMP_UNORD_Q  0x03 /* Unordered (non-signaling)  */
+#define _CMP_NEQ_UQ   0x04 /* Not-equal (unordered, non-signaling)  */
+#define _CMP_NLT_US   0x05 /* Not-less-than (unordered, signaling)  */
+#define _CMP_NLE_US   0x06 /* Not-less-than-or-equal (unordered, signaling)  */
+#define _CMP_ORD_Q0x07 /* Ordered (non-signaling)   */
+
+/// Compares each of the corresponding values of two 128-bit vectors of
+///[4 x float], using the operation specified by the immediate integer
+///operand.
+///
+///Returns a [4 x float] vector consisting of four floats corresponding to
+///the four comparison results: zero if the comparison is false, and all 
1's
+///if the comparison is true.
+///
+/// \headerfile 
+///
+/// \code
+/// __m128 _mm_cmp_ps(__m128 a, __m128 b, const int c);
+/// \endcode
+///
+/// This intrinsic corresponds to the  (V)CMPPS  instruction.
+///
+/// \param a
+///A 128-bit vector of [4 x float].
+/// \param b
+///A 128-bit vector of [4 x float].
+/// \param c
+///An immediate integer operand, with bits [4:0] specifying which 
comparison
+///operation to use: \n
+///0x00: Equal (ordered, non-signaling) \n
+///0x01: Less-than (ordered, signaling) \n
+///0x02: Less-than-or-equal (ordered, signaling) \n
+///0x03: Unordered (non-signaling) \n
+///0x04: Not-equal (unordered, non-signaling) \n
+///0x05: Not-less-than (unordered, signaling) \n
+///0x06: Not-less-than-or-equal (unordered, signaling) \n
+///0x07: Ordered (non-signaling) \n
+/// \returns A 128-bit vector of [4 x float] containing the comparison results.
+#define _mm_cmp_ps(a, b, c)
\
+  ((__m128)__builtin_ia32_cmpps((__v4sf)(__m128)(a), (__v4sf)(__m128)(b), (c)))
+
+/// Compares each of the corresponding scalar values of two 128-bit
+///vectors of [4 x float], using the operation specified by the immediate
+///integer operand.
+///
+///If the result is true, all 32 bits of the destination vector are set;
+///otherwise they are cleared.

pogo59 wrote:

```suggestion
///Each comparison yields 0x0 for false, 0x for true.
```

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


[clang] [X86] Finally handle target of __builtin_ia32_cmp[p|s][s|d] from avx into sse/sse2/avx (PR #84136)

2024-03-08 Thread Paul T Robinson via cfe-commits


@@ -4745,6 +4745,77 @@ static __inline__ __m128d __DEFAULT_FN_ATTRS 
_mm_castsi128_pd(__m128i __a) {
   return (__m128d)__a;
 }
 
+/// Compares each of the corresponding double-precision values of two
+///128-bit vectors of [2 x double], using the operation specified by the
+///immediate integer operand.
+///
+///Returns a [2 x double] vector consisting of two doubles corresponding to
+///the two comparison results: zero if the comparison is false, and all 1's
+///if the comparison is true.
+///
+/// \headerfile 
+///
+/// \code
+/// __m128d _mm_cmp_pd(__m128d a, __m128d b, const int c);
+/// \endcode
+///
+/// This intrinsic corresponds to the  (V)CMPPD  instruction.
+///
+/// \param a
+///A 128-bit vector of [2 x double].
+/// \param b
+///A 128-bit vector of [2 x double].
+/// \param c
+///An immediate integer operand, with bits [4:0] specifying which 
comparison
+///operation to use: \n
+///0x00: Equal (ordered, non-signaling) \n
+///0x01: Less-than (ordered, signaling) \n
+///0x02: Less-than-or-equal (ordered, signaling) \n
+///0x03: Unordered (non-signaling) \n
+///0x04: Not-equal (unordered, non-signaling) \n
+///0x05: Not-less-than (unordered, signaling) \n
+///0x06: Not-less-than-or-equal (unordered, signaling) \n
+///0x07: Ordered (non-signaling) \n
+/// \returns A 128-bit vector of [2 x double] containing the comparison 
results.
+#define _mm_cmp_pd(a, b, c)
\
+  ((__m128d)__builtin_ia32_cmppd((__v2df)(__m128d)(a), (__v2df)(__m128d)(b),   
\
+ (c)))
+
+/// Compares each of the corresponding scalar double-precision values of
+///two 128-bit vectors of [2 x double], using the operation specified by 
the
+///immediate integer operand.
+///
+///If the result is true, all 64 bits of the destination vector are set;
+///otherwise they are cleared.

pogo59 wrote:

```suggestion
///Each comparison yields 0x0 for false, 0x for true.
```

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


[clang] [X86] Finally handle target of __builtin_ia32_cmp[p|s][s|d] from avx into sse/sse2/avx (PR #84136)

2024-03-08 Thread Paul T Robinson via cfe-commits

https://github.com/pogo59 commented:

The example for `\fn` in the [doxygen 
documentation](https://www.doxygen.nl/manual/commands.html#cmdfn) puts the 
directive at the top of the comment block, not at the end. Do we know whether 
putting it at the end will produce the expected result?

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


[clang] [Headers][X86] Add specific results to comparisons (PR #83316)

2024-03-08 Thread Paul T Robinson via cfe-commits

pogo59 wrote:

> I think so - we're just losing the extra info about -1/0 or 1/0 result values?

That's my understanding. I haven't actually tried regenerating the tooltips to 
check.

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


[clang] [Headers][X86] Add rounding and exception notes to conversions (PR #83447)

2024-03-08 Thread Paul T Robinson via cfe-commits


@@ -1405,11 +1413,12 @@ static __inline__ __m128d __DEFAULT_FN_ATTRS 
_mm_cvtss_sd(__m128d __a,
 
 /// Converts the two double-precision floating-point elements of a
 ///128-bit vector of [2 x double] into two signed 32-bit integer values,
-///returned in the lower 64 bits of a 128-bit vector of [4 x i32].
+///returned in the lower 64 bits of a 128-bit vector of [4 x i32],
+///truncating inexact results.

pogo59 wrote:

Truncation is what distinguishes this from `_mm_cvtpd_epi32` so I think it is 
necessary? That information used to be in the second paragraph, I shortened it 
and moved it up to the first paragraph, to make that difference more obvious.
Behavior on overflow was added to the second paragraph.

Do you have a different suggestion for how to organize this information?

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


[clang] [X86] Finally handle target of __builtin_ia32_cmp[p|s][s|d] from avx into sse/sse2/avx (PR #84136)

2024-03-11 Thread Paul T Robinson via cfe-commits

pogo59 wrote:

Thanks!

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


[clang] [Headers][X86] Add specific results to comparisons (PR #83316)

2024-03-11 Thread Paul T Robinson via cfe-commits

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


[clang] [clang-tools-extra] [compiler-rt] [flang] [libclc] [libcxx] [lld] [lldb] [llvm] [NFC] Remove trailing whitespace across all non-test related files (PR #82838)

2024-02-26 Thread Paul T Robinson via cfe-commits

pogo59 wrote:

> This seems akin to running clang-format on the entire project, which last 
> time we talked about still faced opposition

My impression (I admit I haven't reviewed the whole thread lately) is that the 
opposition has mostly to do with how clang-format mangles some constructs, not 
to the idea in general.

I'm juggling 4 projects at the moment, I have to finish some internal 
release-related work before I can get back to clang-format-all-the-things.

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


[clang] [DRAFT][analyzer][NFC] clang-format our folders (PR #82599)

2024-02-26 Thread Paul T Robinson via cfe-commits

https://github.com/pogo59 commented:

Would be good to feed back some of these examples to the RFC. Improving how 
clang-format handles some of these cases (esp. the doxygen ones) would help 
progress toward the goal.

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


[clang] [DRAFT][analyzer][NFC] clang-format our folders (PR #82599)

2024-02-26 Thread Paul T Robinson via cfe-commits


@@ -107,7 +107,8 @@ class CallDescription {
 return CD1.matches(Call);
   }
 
-  /// \copydoc clang::ento::CallDescription::matchesAny(const CallEvent &, 
const CallDescription &)
+  /// \copydoc clang::ento::CallDescription::matchesAny(const CallEvent &, 
const
+  /// CallDescription &)

pogo59 wrote:

I think clang-format would have to be taught not to break lines starting with 
Doxygen directives. 

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


[clang] [DRAFT][analyzer][NFC] clang-format our folders (PR #82599)

2024-02-26 Thread Paul T Robinson via cfe-commits

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


[clang] [DRAFT][analyzer][NFC] clang-format our folders (PR #82599)

2024-02-26 Thread Paul T Robinson via cfe-commits


@@ -219,17 +219,19 @@ void WalkAST::VisitCallExpr(CallExpr *CE) {
 if (containsBadStrncatPattern(CE)) {
   const Expr *DstArg = CE->getArg(0);
   const Expr *LenArg = CE->getArg(2);
-  PathDiagnosticLocation Loc =
-PathDiagnosticLocation::createBegin(LenArg, BR.getSourceManager(), AC);
+  PathDiagnosticLocation Loc = PathDiagnosticLocation::createBegin(
+  LenArg, BR.getSourceManager(), AC);
 
   StringRef DstName = getPrintableName(DstArg);
 
   SmallString<256> S;
   llvm::raw_svector_ostream os(S);
   os << "Potential buffer overflow. ";
   if (!DstName.empty()) {
-os << "Replace with 'sizeof(" << DstName << ") "
-  "- strlen(" << DstName <<") - 1'";
+os << "Replace with 'sizeof(" << DstName
+   << ") "
+  "- strlen("
+   << DstName << ") - 1'";

pogo59 wrote:

Yeah, lots of these ostream chained operators are written to reflect coherent 
bits of output, and clang-format will be unaware of the semantic relevance. I 
think `clang-format off` is the only solution here.

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


[clang] [DRAFT][analyzer][NFC] clang-format our folders (PR #82599)

2024-02-26 Thread Paul T Robinson via cfe-commits


@@ -393,20 +385,19 @@ class ExprEngine {
   ProgramStateRef processAssume(ProgramStateRef state, SVal cond,
 bool assumption);
 
-  /// processRegionChanges - Called by ProgramStateManager whenever a change 
is made
+  /// processRegionChanges - Called by ProgramStateManager whenever a change is
+  /// made

pogo59 wrote:

I don't know how smart clang-format is about Doxygen comments. It's _very_ 
common to have the function name repeated at the beginning of the comment, 
which is somewhere between unnecessary (due to Doxygen changes) and producing 
bad-looking documentation.

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


[clang] [DRAFT][analyzer][NFC] clang-format our folders (PR #82599)

2024-02-26 Thread Paul T Robinson via cfe-commits


@@ -244,24 +246,25 @@ void WalkAST::VisitCallExpr(CallExpr *CE) {
 if (containsBadStrlcpyStrlcatPattern(CE)) {
   const Expr *DstArg = CE->getArg(0);
   const Expr *LenArg = CE->getArg(2);
-  PathDiagnosticLocation Loc =
-PathDiagnosticLocation::createBegin(LenArg, BR.getSourceManager(), AC);
+  PathDiagnosticLocation Loc = PathDiagnosticLocation::createBegin(
+  LenArg, BR.getSourceManager(), AC);
 
   StringRef DstName = getPrintableName(DstArg);
 
   SmallString<256> S;
   llvm::raw_svector_ostream os(S);
-  os << "The third argument allows to potentially copy more bytes than it 
should. ";
+  os << "The third argument allows to potentially copy more bytes than it "
+"should. ";
   os << "Replace with the value ";

pogo59 wrote:

```suggestion
  os << "The third argument allows to potentially copy more bytes than it "
"should. Replace with the value ";
```

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


[clang] [DRAFT][analyzer][NFC] clang-format our folders (PR #82599)

2024-02-26 Thread Paul T Robinson via cfe-commits


@@ -393,20 +385,19 @@ class ExprEngine {
   ProgramStateRef processAssume(ProgramStateRef state, SVal cond,
 bool assumption);
 
-  /// processRegionChanges - Called by ProgramStateManager whenever a change 
is made
+  /// processRegionChanges - Called by ProgramStateManager whenever a change is
+  /// made

pogo59 wrote:

```suggestion
  /// Called by ProgramStateManager whenever a change is made
```


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


[clang] [DRAFT][analyzer][NFC] clang-format our folders (PR #82599)

2024-02-26 Thread Paul T Robinson via cfe-commits


@@ -244,24 +246,25 @@ void WalkAST::VisitCallExpr(CallExpr *CE) {
 if (containsBadStrlcpyStrlcatPattern(CE)) {
   const Expr *DstArg = CE->getArg(0);
   const Expr *LenArg = CE->getArg(2);
-  PathDiagnosticLocation Loc =
-PathDiagnosticLocation::createBegin(LenArg, BR.getSourceManager(), AC);
+  PathDiagnosticLocation Loc = PathDiagnosticLocation::createBegin(
+  LenArg, BR.getSourceManager(), AC);
 
   StringRef DstName = getPrintableName(DstArg);
 
   SmallString<256> S;
   llvm::raw_svector_ostream os(S);
-  os << "The third argument allows to potentially copy more bytes than it 
should. ";
+  os << "The third argument allows to potentially copy more bytes than it "
+"should. ";
   os << "Replace with the value ";

pogo59 wrote:

clang-format can't do that sort of thing automatically. Breaking the too-long 
line is correct IMO.

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


[clang] [clang][NFC] Trim license header comments to 81 characters (PR #82919)

2024-02-26 Thread Paul T Robinson via cfe-commits


@@ -1,10 +1,10 @@
-//===- unittest/ASTMatchers/Dynamic/VariantValueTest.cpp - VariantValue unit 
tests -===//
+// unittest/ASTMatchers/Dynamic/VariantValueTest.cpp - VariantValue unit tests

pogo59 wrote:

Repeating the full path name seems unnecessary? (In various files.)

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


[clang] [Headers][X86] Make brief descriptions briefer (PR #82422)

2024-02-28 Thread Paul T Robinson via cfe-commits

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


[clang] [Headers][X86] Add specific results to comparisons (PR #83316)

2024-02-28 Thread Paul T Robinson via cfe-commits

https://github.com/pogo59 created 
https://github.com/llvm/llvm-project/pull/83316

Comparison intrinsics were described as returning the "result" without 
specifying how. The "cmp" intrinsics return zero or all 1's in the 
corresponding elements of a returned vector; the "com" intrinsics return an 
integer 0 or 1.

Also removed some redundant information.

>From 2afca3e91d96cc77f43556bbf71b6e60a22e45f2 Mon Sep 17 00:00:00 2001
From: Paul Robinson 
Date: Wed, 28 Feb 2024 11:04:41 -0800
Subject: [PATCH] [Headers][X86] Add specific results to comparisons

Comparison intrinsics were described as returning the "result" without
specifying how. The "cmp" intrinsics return zero or all 1's in the
corresponding elements of a returned vector; the "com" intrinsics return
an integer 0 or 1.

Also removed some redundant information.
---
 clang/lib/Headers/smmintrin.h |   6 +-
 clang/lib/Headers/xmmintrin.h | 146 +++---
 2 files changed, 85 insertions(+), 67 deletions(-)

diff --git a/clang/lib/Headers/smmintrin.h b/clang/lib/Headers/smmintrin.h
index 005d7db9c3c308..ba593835b9b3dc 100644
--- a/clang/lib/Headers/smmintrin.h
+++ b/clang/lib/Headers/smmintrin.h
@@ -1186,7 +1186,8 @@ static __inline__ int __DEFAULT_FN_ATTRS 
_mm_testnzc_si128(__m128i __M,
 
 /* SSE4 64-bit Packed Integer Comparisons.  */
 /// Compares each of the corresponding 64-bit values of the 128-bit
-///integer vectors for equality.
+///integer vectors for equality. Returns zero for false and all 1's for
+///true in corresponding elements of the result.
 ///
 /// \headerfile 
 ///
@@ -2303,7 +2304,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS 
_mm_minpos_epu16(__m128i __V) {
 /* SSE4.2 Compare Packed Data -- Greater Than.  */
 /// Compares each of the corresponding 64-bit values of the 128-bit
 ///integer vectors to determine if the values in the first operand are
-///greater than those in the second operand.
+///greater than those in the second operand. Returns zero for false and
+///all 1's for true in corresponding elements of the result.
 ///
 /// \headerfile 
 ///
diff --git a/clang/lib/Headers/xmmintrin.h b/clang/lib/Headers/xmmintrin.h
index 47368f3c23d2d6..d8ad5ae526a45f 100644
--- a/clang/lib/Headers/xmmintrin.h
+++ b/clang/lib/Headers/xmmintrin.h
@@ -474,8 +474,8 @@ _mm_xor_ps(__m128 __a, __m128 __b)
 }
 
 /// Compares two 32-bit float values in the low-order bits of both
-///operands for equality and returns the result of the comparison in the
-///low-order bits of a vector [4 x float].
+///operands for equality and returns the result of the comparison (zero for
+///false, all 1's for true) in the low-order bits of a vector [4 x float].
 ///
 /// \headerfile 
 ///
@@ -496,7 +496,8 @@ _mm_cmpeq_ss(__m128 __a, __m128 __b)
 }
 
 /// Compares each of the corresponding 32-bit float values of the
-///128-bit vectors of [4 x float] for equality.
+///128-bit vectors of [4 x float] for equality. Returns zero for false and
+///all 1's for true in corresponding elements of the result.
 ///
 /// \headerfile 
 ///
@@ -516,7 +517,8 @@ _mm_cmpeq_ps(__m128 __a, __m128 __b)
 /// Compares two 32-bit float values in the low-order bits of both
 ///operands to determine if the value in the first operand is less than the
 ///corresponding value in the second operand and returns the result of the
-///comparison in the low-order bits of a vector of [4 x float].
+///comparison (zero for false, all 1's for true) in the low-order bits of a
+///vector of [4 x float].
 ///
 /// \headerfile 
 ///
@@ -538,7 +540,8 @@ _mm_cmplt_ss(__m128 __a, __m128 __b)
 
 /// Compares each of the corresponding 32-bit float values of the
 ///128-bit vectors of [4 x float] to determine if the values in the first
-///operand are less than those in the second operand.
+///operand are less than those in the second operand. Returns zero for
+///false and all 1's for true in corresponding elements of the result.
 ///
 /// \headerfile 
 ///
@@ -558,8 +561,8 @@ _mm_cmplt_ps(__m128 __a, __m128 __b)
 /// Compares two 32-bit float values in the low-order bits of both
 ///operands to determine if the value in the first operand is less than or
 ///equal to the corresponding value in the second operand and returns the
-///result of the comparison in the low-order bits of a vector of
-///[4 x float].
+///result of the comparison (zero for false, all 1's for true) in the
+///low-order bits of a vector of [4 x float].
 ///
 /// \headerfile 
 ///
@@ -581,7 +584,9 @@ _mm_cmple_ss(__m128 __a, __m128 __b)
 
 /// Compares each of the corresponding 32-bit float values of the
 ///128-bit vectors of [4 x float] to determine if the values in the first
-///operand are less than or equal to those in the second operand.
+///operand are less than or equal to those in the second operand. Returns
+///zero for false and all 1's for true in corresponding ele

[clang] [Headers][X86] Add specific results to comparisons (PR #83316)

2024-02-28 Thread Paul T Robinson via cfe-commits

pogo59 wrote:

Also tag @cflores for your review.

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


[clang] [Headers][X86] Add rounding and exception notes to conversions (PR #83447)

2024-02-29 Thread Paul T Robinson via cfe-commits

https://github.com/pogo59 created 
https://github.com/llvm/llvm-project/pull/83447

Consistently describe rounding/truncating on convert intrinsics. Add notes 
where an out-of-range result can raise an exception.

>From 64cdd358d0bf359383a5dd3d1da236a219644c9e Mon Sep 17 00:00:00 2001
From: Paul Robinson 
Date: Thu, 29 Feb 2024 08:59:26 -0800
Subject: [PATCH] [Headers][X86] Add rounding and exception notes to
 conversions

Consistently describe rounding/truncating on convert intrinsics.
Add notes where an out-of-range result can raise an exception.
---
 clang/lib/Headers/avxintrin.h |  36 +++---
 clang/lib/Headers/emmintrin.h |  91 ++---
 clang/lib/Headers/xmmintrin.h | 125 --
 3 files changed, 182 insertions(+), 70 deletions(-)

diff --git a/clang/lib/Headers/avxintrin.h b/clang/lib/Headers/avxintrin.h
index f116d8bc3a94c7..51c7d76e75ca1a 100644
--- a/clang/lib/Headers/avxintrin.h
+++ b/clang/lib/Headers/avxintrin.h
@@ -2180,7 +2180,8 @@ _mm256_cvtepi32_pd(__m128i __a)
   return (__m256d)__builtin_convertvector((__v4si)__a, __v4df);
 }
 
-/// Converts a vector of [8 x i32] into a vector of [8 x float].
+/// Converts a vector of [8 x i32] into a vector of [8 x float]. Rounds inexact
+///results according to the rounding control bits in the MXCSR register.
 ///
 /// \headerfile 
 ///
@@ -2196,7 +2197,8 @@ _mm256_cvtepi32_ps(__m256i __a)
 }
 
 /// Converts a 256-bit vector of [4 x double] into a 128-bit vector of
-///[4 x float].
+///[4 x float]. Rounds inexact results according to the rounding control
+///bits in the MXCSR register.
 ///
 /// \headerfile 
 ///
@@ -2211,7 +2213,12 @@ _mm256_cvtpd_ps(__m256d __a)
   return (__m128)__builtin_ia32_cvtpd2ps256((__v4df) __a);
 }
 
-/// Converts a vector of [8 x float] into a vector of [8 x i32].
+/// Converts a vector of [8 x float] into a vector of [8 x i32]. Rounds inexact
+///results according to the rounding control bits in the MXCSR register.
+///
+///If a converted value is larger than the maximum possible result,
+///raises a floating-point invalid exception. If the exception is
+///masked, returns the most negative integer.
 ///
 /// \headerfile 
 ///
@@ -2243,8 +2250,11 @@ _mm256_cvtps_pd(__m128 __a)
 }
 
 /// Converts a 256-bit vector of [4 x double] into a 128-bit vector of [4
-///x i32], truncating the result by rounding towards zero when it is
-///inexact.
+///x i32], truncating inexact results.
+///
+///If a converted value is larger than the maximum possible result,
+///raises a floating-point invalid exception. If the exception is
+///masked, returns the most negative integer.
 ///
 /// \headerfile 
 ///
@@ -2259,9 +2269,13 @@ _mm256_cvttpd_epi32(__m256d __a)
   return (__m128i)__builtin_ia32_cvttpd2dq256((__v4df) __a);
 }
 
-/// Converts a 256-bit vector of [4 x double] into a 128-bit vector of [4
-///x i32]. When a conversion is inexact, the value returned is rounded
-///according to the rounding control bits in the MXCSR register.
+/// Converts a 256-bit vector of [4 x double] into a 128-bit vector of
+///[4 x i32]. Rounds inexact results according to the rounding control bits
+///in the MXCSR register.
+///
+///If a converted value is larger than the maximum possible result,
+///raises a floating-point invalid exception. If the exception is
+///masked, returns the most negative integer.
 ///
 /// \headerfile 
 ///
@@ -2277,7 +2291,11 @@ _mm256_cvtpd_epi32(__m256d __a)
 }
 
 /// Converts a vector of [8 x float] into a vector of [8 x i32],
-///truncating the result by rounding towards zero when it is inexact.
+///truncating inexact results.
+///
+///If a converted value is larger than the maximum possible result,
+///raises a floating-point invalid exception. If the exception is
+///masked, returns the most negative integer.
 ///
 /// \headerfile 
 ///
diff --git a/clang/lib/Headers/emmintrin.h b/clang/lib/Headers/emmintrin.h
index 96e3ebdecbdf83..9ae7fe2c809ac6 100644
--- a/clang/lib/Headers/emmintrin.h
+++ b/clang/lib/Headers/emmintrin.h
@@ -1245,7 +1245,8 @@ static __inline__ int __DEFAULT_FN_ATTRS 
_mm_ucomineq_sd(__m128d __a,
 /// Converts the two double-precision floating-point elements of a
 ///128-bit vector of [2 x double] into two single-precision floating-point
 ///values, returned in the lower 64 bits of a 128-bit vector of [4 x 
float].
-///The upper 64 bits of the result vector are set to zero.
+///Rounds inexact results according to the rounding control bits in the
+///MXCSR register. The upper 64 bits of the result vector are set to zero.
 ///
 /// \headerfile 
 ///
@@ -1300,9 +1301,13 @@ static __inline__ __m128d __DEFAULT_FN_ATTRS 
_mm_cvtepi32_pd(__m128i __a) {
 }
 
 /// Converts the two double-precision floating-point elements of a
-///128-bit vector of [2 x double] into two signed 32-bit integer values,
-///returned in the lower 64 bits of

[clang] [Headers][X86] Add rounding and exception notes to conversions (PR #83447)

2024-02-29 Thread Paul T Robinson via cfe-commits

pogo59 wrote:

FYI @cflores 

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


[clang] [Headers][X86] Editorial fixes to ia32intrin.h descriptions (PR #80490)

2024-02-02 Thread Paul T Robinson via cfe-commits

https://github.com/pogo59 created 
https://github.com/llvm/llvm-project/pull/80490

Use indicative not imperative; fix missing capitalization; spell out some 
abbreviations; "time-stamp" not "time stamp".

>From c068144b1e372aec29f268edf7184ee3d3dc7d54 Mon Sep 17 00:00:00 2001
From: Paul Robinson 
Date: Fri, 2 Feb 2024 12:38:16 -0800
Subject: [PATCH] [Headers][X86] Editorial fixes to ia32intrin.h descriptions

Use indicative not imperative; fix missing capitalization; spell out some 
abbreviations; "time-stamp" not "time stamp".
---
 clang/lib/Headers/ia32intrin.h | 60 +-
 1 file changed, 30 insertions(+), 30 deletions(-)

diff --git a/clang/lib/Headers/ia32intrin.h b/clang/lib/Headers/ia32intrin.h
index 1b979770e1962..fca502f1bd17b 100644
--- a/clang/lib/Headers/ia32intrin.h
+++ b/clang/lib/Headers/ia32intrin.h
@@ -26,8 +26,8 @@
 #define __DEFAULT_FN_ATTRS_CONSTEXPR __DEFAULT_FN_ATTRS
 #endif
 
-/// Find the first set bit starting from the lsb. Result is undefined if
-///input is 0.
+/// Finds the first set bit starting from the least significant bit. Result is
+///undefined if input is 0.
 ///
 /// \headerfile 
 ///
@@ -43,8 +43,8 @@ __bsfd(int __A) {
   return __builtin_ctz((unsigned int)__A);
 }
 
-/// Find the first set bit starting from the msb. Result is undefined if
-///input is 0.
+/// Finds the first set bit starting from the most significant bit. Result is
+///undefined if input is 0.
 ///
 /// \headerfile 
 ///
@@ -90,8 +90,8 @@ _bswap(int __A) {
   return (int)__builtin_bswap32((unsigned int)__A);
 }
 
-/// Find the first set bit starting from the lsb. Result is undefined if
-///input is 0.
+/// Finds the first set bit starting from the least significant bit. Result is
+///undefined if input is 0.
 ///
 /// \headerfile 
 ///
@@ -108,8 +108,8 @@ _bswap(int __A) {
 /// \see __bsfd
 #define _bit_scan_forward(A) __bsfd((A))
 
-/// Find the first set bit starting from the msb. Result is undefined if
-///input is 0.
+/// Finds the first set bit starting from the most significant bit. Result is
+///undefined if input is 0.
 ///
 /// \headerfile 
 ///
@@ -127,8 +127,8 @@ _bswap(int __A) {
 #define _bit_scan_reverse(A) __bsrd((A))
 
 #ifdef __x86_64__
-/// Find the first set bit starting from the lsb. Result is undefined if
-///input is 0.
+/// Finds the first set bit starting from the least significant bit. Result is
+///undefined if input is 0.
 ///
 /// \headerfile 
 ///
@@ -143,8 +143,8 @@ __bsfq(long long __A) {
   return (long long)__builtin_ctzll((unsigned long long)__A);
 }
 
-/// Find the first set bit starting from the msb. Result is undefined if
-///input is 0.
+/// Finds the first set bit starting from the most significant bit. Result is
+///undefined if input is 0.
 ///
 /// \headerfile 
 ///
@@ -159,7 +159,7 @@ __bsrq(long long __A) {
   return 63 - __builtin_clzll((unsigned long long)__A);
 }
 
-/// Swaps the bytes in the input. Converting little endian to big endian or
+/// Swaps the bytes in the input, converting little endian to big endian or
 ///vice versa.
 ///
 /// \headerfile 
@@ -175,7 +175,7 @@ __bswapq(long long __A) {
   return (long long)__builtin_bswap64((unsigned long long)__A);
 }
 
-/// Swaps the bytes in the input. Converting little endian to big endian or
+/// Swaps the bytes in the input, converting little endian to big endian or
 ///vice versa.
 ///
 /// \headerfile 
@@ -198,7 +198,7 @@ __bswapq(long long __A) {
 /// \headerfile 
 ///
 /// This intrinsic corresponds to the \c POPCNT instruction or a
-///a sequence of arithmetic and logic ops to calculate it.
+///sequence of arithmetic and logic operations to calculate it.
 ///
 /// \param __A
 ///An unsigned 32-bit integer operand.
@@ -220,7 +220,7 @@ __popcntd(unsigned int __A)
 /// \endcode
 ///
 /// This intrinsic corresponds to the \c POPCNT instruction or a
-///a sequence of arithmetic and logic ops to calculate it.
+///sequence of arithmetic and logic operations to calculate it.
 ///
 /// \param A
 ///An unsigned 32-bit integer operand.
@@ -235,7 +235,7 @@ __popcntd(unsigned int __A)
 /// \headerfile 
 ///
 /// This intrinsic corresponds to the \c POPCNT instruction or a
-///a sequence of arithmetic and logic ops to calculate it.
+///sequence of arithmetic and logic operations to calculate it.
 ///
 /// \param __A
 ///An unsigned 64-bit integer operand.
@@ -257,7 +257,7 @@ __popcntq(unsigned long long __A)
 /// \endcode
 ///
 /// This intrinsic corresponds to the \c POPCNT instruction or a
-///a sequence of arithmetic and logic ops to calculate it.
+///sequence of arithmetic and logic operations to calculate it.
 ///
 /// \param A
 ///An unsigned 64-bit integer operand.
@@ -328,7 +328,7 @@ __writeeflags(unsigned int __f)
 }
 #endif /* !__x86_64__ */
 
-/// Cast a 32-bit float value to a 32-bit unsigned integer value.
+/// Casts a 32-bit float value to a 32-bit unsigned integer 

[clang] [Headers][X86] Editorial fixes to ia32intrin.h descriptions (PR #80490)

2024-02-02 Thread Paul T Robinson via cfe-commits

pogo59 wrote:

Tag @cflores as well, 

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


[clang] Add support for builtin_verbose_trap (PR #79230)

2024-01-24 Thread Paul T Robinson via cfe-commits


@@ -3379,6 +3379,54 @@ Query for this feature with 
``__has_builtin(__builtin_debugtrap)``.
 
 Query for this feature with ``__has_builtin(__builtin_trap)``.
 
+``__builtin_verbose_trap``
+--
+
+``__builtin_verbose_trap`` causes the program to stop its execution abnormally
+and shows a human-readable description of the reason for the termination when a
+debugger is attached or in a symbolicated crash log.
+
+**Syntax**:
+
+.. code-block:: c++
+
+__builtin_verbose_trap(const char *reason)
+
+**Description**
+
+``__builtin_verbose_trap`` is lowered to the ` ``llvm.trap`` 
`_ builtin.
+Additionally, clang emits debug metadata that represents an artificial inline
+frame whose name encodes the string passed to the builtin, prefixed by a 
"magic"
+prefix.
+
+For example, consider the following code:
+
+.. code-block:: c++
+
+void foo(int* p) {
+  if (p == nullptr)
+__builtin_verbose_trap("Argument_must_not_be_null");
+}
+
+The debug metadata would look as if it were produced for the following code:
+
+.. code-block:: c++
+
+__attribute__((always_inline))
+inline void "__llvm_verbose_trap: Argument_must_not_be_null"() {
+  __builtin_trap();
+}
+
+void foo(int* p) {
+  if (p == nullptr)
+"__llvm_verbose_trap: Argument_must_not_be_null"();
+}
+
+However, the LLVM IR would not actually contain a call to the artificial
+function — it only exists in the debug metadata.

pogo59 wrote:

However, the generated code would not ... in the debugging information.

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


[clang] Add support for builtin_verbose_trap (PR #79230)

2024-01-24 Thread Paul T Robinson via cfe-commits

https://github.com/pogo59 commented:

The documentation should say that this works only when debug information is 
enabled.

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


[clang] Add support for builtin_verbose_trap (PR #79230)

2024-01-24 Thread Paul T Robinson via cfe-commits


@@ -3379,6 +3379,54 @@ Query for this feature with 
``__has_builtin(__builtin_debugtrap)``.
 
 Query for this feature with ``__has_builtin(__builtin_trap)``.
 
+``__builtin_verbose_trap``
+--
+
+``__builtin_verbose_trap`` causes the program to stop its execution abnormally
+and shows a human-readable description of the reason for the termination when a
+debugger is attached or in a symbolicated crash log.
+
+**Syntax**:
+
+.. code-block:: c++
+
+__builtin_verbose_trap(const char *reason)
+
+**Description**
+
+``__builtin_verbose_trap`` is lowered to the ` ``llvm.trap`` 
`_ builtin.
+Additionally, clang emits debug metadata that represents an artificial inline

pogo59 wrote:

"metadata" is a clang internal term, of no real meaning to end users, and this 
page is intended for end users. I think "debugging information" would be better.

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


[clang] Add support for builtin_verbose_trap (PR #79230)

2024-01-24 Thread Paul T Robinson via cfe-commits


@@ -3379,6 +3379,54 @@ Query for this feature with 
``__has_builtin(__builtin_debugtrap)``.
 
 Query for this feature with ``__has_builtin(__builtin_trap)``.
 
+``__builtin_verbose_trap``
+--
+
+``__builtin_verbose_trap`` causes the program to stop its execution abnormally
+and shows a human-readable description of the reason for the termination when a
+debugger is attached or in a symbolicated crash log.
+
+**Syntax**:
+
+.. code-block:: c++
+
+__builtin_verbose_trap(const char *reason)
+
+**Description**
+
+``__builtin_verbose_trap`` is lowered to the ` ``llvm.trap`` 
`_ builtin.
+Additionally, clang emits debug metadata that represents an artificial inline
+frame whose name encodes the string passed to the builtin, prefixed by a 
"magic"
+prefix.
+
+For example, consider the following code:
+
+.. code-block:: c++
+
+void foo(int* p) {
+  if (p == nullptr)
+__builtin_verbose_trap("Argument_must_not_be_null");
+}
+
+The debug metadata would look as if it were produced for the following code:

pogo59 wrote:

"debugging information"

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


[clang] Add support for builtin_verbose_trap (PR #79230)

2024-01-24 Thread Paul T Robinson via cfe-commits

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


[clang] Add support for builtin_verbose_trap (PR #79230)

2024-01-26 Thread Paul T Robinson via cfe-commits


@@ -0,0 +1,28 @@
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -fcxx-exceptions -verify %s
+
+#if !__has_builtin(__builtin_verbose_trap)
+#error
+#endif
+
+constexpr char const* constMsg1 = "hello";
+char const* const constMsg2 = "hello";
+char const constMsg3[] = "hello";
+
+template 
+void f(const char * arg) {
+  __builtin_verbose_trap("Argument_must_not_be_null");

pogo59 wrote:

You can't overload the builtin? IIRC there are others that do this, although I 
can't name one offhand.

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


[clang] [Headers][X86] Add more descriptions to ia32intrin.h and immintrin.h (PR #77686)

2024-01-16 Thread Paul T Robinson via cfe-commits

https://github.com/pogo59 updated 
https://github.com/llvm/llvm-project/pull/77686

>From 39a884d27f56772a222d352665be95194716beff Mon Sep 17 00:00:00 2001
From: Paul Robinson 
Date: Wed, 10 Jan 2024 10:42:24 -0800
Subject: [PATCH 1/2] [Headers][X86] Add more descriptions to ia32intrin.h and
 immintrin.h

ia32intrin.h gets descriptions for all remaining non-privileged intrinsic
functions; the macros providing alternate names are not described.
immintrin.h ditto, except for the Interlocked Exchange functions.
---
 clang/lib/Headers/ia32intrin.h | 172 -
 clang/lib/Headers/immintrin.h  |  57 +++
 2 files changed, 227 insertions(+), 2 deletions(-)

diff --git a/clang/lib/Headers/ia32intrin.h b/clang/lib/Headers/ia32intrin.h
index a8b59dfaad8980..39013e1a5bd0dd 100644
--- a/clang/lib/Headers/ia32intrin.h
+++ b/clang/lib/Headers/ia32intrin.h
@@ -58,7 +58,7 @@ __bsrd(int __A) {
   return 31 - __builtin_clz((unsigned int)__A);
 }
 
-/// Swaps the bytes in the input. Converting little endian to big endian or
+/// Swaps the bytes in the input, converting little endian to big endian or
 ///vice versa.
 ///
 /// \headerfile 
@@ -73,6 +73,16 @@ __bswapd(int __A) {
   return (int)__builtin_bswap32((unsigned int)__A);
 }
 
+/// Swaps the bytes in the input, converting little endian to big endian or
+///vice versa.
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c BSWAP instruction.
+///
+/// \param __A
+///A 32-bit integer operand.
+/// \returns A 32-bit integer containing the swapped bytes.
 static __inline__ int __DEFAULT_FN_ATTRS_CONSTEXPR
 _bswap(int __A) {
   return (int)__builtin_bswap32((unsigned int)__A);
@@ -173,12 +183,29 @@ __popcntq(unsigned long long __A)
 #endif /* __x86_64__ */
 
 #ifdef __x86_64__
+/// Returns the program status and control \c RFLAGS register with the \c VM
+///and \c RF flags cleared.
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c PUSHFQ + \c POPQ instruction sequence.
+///
+/// \returns The 64-bit value of the RFLAGS register.
 static __inline__ unsigned long long __DEFAULT_FN_ATTRS
 __readeflags(void)
 {
   return __builtin_ia32_readeflags_u64();
 }
 
+/// Writes the specified value to the program status and control \c RFLAGS
+///register. Reserved bits are not affected.
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c PUSHQ + \c POPFQ instruction sequence.
+///
+/// \param __f
+///The 64-bit value to write to \c RFLAGS.
 static __inline__ void __DEFAULT_FN_ATTRS
 __writeeflags(unsigned long long __f)
 {
@@ -186,12 +213,29 @@ __writeeflags(unsigned long long __f)
 }
 
 #else /* !__x86_64__ */
+/// Returns the program status and control \c EFLAGS register with the \c VM
+///and \c RF flags cleared.
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c PUSHFD + \c POPD instruction sequence.
+///
+/// \returns The 32-bit value of the EFLAGS register.
 static __inline__ unsigned int __DEFAULT_FN_ATTRS
 __readeflags(void)
 {
   return __builtin_ia32_readeflags_u32();
 }
 
+/// Writes the specified value to the program status and control \c EFLAGS
+///register. Reserved bits are not affected.
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c PUSHD + \c POPFD instruction sequence.
+///
+/// \param __f
+///The 32-bit value to write to \c EFLAGS.
 static __inline__ void __DEFAULT_FN_ATTRS
 __writeeflags(unsigned int __f)
 {
@@ -341,12 +385,32 @@ __crc32q(unsigned long long __C, unsigned long long __D)
 }
 #endif /* __x86_64__ */
 
+/// Reads the specified performance monitoring counter. Refer to your
+///processor's documentation to determine which performance counters are
+///supported.
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c RDPMC instruction.
+///
+/// \param __A
+///The performance counter to read.
+/// \returns The 64-bit value read from the performance counter.
 static __inline__ unsigned long long __DEFAULT_FN_ATTRS
 __rdpmc(int __A) {
   return __builtin_ia32_rdpmc(__A);
 }
 
-/* __rdtscp */
+/// Reads the processor's time stamp counter and the \c IA32_TSC_AUX MSR
+///\c (0xc103).
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c RDTSCP instruction.
+///
+/// \param __A
+///Address of where to store the 32-bit \c IA32_TSC_AUX value.
+/// \returns The 64-bit value of the time stamp counter.
 static __inline__ unsigned long long __DEFAULT_FN_ATTRS
 __rdtscp(unsigned int *__A) {
   return __builtin_ia32_rdtscp(__A);
@@ -361,42 +425,146 @@ _wbinvd(void) {
   __builtin_ia32_wbinvd();
 }
 
+/// Rotates an 8-bit value to the left by the specified number of bits.
+///This operation is undefined if the number of bits exceeds the size of
+///the value.
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c ROLB instruction.
+///
+/// \param __X
+///The unsigned 8-bit value to be rotated.
+/// \param __C
+///The number o

[clang] [Headers][X86] Add more descriptions to ia32intrin.h and immintrin.h (PR #77686)

2024-01-16 Thread Paul T Robinson via cfe-commits


@@ -173,25 +183,59 @@ __popcntq(unsigned long long __A)
 #endif /* __x86_64__ */
 
 #ifdef __x86_64__
+/// Returns the program status and control \c RFLAGS register with the \c VM
+///and \c RF flags cleared.
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c PUSHFQ + \c POPQ instruction sequence.

pogo59 wrote:

Done

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


[clang] [Headers][X86] Add more descriptions to ia32intrin.h and immintrin.h (PR #77686)

2024-01-16 Thread Paul T Robinson via cfe-commits


@@ -361,42 +425,146 @@ _wbinvd(void) {
   __builtin_ia32_wbinvd();
 }
 
+/// Rotates an 8-bit value to the left by the specified number of bits.
+///This operation is undefined if the number of bits exceeds the size of
+///the value.
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c ROLB instruction.

pogo59 wrote:

Done

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


[clang-tools-extra] [clang] [Clang][NFC] Rename CXXMethodDecl::isPure -> is VirtualPure (PR #78463)

2024-01-17 Thread Paul T Robinson via cfe-commits

pogo59 wrote:

I think "pure virtual" is a more common phrasing than "virtual pure" so maybe 
`isPureVirtual` instead? Up to Aaron, though.

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


[clang] [Headers][X86] Add more descriptions to ia32intrin.h and immintrin.h (PR #77686)

2024-01-17 Thread Paul T Robinson via cfe-commits

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


[clang] [Headers][X86] Add macro descriptions to ia32intrin.h (PR #78613)

2024-01-18 Thread Paul T Robinson via cfe-commits

https://github.com/pogo59 created 
https://github.com/llvm/llvm-project/pull/78613

These are largely copy-pasted from the corresponding function descriptions. 
Updated _rdtsc definition because it was just plain wrong.

>From e4c9272ee9cbb918347a23d2dce14c9c12765009 Mon Sep 17 00:00:00 2001
From: Paul Robinson 
Date: Thu, 18 Jan 2024 10:50:21 -0800
Subject: [PATCH] [Headers][X86] Add macro descriptions to ia32intrin.h

These are largely copy-pasted from the corresponding function descriptions.
Updated _rdtsc definition because it was just plain wrong.
---
 clang/lib/Headers/ia32intrin.h | 253 -
 1 file changed, 249 insertions(+), 4 deletions(-)

diff --git a/clang/lib/Headers/ia32intrin.h b/clang/lib/Headers/ia32intrin.h
index 7d5fede61ce859..5d8d02ea14200f 100644
--- a/clang/lib/Headers/ia32intrin.h
+++ b/clang/lib/Headers/ia32intrin.h
@@ -88,7 +88,38 @@ _bswap(int __A) {
   return (int)__builtin_bswap32((unsigned int)__A);
 }
 
+/// Find the first set bit starting from the lsb. Result is undefined if
+///input is 0.
+///
+/// \headerfile 
+///
+/// \code
+/// int _bit_scan_forward(int A);
+/// \endcode
+///
+/// This intrinsic corresponds to the \c BSF instruction or the
+///\c TZCNT instruction.
+///
+/// \param A
+///A 32-bit integer operand.
+/// \returns A 32-bit integer containing the bit number.
 #define _bit_scan_forward(A) __bsfd((A))
+
+/// Find the first set bit starting from the msb. Result is undefined if
+///input is 0.
+///
+/// \headerfile 
+///
+/// \code
+/// int _bit_scan_reverse(int A);
+/// \endcode
+///
+/// This intrinsic corresponds to the \c BSR instruction or the
+///\c LZCNT instruction and an \c XOR.
+///
+/// \param A
+///A 32-bit integer operand.
+/// \returns A 32-bit integer containing the bit number.
 #define _bit_scan_reverse(A) __bsrd((A))
 
 #ifdef __x86_64__
@@ -139,8 +170,22 @@ __bswapq(long long __A) {
   return (long long)__builtin_bswap64((unsigned long long)__A);
 }
 
+/// Swaps the bytes in the input. Converting little endian to big endian or
+///vice versa.
+///
+/// \headerfile 
+///
+/// \code
+/// long long _bswap64(long long A);
+/// \endcode
+///
+/// This intrinsic corresponds to the \c BSWAP instruction.
+///
+/// \param A
+///A 64-bit integer operand.
+/// \returns A 64-bit integer containing the swapped bytes.
 #define _bswap64(A) __bswapq((A))
-#endif
+#endif /* __x86_64__ */
 
 /// Counts the number of bits in the source operand having a value of 1.
 ///
@@ -159,6 +204,21 @@ __popcntd(unsigned int __A)
   return __builtin_popcount(__A);
 }
 
+/// Counts the number of bits in the source operand having a value of 1.
+///
+/// \headerfile 
+///
+/// \code
+/// int _popcnt32(int A);
+/// \endcode
+///
+/// This intrinsic corresponds to the \c POPCNT instruction or a
+///a sequence of arithmetic and logic ops to calculate it.
+///
+/// \param A
+///An unsigned 32-bit integer operand.
+/// \returns A 32-bit integer containing the number of bits with value 1 in the
+///source operand.
 #define _popcnt32(A) __popcntd((A))
 
 #ifdef __x86_64__
@@ -179,6 +239,21 @@ __popcntq(unsigned long long __A)
   return __builtin_popcountll(__A);
 }
 
+/// Counts the number of bits in the source operand having a value of 1.
+///
+/// \headerfile 
+///
+/// \code
+/// long long _popcnt64(unsigned long long A);
+/// \endcode
+///
+/// This intrinsic corresponds to the \c POPCNT instruction or a
+///a sequence of arithmetic and logic ops to calculate it.
+///
+/// \param A
+///An unsigned 64-bit integer operand.
+/// \returns A 64-bit integer containing the number of bits with value 1 in the
+///source operand.
 #define _popcnt64(A) __popcntq((A))
 #endif /* __x86_64__ */
 
@@ -416,8 +491,37 @@ __rdtscp(unsigned int *__A) {
   return __builtin_ia32_rdtscp(__A);
 }
 
-#define _rdtsc() __rdtsc()
+/// Reads the processor's time stamp counter and the \c IA32_TSC_AUX MSR
+///\c (0xc103).
+///
+/// \headerfile 
+///
+/// \code
+/// unsigned long long _rdtsc(unsigned int *A);
+/// \endcode
+///
+/// This intrinsic corresponds to the \c RDTSCP instruction.
+///
+/// \param A
+///Address of where to store the 32-bit \c IA32_TSC_AUX value.
+/// \returns The 64-bit value of the time stamp counter.
+#define _rdtsc(A) __rdtscp(A)
 
+/// Reads the specified performance monitoring counter. Refer to your
+///processor's documentation to determine which performance counters are
+///supported.
+///
+/// \headerfile 
+///
+/// \code
+/// unsigned long long _rdpmc(int A);
+/// \endcode
+///
+/// This intrinsic corresponds to the \c RDPMC instruction.
+///
+/// \param A
+///The performance counter to read.
+/// \returns The 64-bit value read from the performance counter.
 #define _rdpmc(A) __rdpmc(A)
 
 static __inline__ void __DEFAULT_FN_ATTRS
@@ -575,18 +679,159 @@ __rorq(unsigned long long __X, int __C) {
 /* These are already provided as builtins for MSVC. */
 /* Select the correc

[clang] [Headers][X86] Add macro descriptions to ia32intrin.h (PR #78613)

2024-01-18 Thread Paul T Robinson via cfe-commits

pogo59 wrote:

Reviewer questions:
1. When a macro is merely an alternate name for an intrinsic function, does it 
want to be documented as its own intrinsic function? I assume yes in this 
patch, but if there's a different tactic that avoids duplicating a bunch of 
descriptions, I'm open to suggestions.
2. Is _bswap (one underscore) a mistake? The [12.0 release 
notes](https://releases.llvm.org/12.0.0/tools/clang/docs/ReleaseNotes.html#x86-support-in-clang)
 say it has two underscores.
4. Is _rdtsc correct, or should it be _rdtscp? I have to change the macro 
anyway, it was wrong.


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


[clang] [Headers][X86] Add macro descriptions to ia32intrin.h (PR #78613)

2024-01-18 Thread Paul T Robinson via cfe-commits

https://github.com/pogo59 updated 
https://github.com/llvm/llvm-project/pull/78613

>From e4c9272ee9cbb918347a23d2dce14c9c12765009 Mon Sep 17 00:00:00 2001
From: Paul Robinson 
Date: Thu, 18 Jan 2024 10:50:21 -0800
Subject: [PATCH 1/2] [Headers][X86] Add macro descriptions to ia32intrin.h

These are largely copy-pasted from the corresponding function descriptions.
Updated _rdtsc definition because it was just plain wrong.
---
 clang/lib/Headers/ia32intrin.h | 253 -
 1 file changed, 249 insertions(+), 4 deletions(-)

diff --git a/clang/lib/Headers/ia32intrin.h b/clang/lib/Headers/ia32intrin.h
index 7d5fede61ce8590..5d8d02ea14200fa 100644
--- a/clang/lib/Headers/ia32intrin.h
+++ b/clang/lib/Headers/ia32intrin.h
@@ -88,7 +88,38 @@ _bswap(int __A) {
   return (int)__builtin_bswap32((unsigned int)__A);
 }
 
+/// Find the first set bit starting from the lsb. Result is undefined if
+///input is 0.
+///
+/// \headerfile 
+///
+/// \code
+/// int _bit_scan_forward(int A);
+/// \endcode
+///
+/// This intrinsic corresponds to the \c BSF instruction or the
+///\c TZCNT instruction.
+///
+/// \param A
+///A 32-bit integer operand.
+/// \returns A 32-bit integer containing the bit number.
 #define _bit_scan_forward(A) __bsfd((A))
+
+/// Find the first set bit starting from the msb. Result is undefined if
+///input is 0.
+///
+/// \headerfile 
+///
+/// \code
+/// int _bit_scan_reverse(int A);
+/// \endcode
+///
+/// This intrinsic corresponds to the \c BSR instruction or the
+///\c LZCNT instruction and an \c XOR.
+///
+/// \param A
+///A 32-bit integer operand.
+/// \returns A 32-bit integer containing the bit number.
 #define _bit_scan_reverse(A) __bsrd((A))
 
 #ifdef __x86_64__
@@ -139,8 +170,22 @@ __bswapq(long long __A) {
   return (long long)__builtin_bswap64((unsigned long long)__A);
 }
 
+/// Swaps the bytes in the input. Converting little endian to big endian or
+///vice versa.
+///
+/// \headerfile 
+///
+/// \code
+/// long long _bswap64(long long A);
+/// \endcode
+///
+/// This intrinsic corresponds to the \c BSWAP instruction.
+///
+/// \param A
+///A 64-bit integer operand.
+/// \returns A 64-bit integer containing the swapped bytes.
 #define _bswap64(A) __bswapq((A))
-#endif
+#endif /* __x86_64__ */
 
 /// Counts the number of bits in the source operand having a value of 1.
 ///
@@ -159,6 +204,21 @@ __popcntd(unsigned int __A)
   return __builtin_popcount(__A);
 }
 
+/// Counts the number of bits in the source operand having a value of 1.
+///
+/// \headerfile 
+///
+/// \code
+/// int _popcnt32(int A);
+/// \endcode
+///
+/// This intrinsic corresponds to the \c POPCNT instruction or a
+///a sequence of arithmetic and logic ops to calculate it.
+///
+/// \param A
+///An unsigned 32-bit integer operand.
+/// \returns A 32-bit integer containing the number of bits with value 1 in the
+///source operand.
 #define _popcnt32(A) __popcntd((A))
 
 #ifdef __x86_64__
@@ -179,6 +239,21 @@ __popcntq(unsigned long long __A)
   return __builtin_popcountll(__A);
 }
 
+/// Counts the number of bits in the source operand having a value of 1.
+///
+/// \headerfile 
+///
+/// \code
+/// long long _popcnt64(unsigned long long A);
+/// \endcode
+///
+/// This intrinsic corresponds to the \c POPCNT instruction or a
+///a sequence of arithmetic and logic ops to calculate it.
+///
+/// \param A
+///An unsigned 64-bit integer operand.
+/// \returns A 64-bit integer containing the number of bits with value 1 in the
+///source operand.
 #define _popcnt64(A) __popcntq((A))
 #endif /* __x86_64__ */
 
@@ -416,8 +491,37 @@ __rdtscp(unsigned int *__A) {
   return __builtin_ia32_rdtscp(__A);
 }
 
-#define _rdtsc() __rdtsc()
+/// Reads the processor's time stamp counter and the \c IA32_TSC_AUX MSR
+///\c (0xc103).
+///
+/// \headerfile 
+///
+/// \code
+/// unsigned long long _rdtsc(unsigned int *A);
+/// \endcode
+///
+/// This intrinsic corresponds to the \c RDTSCP instruction.
+///
+/// \param A
+///Address of where to store the 32-bit \c IA32_TSC_AUX value.
+/// \returns The 64-bit value of the time stamp counter.
+#define _rdtsc(A) __rdtscp(A)
 
+/// Reads the specified performance monitoring counter. Refer to your
+///processor's documentation to determine which performance counters are
+///supported.
+///
+/// \headerfile 
+///
+/// \code
+/// unsigned long long _rdpmc(int A);
+/// \endcode
+///
+/// This intrinsic corresponds to the \c RDPMC instruction.
+///
+/// \param A
+///The performance counter to read.
+/// \returns The 64-bit value read from the performance counter.
 #define _rdpmc(A) __rdpmc(A)
 
 static __inline__ void __DEFAULT_FN_ATTRS
@@ -575,18 +679,159 @@ __rorq(unsigned long long __X, int __C) {
 /* These are already provided as builtins for MSVC. */
 /* Select the correct function based on the size of long. */
 #ifdef __LP64__
+/// Rotates a 64-bit value to the left by the specified number of bits.

[clang] [Headers][X86] Add macro descriptions to ia32intrin.h (PR #78613)

2024-01-18 Thread Paul T Robinson via cfe-commits

pogo59 wrote:

> When a macro is merely an alternate name for an intrinsic function, does it 
> want to be documented as its own intrinsic function? I assume yes in this 
> patch, but if there's a different tactic that avoids duplicating a bunch of 
> descriptions, I'm open to suggestions.

I discovered the \see directive and added those.

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


[clang-tools-extra] [llvm] [compiler-rt] [clang] Make clang report invalid target versions for all environment types. (PR #78655)

2024-01-19 Thread Paul T Robinson via cfe-commits


@@ -1,7 +1,7 @@
 // RUN: %clang -x c -ffixed-point -S -emit-llvm -o - %s | FileCheck %s
-// RUN: %clang -x c -ffixed-point -S -emit-llvm -o - 
--target=x86_64-scei-ps4-ubuntu-fast %s | FileCheck %s

pogo59 wrote:

Thanks for tagging me. These are definitely invalid triples. It appears they 
were added in f921d854, which was a recommit of db55d833, where the test was 
introduced. I don't see that they are really adding anything to the coverage, 
so I think it's fine to remove them.

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


[clang] [Headers][X86] Add macro descriptions to ia32intrin.h (PR #78613)

2024-01-19 Thread Paul T Robinson via cfe-commits


@@ -411,13 +497,45 @@ __rdpmc(int __A) {
 /// \param __A
 ///Address of where to store the 32-bit \c IA32_TSC_AUX value.
 /// \returns The 64-bit value of the time stamp counter.
+/// \see _rdtsc
 static __inline__ unsigned long long __DEFAULT_FN_ATTRS
 __rdtscp(unsigned int *__A) {
   return __builtin_ia32_rdtscp(__A);
 }
 
-#define _rdtsc() __rdtsc()

pogo59 wrote:

Thanks! I will revise the description, and make a note to add `__rdtsc` to our 
guide. (We have `__builtin_readcyclecounter` but not that one.)

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


[clang] [Headers][X86] Add macro descriptions to ia32intrin.h (PR #78613)

2024-01-19 Thread Paul T Robinson via cfe-commits

https://github.com/pogo59 updated 
https://github.com/llvm/llvm-project/pull/78613

>From e4c9272ee9cbb918347a23d2dce14c9c12765009 Mon Sep 17 00:00:00 2001
From: Paul Robinson 
Date: Thu, 18 Jan 2024 10:50:21 -0800
Subject: [PATCH 1/3] [Headers][X86] Add macro descriptions to ia32intrin.h

These are largely copy-pasted from the corresponding function descriptions.
Updated _rdtsc definition because it was just plain wrong.
---
 clang/lib/Headers/ia32intrin.h | 253 -
 1 file changed, 249 insertions(+), 4 deletions(-)

diff --git a/clang/lib/Headers/ia32intrin.h b/clang/lib/Headers/ia32intrin.h
index 7d5fede61ce8590..5d8d02ea14200fa 100644
--- a/clang/lib/Headers/ia32intrin.h
+++ b/clang/lib/Headers/ia32intrin.h
@@ -88,7 +88,38 @@ _bswap(int __A) {
   return (int)__builtin_bswap32((unsigned int)__A);
 }
 
+/// Find the first set bit starting from the lsb. Result is undefined if
+///input is 0.
+///
+/// \headerfile 
+///
+/// \code
+/// int _bit_scan_forward(int A);
+/// \endcode
+///
+/// This intrinsic corresponds to the \c BSF instruction or the
+///\c TZCNT instruction.
+///
+/// \param A
+///A 32-bit integer operand.
+/// \returns A 32-bit integer containing the bit number.
 #define _bit_scan_forward(A) __bsfd((A))
+
+/// Find the first set bit starting from the msb. Result is undefined if
+///input is 0.
+///
+/// \headerfile 
+///
+/// \code
+/// int _bit_scan_reverse(int A);
+/// \endcode
+///
+/// This intrinsic corresponds to the \c BSR instruction or the
+///\c LZCNT instruction and an \c XOR.
+///
+/// \param A
+///A 32-bit integer operand.
+/// \returns A 32-bit integer containing the bit number.
 #define _bit_scan_reverse(A) __bsrd((A))
 
 #ifdef __x86_64__
@@ -139,8 +170,22 @@ __bswapq(long long __A) {
   return (long long)__builtin_bswap64((unsigned long long)__A);
 }
 
+/// Swaps the bytes in the input. Converting little endian to big endian or
+///vice versa.
+///
+/// \headerfile 
+///
+/// \code
+/// long long _bswap64(long long A);
+/// \endcode
+///
+/// This intrinsic corresponds to the \c BSWAP instruction.
+///
+/// \param A
+///A 64-bit integer operand.
+/// \returns A 64-bit integer containing the swapped bytes.
 #define _bswap64(A) __bswapq((A))
-#endif
+#endif /* __x86_64__ */
 
 /// Counts the number of bits in the source operand having a value of 1.
 ///
@@ -159,6 +204,21 @@ __popcntd(unsigned int __A)
   return __builtin_popcount(__A);
 }
 
+/// Counts the number of bits in the source operand having a value of 1.
+///
+/// \headerfile 
+///
+/// \code
+/// int _popcnt32(int A);
+/// \endcode
+///
+/// This intrinsic corresponds to the \c POPCNT instruction or a
+///a sequence of arithmetic and logic ops to calculate it.
+///
+/// \param A
+///An unsigned 32-bit integer operand.
+/// \returns A 32-bit integer containing the number of bits with value 1 in the
+///source operand.
 #define _popcnt32(A) __popcntd((A))
 
 #ifdef __x86_64__
@@ -179,6 +239,21 @@ __popcntq(unsigned long long __A)
   return __builtin_popcountll(__A);
 }
 
+/// Counts the number of bits in the source operand having a value of 1.
+///
+/// \headerfile 
+///
+/// \code
+/// long long _popcnt64(unsigned long long A);
+/// \endcode
+///
+/// This intrinsic corresponds to the \c POPCNT instruction or a
+///a sequence of arithmetic and logic ops to calculate it.
+///
+/// \param A
+///An unsigned 64-bit integer operand.
+/// \returns A 64-bit integer containing the number of bits with value 1 in the
+///source operand.
 #define _popcnt64(A) __popcntq((A))
 #endif /* __x86_64__ */
 
@@ -416,8 +491,37 @@ __rdtscp(unsigned int *__A) {
   return __builtin_ia32_rdtscp(__A);
 }
 
-#define _rdtsc() __rdtsc()
+/// Reads the processor's time stamp counter and the \c IA32_TSC_AUX MSR
+///\c (0xc103).
+///
+/// \headerfile 
+///
+/// \code
+/// unsigned long long _rdtsc(unsigned int *A);
+/// \endcode
+///
+/// This intrinsic corresponds to the \c RDTSCP instruction.
+///
+/// \param A
+///Address of where to store the 32-bit \c IA32_TSC_AUX value.
+/// \returns The 64-bit value of the time stamp counter.
+#define _rdtsc(A) __rdtscp(A)
 
+/// Reads the specified performance monitoring counter. Refer to your
+///processor's documentation to determine which performance counters are
+///supported.
+///
+/// \headerfile 
+///
+/// \code
+/// unsigned long long _rdpmc(int A);
+/// \endcode
+///
+/// This intrinsic corresponds to the \c RDPMC instruction.
+///
+/// \param A
+///The performance counter to read.
+/// \returns The 64-bit value read from the performance counter.
 #define _rdpmc(A) __rdpmc(A)
 
 static __inline__ void __DEFAULT_FN_ATTRS
@@ -575,18 +679,159 @@ __rorq(unsigned long long __X, int __C) {
 /* These are already provided as builtins for MSVC. */
 /* Select the correct function based on the size of long. */
 #ifdef __LP64__
+/// Rotates a 64-bit value to the left by the specified number of bits.

[clang] Add a "don't override" mapping for -fvisibility-from-dllstorageclass (PR #74629)

2024-01-19 Thread Paul T Robinson via cfe-commits

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

LGTM

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


[clang] [Sema] Provide `-fvisibility-global-new-delete=` option (PR #75364)

2024-01-19 Thread Paul T Robinson via cfe-commits

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


[clang] [Sema] Provide `-fvisibility-global-new-delete=` option (PR #75364)

2024-01-19 Thread Paul T Robinson via cfe-commits


@@ -359,6 +359,12 @@ void toolchains::PS4PS5Base::addClangTargetOptions(
 
   CC1Args.push_back("-fno-use-init-array");
 
+  // Default to -fglobal-new-delete-visibility=source for PS5.

pogo59 wrote:

Spelling in comment needs to match the option spelling.

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


[clang] [Sema] Provide `-fvisibility-global-new-delete=` option (PR #75364)

2024-01-19 Thread Paul T Robinson via cfe-commits

https://github.com/pogo59 commented:

I'm okay with the PS5-specific bits. Other people should have a chance to chime 
in so I won't mark it approved.

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


[clang] Add a "don't override" mapping for -fvisibility-from-dllstorageclass (PR #74629)

2024-01-19 Thread Paul T Robinson via cfe-commits


@@ -79,6 +107,8 @@ extern void __declspec(dllimport) imported_e();
 // EXPLICIT-DAG: declare hidden void @_Z10imported_ev()
 // ALL_DEFAULT-DAG: declare void @_Z1ev()
 // ALL_DEFAULT-DAG: declare void @_Z10imported_ev()
+// ALL_KEEP-DAG: declare hidden void @_Z1ev()
+// ALL_KEEP-DAG: void @_Z10imported_ev()

pogo59 wrote:

Oh, this line looks like it would allow any visibility (missing `declare` and 
whatever might be between that and the `void`)

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


  1   2   3   4   >