[PATCH] D50594: [analyzer] [NFC] Introduce separate targets for testing the analyzer: check-clang-analyzer and check-clang-analyzer-z3

2018-08-14 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre added a comment.

Hi George,

This commit seems to be causing some testsuite regression on Armv8 (both 
Aarch64 and ARM) architectures:
http://lab.llvm.org:8011/builders/clang-cmake-armv8-full/builds/5450
http://lab.llvm.org:8011/builders/clang-cmake-armv8-quick/builds/5625

Best regards,

Thomas


Repository:
  rC Clang

https://reviews.llvm.org/D50594



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


[PATCH] D55428: [Docs] Expand -fstack-protector and -fstack-protector-all info

2018-12-10 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre added inline comments.



Comment at: include/clang/Driver/Options.td:1634-1636
+  HelpText<"Uses a stronger heuristic to apply stack protectors to functions "
+   "that include arrays of any size (and any type), "
+   "as well as any calls to alloca or the taking of an address from a 
local variable">;

I'm not sure what's the policy for related options but I feel the description 
should stand on its own. I'd therefor start by:

"Enable stack protectors for some functions potentially vulnerable to stack 
smashing. Compared to -fstack-protector, this uses a stronger heuristic ()"

If the policy is to avoid such repeatition then please ignore this comment.



Comment at: include/clang/Driver/Options.td:1638
 def fstack_protector : Flag<["-"], "fstack-protector">, Group,
-  HelpText<"Enable stack protectors for functions potentially vulnerable to 
stack smashing">;
+  HelpText<"Enable stack protectors for some functions potentially vulnerable 
to stack smashing. "
+   "Namely those containing a char (or 8bit integer) array or constant 
sized calls to "

Not a native english speaker but I feel that "potentially" is redundant given 
you said it enables stack protector for *some* functions. Perhaps rewrite it 
along the lines of:

"Enable stack protectors for some of the functions vulnerable to stack smashing 
based on simple heuristic"

with a better word than "simple". This conveys both that not all functions are 
protected and suggests that a better heuristic is possible. You can then easily 
refer the reader to -fstack-protector-strong and -fstack-protector-all in a 
following sentence.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55428/new/

https://reviews.llvm.org/D55428



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


[PATCH] D55428: [Docs] Expand -fstack-protector and -fstack-protector-all info

2018-12-11 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre added inline comments.



Comment at: include/clang/Driver/Options.td:1636
 def fstack_protector_all : Flag<["-"], "fstack-protector-all">, Group,
   HelpText<"Force the usage of stack protectors for all functions">;
 def fstack_protector_strong : Flag<["-"], "fstack-protector-strong">, 
Group,

May I suggest to change it to "Enable stack protectors for all functions" for 
consistency with below entries? Rest LGTM otherwise.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55428/new/

https://reviews.llvm.org/D55428



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


[PATCH] D61269: [CommandLine] Change help output to prefix long options with `--` instead of `-`. NFC . Part 3 of 5

2019-04-30 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre added inline comments.



Comment at: llvm/lib/Support/CommandLine.cpp:95
+
+static size_t argPrefixesSize(size_t len) {
+  if (len == 1)

Any reason why not take a StringRef of the option to compute the prefix of? 
That would put the .size() gymnastic in one place instead of many.



Comment at: llvm/lib/Support/CommandLine.cpp:101
+
+static StringRef argPrefix(size_t len) {
+  if (len == 1)

Likewise.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61269/new/

https://reviews.llvm.org/D61269



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


[PATCH] D61269: [CommandLine] Change help output to prefix long options with `--` instead of `-`. NFC . Part 3 of 5

2019-05-02 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre accepted this revision.
thopre added a comment.
This revision is now accepted and ready to land.

That's much better thank you. I like the stream shift operator overload, nice 
touch. LGTM but give it a day for other to give feedback.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61269/new/

https://reviews.llvm.org/D61269



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


[PATCH] D55428: [Docs] Expand -fstack-protector and -fstack-protector-all info

2018-12-12 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre accepted this revision.
thopre added a comment.
This revision is now accepted and ready to land.

LGTM. Thanks!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55428/new/

https://reviews.llvm.org/D55428



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


[PATCH] D45965: [Targets] Implement getConstraintRegister for ARM and AArch64

2018-04-23 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre added inline comments.



Comment at: lib/Basic/Targets/AArch64.h:85-89
+  StringRef getConstraintRegister(StringRef Constraint,
+  StringRef Expression) const override {
+return Expression;
+  }
+

From what I understood of the original patch, getConstraintRegister is a sort 
of a more comprehensive version of convertRegister. On ARM convertRegister 
handles U and p constraint specially, should this do the same?


https://reviews.llvm.org/D45965



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


[PATCH] D45965: [Targets] Implement getConstraintRegister for ARM and AArch64

2018-04-24 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre added inline comments.



Comment at: lib/Basic/Targets/AArch64.h:85-89
+  StringRef getConstraintRegister(StringRef Constraint,
+  StringRef Expression) const override {
+return Expression;
+  }
+

miyuki wrote:
> thopre wrote:
> > From what I understood of the original patch, getConstraintRegister is a 
> > sort of a more comprehensive version of convertRegister. On ARM 
> > convertRegister handles U and p constraint specially, should this do the 
> > same?
> Did you mean `convertConstraint`? As I understand, this function does 
> canonicalization of constraints. If a constraint happens to be 
> single-register, it is converted into `{register}` form (but this does not 
> happen on ARM). On the other hand, `getConstraintRegister` takes a constraint 
> and an asm label and converts them into a register (and in our case the 
> register always comes from the asm label, never from the constraint), so I 
> don't think we need to handle U and p specially.
Forgot to send this:

Fair enough. Since you seems to have the expected behavior of this function 
well understood, would you mind adding a comment here and in 
clang/Basic/TargetInfo.h?

Luckily we had a similar chat offline. Thanks for the change


https://reviews.llvm.org/D45965



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


[PATCH] D45965: [Targets] Implement getConstraintRegister for ARM and AArch64

2018-04-24 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre added a comment.

FWIW LGTM.


https://reviews.llvm.org/D45965



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


[PATCH] D45965: [Targets] Implement getConstraintRegister for ARM and AArch64

2018-04-24 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre accepted this revision.
thopre added a comment.
This revision is now accepted and ready to land.

As I said, LGTM. Please wait a few days (say next Monday) in case anyone else 
has any objection.


https://reviews.llvm.org/D45965



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


[PATCH] D80933: [clang-format] [PR46157] Wrong spacing of negative literals with use of operator

2020-06-01 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre added a comment.

That was a speedy patch! I can confirm that my non reduced testcase (git diff 
-U0 23ac16cf9bd4cc0bb434efcf6385baf083a2ff7b 
^ 
23ac16cf9bd4cc0bb434efcf6385baf083a2ff7b 
 | 
clang-format-diff.py -i -p1) is fixed with this patch. Thanks! I don't feel 
confident reviewing the code unfortunately.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80933/new/

https://reviews.llvm.org/D80933



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


[PATCH] D81422: Change filecheck default to dump input on failure

2020-06-09 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre accepted this revision.
thopre added a comment.

In D81422#2080758 , @probinson wrote:

> I don't remember the exact reasoning but I believe it had something to do 
> with bot logs?  @jdenny or @thopre might remember.


I guess -dump-input just followed the existing default behavior when 
-dump-input-on-failure was introduced. There was several mentions of whether to 
make it the default when that was introduced [1][2] and my understanding was 
the worry was on whether it would make some FileCheck test fail. I think with 
FileCheckOpt this is no longer a concern. I would have personally benefited 
from having this the default so I support this change.

[1] https://reviews.llvm.org/D49328?id=155527#inline-433596
[2] https://reviews.llvm.org/D49328#1170186


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81422/new/

https://reviews.llvm.org/D81422



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


[PATCH] D85367: [clang, test, Darwin] Fix tests expecting Darwin target

2020-08-05 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre created this revision.
thopre added reviewers: zixuw, arphaman, ributzka, steven_wu, dexonsmith.
Herald added subscribers: cfe-commits, kristof.beyls.
Herald added a project: clang.
thopre requested review of this revision.

Clang tests Driver/apple-arm64-arch.c and
Driver/darwin-warning-options.c test Darwin driver functionality but
only require the host system to be Darwin. This leads the tests to fail
when building a cross-compiler on Darwin and to be marked unsupported
when cross-compiling to Darwin from another system. This commit changes
the requirements for those tests to require the target to be Darwin.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D85367

Files:
  clang/test/Driver/apple-arm64-arch.c
  clang/test/Driver/darwin-warning-options.c


Index: clang/test/Driver/darwin-warning-options.c
===
--- clang/test/Driver/darwin-warning-options.c
+++ clang/test/Driver/darwin-warning-options.c
@@ -1,4 +1,4 @@
-// REQUIRES: system-darwin
+// REQUIRES: darwin
 
 // Always error about undefined 'TARGET_OS_*' macros on Darwin.
 // RUN: %clang -### %s 2>&1 | FileCheck %s
Index: clang/test/Driver/apple-arm64-arch.c
===
--- clang/test/Driver/apple-arm64-arch.c
+++ clang/test/Driver/apple-arm64-arch.c
@@ -1,7 +1,7 @@
 // RUN: env SDKROOT="/" %clang -arch arm64 -c -### %s 2>&1 | \
 // RUN:   FileCheck %s
 //
-// REQUIRES: system-darwin
+// REQUIRES: darwin
 // XFAIL: apple-silicon-mac
 //
 // CHECK: "-triple" "arm64-apple-ios{{[0-9.]+}}"


Index: clang/test/Driver/darwin-warning-options.c
===
--- clang/test/Driver/darwin-warning-options.c
+++ clang/test/Driver/darwin-warning-options.c
@@ -1,4 +1,4 @@
-// REQUIRES: system-darwin
+// REQUIRES: darwin
 
 // Always error about undefined 'TARGET_OS_*' macros on Darwin.
 // RUN: %clang -### %s 2>&1 | FileCheck %s
Index: clang/test/Driver/apple-arm64-arch.c
===
--- clang/test/Driver/apple-arm64-arch.c
+++ clang/test/Driver/apple-arm64-arch.c
@@ -1,7 +1,7 @@
 // RUN: env SDKROOT="/" %clang -arch arm64 -c -### %s 2>&1 | \
 // RUN:   FileCheck %s
 //
-// REQUIRES: system-darwin
+// REQUIRES: darwin
 // XFAIL: apple-silicon-mac
 //
 // CHECK: "-triple" "arm64-apple-ios{{[0-9.]+}}"
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D85367: [clang, test, Darwin] Fix tests expecting Darwin target

2020-08-07 Thread Thomas Preud'homme via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG6dc863cd858f: [clang, test, Darwin] Fix tests expecting 
Darwin target (authored by thopre).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85367/new/

https://reviews.llvm.org/D85367

Files:
  clang/test/Driver/apple-arm64-arch.c
  clang/test/Driver/darwin-warning-options.c


Index: clang/test/Driver/darwin-warning-options.c
===
--- clang/test/Driver/darwin-warning-options.c
+++ clang/test/Driver/darwin-warning-options.c
@@ -1,4 +1,4 @@
-// REQUIRES: system-darwin
+// REQUIRES: darwin
 
 // Always error about undefined 'TARGET_OS_*' macros on Darwin.
 // RUN: %clang -### %s 2>&1 | FileCheck %s
Index: clang/test/Driver/apple-arm64-arch.c
===
--- clang/test/Driver/apple-arm64-arch.c
+++ clang/test/Driver/apple-arm64-arch.c
@@ -1,7 +1,7 @@
 // RUN: env SDKROOT="/" %clang -arch arm64 -c -### %s 2>&1 | \
 // RUN:   FileCheck %s
 //
-// REQUIRES: system-darwin
+// REQUIRES: darwin
 // XFAIL: apple-silicon-mac
 //
 // CHECK: "-triple" "arm64-apple-ios{{[0-9.]+}}"


Index: clang/test/Driver/darwin-warning-options.c
===
--- clang/test/Driver/darwin-warning-options.c
+++ clang/test/Driver/darwin-warning-options.c
@@ -1,4 +1,4 @@
-// REQUIRES: system-darwin
+// REQUIRES: darwin
 
 // Always error about undefined 'TARGET_OS_*' macros on Darwin.
 // RUN: %clang -### %s 2>&1 | FileCheck %s
Index: clang/test/Driver/apple-arm64-arch.c
===
--- clang/test/Driver/apple-arm64-arch.c
+++ clang/test/Driver/apple-arm64-arch.c
@@ -1,7 +1,7 @@
 // RUN: env SDKROOT="/" %clang -arch arm64 -c -### %s 2>&1 | \
 // RUN:   FileCheck %s
 //
-// REQUIRES: system-darwin
+// REQUIRES: darwin
 // XFAIL: apple-silicon-mac
 //
 // CHECK: "-triple" "arm64-apple-ios{{[0-9.]+}}"
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D79276: [FileCheck] Support comment directives

2020-05-07 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre added inline comments.



Comment at: llvm/test/FileCheck/comment/after-words.txt:1
+# Comment prefixes are not recognized at ends of words.
+

How about characters that cannot be part of an identifier? E.g. would "@COM:" 
be interpreted as a comment? Should we only accept comment prefix if it's a 
space or beginning of line before?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79276/new/

https://reviews.llvm.org/D79276



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


[PATCH] D79276: [FileCheck] Support comment directives

2020-05-07 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre accepted this revision.
thopre added a comment.

LGTM. Sorry for the late review.




Comment at: llvm/test/FileCheck/comment/after-words.txt:1
+# Comment prefixes are not recognized at ends of words.
+

jdenny wrote:
> jdenny wrote:
> > thopre wrote:
> > > How about characters that cannot be part of an identifier? E.g. would 
> > > "@COM:" be interpreted as a comment? Should we only accept comment prefix 
> > > if it's a space or beginning of line before?
> > Yes, this patch interprets `@COM:` as a comment directive.
> > 
> > My justification is that, to keep things simple for the FileCheck user and 
> > implementation, I tried to keep parsing of comment directives and check 
> > directives as similar as possible.  One intentional difference is that 
> > comment directives are ignored if they have check suffixes, such as `-NOT`.
> `git grep '@RUN'` shows that `@` without a following space might be a comment 
> style we should support. Here's an example match:
> 
> ```
> llvm/test/MC/ARM/ldr-pseudo-cond-darwin.s:@RUN: llvm-mc -triple 
> armv7-base-apple-darwin %s | FileCheck --check-prefix=CHECK-ARM 
> --check-prefix=CHECK %s
> ```
You're right, I forgot CHECK directives have the same problem. This should be 
fixed by the patch that was proposed to force a comment mark or beginning of 
line for a prefix to be recognized as a directive. Patch LGTM then.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79276/new/

https://reviews.llvm.org/D79276



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


[PATCH] D125084: [test, x86] Fix spurious x86-target-features.c failure

2022-05-06 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre created this revision.
thopre added reviewers: sconstab, craig.topper, andrew.w.kaylor, zbrid, 
chandlerc.
Herald added subscribers: StephenFan, pengfei.
Herald added a project: All.
thopre requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

x86-target-features.c can spuriously fail when checking for absence of
the string "lvi" in the compiler output due to the temporary path used
for the output file. For example:
"-o" "/tmp/lit-tmp-981j7lvi/x86-target-features-670b86.o"
will make the test fail. This commit checks specifically for lvi as a
target feature, in a similar way to the positive CHECK directive just
above.

Test Plan: fails when using -mlvi-hardening and pass otherwise


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D125084

Files:
  clang/test/Driver/x86-target-features.c


Index: clang/test/Driver/x86-target-features.c
===
--- clang/test/Driver/x86-target-features.c
+++ clang/test/Driver/x86-target-features.c
@@ -170,7 +170,7 @@
 // RUN: %clang -target i386-linux-gnu -mlvi-hardening %s -### -o %t.o 2>&1 | 
FileCheck -check-prefix=LVIHARDENING %s
 // RUN: %clang -target i386-linux-gnu -mno-lvi-hardening %s -### -o %t.o 2>&1 
| FileCheck -check-prefix=NO-LVIHARDENING %s
 // LVIHARDENING: "-target-feature" "+lvi-load-hardening" "-target-feature" 
"+lvi-cfi"
-// NO-LVIHARDENING-NOT: lvi
+// NO-LVIHARDENING-NOT: "-target-feature" "+lvi
 
 // RUN: %clang -target i386-linux-gnu -mlvi-hardening 
-mspeculative-load-hardening %s -### -o %t.o 2>&1 | FileCheck 
-check-prefix=LVIHARDENING-SLH %s
 // LVIHARDENING-SLH: error: invalid argument 'mspeculative-load-hardening' not 
allowed with 'mlvi-hardening'


Index: clang/test/Driver/x86-target-features.c
===
--- clang/test/Driver/x86-target-features.c
+++ clang/test/Driver/x86-target-features.c
@@ -170,7 +170,7 @@
 // RUN: %clang -target i386-linux-gnu -mlvi-hardening %s -### -o %t.o 2>&1 | FileCheck -check-prefix=LVIHARDENING %s
 // RUN: %clang -target i386-linux-gnu -mno-lvi-hardening %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-LVIHARDENING %s
 // LVIHARDENING: "-target-feature" "+lvi-load-hardening" "-target-feature" "+lvi-cfi"
-// NO-LVIHARDENING-NOT: lvi
+// NO-LVIHARDENING-NOT: "-target-feature" "+lvi
 
 // RUN: %clang -target i386-linux-gnu -mlvi-hardening -mspeculative-load-hardening %s -### -o %t.o 2>&1 | FileCheck -check-prefix=LVIHARDENING-SLH %s
 // LVIHARDENING-SLH: error: invalid argument 'mspeculative-load-hardening' not allowed with 'mlvi-hardening'
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D125604: [FileCheck] Catch missspelled directives.

2022-05-16 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre added inline comments.



Comment at: llvm/lib/FileCheck/FileCheck.cpp:1774-1781
+static std::pair
+FindCheckType(const FileCheckRequest &Req, StringRef Buffer, StringRef Prefix) 
{
+  bool Misspelled = false;
+  auto Res = FindCheckType(Req, Buffer, Prefix, Misspelled);
+  if (Res.first != Check::CheckNone && Misspelled)
+return {Check::CheckMisspelled, Res.second};
+  return Res;

Instead of introducing a new wrapper, why don't you change all the return to 
call a constructor method (e.g. `make_check_type()`) that does what this 
wrapper do? Then there would not be any FindCheckType that take a Misspelled 
parameter.

I'm also not sure about Misspelled being a check kind. It feels conceptually 
wrong but on the other hand I guess it makes the implementation simpler.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D125604/new/

https://reviews.llvm.org/D125604

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


[PATCH] D125084: [test, x86] Fix spurious x86-target-features.c failure

2022-05-17 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre added a comment.

Ping?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D125084/new/

https://reviews.llvm.org/D125084

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


[PATCH] D125084: [test, x86] Fix spurious x86-target-features.c failure

2022-05-17 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre updated this revision to Diff 430029.
thopre marked an inline comment as done.
thopre added a comment.

Be more conservative in what we reject


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D125084/new/

https://reviews.llvm.org/D125084

Files:
  clang/test/Driver/x86-target-features.c


Index: clang/test/Driver/x86-target-features.c
===
--- clang/test/Driver/x86-target-features.c
+++ clang/test/Driver/x86-target-features.c
@@ -170,7 +170,7 @@
 // RUN: %clang -target i386-linux-gnu -mlvi-hardening %s -### -o %t.o 2>&1 | 
FileCheck -check-prefix=LVIHARDENING %s
 // RUN: %clang -target i386-linux-gnu -mno-lvi-hardening %s -### -o %t.o 2>&1 
| FileCheck -check-prefix=NO-LVIHARDENING %s
 // LVIHARDENING: "-target-feature" "+lvi-load-hardening" "-target-feature" 
"+lvi-cfi"
-// NO-LVIHARDENING-NOT: lvi
+// NO-LVIHARDENING-NOT: "+lvi-
 
 // RUN: %clang -target i386-linux-gnu -mlvi-hardening 
-mspeculative-load-hardening %s -### -o %t.o 2>&1 | FileCheck 
-check-prefix=LVIHARDENING-SLH %s
 // LVIHARDENING-SLH: error: invalid argument 'mspeculative-load-hardening' not 
allowed with 'mlvi-hardening'


Index: clang/test/Driver/x86-target-features.c
===
--- clang/test/Driver/x86-target-features.c
+++ clang/test/Driver/x86-target-features.c
@@ -170,7 +170,7 @@
 // RUN: %clang -target i386-linux-gnu -mlvi-hardening %s -### -o %t.o 2>&1 | FileCheck -check-prefix=LVIHARDENING %s
 // RUN: %clang -target i386-linux-gnu -mno-lvi-hardening %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-LVIHARDENING %s
 // LVIHARDENING: "-target-feature" "+lvi-load-hardening" "-target-feature" "+lvi-cfi"
-// NO-LVIHARDENING-NOT: lvi
+// NO-LVIHARDENING-NOT: "+lvi-
 
 // RUN: %clang -target i386-linux-gnu -mlvi-hardening -mspeculative-load-hardening %s -### -o %t.o 2>&1 | FileCheck -check-prefix=LVIHARDENING-SLH %s
 // LVIHARDENING-SLH: error: invalid argument 'mspeculative-load-hardening' not allowed with 'mlvi-hardening'
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D125604: [FileCheck] Catch missspelled directives.

2022-05-17 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre added inline comments.



Comment at: llvm/lib/FileCheck/FileCheck.cpp:1774-1781
+static std::pair
+FindCheckType(const FileCheckRequest &Req, StringRef Buffer, StringRef Prefix) 
{
+  bool Misspelled = false;
+  auto Res = FindCheckType(Req, Buffer, Prefix, Misspelled);
+  if (Res.first != Check::CheckNone && Misspelled)
+return {Check::CheckMisspelled, Res.second};
+  return Res;

kosarev wrote:
> thopre wrote:
> > Instead of introducing a new wrapper, why don't you change all the return 
> > to call a constructor method (e.g. `make_check_type()`) that does what this 
> > wrapper do? Then there would not be any FindCheckType that take a 
> > Misspelled parameter.
> > 
> > I'm also not sure about Misspelled being a check kind. It feels 
> > conceptually wrong but on the other hand I guess it makes the 
> > implementation simpler.
> Tried that. Replacing the returned pair with a new `CheckLine` kind of object 
> implementing the misspelled-related logic seems to add a lot of extra clutter 
> such as the definition of the new structure itself, but especially all the 
> repetitive mentions of `Misspelled` on every `return`. Feels like having it 
> as a reference parameter works better, as we only need to alter the flag 
> occasionally.
> 
> Regarding `CheckMisspelled`, now that we have `CheckBadNot` and 
> `CheckBadCount`, this looks the usual way of propagating the information 
> about our spelling-related concerns. Might be not the best design and may be 
> worth looking into at some point, but at least doesn' seem to be specific to 
> this patch?
I was thinking something along the line of:

return getRealCheckType(CHECK::CheckBadCount, Rest, Misspelled); with:

```static std::pair
getRealCheckType(Check::FileCheckType CheckType, StringRef Rest, bool 
Misspelled) {
  if (CheckType != Check::CheckNone && Misspelled)
return {Check::CheckMisspelled, Rest};
  return {CheckType, Rest};
}```

Fair enough for CheckMisspelled, there is indeeed precedent.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D125604/new/

https://reviews.llvm.org/D125604

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


[PATCH] D125604: [FileCheck] Catch missspelled directives.

2022-05-18 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre added inline comments.



Comment at: llvm/lib/FileCheck/FileCheck.cpp:1774-1781
+static std::pair
+FindCheckType(const FileCheckRequest &Req, StringRef Buffer, StringRef Prefix) 
{
+  bool Misspelled = false;
+  auto Res = FindCheckType(Req, Buffer, Prefix, Misspelled);
+  if (Res.first != Check::CheckNone && Misspelled)
+return {Check::CheckMisspelled, Res.second};
+  return Res;

kosarev wrote:
> thopre wrote:
> > kosarev wrote:
> > > thopre wrote:
> > > > Instead of introducing a new wrapper, why don't you change all the 
> > > > return to call a constructor method (e.g. `make_check_type()`) that 
> > > > does what this wrapper do? Then there would not be any FindCheckType 
> > > > that take a Misspelled parameter.
> > > > 
> > > > I'm also not sure about Misspelled being a check kind. It feels 
> > > > conceptually wrong but on the other hand I guess it makes the 
> > > > implementation simpler.
> > > Tried that. Replacing the returned pair with a new `CheckLine` kind of 
> > > object implementing the misspelled-related logic seems to add a lot of 
> > > extra clutter such as the definition of the new structure itself, but 
> > > especially all the repetitive mentions of `Misspelled` on every `return`. 
> > > Feels like having it as a reference parameter works better, as we only 
> > > need to alter the flag occasionally.
> > > 
> > > Regarding `CheckMisspelled`, now that we have `CheckBadNot` and 
> > > `CheckBadCount`, this looks the usual way of propagating the information 
> > > about our spelling-related concerns. Might be not the best design and may 
> > > be worth looking into at some point, but at least doesn' seem to be 
> > > specific to this patch?
> > I was thinking something along the line of:
> > 
> > return getRealCheckType(CHECK::CheckBadCount, Rest, Misspelled); with:
> > 
> > ```static std::pair
> > getRealCheckType(Check::FileCheckType CheckType, StringRef Rest, bool 
> > Misspelled) {
> >   if (CheckType != Check::CheckNone && Misspelled)
> > return {Check::CheckMisspelled, Rest};
> >   return {CheckType, Rest};
> > }```
> > 
> > Fair enough for CheckMisspelled, there is indeeed precedent.
> That unfortunately wouldn't eliminate the repetitive `return 
> getRealCheckType(..., Misspelled)` bits, thus adding a significant amount of 
> clutter -- all for the sake of a single assignment where we raise the flag, 
> while also making the code more fragile as the compiler wouldn't then be able 
> to catch `return`s without calling `getRealCheckType()`. And if that's not 
> enough, then the name of the function sounds like we introduce one of the 
> most irritating kinds of concepts -- the 'real' ones. :-)
Fair enough. LGTM for the FileCheck part then. Have you sent a message to 
discourse to ask test authors for help on the TODO?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D125604/new/

https://reviews.llvm.org/D125604

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


[PATCH] D125084: [test, x86] Fix spurious x86-target-features.c failure

2022-05-18 Thread Thomas Preud'homme via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7e65ffaa8bb6: [test, x86] Fix spurious x86-target-features.c 
failure (authored by thopre).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D125084/new/

https://reviews.llvm.org/D125084

Files:
  clang/test/Driver/x86-target-features.c


Index: clang/test/Driver/x86-target-features.c
===
--- clang/test/Driver/x86-target-features.c
+++ clang/test/Driver/x86-target-features.c
@@ -170,7 +170,7 @@
 // RUN: %clang -target i386-linux-gnu -mlvi-hardening %s -### -o %t.o 2>&1 | 
FileCheck -check-prefix=LVIHARDENING %s
 // RUN: %clang -target i386-linux-gnu -mno-lvi-hardening %s -### -o %t.o 2>&1 
| FileCheck -check-prefix=NO-LVIHARDENING %s
 // LVIHARDENING: "-target-feature" "+lvi-load-hardening" "-target-feature" 
"+lvi-cfi"
-// NO-LVIHARDENING-NOT: lvi
+// NO-LVIHARDENING-NOT: "+lvi-
 
 // RUN: %clang -target i386-linux-gnu -mlvi-hardening 
-mspeculative-load-hardening %s -### -o %t.o 2>&1 | FileCheck 
-check-prefix=LVIHARDENING-SLH %s
 // LVIHARDENING-SLH: error: invalid argument 'mspeculative-load-hardening' not 
allowed with 'mlvi-hardening'


Index: clang/test/Driver/x86-target-features.c
===
--- clang/test/Driver/x86-target-features.c
+++ clang/test/Driver/x86-target-features.c
@@ -170,7 +170,7 @@
 // RUN: %clang -target i386-linux-gnu -mlvi-hardening %s -### -o %t.o 2>&1 | FileCheck -check-prefix=LVIHARDENING %s
 // RUN: %clang -target i386-linux-gnu -mno-lvi-hardening %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-LVIHARDENING %s
 // LVIHARDENING: "-target-feature" "+lvi-load-hardening" "-target-feature" "+lvi-cfi"
-// NO-LVIHARDENING-NOT: lvi
+// NO-LVIHARDENING-NOT: "+lvi-
 
 // RUN: %clang -target i386-linux-gnu -mlvi-hardening -mspeculative-load-hardening %s -### -o %t.o 2>&1 | FileCheck -check-prefix=LVIHARDENING-SLH %s
 // LVIHARDENING-SLH: error: invalid argument 'mspeculative-load-hardening' not allowed with 'mlvi-hardening'
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D92409: [AST][NFC] Silence GCC warning about multiline comments

2020-12-12 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre added a comment.

In D92409#2426196 , @thopre wrote:

> In D92409#2426188 , @rsmith wrote:
>
>> Let's just disable this broken GCC warning. IIRC, the corresponding clang 
>> warning covers the actual bugs caused by line continuation in comments, and 
>> doesn't warn if the next line begins with a `//`.
>
> Is there a way to disable it from the header? I've noticed this warning when 
> compiling an application using libclang with g++. So I'm looking for a fix 
> outside clang's build system which is not used in that case.

Ping?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92409/new/

https://reviews.llvm.org/D92409

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


[PATCH] D92409: [AST][NFC] Silence GCC warning about multiline comments

2020-12-13 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre added a comment.

In D92409#2450690 , @rsmith wrote:

> In D92409#2450550 , @thopre wrote:
>
>> In D92409#2426196 , @thopre wrote:
>>
>>> Is there a way to disable it from the header? I've noticed this warning 
>>> when compiling an application using libclang with g++. So I'm looking for a 
>>> fix outside clang's build system which is not used in that case.
>>
>> Ping?
>
> `#pragma GCC diagnostic ignored` 
> (https://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html) can do it. Now, 
> we can't reasonably guarantee that Clang headers won't cause arbitrary broken 
> warnings to fire, so there's a judgment call here on the extent to which we 
> should carry changes to support use of such warning flags (versus expecting 
> the code including the header to disable the warning). In this case, it's 
> probably worth it, though, because the warning in question is part of GCC's 
> `-Wall`.

The documentation for that pragma says:

> Note that not all diagnostics are modifiable; at the moment only warnings 
> (normally controlled by ‘-W…’) can be controlled, and not all of them.

Unfortunately -Wcomment seems to be one of them as the pragma has no effect on 
the warning, at least with GCC 7, I haven't tried other versions.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92409/new/

https://reviews.llvm.org/D92409

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


[PATCH] D93347: [Test] Fix undef var in attr-speculative-load-hardening.c

2020-12-15 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre created this revision.
thopre added reviewers: zbrid, chandlerc, EricWF.
thopre requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Fix use of undefined variable in CHECK-NOT directive in clang test
CodeGen/attr-speculative-load-hardening.c.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D93347

Files:
  clang/test/CodeGen/attr-speculative-load-hardening.c


Index: clang/test/CodeGen/attr-speculative-load-hardening.c
===
--- clang/test/CodeGen/attr-speculative-load-hardening.c
+++ clang/test/CodeGen/attr-speculative-load-hardening.c
@@ -12,4 +12,4 @@
 
 // NOSLH: @{{.*}}test1{{.*}}[[NOSLH:#[0-9]+]]
 
-// NOSLH-NOT: attributes [[SLH]] = { {{.*}}speculative_load_hardening{{.*}} }
+// NOSLH-NOT: attributes [[NOSLH]] = { {{.*}}speculative_load_hardening{{.*}} }


Index: clang/test/CodeGen/attr-speculative-load-hardening.c
===
--- clang/test/CodeGen/attr-speculative-load-hardening.c
+++ clang/test/CodeGen/attr-speculative-load-hardening.c
@@ -12,4 +12,4 @@
 
 // NOSLH: @{{.*}}test1{{.*}}[[NOSLH:#[0-9]+]]
 
-// NOSLH-NOT: attributes [[SLH]] = { {{.*}}speculative_load_hardening{{.*}} }
+// NOSLH-NOT: attributes [[NOSLH]] = { {{.*}}speculative_load_hardening{{.*}} }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D93350: [Test] Fix undef var in catch-undef-behavior.c

2020-12-15 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre created this revision.
thopre added reviewers: rsmith, rnk, BillyONeal, spatel.
thopre requested review of this revision.
Herald added a project: clang.

Commit 9e52c43090f8cd980167bbd2719878ae36bcf6b5 removed the directive
defining LINE_1600 but left a string substitution to that variable in a
CHECK-NOT directive. This will make that CHECK-NOT directive always fail
to match, no matter the string.

This commit follows the pattern done in
9e52c43090f8cd980167bbd2719878ae36bcf6b5 of simplifying the CHECK-NOT to
only look for the function name and the opening parenthesis, thereby not
requiring the LINE_1600 variable.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D93350

Files:
  clang/test/CodeGen/catch-undef-behavior.c


Index: clang/test/CodeGen/catch-undef-behavior.c
===
--- clang/test/CodeGen/catch-undef-behavior.c
+++ clang/test/CodeGen/catch-undef-behavior.c
@@ -275,7 +275,7 @@
 
 // CHECK-COMMON-LABEL: @float_float_overflow
 float float_float_overflow(double f) {
-  // CHECK-UBSAN-NOT: call {{.*}} @__ubsan_handle_float_cast_overflow(i8* 
bitcast ({{.*}} @[[LINE_1600]] to i8*),
+  // CHECK-UBSAN-NOT: call {{.*}} @__ubsan_handle_float_cast_overflow(
   // CHECK-TRAP-NOT:  call {{.*}} @llvm.ubsantrap(i8 19) [[NR_NUW]]
   // CHECK-COMMON: }
   return f;


Index: clang/test/CodeGen/catch-undef-behavior.c
===
--- clang/test/CodeGen/catch-undef-behavior.c
+++ clang/test/CodeGen/catch-undef-behavior.c
@@ -275,7 +275,7 @@
 
 // CHECK-COMMON-LABEL: @float_float_overflow
 float float_float_overflow(double f) {
-  // CHECK-UBSAN-NOT: call {{.*}} @__ubsan_handle_float_cast_overflow(i8* bitcast ({{.*}} @[[LINE_1600]] to i8*),
+  // CHECK-UBSAN-NOT: call {{.*}} @__ubsan_handle_float_cast_overflow(
   // CHECK-TRAP-NOT:  call {{.*}} @llvm.ubsantrap(i8 19) [[NR_NUW]]
   // CHECK-COMMON: }
   return f;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D93350: [Test] Fix undef var in catch-undef-behavior.c

2020-12-16 Thread Thomas Preud'homme via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG150fe05db441: [Test] Fix undef var in catch-undef-behavior.c 
(authored by thopre).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93350/new/

https://reviews.llvm.org/D93350

Files:
  clang/test/CodeGen/catch-undef-behavior.c


Index: clang/test/CodeGen/catch-undef-behavior.c
===
--- clang/test/CodeGen/catch-undef-behavior.c
+++ clang/test/CodeGen/catch-undef-behavior.c
@@ -275,7 +275,7 @@
 
 // CHECK-COMMON-LABEL: @float_float_overflow
 float float_float_overflow(double f) {
-  // CHECK-UBSAN-NOT: call {{.*}} @__ubsan_handle_float_cast_overflow(i8* 
bitcast ({{.*}} @[[LINE_1600]] to i8*),
+  // CHECK-UBSAN-NOT: call {{.*}} @__ubsan_handle_float_cast_overflow(
   // CHECK-TRAP-NOT:  call {{.*}} @llvm.ubsantrap(i8 19) [[NR_NUW]]
   // CHECK-COMMON: }
   return f;


Index: clang/test/CodeGen/catch-undef-behavior.c
===
--- clang/test/CodeGen/catch-undef-behavior.c
+++ clang/test/CodeGen/catch-undef-behavior.c
@@ -275,7 +275,7 @@
 
 // CHECK-COMMON-LABEL: @float_float_overflow
 float float_float_overflow(double f) {
-  // CHECK-UBSAN-NOT: call {{.*}} @__ubsan_handle_float_cast_overflow(i8* bitcast ({{.*}} @[[LINE_1600]] to i8*),
+  // CHECK-UBSAN-NOT: call {{.*}} @__ubsan_handle_float_cast_overflow(
   // CHECK-TRAP-NOT:  call {{.*}} @llvm.ubsantrap(i8 19) [[NR_NUW]]
   // CHECK-COMMON: }
   return f;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D92384: [AST][NFC] Silence GCC warning about broken strict aliasing rules

2020-12-01 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre created this revision.
thopre added reviewers: jdenny, aaron.ballman, hfinkel, llvm-commits.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
thopre requested review of this revision.

The deserialize() method would trigger the following warning on GCC <7:

  warning: dereferencing type-punned pointer will break
  strict-aliasing rules [-Wstrict-aliasing]
  
  ParamIdx P(*reinterpret_cast(&S));
 ^

&S was previously reinterpret_casted from a ParamIdx into a SerialType,
it is therefore safe to cast back into a ParamIdx. Similar to what was
done in D50608 , we replace it with two 
static_cast via void * which
silences the warning and presumably makes GCC understand that no
strict-aliasing violation is happening.

No functional change intended.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D92384

Files:
  clang/include/clang/AST/Attr.h


Index: clang/include/clang/AST/Attr.h
===
--- clang/include/clang/AST/Attr.h
+++ clang/include/clang/AST/Attr.h
@@ -259,7 +259,10 @@
 
   /// Construct from a result from \c serialize.
   static ParamIdx deserialize(SerialType S) {
-ParamIdx P(*reinterpret_cast(&S));
+// Using this two-step static_cast via void * instead of reinterpret_cast
+// silences a -Wstrict-aliasing false positive from GCC7 and earlier.
+void *ParamIdxPtr = static_cast(&S);
+ParamIdx P(*static_cast(ParamIdxPtr));
 assert((!P.IsValid || P.Idx >= 1) && "valid Idx must be one-origin");
 return P;
   }


Index: clang/include/clang/AST/Attr.h
===
--- clang/include/clang/AST/Attr.h
+++ clang/include/clang/AST/Attr.h
@@ -259,7 +259,10 @@
 
   /// Construct from a result from \c serialize.
   static ParamIdx deserialize(SerialType S) {
-ParamIdx P(*reinterpret_cast(&S));
+// Using this two-step static_cast via void * instead of reinterpret_cast
+// silences a -Wstrict-aliasing false positive from GCC7 and earlier.
+void *ParamIdxPtr = static_cast(&S);
+ParamIdx P(*static_cast(ParamIdxPtr));
 assert((!P.IsValid || P.Idx >= 1) && "valid Idx must be one-origin");
 return P;
   }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D92409: [AST][NFC] Silence GCC warning about multiline comments

2020-12-01 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre created this revision.
thopre added reviewers: ABataev, rjmccall, rsmith.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
thopre requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added a subscriber: sstefan1.

GCC's -Wcomment warning is emitted on OMPDeclareReductionDecl heading
comment due to the continuation mark in the code example. This commit
changes the comment style to javadoc to avoid the warning and allow
building with -Werror.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D92409

Files:
  clang/include/clang/AST/DeclOpenMP.h


Index: clang/include/clang/AST/DeclOpenMP.h
===
--- clang/include/clang/AST/DeclOpenMP.h
+++ clang/include/clang/AST/DeclOpenMP.h
@@ -158,16 +158,18 @@
   static bool classofKind(Kind K) { return K == OMPThreadPrivate; }
 };
 
-/// This represents '#pragma omp declare reduction ...' directive.
-/// For example, in the following, declared reduction 'foo' for types 'int' and
-/// 'float':
-///
-/// \code
-/// #pragma omp declare reduction (foo : int,float : omp_out += omp_in) \
-/// initializer (omp_priv = 0)
-/// \endcode
-///
-/// Here 'omp_out += omp_in' is a combiner and 'omp_priv = 0' is an 
initializer.
+/**
+ * This represents '#pragma omp declare reduction ...' directive.
+ * For example, in the following, declared reduction 'foo' for types 'int' and
+ * 'float':
+ *
+ * \code
+ * #pragma omp declare reduction (foo : int,float : omp_out += omp_in) \
+ * initializer (omp_priv = 0)
+ * \endcode
+ *
+ * Here 'omp_out += omp_in' is a combiner and 'omp_priv = 0' is an initializer.
+ */
 class OMPDeclareReductionDecl final : public ValueDecl, public DeclContext {
   // This class stores some data in DeclContext::OMPDeclareReductionDeclBits
   // to save some space. Use the provided accessors to access it.


Index: clang/include/clang/AST/DeclOpenMP.h
===
--- clang/include/clang/AST/DeclOpenMP.h
+++ clang/include/clang/AST/DeclOpenMP.h
@@ -158,16 +158,18 @@
   static bool classofKind(Kind K) { return K == OMPThreadPrivate; }
 };
 
-/// This represents '#pragma omp declare reduction ...' directive.
-/// For example, in the following, declared reduction 'foo' for types 'int' and
-/// 'float':
-///
-/// \code
-/// #pragma omp declare reduction (foo : int,float : omp_out += omp_in) \
-/// initializer (omp_priv = 0)
-/// \endcode
-///
-/// Here 'omp_out += omp_in' is a combiner and 'omp_priv = 0' is an initializer.
+/**
+ * This represents '#pragma omp declare reduction ...' directive.
+ * For example, in the following, declared reduction 'foo' for types 'int' and
+ * 'float':
+ *
+ * \code
+ * #pragma omp declare reduction (foo : int,float : omp_out += omp_in) \
+ * initializer (omp_priv = 0)
+ * \endcode
+ *
+ * Here 'omp_out += omp_in' is a combiner and 'omp_priv = 0' is an initializer.
+ */
 class OMPDeclareReductionDecl final : public ValueDecl, public DeclContext {
   // This class stores some data in DeclContext::OMPDeclareReductionDeclBits
   // to save some space. Use the provided accessors to access it.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D92409: [AST][NFC] Silence GCC warning about multiline comments

2020-12-01 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre added a comment.

In D92409#2426160 , @ABataev wrote:

> I would just remove this extra symbol.

But then the example code is no longer copy/pastable. Note that I expect people 
to copy/paste but it's nice if it looks authentic. Note that I don't mind 
either way.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92409/new/

https://reviews.llvm.org/D92409

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


[PATCH] D92409: [AST][NFC] Silence GCC warning about multiline comments

2020-12-01 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre added a comment.

In D92409#2426188 , @rsmith wrote:

> Let's just disable this broken GCC warning. IIRC, the corresponding clang 
> warning covers the actual bugs caused by line continuation in comments, and 
> doesn't warn if the next line begins with a `//`.

Is there a way to disable it from the header? I've noticed this warning when 
compiling an application using libclang with g++. So I'm looking for a fix 
outside clang's build system which is not used in that case.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92409/new/

https://reviews.llvm.org/D92409

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


[PATCH] D92384: [AST][NFC] Silence GCC warning about broken strict aliasing rules

2020-12-04 Thread Thomas Preud'homme via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG507bbc45bba9: [AST][NFC] Silence GCC warning about broken 
strict aliasing rules (authored by thopre).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92384/new/

https://reviews.llvm.org/D92384

Files:
  clang/include/clang/AST/Attr.h


Index: clang/include/clang/AST/Attr.h
===
--- clang/include/clang/AST/Attr.h
+++ clang/include/clang/AST/Attr.h
@@ -259,7 +259,10 @@
 
   /// Construct from a result from \c serialize.
   static ParamIdx deserialize(SerialType S) {
-ParamIdx P(*reinterpret_cast(&S));
+// Using this two-step static_cast via void * instead of reinterpret_cast
+// silences a -Wstrict-aliasing false positive from GCC7 and earlier.
+void *ParamIdxPtr = static_cast(&S);
+ParamIdx P(*static_cast(ParamIdxPtr));
 assert((!P.IsValid || P.Idx >= 1) && "valid Idx must be one-origin");
 return P;
   }


Index: clang/include/clang/AST/Attr.h
===
--- clang/include/clang/AST/Attr.h
+++ clang/include/clang/AST/Attr.h
@@ -259,7 +259,10 @@
 
   /// Construct from a result from \c serialize.
   static ParamIdx deserialize(SerialType S) {
-ParamIdx P(*reinterpret_cast(&S));
+// Using this two-step static_cast via void * instead of reinterpret_cast
+// silences a -Wstrict-aliasing false positive from GCC7 and earlier.
+void *ParamIdxPtr = static_cast(&S);
+ParamIdx P(*static_cast(ParamIdxPtr));
 assert((!P.IsValid || P.Idx >= 1) && "valid Idx must be one-origin");
 return P;
   }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D94396: Fix macos target assumption in test

2021-01-29 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre added reviewers: hans, jyknight, steven_wu.
thopre added a comment.

Ping?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D94396/new/

https://reviews.llvm.org/D94396

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


[PATCH] D94396: Fix macos target assumption in test

2021-01-29 Thread Thomas Preud'homme via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG305ac81e1d4b: Fix macos target assumption in test (authored 
by thopre).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D94396/new/

https://reviews.llvm.org/D94396

Files:
  clang/test/Driver/macos-apple-silicon-slice-link-libs-darwin-only.cpp


Index: clang/test/Driver/macos-apple-silicon-slice-link-libs-darwin-only.cpp
===
--- clang/test/Driver/macos-apple-silicon-slice-link-libs-darwin-only.cpp
+++ clang/test/Driver/macos-apple-silicon-slice-link-libs-darwin-only.cpp
@@ -1,5 +1,5 @@
-// RUN: %clang -### -arch arm64 -mmacosx-version-min=10.7 %s 2>&1 | FileCheck 
-check-prefix=ARM64-10_7 %s
-// RUN: %clang -### -arch x86_64 -mmacosx-version-min=10.7 %s 2>&1 | FileCheck 
-check-prefix=x86_64-10_7 %s
+// RUN: %clang -### -target arm64-apple-darwin -arch arm64 
-mmacosx-version-min=10.7 %s 2>&1 | FileCheck -check-prefix=ARM64-10_7 %s
+// RUN: %clang -### -target x86_64-apple-darwin10 -arch x86_64 
-mmacosx-version-min=10.7 %s 2>&1 | FileCheck -check-prefix=x86_64-10_7 %s
 // REQUIRES: system-darwin
 
 // ARM64-10_7-NOT: -lcrt1.10.6.o


Index: clang/test/Driver/macos-apple-silicon-slice-link-libs-darwin-only.cpp
===
--- clang/test/Driver/macos-apple-silicon-slice-link-libs-darwin-only.cpp
+++ clang/test/Driver/macos-apple-silicon-slice-link-libs-darwin-only.cpp
@@ -1,5 +1,5 @@
-// RUN: %clang -### -arch arm64 -mmacosx-version-min=10.7 %s 2>&1 | FileCheck -check-prefix=ARM64-10_7 %s
-// RUN: %clang -### -arch x86_64 -mmacosx-version-min=10.7 %s 2>&1 | FileCheck -check-prefix=x86_64-10_7 %s
+// RUN: %clang -### -target arm64-apple-darwin -arch arm64 -mmacosx-version-min=10.7 %s 2>&1 | FileCheck -check-prefix=ARM64-10_7 %s
+// RUN: %clang -### -target x86_64-apple-darwin10 -arch x86_64 -mmacosx-version-min=10.7 %s 2>&1 | FileCheck -check-prefix=x86_64-10_7 %s
 // REQUIRES: system-darwin
 
 // ARM64-10_7-NOT: -lcrt1.10.6.o
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D93347: [Test] Fix undef var in attr-speculative-load-hardening.c

2021-01-29 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre added a comment.

Ping?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93347/new/

https://reviews.llvm.org/D93347

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


[PATCH] D95948: Stop traping on sNaN in __builtin_isnan

2021-02-03 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre created this revision.
thopre added reviewers: efriedma, kpn, mibintc, sepavloff, rjmccall.
Herald added subscribers: dexonsmith, pengfei.
thopre requested review of this revision.
Herald added projects: clang, LLVM.
Herald added a subscriber: llvm-commits.

__builtin_isnan currently generates a floating-point compare operation
which triggers a trap when faced with a signaling NaN in StrictFP mode.
This commit uses integer operations instead to not generate any trap in
such a case.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D95948

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/test/CodeGen/X86/strictfp_builtins.c
  clang/test/CodeGen/strictfp_builtins.c
  clang/test/CodeGen/strictfp_fpclassify.c
  llvm/include/llvm/ADT/APFloat.h
  llvm/include/llvm/IR/Type.h

Index: llvm/include/llvm/IR/Type.h
===
--- llvm/include/llvm/IR/Type.h
+++ llvm/include/llvm/IR/Type.h
@@ -308,6 +308,10 @@
   /// ppc long double), this method returns -1.
   int getFPMantissaWidth() const;
 
+  /// Return whether the type is IEEE compatible, as defined by the eponymous
+  /// method in APFloat.
+  bool isIEEE() const { return APFloat::getZero(getFltSemantics()).isIEEE(); }
+
   /// If this is a vector type, return the element type, otherwise return
   /// 'this'.
   inline Type *getScalarType() const {
Index: llvm/include/llvm/ADT/APFloat.h
===
--- llvm/include/llvm/ADT/APFloat.h
+++ llvm/include/llvm/ADT/APFloat.h
@@ -1218,6 +1218,7 @@
   bool isSmallest() const { APFLOAT_DISPATCH_ON_SEMANTICS(isSmallest()); }
   bool isLargest() const { APFLOAT_DISPATCH_ON_SEMANTICS(isLargest()); }
   bool isInteger() const { APFLOAT_DISPATCH_ON_SEMANTICS(isInteger()); }
+  bool isIEEE() const { return usesLayout(getSemantics()); }
 
   APFloat &operator=(const APFloat &RHS) = default;
   APFloat &operator=(APFloat &&RHS) = default;
Index: clang/test/CodeGen/strictfp_builtins.c
===
--- clang/test/CodeGen/strictfp_builtins.c
+++ clang/test/CodeGen/strictfp_builtins.c
@@ -92,17 +92,38 @@
   return;
 }
 
-// CHECK-LABEL: @test_isnan(
+// CHECK-LABEL: @test_float_isnan(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[F_ADDR:%.*]] = alloca float, align 4
+// CHECK-NEXT:store float [[F:%.*]], float* [[F_ADDR]], align 4
+// CHECK-NEXT:[[TMP0:%.*]] = load float, float* [[F_ADDR]], align 4
+// CHECK-NEXT:[[BITCAST:%.*]] = bitcast float [[TMP0]] to i32
+// CHECK-NEXT:[[ABS:%.*]] = and i32 [[BITCAST]], [[#%u,0x7FFF]]
+// CHECK-NEXT:[[TMP1:%.*]] = sub i32 [[#%u,0x7F80]], [[ABS]]
+// CHECK-NEXT:[[ISNAN:%.*]] = lshr i32 [[TMP1]], 31
+// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32 [[ISNAN]]) [[ATTR4]]
+// CHECK-NEXT:ret void
+//
+void test_float_isnan(float f) {
+  P(isnan, (f));
+
+  return;
+}
+
+// CHECK-LABEL: @test_double_isnan(
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:[[D_ADDR:%.*]] = alloca double, align 8
 // CHECK-NEXT:store double [[D:%.*]], double* [[D_ADDR]], align 8
 // CHECK-NEXT:[[TMP0:%.*]] = load double, double* [[D_ADDR]], align 8
-// CHECK-NEXT:[[CMP:%.*]] = call i1 @llvm.experimental.constrained.fcmp.f64(double [[TMP0]], double [[TMP0]], metadata !"uno", metadata !"fpexcept.strict") [[ATTR4]]
-// CHECK-NEXT:[[TMP1:%.*]] = zext i1 [[CMP]] to i32
-// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32 [[TMP1]]) [[ATTR4]]
+// CHECK-NEXT:[[BITCAST:%.*]] = bitcast double [[TMP0]] to i64
+// CHECK-NEXT:[[ABS:%.*]] = and i64 [[BITCAST]], [[#%u,0x7FFF]]
+// CHECK-NEXT:[[TMP1:%.*]] = sub i64 [[#%u,0x7FF0]], [[ABS]]
+// CHECK-NEXT:[[ISNAN:%.*]] = lshr i64 [[TMP1]], 63
+// CHECK-NEXT:[[RES:%.*]] = trunc i64 [[ISNAN]] to i32
+// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i32 [[RES]]) [[ATTR4]]
 // CHECK-NEXT:ret void
 //
-void test_isnan(double d) {
+void test_double_isnan(double d) {
   P(isnan, (d));
 
   return;
@@ -120,7 +141,7 @@
 // CHECK-NEXT:[[AND:%.*]] = and i1 [[ISEQ]], [[ISINF]]
 // CHECK-NEXT:[[AND1:%.*]] = and i1 [[AND]], [[ISNORMAL]]
 // CHECK-NEXT:[[TMP2:%.*]] = zext i1 [[AND1]] to i32
-// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i32 [[TMP2]]) [[ATTR4]]
+// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i32 [[TMP2]]) [[ATTR4]]
 // CHECK-NEXT:ret void
 //
 void test_isnormal(double d) {
Index: clang/test/CodeGen/X86/strictfp_builtins.c
===
--- /dev/null
+++ clang/test/CodeGen/X86/strictfp_builtins.c
@@ -0,0 +1,46 @@
+// NOTE: Assertions have been autogenerated by u

[PATCH] D95948: Stop traping on sNaN in __builtin_isnan

2021-02-03 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre marked 2 inline comments as done.
thopre added inline comments.



Comment at: clang/lib/CodeGen/CGBuiltin.cpp:2988
 CodeGenFunction::CGFPOptionsRAII FPOptsRAII(*this, E);
-// FIXME: for strictfp/IEEE-754 we need to not trap on SNaN here.
 Value *V = EmitScalarExpr(E->getArg(0));

mibintc wrote:
> What about all the other FIXME related to strictfp, are we going to pick them 
> off piecemeal? It would be nice to have a holistic approach, it would be more 
> clear, and less duplicated code. For example, presumably the test at line 
> 2991 is common.
I do want to do isinf and other similar builtin but I would prefer to have a 
review of this to see if there's anything wrong with my approach before I work 
on other builtins. Once I do I'll factor things out as needed.



Comment at: clang/lib/CodeGen/CGBuiltin.cpp:3010
+Value *Sub =
+Builder.CreateSub(llvm::ConstantInt::get(IntTy, ExpMask), AbsV);
+V = Builder.CreateLShr(Sub, llvm::ConstantInt::get(IntTy, bitsize - 1));

mibintc wrote:
> compared to the comment above at line 3001, lhs and rhs are swapped in the sub
My bad, the comment needs to be fixed.



Comment at: clang/lib/CodeGen/CGBuiltin.cpp:3011
+Builder.CreateSub(llvm::ConstantInt::get(IntTy, ExpMask), AbsV);
+V = Builder.CreateLShr(Sub, llvm::ConstantInt::get(IntTy, bitsize - 1));
+if (bitsize > 32)

mibintc wrote:
> the comment at line 3001 doesn't show the lshr or the compare to zero
This logical right shift will move the sign bit to bit0 and set all other bits 
to 0. The result will be 1 (true) if sign bit is set (sub is negative) or 0 
(false) otherwise. That matches the comment. Would you like me to add a comment 
here to make it more explicit?



Comment at: clang/test/CodeGen/X86/strictfp_builtins.c:1
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
+// RUN: %clang_cc1 %s -emit-llvm -ffp-exception-behavior=maytrap -o - -triple 
x86_64-unknown-unknown | FileCheck %s

mibintc wrote:
> Why did you put long double into this new test case instead of putting it 
> with the float and double in strictfp_builtins?
long double is implemented differently for each target. x86 uses an 80 bit 
extended precision format, AFAIK AArch64 uses a 128bit IEEE format, etc.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95948/new/

https://reviews.llvm.org/D95948

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


[PATCH] D95948: Stop traping on sNaN in __builtin_isnan

2021-02-03 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre marked 2 inline comments as done.
thopre added inline comments.



Comment at: clang/lib/CodeGen/CGBuiltin.cpp:2995
+Builder.getDefaultConstrainedExcept() == fp::ebIgnore ||
+!Ty->isIEEE()) {
+  V = Builder.CreateFCmpUNO(V, V, "cmp");

I'm not too sure if that's enough to check isIEEE here. x86 extended precision 
behaves a bit different to IEEE single and double precision, esp. wrt. infinite 
and NaN. I've decided to ignore NaN values that are deprecated since the 8087.



Comment at: clang/lib/CodeGen/CGBuiltin.cpp:3001
+// NaN has all exp bits set and a non zero significand. Therefore:
+// isnan(V) == ((abs(V) & exp mask) - exp mask < 0)
+unsigned bitsize = Ty->getScalarSizeInBits();

mibintc wrote:
> Are you using a reference (e.g. existing implementation) for this rewrite, or 
> is this invention? If a reference can you please tell me what it is.  The 
> expression you have written here doesn't match the codegen below. I don't see 
> the comparison to zero. Can you provide full parenthesization--the compare to 
> zero is lower than subtract?
I've noticed glibc isnan implementation does not trigger a trap so I've looked 
at the assembly it generates for the float case. This is the generalized 
version for double and long double as well.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95948/new/

https://reviews.llvm.org/D95948

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


[PATCH] D95948: Stop traping on sNaN in __builtin_isnan

2021-02-03 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre updated this revision to Diff 321107.
thopre marked 2 inline comments as done.
thopre added a comment.

- Fix order of sub operands in comments and use fully parenthesized expression
- Explain how LShr is equivalent to < 0


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95948/new/

https://reviews.llvm.org/D95948

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/test/CodeGen/X86/strictfp_builtins.c
  clang/test/CodeGen/strictfp_builtins.c
  clang/test/CodeGen/strictfp_fpclassify.c
  llvm/include/llvm/ADT/APFloat.h
  llvm/include/llvm/IR/Type.h

Index: llvm/include/llvm/IR/Type.h
===
--- llvm/include/llvm/IR/Type.h
+++ llvm/include/llvm/IR/Type.h
@@ -308,6 +308,10 @@
   /// ppc long double), this method returns -1.
   int getFPMantissaWidth() const;
 
+  /// Return whether the type is IEEE compatible, as defined by the eponymous
+  /// method in APFloat.
+  bool isIEEE() const { return APFloat::getZero(getFltSemantics()).isIEEE(); }
+
   /// If this is a vector type, return the element type, otherwise return
   /// 'this'.
   inline Type *getScalarType() const {
Index: llvm/include/llvm/ADT/APFloat.h
===
--- llvm/include/llvm/ADT/APFloat.h
+++ llvm/include/llvm/ADT/APFloat.h
@@ -1218,6 +1218,7 @@
   bool isSmallest() const { APFLOAT_DISPATCH_ON_SEMANTICS(isSmallest()); }
   bool isLargest() const { APFLOAT_DISPATCH_ON_SEMANTICS(isLargest()); }
   bool isInteger() const { APFLOAT_DISPATCH_ON_SEMANTICS(isInteger()); }
+  bool isIEEE() const { return usesLayout(getSemantics()); }
 
   APFloat &operator=(const APFloat &RHS) = default;
   APFloat &operator=(APFloat &&RHS) = default;
Index: clang/test/CodeGen/strictfp_builtins.c
===
--- clang/test/CodeGen/strictfp_builtins.c
+++ clang/test/CodeGen/strictfp_builtins.c
@@ -92,17 +92,38 @@
   return;
 }
 
-// CHECK-LABEL: @test_isnan(
+// CHECK-LABEL: @test_float_isnan(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[F_ADDR:%.*]] = alloca float, align 4
+// CHECK-NEXT:store float [[F:%.*]], float* [[F_ADDR]], align 4
+// CHECK-NEXT:[[TMP0:%.*]] = load float, float* [[F_ADDR]], align 4
+// CHECK-NEXT:[[BITCAST:%.*]] = bitcast float [[TMP0]] to i32
+// CHECK-NEXT:[[ABS:%.*]] = and i32 [[BITCAST]], [[#%u,0x7FFF]]
+// CHECK-NEXT:[[TMP1:%.*]] = sub i32 [[#%u,0x7F80]], [[ABS]]
+// CHECK-NEXT:[[ISNAN:%.*]] = lshr i32 [[TMP1]], 31
+// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32 [[ISNAN]]) [[ATTR4]]
+// CHECK-NEXT:ret void
+//
+void test_float_isnan(float f) {
+  P(isnan, (f));
+
+  return;
+}
+
+// CHECK-LABEL: @test_double_isnan(
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:[[D_ADDR:%.*]] = alloca double, align 8
 // CHECK-NEXT:store double [[D:%.*]], double* [[D_ADDR]], align 8
 // CHECK-NEXT:[[TMP0:%.*]] = load double, double* [[D_ADDR]], align 8
-// CHECK-NEXT:[[CMP:%.*]] = call i1 @llvm.experimental.constrained.fcmp.f64(double [[TMP0]], double [[TMP0]], metadata !"uno", metadata !"fpexcept.strict") [[ATTR4]]
-// CHECK-NEXT:[[TMP1:%.*]] = zext i1 [[CMP]] to i32
-// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32 [[TMP1]]) [[ATTR4]]
+// CHECK-NEXT:[[BITCAST:%.*]] = bitcast double [[TMP0]] to i64
+// CHECK-NEXT:[[ABS:%.*]] = and i64 [[BITCAST]], [[#%u,0x7FFF]]
+// CHECK-NEXT:[[TMP1:%.*]] = sub i64 [[#%u,0x7FF0]], [[ABS]]
+// CHECK-NEXT:[[ISNAN:%.*]] = lshr i64 [[TMP1]], 63
+// CHECK-NEXT:[[RES:%.*]] = trunc i64 [[ISNAN]] to i32
+// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i32 [[RES]]) [[ATTR4]]
 // CHECK-NEXT:ret void
 //
-void test_isnan(double d) {
+void test_double_isnan(double d) {
   P(isnan, (d));
 
   return;
@@ -120,7 +141,7 @@
 // CHECK-NEXT:[[AND:%.*]] = and i1 [[ISEQ]], [[ISINF]]
 // CHECK-NEXT:[[AND1:%.*]] = and i1 [[AND]], [[ISNORMAL]]
 // CHECK-NEXT:[[TMP2:%.*]] = zext i1 [[AND1]] to i32
-// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i32 [[TMP2]]) [[ATTR4]]
+// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i32 [[TMP2]]) [[ATTR4]]
 // CHECK-NEXT:ret void
 //
 void test_isnormal(double d) {
Index: clang/test/CodeGen/X86/strictfp_builtins.c
===
--- /dev/null
+++ clang/test/CodeGen/X86/strictfp_builtins.c
@@ -0,0 +1,46 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
+// RUN: %clang_cc1 %s -emit-llvm -ffp-exception-behavior=maytrap -o - -triple x86_64-unknown-unknown | FileCheck %s
+
+// Test that the constrained intrinsics are pick

[PATCH] D95948: Stop traping on sNaN in __builtin_isnan

2021-02-04 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre updated this revision to Diff 321554.
thopre added a comment.

Add AArch64 testcase and rebase


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95948/new/

https://reviews.llvm.org/D95948

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/test/CodeGen/X86/strictfp_builtins.c
  clang/test/CodeGen/aarch64-strictfp-builtins.c
  clang/test/CodeGen/strictfp_builtins.c
  clang/test/CodeGen/strictfp_fpclassify.c
  llvm/include/llvm/ADT/APFloat.h
  llvm/include/llvm/IR/Type.h

Index: llvm/include/llvm/IR/Type.h
===
--- llvm/include/llvm/IR/Type.h
+++ llvm/include/llvm/IR/Type.h
@@ -308,6 +308,10 @@
   /// ppc long double), this method returns -1.
   int getFPMantissaWidth() const;
 
+  /// Return whether the type is IEEE compatible, as defined by the eponymous
+  /// method in APFloat.
+  bool isIEEE() const { return APFloat::getZero(getFltSemantics()).isIEEE(); }
+
   /// If this is a vector type, return the element type, otherwise return
   /// 'this'.
   inline Type *getScalarType() const {
Index: llvm/include/llvm/ADT/APFloat.h
===
--- llvm/include/llvm/ADT/APFloat.h
+++ llvm/include/llvm/ADT/APFloat.h
@@ -1218,6 +1218,7 @@
   bool isSmallest() const { APFLOAT_DISPATCH_ON_SEMANTICS(isSmallest()); }
   bool isLargest() const { APFLOAT_DISPATCH_ON_SEMANTICS(isLargest()); }
   bool isInteger() const { APFLOAT_DISPATCH_ON_SEMANTICS(isInteger()); }
+  bool isIEEE() const { return usesLayout(getSemantics()); }
 
   APFloat &operator=(const APFloat &RHS) = default;
   APFloat &operator=(APFloat &&RHS) = default;
Index: clang/test/CodeGen/strictfp_builtins.c
===
--- clang/test/CodeGen/strictfp_builtins.c
+++ clang/test/CodeGen/strictfp_builtins.c
@@ -92,17 +92,38 @@
   return;
 }
 
-// CHECK-LABEL: @test_isnan(
+// CHECK-LABEL: @test_float_isnan(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[F_ADDR:%.*]] = alloca float, align 4
+// CHECK-NEXT:store float [[F:%.*]], float* [[F_ADDR]], align 4
+// CHECK-NEXT:[[TMP0:%.*]] = load float, float* [[F_ADDR]], align 4
+// CHECK-NEXT:[[BITCAST:%.*]] = bitcast float [[TMP0]] to i32
+// CHECK-NEXT:[[ABS:%.*]] = and i32 [[BITCAST]], [[#%u,0x7FFF]]
+// CHECK-NEXT:[[TMP1:%.*]] = sub i32 [[#%u,0x7F80]], [[ABS]]
+// CHECK-NEXT:[[ISNAN:%.*]] = lshr i32 [[TMP1]], 31
+// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32 [[ISNAN]]) [[ATTR4]]
+// CHECK-NEXT:ret void
+//
+void test_float_isnan(float f) {
+  P(isnan, (f));
+
+  return;
+}
+
+// CHECK-LABEL: @test_double_isnan(
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:[[D_ADDR:%.*]] = alloca double, align 8
 // CHECK-NEXT:store double [[D:%.*]], double* [[D_ADDR]], align 8
 // CHECK-NEXT:[[TMP0:%.*]] = load double, double* [[D_ADDR]], align 8
-// CHECK-NEXT:[[CMP:%.*]] = call i1 @llvm.experimental.constrained.fcmp.f64(double [[TMP0]], double [[TMP0]], metadata !"uno", metadata !"fpexcept.strict") [[ATTR4]]
-// CHECK-NEXT:[[TMP1:%.*]] = zext i1 [[CMP]] to i32
-// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32 [[TMP1]]) [[ATTR4]]
+// CHECK-NEXT:[[BITCAST:%.*]] = bitcast double [[TMP0]] to i64
+// CHECK-NEXT:[[ABS:%.*]] = and i64 [[BITCAST]], [[#%u,0x7FFF]]
+// CHECK-NEXT:[[TMP1:%.*]] = sub i64 [[#%u,0x7FF0]], [[ABS]]
+// CHECK-NEXT:[[ISNAN:%.*]] = lshr i64 [[TMP1]], 63
+// CHECK-NEXT:[[RES:%.*]] = trunc i64 [[ISNAN]] to i32
+// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i32 [[RES]]) [[ATTR4]]
 // CHECK-NEXT:ret void
 //
-void test_isnan(double d) {
+void test_double_isnan(double d) {
   P(isnan, (d));
 
   return;
@@ -120,7 +141,7 @@
 // CHECK-NEXT:[[AND:%.*]] = and i1 [[ISEQ]], [[ISINF]]
 // CHECK-NEXT:[[AND1:%.*]] = and i1 [[AND]], [[ISNORMAL]]
 // CHECK-NEXT:[[TMP2:%.*]] = zext i1 [[AND1]] to i32
-// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i32 [[TMP2]]) [[ATTR4]]
+// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i32 [[TMP2]]) [[ATTR4]]
 // CHECK-NEXT:ret void
 //
 void test_isnormal(double d) {
Index: clang/test/CodeGen/aarch64-strictfp-builtins.c
===
--- /dev/null
+++ clang/test/CodeGen/aarch64-strictfp-builtins.c
@@ -0,0 +1,44 @@
+// RUN: %clang_cc1 %s -emit-llvm -ffp-exception-behavior=maytrap -fexperimental-strict-floating-point -o - -triple arm64-none-linux-gnu | FileCheck %s
+
+// Test that the constrained intrinsics are picking up the exception
+// metadata from the AST instead of the global default from the command line.
+
+#pragma floa

[PATCH] D95948: Stop traping on sNaN in __builtin_isnan

2021-02-04 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre added inline comments.



Comment at: clang/test/CodeGen/aarch64-strictfp-builtins.c:1
+// RUN: %clang_cc1 %s -emit-llvm -ffp-exception-behavior=maytrap 
-fexperimental-strict-floating-point -o - -triple arm64-none-linux-gnu | 
FileCheck %s
+

AArch64 is not StrictFP enabled so we need this option.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95948/new/

https://reviews.llvm.org/D95948

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


[PATCH] D95948: Stop traping on sNaN in __builtin_isnan

2021-02-05 Thread Thomas Preud'homme via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG00a62547da7e: Stop traping on sNaN in __builtin_isnan 
(authored by thopre).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95948/new/

https://reviews.llvm.org/D95948

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/test/CodeGen/X86/strictfp_builtins.c
  clang/test/CodeGen/aarch64-strictfp-builtins.c
  clang/test/CodeGen/strictfp_builtins.c
  clang/test/CodeGen/strictfp_fpclassify.c
  llvm/include/llvm/ADT/APFloat.h
  llvm/include/llvm/IR/Type.h

Index: llvm/include/llvm/IR/Type.h
===
--- llvm/include/llvm/IR/Type.h
+++ llvm/include/llvm/IR/Type.h
@@ -308,6 +308,10 @@
   /// ppc long double), this method returns -1.
   int getFPMantissaWidth() const;
 
+  /// Return whether the type is IEEE compatible, as defined by the eponymous
+  /// method in APFloat.
+  bool isIEEE() const { return APFloat::getZero(getFltSemantics()).isIEEE(); }
+
   /// If this is a vector type, return the element type, otherwise return
   /// 'this'.
   inline Type *getScalarType() const {
Index: llvm/include/llvm/ADT/APFloat.h
===
--- llvm/include/llvm/ADT/APFloat.h
+++ llvm/include/llvm/ADT/APFloat.h
@@ -1218,6 +1218,7 @@
   bool isSmallest() const { APFLOAT_DISPATCH_ON_SEMANTICS(isSmallest()); }
   bool isLargest() const { APFLOAT_DISPATCH_ON_SEMANTICS(isLargest()); }
   bool isInteger() const { APFLOAT_DISPATCH_ON_SEMANTICS(isInteger()); }
+  bool isIEEE() const { return usesLayout(getSemantics()); }
 
   APFloat &operator=(const APFloat &RHS) = default;
   APFloat &operator=(APFloat &&RHS) = default;
Index: clang/test/CodeGen/strictfp_builtins.c
===
--- clang/test/CodeGen/strictfp_builtins.c
+++ clang/test/CodeGen/strictfp_builtins.c
@@ -92,17 +92,38 @@
   return;
 }
 
-// CHECK-LABEL: @test_isnan(
+// CHECK-LABEL: @test_float_isnan(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[F_ADDR:%.*]] = alloca float, align 4
+// CHECK-NEXT:store float [[F:%.*]], float* [[F_ADDR]], align 4
+// CHECK-NEXT:[[TMP0:%.*]] = load float, float* [[F_ADDR]], align 4
+// CHECK-NEXT:[[BITCAST:%.*]] = bitcast float [[TMP0]] to i32
+// CHECK-NEXT:[[ABS:%.*]] = and i32 [[BITCAST]], [[#%u,0x7FFF]]
+// CHECK-NEXT:[[TMP1:%.*]] = sub i32 [[#%u,0x7F80]], [[ABS]]
+// CHECK-NEXT:[[ISNAN:%.*]] = lshr i32 [[TMP1]], 31
+// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32 [[ISNAN]]) [[ATTR4]]
+// CHECK-NEXT:ret void
+//
+void test_float_isnan(float f) {
+  P(isnan, (f));
+
+  return;
+}
+
+// CHECK-LABEL: @test_double_isnan(
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:[[D_ADDR:%.*]] = alloca double, align 8
 // CHECK-NEXT:store double [[D:%.*]], double* [[D_ADDR]], align 8
 // CHECK-NEXT:[[TMP0:%.*]] = load double, double* [[D_ADDR]], align 8
-// CHECK-NEXT:[[CMP:%.*]] = call i1 @llvm.experimental.constrained.fcmp.f64(double [[TMP0]], double [[TMP0]], metadata !"uno", metadata !"fpexcept.strict") [[ATTR4]]
-// CHECK-NEXT:[[TMP1:%.*]] = zext i1 [[CMP]] to i32
-// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32 [[TMP1]]) [[ATTR4]]
+// CHECK-NEXT:[[BITCAST:%.*]] = bitcast double [[TMP0]] to i64
+// CHECK-NEXT:[[ABS:%.*]] = and i64 [[BITCAST]], [[#%u,0x7FFF]]
+// CHECK-NEXT:[[TMP1:%.*]] = sub i64 [[#%u,0x7FF0]], [[ABS]]
+// CHECK-NEXT:[[ISNAN:%.*]] = lshr i64 [[TMP1]], 63
+// CHECK-NEXT:[[RES:%.*]] = trunc i64 [[ISNAN]] to i32
+// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i32 [[RES]]) [[ATTR4]]
 // CHECK-NEXT:ret void
 //
-void test_isnan(double d) {
+void test_double_isnan(double d) {
   P(isnan, (d));
 
   return;
@@ -120,7 +141,7 @@
 // CHECK-NEXT:[[AND:%.*]] = and i1 [[ISEQ]], [[ISINF]]
 // CHECK-NEXT:[[AND1:%.*]] = and i1 [[AND]], [[ISNORMAL]]
 // CHECK-NEXT:[[TMP2:%.*]] = zext i1 [[AND1]] to i32
-// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i32 [[TMP2]]) [[ATTR4]]
+// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i32 [[TMP2]]) [[ATTR4]]
 // CHECK-NEXT:ret void
 //
 void test_isnormal(double d) {
Index: clang/test/CodeGen/aarch64-strictfp-builtins.c
===
--- /dev/null
+++ clang/test/CodeGen/aarch64-strictfp-builtins.c
@@ -0,0 +1,44 @@
+// RUN: %clang_cc1 %s -emit-llvm -ffp-exception-behavior=maytrap -fexperimental-strict-floating-point -o - -triple arm64-none-linux-gnu | FileCheck %s
+
+// Test that the constrained intrinsics 

[PATCH] D109234: [PGO] Change ThinLTO test for targets with loop unrolling disabled

2021-09-16 Thread Thomas Preud'homme via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG005fc11ebdd6: [PGO] Change ThinLTO test for targets with 
loop unrolling disabled (authored by Sherwin da Cruz 
<59867245+sherwin...@users.noreply.github.com>, committed by thopre).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109234/new/

https://reviews.llvm.org/D109234

Files:
  clang/test/CodeGen/pgo-sample-thinlto-summary.c


Index: clang/test/CodeGen/pgo-sample-thinlto-summary.c
===
--- clang/test/CodeGen/pgo-sample-thinlto-summary.c
+++ clang/test/CodeGen/pgo-sample-thinlto-summary.c
@@ -1,9 +1,7 @@
-// RUN: %clang_cc1 -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
- 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
-// RUN: %clang_cc1 -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
-// RUN: %clang_cc1 -O2 -fexperimental-new-pass-manager 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
- 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
-// RUN: %clang_cc1 -O2 -fexperimental-new-pass-manager 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
-// Checks if hot call is inlined by normal compile, but not inlined by
-// thinlto compile.
+// RUN: %clang_cc1 -mllvm -debug-pass=Structure -O2 
-fno-experimental-new-pass-manager 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
- 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO-OLDPM
+// RUN: %clang_cc1 -mllvm -debug-pass=Structure -O2 
-fno-experimental-new-pass-manager 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO-OLDPM
+// RUN: %clang_cc1 -fdebug-pass-manager -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
- 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
+// RUN: %clang_cc1 -fdebug-pass-manager -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
 
 int baz(int);
 int g;
@@ -13,6 +11,27 @@
 g += baz(i);
 }
 
+// Checks that loop unroll and icp are invoked by normal compile, but not 
thinlto compile.
+
+// SAMPLEPGO:   Running pass: PGOIndirectCallPromotion on [module]
+// SAMPLEPGO:   Running pass: LoopUnrollPass on bar
+
+// SAMPLEPGO-OLDPM: PGOIndirectCallPromotion
+// SAMPLEPGO-OLDPM: Unroll loops
+// SAMPLEPGO-OLDPM: Unroll loops
+
+// THINLTO-NOT: Running pass: PGOIndirectCallPromotion on [module]
+// THINLTO-NOT: Running pass: LoopUnrollPass on bar
+
+// THINLTO-OLDPM-NOT:   PGOIndirectCallPromotion
+// The first Unroll loop pass is the createSimpleLoopUnrollPass that unrolls 
and peels
+// loops with small constant trip counts. The second one is skipped by ThinLTO.
+// THINLTO-OLDPM:   Unroll loops
+// THINLTO-OLDPM-NOT:   Unroll loops
+
+
+// Checks if hot call is inlined by normal compile, but not inlined by
+// thinlto compile.
 // SAMPLEPGO-LABEL: define {{(dso_local )?}}void @bar
 // THINLTO-LABEL: define {{(dso_local )?}}void @bar
 // SAMPLEPGO-NOT: call{{.*}}foo
@@ -20,27 +39,4 @@
 void bar(int n) {
   for (int i = 0; i < n; i++)
 foo(i);
-}
-
-// Checks if loop unroll is invoked by normal compile, but not thinlto compile.
-// SAMPLEPGO-LABEL: define {{(dso_local )?}}void @unroll
-// THINLTO-LABEL: define {{(dso_local )?}}void @unroll
-// SAMPLEPGO: call{{.*}}baz
-// SAMPLEPGO: call{{.*}}baz
-// THINLTO: call{{.*}}baz
-// THINLTO-NOT: call{{.*}}baz
-void unroll() {
-  for (int i = 0; i < 2; i++)
-baz(i);
-}
-
-// Checks that icp is not invoked for ThinLTO, but invoked for normal 
samplepgo.
-// SAMPLEPGO-LABEL: define {{(dso_local )?}}void @icp
-// THINLTO-LABEL: define {{(dso_local )?}}void @icp
-// SAMPLEPGO: if.true.direct_targ
-// FIXME: the following condition needs to be reversed once
-//LTOPreLinkDefaultPipeline is customized.
-// THINLTO-NOT: if.true.direct_targ
-void icp(void (*p)()) {
-  p();
-}
+}
\ No newline at end of file


Index: clang/test/CodeGen/pgo-sample-thinlto-summary.c
===
--- clang/test/CodeGen/pgo-sample-thinlto-summary.c
+++ clang/test/CodeGen/pgo-sample-thinlto-summary.c
@@ -1,9 +1,7 @@
-// RUN: %clang_cc1 -O2 -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
-// RUN: %clang_cc1 -O2 -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
-// RUN: %clang_cc1 -O2 -fexperimental-new-pass-manager -fprofile-sample-use=%S/Input

[PATCH] D109956: Fix CodeGen/pgo-sample-thinlto-summary.c with old PM

2021-09-17 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre created this revision.
thopre added reviewers: gregmiller, tejohnson, davide, danielcdh.
Herald added subscribers: ormris, wenlei, steven_wu, hiraditya, inglorion.
thopre requested review of this revision.
Herald added a project: clang.

Re-add -fexperimental-new-pass-manager to
Clang::CodeGen/pgo-sample-thinlto-summary.c for the test to work on
builds that still default to the old pass manager.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D109956

Files:
  clang/test/CodeGen/pgo-sample-thinlto-summary.c


Index: clang/test/CodeGen/pgo-sample-thinlto-summary.c
===
--- clang/test/CodeGen/pgo-sample-thinlto-summary.c
+++ clang/test/CodeGen/pgo-sample-thinlto-summary.c
@@ -1,7 +1,7 @@
 // RUN: %clang_cc1 -mllvm -debug-pass=Structure -O2 
-fno-experimental-new-pass-manager 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
- 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO-OLDPM
 // RUN: %clang_cc1 -mllvm -debug-pass=Structure -O2 
-fno-experimental-new-pass-manager 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO-OLDPM
-// RUN: %clang_cc1 -fdebug-pass-manager -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
- 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
-// RUN: %clang_cc1 -fdebug-pass-manager -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
+// RUN: %clang_cc1 -fexperimental-new-pass-manager -fdebug-pass-manager -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
- 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
+// RUN: %clang_cc1 -fexperimental-new-pass-manager -fdebug-pass-manager -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
 
 int baz(int);
 int g;
@@ -39,4 +39,4 @@
 void bar(int n) {
   for (int i = 0; i < n; i++)
 foo(i);
-}
\ No newline at end of file
+}


Index: clang/test/CodeGen/pgo-sample-thinlto-summary.c
===
--- clang/test/CodeGen/pgo-sample-thinlto-summary.c
+++ clang/test/CodeGen/pgo-sample-thinlto-summary.c
@@ -1,7 +1,7 @@
 // RUN: %clang_cc1 -mllvm -debug-pass=Structure -O2 -fno-experimental-new-pass-manager -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO-OLDPM
 // RUN: %clang_cc1 -mllvm -debug-pass=Structure -O2 -fno-experimental-new-pass-manager -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO-OLDPM
-// RUN: %clang_cc1 -fdebug-pass-manager -O2 -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
-// RUN: %clang_cc1 -fdebug-pass-manager -O2 -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
+// RUN: %clang_cc1 -fexperimental-new-pass-manager -fdebug-pass-manager -O2 -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
+// RUN: %clang_cc1 -fexperimental-new-pass-manager -fdebug-pass-manager -O2 -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
 
 int baz(int);
 int g;
@@ -39,4 +39,4 @@
 void bar(int n) {
   for (int i = 0; i < n; i++)
 foo(i);
-}
\ No newline at end of file
+}
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D109234: [PGO] Change ThinLTO test for targets with loop unrolling disabled

2021-09-17 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre added a comment.

In D109234#3004253 , @gregmiller 
wrote:

> Hello, 
> We are maintaining a downstream version of the monorepo based on the LLVM 
> main branch. We have not transitioned to the new PM yet. In a recent attempt 
> to merge the latest upstream commits into our monorepo we came across the 
> following test failures after your commit.

Sorry about that, it's my fault for asking Sherwin to remove the 
-fexperimental-new-pass-manager flag. I've created 
https://reviews.llvm.org/D109956


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109234/new/

https://reviews.llvm.org/D109234

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


[PATCH] D109956: Fix CodeGen/pgo-sample-thinlto-summary.c with old PM

2021-09-17 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre updated this revision to Diff 373214.
thopre added a comment.

Remove old PM tests


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109956/new/

https://reviews.llvm.org/D109956

Files:
  clang/test/CodeGen/pgo-sample-thinlto-summary.c


Index: clang/test/CodeGen/pgo-sample-thinlto-summary.c
===
--- clang/test/CodeGen/pgo-sample-thinlto-summary.c
+++ clang/test/CodeGen/pgo-sample-thinlto-summary.c
@@ -1,7 +1,5 @@
-// RUN: %clang_cc1 -mllvm -debug-pass=Structure -O2 
-fno-experimental-new-pass-manager 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
- 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO-OLDPM
-// RUN: %clang_cc1 -mllvm -debug-pass=Structure -O2 
-fno-experimental-new-pass-manager 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO-OLDPM
-// RUN: %clang_cc1 -fdebug-pass-manager -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
- 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
-// RUN: %clang_cc1 -fdebug-pass-manager -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
+// RUN: %clang_cc1 -fexperimental-new-pass-manager -fdebug-pass-manager -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
- 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
+// RUN: %clang_cc1 -fexperimental-new-pass-manager -fdebug-pass-manager -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
 
 int baz(int);
 int g;
@@ -39,4 +37,4 @@
 void bar(int n) {
   for (int i = 0; i < n; i++)
 foo(i);
-}
\ No newline at end of file
+}


Index: clang/test/CodeGen/pgo-sample-thinlto-summary.c
===
--- clang/test/CodeGen/pgo-sample-thinlto-summary.c
+++ clang/test/CodeGen/pgo-sample-thinlto-summary.c
@@ -1,7 +1,5 @@
-// RUN: %clang_cc1 -mllvm -debug-pass=Structure -O2 -fno-experimental-new-pass-manager -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO-OLDPM
-// RUN: %clang_cc1 -mllvm -debug-pass=Structure -O2 -fno-experimental-new-pass-manager -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO-OLDPM
-// RUN: %clang_cc1 -fdebug-pass-manager -O2 -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
-// RUN: %clang_cc1 -fdebug-pass-manager -O2 -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
+// RUN: %clang_cc1 -fexperimental-new-pass-manager -fdebug-pass-manager -O2 -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
+// RUN: %clang_cc1 -fexperimental-new-pass-manager -fdebug-pass-manager -O2 -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
 
 int baz(int);
 int g;
@@ -39,4 +37,4 @@
 void bar(int n) {
   for (int i = 0; i < n; i++)
 foo(i);
-}
\ No newline at end of file
+}
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D109956: Fix CodeGen/pgo-sample-thinlto-summary.c with old PM

2021-09-17 Thread Thomas Preud'homme via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG8a7a28075b7f: Fix CodeGen/pgo-sample-thinlto-summary.c with 
old PM (authored by thopre).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109956/new/

https://reviews.llvm.org/D109956

Files:
  clang/test/CodeGen/pgo-sample-thinlto-summary.c


Index: clang/test/CodeGen/pgo-sample-thinlto-summary.c
===
--- clang/test/CodeGen/pgo-sample-thinlto-summary.c
+++ clang/test/CodeGen/pgo-sample-thinlto-summary.c
@@ -1,7 +1,5 @@
-// RUN: %clang_cc1 -mllvm -debug-pass=Structure -O2 
-fno-experimental-new-pass-manager 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
- 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO-OLDPM
-// RUN: %clang_cc1 -mllvm -debug-pass=Structure -O2 
-fno-experimental-new-pass-manager 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO-OLDPM
-// RUN: %clang_cc1 -fdebug-pass-manager -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
- 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
-// RUN: %clang_cc1 -fdebug-pass-manager -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
+// RUN: %clang_cc1 -fexperimental-new-pass-manager -fdebug-pass-manager -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
- 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
+// RUN: %clang_cc1 -fexperimental-new-pass-manager -fdebug-pass-manager -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
 
 int baz(int);
 int g;
@@ -39,4 +37,4 @@
 void bar(int n) {
   for (int i = 0; i < n; i++)
 foo(i);
-}
\ No newline at end of file
+}


Index: clang/test/CodeGen/pgo-sample-thinlto-summary.c
===
--- clang/test/CodeGen/pgo-sample-thinlto-summary.c
+++ clang/test/CodeGen/pgo-sample-thinlto-summary.c
@@ -1,7 +1,5 @@
-// RUN: %clang_cc1 -mllvm -debug-pass=Structure -O2 -fno-experimental-new-pass-manager -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO-OLDPM
-// RUN: %clang_cc1 -mllvm -debug-pass=Structure -O2 -fno-experimental-new-pass-manager -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO-OLDPM
-// RUN: %clang_cc1 -fdebug-pass-manager -O2 -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
-// RUN: %clang_cc1 -fdebug-pass-manager -O2 -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
+// RUN: %clang_cc1 -fexperimental-new-pass-manager -fdebug-pass-manager -O2 -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=SAMPLEPGO
+// RUN: %clang_cc1 -fexperimental-new-pass-manager -fdebug-pass-manager -O2 -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -flto=thin -o - 2>&1 | FileCheck %s -check-prefix=THINLTO
 
 int baz(int);
 int g;
@@ -39,4 +37,4 @@
 void bar(int n) {
   for (int i = 0; i < n; i++)
 foo(i);
-}
\ No newline at end of file
+}
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D96568: [CFE, SystemZ] Emit s390.tdc instrincic for __builtin_isnan in Constrained FP mode.

2021-02-17 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre added a comment.

In D96568#2567145 , @jonpa wrote:

> In D96568#2559476 , @thopre wrote:
>
>> In D96568#2559475 , @uweigand wrote:
>>
>>> In D96568#2559336 , @thopre wrote:
>>>
 That's interesting. I presume that can be used to implement isinf as well? 
 Perhaps better call the hook fpclassify or similar?
>>>
>>> Hmm, the instruction doesn't really implement fpclassify in itself, it is 
>>> more like a combined check for fpclassify() == .   
>>> Specifically, the TEST DATA CLASS instruction takes an immediate operand 
>>> that represents a bit mask, which each bit standing for one type of 
>>> floating-point value (zero, normal, subnormal, infinity, QNaN, SNaN -- each 
>>> in positive and negative versions).  The instruction sets the condition 
>>> code depending on whether the input FP number is in one of the classes 
>>> selected by the bit mask, or not.
>>>
>>> This is why Jonas' patch uses a bit mask of 0x0F -- this has the bits for 
>>> the four types of NaN set (pos/neg QNaN/SNan).   The instruction could 
>>> indeed also be used to implement an isinf check (bit mask 0x30) or many 
>>> other checks.   We actually have a SystemZ back-end pass that tries to 
>>> multiple combine FP checks into a single TEST DATA CLASS instruction.
>>>
>>> However, the instruction does not directly implement the fpclassify 
>>> semantics.  To implement fpclassify, you'd still have to use multiple 
>>> invocations of the instruction with different flags to determine the 
>>> fpclassify output value.
>>
>> I see. I'm not sure whether it's better to have several target hooks or a 
>> single one like testFPKind that would take a flag saying what do we want to 
>> test (NaN, Inf, etc.).
>
> Personally I think testFPKind should work well - it gives a single target 
> hook for related purposes which should be more readable, and it is also 
> natural for SystemZ since we will be using the same (Test Data Class) 
> instruction for differnet checks only with different flag bits... Any one 
> else has an opinion? Should I go ahead and change the patch to this end?

Sounds good to me. Hopefully I'll get round to __builtin_isinf soon and a 
single hook will make the patch slightly smaller.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D96568/new/

https://reviews.llvm.org/D96568

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


[PATCH] D96568: [CFE, SystemZ] Emit s390.tdc instrincic for __builtin_isnan in Constrained FP mode.

2021-02-17 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre added a comment.

In D96568#2569296 , @jonpa wrote:

>> Sounds good to me. Hopefully I'll get round to __builtin_isinf soon and a 
>> single hook will make the patch slightly smaller.
>
> Patch updated to call the new hook testFPKind() and make it take a BuiltinID 
> as argument (that seems to work at least for the moment - maybe an enum type 
> will become necessary at some point per your suggestion..?)
>
> I am not sure if this is "only" or "typically" used in constrained FP mode, 
> or if the mode should be independent of calling this hook. The patch as it is 
> asserts that it is called for an FP type but leaves it to the target to 
> decide based on the FP mode, where SystemZ opts out unless it is constrained 
> (which I think is what is wanted...).

LGTM, we can adapt the hook later if needed. I do not know whether allowing the 
hook to be used for non constrained FP will prove useful but it is easy enough 
to ignore it for non FP so why not. Thanks for changing that!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D96568/new/

https://reviews.llvm.org/D96568

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


[PATCH] D97125: Stop traping on sNaN in __builtin_isinf

2021-02-20 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre created this revision.
thopre added reviewers: kpn, efriedma, mibintc, sepavloff, rjmccall.
Herald added a subscriber: pengfei.
thopre requested review of this revision.
Herald added a project: clang.

__builtin_isinf currently generates a floating-point compare operation
which triggers a trap when faced with a signaling NaN in StrictFP mode.
This commit uses integer operations instead to not generate any trap in
such a case.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D97125

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/test/CodeGen/X86/strictfp_builtins.c
  clang/test/CodeGen/aarch64-strictfp-builtins.c
  clang/test/CodeGen/strictfp_builtins.c

Index: clang/test/CodeGen/strictfp_builtins.c
===
--- clang/test/CodeGen/strictfp_builtins.c
+++ clang/test/CodeGen/strictfp_builtins.c
@@ -55,18 +55,37 @@
   return;
 }
 
-// CHECK-LABEL: @test_isinf(
+// CHECK-LABEL: @test_float_isinf(
 // CHECK-NEXT:  entry:
-// CHECK-NEXT:[[D_ADDR:%.*]] = alloca double, align 8
-// CHECK-NEXT:store double [[D:%.*]], double* [[D_ADDR]], align 8
-// CHECK-NEXT:[[TMP0:%.*]] = load double, double* [[D_ADDR]], align 8
-// CHECK-NEXT:[[TMP1:%.*]] = call double @llvm.fabs.f64(double [[TMP0]]) [[ATTR5]]
-// CHECK-NEXT:[[CMPINF:%.*]] = call i1 @llvm.experimental.constrained.fcmp.f64(double [[TMP1]], double 0x7FF0, metadata !"oeq", metadata !"fpexcept.strict") [[ATTR4]]
-// CHECK-NEXT:[[TMP2:%.*]] = zext i1 [[CMPINF]] to i32
-// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 [[TMP2]]) [[ATTR4]]
+// CHECK-NEXT:[[LD_ADDR:%.*]] = alloca float, align 4
+// CHECK-NEXT:store float [[F:%.*]], float* [[LD_ADDR]], align 4
+// CHECK-NEXT:[[TMP0:%.*]] = load float, float* [[LD_ADDR]], align 4
+// CHECK-NEXT:[[BITCAST:%.*]] = bitcast float [[TMP0]] to i32
+// CHECK-NEXT:[[SHL1:%.*]] = shl i32 [[BITCAST]], 1
+// CHECK-NEXT:[[CMP:%.*]] = icmp eq i32 [[SHL1]], -16777216
+// CHECK-NEXT:[[RES:%.*]] = zext i1 [[CMP]] to i32
+// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 [[RES]]) [[ATTR4]]
+// CHECK-NEXT:ret void
+//
+void test_float_isinf(float f) {
+  P(isinf, (f));
+
+  return;
+}
+
+// CHECK-LABEL: @test_double_isinf(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[LD_ADDR:%.*]] = alloca double, align 8
+// CHECK-NEXT:store double [[D:%.*]], double* [[LD_ADDR]], align 8
+// CHECK-NEXT:[[TMP0:%.*]] = load double, double* [[LD_ADDR]], align 8
+// CHECK-NEXT:[[BITCAST:%.*]] = bitcast double [[TMP0]] to i64
+// CHECK-NEXT:[[SHL1:%.*]] = shl i64 [[BITCAST]], 1
+// CHECK-NEXT:[[CMP:%.*]] = icmp eq i64 [[SHL1]], -9007199254740992
+// CHECK-NEXT:[[RES:%.*]] = zext i1 [[CMP]] to i32
+// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 [[RES]]) [[ATTR4]]
 // CHECK-NEXT:ret void
 //
-void test_isinf(double d) {
+void test_double_isinf(double d) {
   P(isinf, (d));
 
   return;
@@ -83,7 +102,7 @@
 // CHECK-NEXT:[[TMP3:%.*]] = icmp slt i64 [[TMP2]], 0
 // CHECK-NEXT:[[TMP4:%.*]] = select i1 [[TMP3]], i32 -1, i32 1
 // CHECK-NEXT:[[TMP5:%.*]] = select i1 [[ISINF]], i32 [[TMP4]], i32 0
-// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 [[TMP5]]) [[ATTR4]]
+// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 [[TMP5]]) [[ATTR4]]
 // CHECK-NEXT:ret void
 //
 void test_isinf_sign(double d) {
@@ -101,7 +120,7 @@
 // CHECK-NEXT:[[ABS:%.*]] = and i32 [[BITCAST]], [[#%u,0x7FFF]]
 // CHECK-NEXT:[[TMP1:%.*]] = sub i32 [[#%u,0x7F80]], [[ABS]]
 // CHECK-NEXT:[[ISNAN:%.*]] = lshr i32 [[TMP1]], 31
-// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32 [[ISNAN]]) [[ATTR4]]
+// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i32 [[ISNAN]]) [[ATTR4]]
 // CHECK-NEXT:ret void
 //
 void test_float_isnan(float f) {
@@ -120,7 +139,7 @@
 // CHECK-NEXT:[[TMP1:%.*]] = sub i64 [[#%u,0x7FF0]], [[ABS]]
 // CHECK-NEXT:[[ISNAN:%.*]] = lshr i64 [[TMP1]], 63
 // CHECK-NEXT:[[RES:%.*]] = trunc i64 [[ISNAN]] to i32
-// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i32 [[RES]]) [[ATTR4]]
+// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i32 [[RES]]) [[ATTR4]]
 // CHECK-NEXT:ret void
 //
 void test_double_isnan(double d) {
@@ -141,7 +160,7 @@
 // CHECK-NEXT:[[AND:%.*]] = and i1 [[ISEQ]], [[ISINF]]
 // CHECK-NEXT:[[AND1:%.*]] = and i1 [[AND]], [[ISNORMAL]]
 // CHECK-NEXT:[[TMP2:%.*]] = zext i1 [[AND1]] to i32
-// CHECK-NEXT:call void @p(i8* 

[PATCH] D97125: Stop traping on sNaN in __builtin_isinf

2021-02-22 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre added a comment.

I think we should also add tests for half


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97125/new/

https://reviews.llvm.org/D97125

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


[PATCH] D97125: Stop traping on sNaN in __builtin_isinf

2021-02-23 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre updated this revision to Diff 325718.
thopre added a comment.

- Add half testcase
- Fixup existing testcase


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97125/new/

https://reviews.llvm.org/D97125

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/test/CodeGen/X86/strictfp_builtins.c
  clang/test/CodeGen/aarch64-strictfp-builtins.c
  clang/test/CodeGen/builtin_float_strictfp.c
  clang/test/CodeGen/strictfp_builtins.c

Index: clang/test/CodeGen/strictfp_builtins.c
===
--- clang/test/CodeGen/strictfp_builtins.c
+++ clang/test/CodeGen/strictfp_builtins.c
@@ -1,5 +1,5 @@
 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
-// RUN: %clang_cc1 %s -emit-llvm -ffp-exception-behavior=maytrap -o - -triple x86_64-unknown-unknown | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -ffp-exception-behavior=maytrap -fallow-half-arguments-and-returns -o - -triple x86_64-unknown-unknown | FileCheck %s
 
 // Test that the constrained intrinsics are picking up the exception
 // metadata from the AST instead of the global default from the command line.
@@ -55,18 +55,55 @@
   return;
 }
 
-// CHECK-LABEL: @test_isinf(
+// CHECK-LABEL: @test_fp16_isinf(
 // CHECK-NEXT:  entry:
-// CHECK-NEXT:[[D_ADDR:%.*]] = alloca double, align 8
-// CHECK-NEXT:store double [[D:%.*]], double* [[D_ADDR]], align 8
-// CHECK-NEXT:[[TMP0:%.*]] = load double, double* [[D_ADDR]], align 8
-// CHECK-NEXT:[[TMP1:%.*]] = call double @llvm.fabs.f64(double [[TMP0]]) [[ATTR5]]
-// CHECK-NEXT:[[CMPINF:%.*]] = call i1 @llvm.experimental.constrained.fcmp.f64(double [[TMP1]], double 0x7FF0, metadata !"oeq", metadata !"fpexcept.strict") [[ATTR4]]
-// CHECK-NEXT:[[TMP2:%.*]] = zext i1 [[CMPINF]] to i32
-// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 [[TMP2]]) [[ATTR4]]
+// CHECK-NEXT:[[LD_ADDR:%.*]] = alloca half, align 2
+// CHECK-NEXT:store half [[H:%.*]], half* [[LD_ADDR]], align 2
+// CHECK-NEXT:[[TMP0:%.*]] = load half, half* [[LD_ADDR]], align 2
+// CHECK-NEXT:[[BITCAST:%.*]] = bitcast half [[TMP0]] to i16
+// CHECK-NEXT:[[SHL1:%.*]] = shl i16 [[BITCAST]], 1
+// CHECK-NEXT:[[CMP:%.*]] = icmp eq i16 [[SHL1]], -2048
+// CHECK-NEXT:[[RES:%.*]] = zext i1 [[CMP]] to i32
+// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.[[#STRID:2]], i64 0, i64 0), i32 [[RES]]) [[ATTR4]]
+// CHECK-NEXT:ret void
+//
+void test_fp16_isinf(__fp16 h) {
+  P(isinf, (h));
+
+  return;
+}
+
+// CHECK-LABEL: @test_float_isinf(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[LD_ADDR:%.*]] = alloca float, align 4
+// CHECK-NEXT:store float [[F:%.*]], float* [[LD_ADDR]], align 4
+// CHECK-NEXT:[[TMP0:%.*]] = load float, float* [[LD_ADDR]], align 4
+// CHECK-NEXT:[[BITCAST:%.*]] = bitcast float [[TMP0]] to i32
+// CHECK-NEXT:[[SHL1:%.*]] = shl i32 [[BITCAST]], 1
+// CHECK-NEXT:[[CMP:%.*]] = icmp eq i32 [[SHL1]], -16777216
+// CHECK-NEXT:[[RES:%.*]] = zext i1 [[CMP]] to i32
+// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.[[#STRID:STRID+1]], i64 0, i64 0), i32 [[RES]]) [[ATTR4]]
+// CHECK-NEXT:ret void
+//
+void test_float_isinf(float f) {
+  P(isinf, (f));
+
+  return;
+}
+
+// CHECK-LABEL: @test_double_isinf(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[LD_ADDR:%.*]] = alloca double, align 8
+// CHECK-NEXT:store double [[D:%.*]], double* [[LD_ADDR]], align 8
+// CHECK-NEXT:[[TMP0:%.*]] = load double, double* [[LD_ADDR]], align 8
+// CHECK-NEXT:[[BITCAST:%.*]] = bitcast double [[TMP0]] to i64
+// CHECK-NEXT:[[SHL1:%.*]] = shl i64 [[BITCAST]], 1
+// CHECK-NEXT:[[CMP:%.*]] = icmp eq i64 [[SHL1]], -9007199254740992
+// CHECK-NEXT:[[RES:%.*]] = zext i1 [[CMP]] to i32
+// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.[[#STRID:STRID+1]], i64 0, i64 0), i32 [[RES]]) [[ATTR4]]
 // CHECK-NEXT:ret void
 //
-void test_isinf(double d) {
+void test_double_isinf(double d) {
   P(isinf, (d));
 
   return;
@@ -83,7 +120,7 @@
 // CHECK-NEXT:[[TMP3:%.*]] = icmp slt i64 [[TMP2]], 0
 // CHECK-NEXT:[[TMP4:%.*]] = select i1 [[TMP3]], i32 -1, i32 1
 // CHECK-NEXT:[[TMP5:%.*]] = select i1 [[ISINF]], i32 [[TMP4]], i32 0
-// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 [[TMP5]]) [[ATTR4]]
+// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.[[#STRID:STRID+1]], i64 0, i64 0), i32 [[TMP5]]) [[ATTR4]]
 // CHECK-NEXT:ret void
 //
 void test_isinf_sign(double d) {
@@ -101,7 +138,7 @@
 // CHECK-NEXT:[[ABS:%.*]] = and i32 [[BITCAST]], [[#%u,0x7FFF]]
 // CHECK-NEXT:[[TMP1:%.*]] = sub i32 [[#%u,0x7F80]], [[ABS]]
 // CHECK-NEXT:[[ISNAN:%.*]] = lshr i32 [[TMP1]], 31
-// 

[PATCH] D97125: Stop traping on sNaN in __builtin_isinf

2021-02-23 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre added inline comments.



Comment at: clang/test/CodeGen/builtin_float_strictfp.c:21
+  // NOFP16-NEXT:  [[IHALF:%.*]]  = load i16, i16* [[LDADDR]], align 2
+  // NOFP16-NEXT:  [[CONV:%.*]]   = call float @llvm.convert.from.fp16.f32(i16 
[[IHALF]])
+  // NOFP16-NEXT:  [[IFLOAT:%.*]] = bitcast float [[CONV]] to i32

Am I right to think that clang should not use llvm.convert here since it's a 
constrained operation? Any idea why that happens?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97125/new/

https://reviews.llvm.org/D97125

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


[PATCH] D104099: [NewPM] Remove SpeculateAroundPHIs pass from pipeline

2021-06-11 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre added a comment.

+1 for this change but being a downstream target only I prefer to let someone 
else approve this.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104099/new/

https://reviews.llvm.org/D104099

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


[PATCH] D96568: [CFE, SystemZ] Emit s390.tdc instrincic for __builtin_isnan in Constrained FP mode.

2021-06-22 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre added a comment.

In D96568#2569296 , @jonpa wrote:

>> Sounds good to me. Hopefully I'll get round to __builtin_isinf soon and a 
>> single hook will make the patch slightly smaller.
>
> Patch updated to call the new hook testFPKind() and make it take a BuiltinID 
> as argument (that seems to work at least for the moment - maybe an enum type 
> will become necessary at some point per your suggestion..?)
>
> I am not sure if this is "only" or "typically" used in constrained FP mode, 
> or if the mode should be independent of calling this hook. The patch as it is 
> asserts that it is called for an FP type but leaves it to the target to 
> decide based on the FP mode, where SystemZ opts out unless it is constrained 
> (which I think is what is wanted...).

I forgot to ask at the time, why do you restrict this code to the constrained 
case? Presumably it's a lot faster than fabs+cmp and should be faster in all 
cases?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D96568/new/

https://reviews.llvm.org/D96568

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


[PATCH] D104854: Introduce intrinsic llvm.isnan

2021-06-24 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre added a comment.

Are you planning to do this for the other FP test builtin (isinf, isfinite, 
isinf_sign, isnormal)?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104854/new/

https://reviews.llvm.org/D104854

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


[PATCH] D107633: Set supported target for asan-use-callbacks test

2021-08-06 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre created this revision.
thopre added reviewers: kstoimenov, vitalybuka.
Herald added subscribers: pengfei, krytarowski.
thopre requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Explicitely set x86_64-linux-gnu as a target for asan-use-callbacks
clang test since some target do not support -fsanitize=address (e.g.
i386-pc-openbsd). Also remove redundant -fsanitize=address and move
-emit-llvm right after -S.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D107633

Files:
  clang/test/CodeGen/asan-use-callbacks.cpp


Index: clang/test/CodeGen/asan-use-callbacks.cpp
===
--- clang/test/CodeGen/asan-use-callbacks.cpp
+++ clang/test/CodeGen/asan-use-callbacks.cpp
@@ -1,7 +1,10 @@
-// RUN: %clang -S -fsanitize=address -emit-llvm -o - -fsanitize=address %s \
+// REQUIRES: x86-registered-target
+//
+// RUN: %clang -target x86_64-linux-gnu -S -emit-llvm -fsanitize=address \
+// RUN: -o - %s \
 // RUN: | FileCheck %s --check-prefixes=CHECK-NO-OUTLINE
-// RUN: %clang -S -fsanitize=address -emit-llvm -o - -fsanitize=address %s \
-// RUN: -fsanitize-address-outline-instrumentation \
+// RUN: %clang -target x86_64-linux-gnu -S -emit-llvm -o - \
+// RUN: -fsanitize=address %s -fsanitize-address-outline-instrumentation \
 // RUN: | FileCheck %s --check-prefixes=CHECK-OUTLINE
 
 // CHECK-NO-OUTLINE-NOT: call{{.*}}@__asan_load4


Index: clang/test/CodeGen/asan-use-callbacks.cpp
===
--- clang/test/CodeGen/asan-use-callbacks.cpp
+++ clang/test/CodeGen/asan-use-callbacks.cpp
@@ -1,7 +1,10 @@
-// RUN: %clang -S -fsanitize=address -emit-llvm -o - -fsanitize=address %s \
+// REQUIRES: x86-registered-target
+//
+// RUN: %clang -target x86_64-linux-gnu -S -emit-llvm -fsanitize=address \
+// RUN: -o - %s \
 // RUN: | FileCheck %s --check-prefixes=CHECK-NO-OUTLINE
-// RUN: %clang -S -fsanitize=address -emit-llvm -o - -fsanitize=address %s \
-// RUN: -fsanitize-address-outline-instrumentation \
+// RUN: %clang -target x86_64-linux-gnu -S -emit-llvm -o - \
+// RUN: -fsanitize=address %s -fsanitize-address-outline-instrumentation \
 // RUN: | FileCheck %s --check-prefixes=CHECK-OUTLINE
 
 // CHECK-NO-OUTLINE-NOT: call{{.*}}@__asan_load4
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D107667: [clang/test] Run thinlto-clang-diagnostic-handler-in-be.c on x86

2021-08-06 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre created this revision.
thopre added reviewers: xur, tejohnson, lebedev.ri.
Herald added subscribers: ormris, pengfei, steven_wu, hiraditya, inglorion.
thopre requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Clang test CodeGen/thinlto-clang-diagnostic-handler-in-be.c fails on
some non x86 targets, e.g. hexagon. Since the test already requires x86
to be available as a target this commit forces the target to x86_64.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D107667

Files:
  clang/test/CodeGen/thinlto-clang-diagnostic-handler-in-be.c


Index: clang/test/CodeGen/thinlto-clang-diagnostic-handler-in-be.c
===
--- clang/test/CodeGen/thinlto-clang-diagnostic-handler-in-be.c
+++ clang/test/CodeGen/thinlto-clang-diagnostic-handler-in-be.c
@@ -3,11 +3,11 @@
 // REQUIRES: x86-registered-target
 
 // RUN: llvm-profdata merge -o %t1.profdata %S/Inputs/thinlto_expect1.proftext
-// RUN: %clang -O2 -fexperimental-new-pass-manager -flto=thin -g 
-fprofile-use=%t1.profdata -c -o %t1.bo %s
+// RUN: %clang -target x86_64 -O2 -fexperimental-new-pass-manager -flto=thin 
-g -fprofile-use=%t1.profdata -c -o %t1.bo %s
 // RUN: llvm-lto -thinlto -o %t %t1.bo
-// RUN: %clang -cc1 -O2 -fexperimental-new-pass-manager -x ir %t1.bo 
-fthinlto-index=%t.thinlto.bc -emit-obj -Rpass-analysis=info 2>&1 | FileCheck 
%s -check-prefix=CHECK-REMARK
+// RUN: %clang -cc1 -triple x86_64 -O2 -fexperimental-new-pass-manager -x ir 
%t1.bo -fthinlto-index=%t.thinlto.bc -emit-obj -Rpass-analysis=info 2>&1 | 
FileCheck %s -check-prefix=CHECK-REMARK
 // RUN: llvm-profdata merge -o %t2.profdata %S/Inputs/thinlto_expect2.proftext
-// RUN: %clang -cc1 -O2 -fexperimental-new-pass-manager -x ir %t1.bo 
-fthinlto-index=%t.thinlto.bc -fprofile-instrument-use-path=%t2.profdata 
-emit-obj 2>&1 | FileCheck %s -allow-empty -check-prefix=CHECK-NOWARNING
+// RUN: %clang -cc1 -triple x86_64 -O2 -fexperimental-new-pass-manager -x ir 
%t1.bo -fthinlto-index=%t.thinlto.bc -fprofile-instrument-use-path=%t2.profdata 
-emit-obj 2>&1 | FileCheck %s -allow-empty -check-prefix=CHECK-NOWARNING
 
 int sum;
 __attribute__((noinline)) void bar() {


Index: clang/test/CodeGen/thinlto-clang-diagnostic-handler-in-be.c
===
--- clang/test/CodeGen/thinlto-clang-diagnostic-handler-in-be.c
+++ clang/test/CodeGen/thinlto-clang-diagnostic-handler-in-be.c
@@ -3,11 +3,11 @@
 // REQUIRES: x86-registered-target
 
 // RUN: llvm-profdata merge -o %t1.profdata %S/Inputs/thinlto_expect1.proftext
-// RUN: %clang -O2 -fexperimental-new-pass-manager -flto=thin -g -fprofile-use=%t1.profdata -c -o %t1.bo %s
+// RUN: %clang -target x86_64 -O2 -fexperimental-new-pass-manager -flto=thin -g -fprofile-use=%t1.profdata -c -o %t1.bo %s
 // RUN: llvm-lto -thinlto -o %t %t1.bo
-// RUN: %clang -cc1 -O2 -fexperimental-new-pass-manager -x ir %t1.bo -fthinlto-index=%t.thinlto.bc -emit-obj -Rpass-analysis=info 2>&1 | FileCheck %s -check-prefix=CHECK-REMARK
+// RUN: %clang -cc1 -triple x86_64 -O2 -fexperimental-new-pass-manager -x ir %t1.bo -fthinlto-index=%t.thinlto.bc -emit-obj -Rpass-analysis=info 2>&1 | FileCheck %s -check-prefix=CHECK-REMARK
 // RUN: llvm-profdata merge -o %t2.profdata %S/Inputs/thinlto_expect2.proftext
-// RUN: %clang -cc1 -O2 -fexperimental-new-pass-manager -x ir %t1.bo -fthinlto-index=%t.thinlto.bc -fprofile-instrument-use-path=%t2.profdata -emit-obj 2>&1 | FileCheck %s -allow-empty -check-prefix=CHECK-NOWARNING
+// RUN: %clang -cc1 -triple x86_64 -O2 -fexperimental-new-pass-manager -x ir %t1.bo -fthinlto-index=%t.thinlto.bc -fprofile-instrument-use-path=%t2.profdata -emit-obj 2>&1 | FileCheck %s -allow-empty -check-prefix=CHECK-NOWARNING
 
 int sum;
 __attribute__((noinline)) void bar() {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D107667: [clang/test] Run thinlto-clang-diagnostic-handler-in-be.c on x86

2021-08-10 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre updated this revision to Diff 365425.
thopre added a comment.

Use x86_64-linux-gnu as triplet


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107667/new/

https://reviews.llvm.org/D107667

Files:
  clang/test/CodeGen/thinlto-clang-diagnostic-handler-in-be.c


Index: clang/test/CodeGen/thinlto-clang-diagnostic-handler-in-be.c
===
--- clang/test/CodeGen/thinlto-clang-diagnostic-handler-in-be.c
+++ clang/test/CodeGen/thinlto-clang-diagnostic-handler-in-be.c
@@ -3,11 +3,11 @@
 // REQUIRES: x86-registered-target
 
 // RUN: llvm-profdata merge -o %t1.profdata %S/Inputs/thinlto_expect1.proftext
-// RUN: %clang -O2 -fexperimental-new-pass-manager -flto=thin -g 
-fprofile-use=%t1.profdata -c -o %t1.bo %s
+// RUN: %clang -target x86_64-linux-gnu -O2 -fexperimental-new-pass-manager 
-flto=thin -g -fprofile-use=%t1.profdata -c -o %t1.bo %s
 // RUN: llvm-lto -thinlto -o %t %t1.bo
-// RUN: %clang -cc1 -O2 -fexperimental-new-pass-manager -x ir %t1.bo 
-fthinlto-index=%t.thinlto.bc -emit-obj -Rpass-analysis=info 2>&1 | FileCheck 
%s -check-prefix=CHECK-REMARK
+// RUN: %clang -cc1 -triple x86_64-linux-gnu -O2 
-fexperimental-new-pass-manager -x ir %t1.bo -fthinlto-index=%t.thinlto.bc 
-emit-obj -Rpass-analysis=info 2>&1 | FileCheck %s -check-prefix=CHECK-REMARK
 // RUN: llvm-profdata merge -o %t2.profdata %S/Inputs/thinlto_expect2.proftext
-// RUN: %clang -cc1 -O2 -fexperimental-new-pass-manager -x ir %t1.bo 
-fthinlto-index=%t.thinlto.bc -fprofile-instrument-use-path=%t2.profdata 
-emit-obj 2>&1 | FileCheck %s -allow-empty -check-prefix=CHECK-NOWARNING
+// RUN: %clang -cc1 -triple x86_64-linux-gnu -O2 
-fexperimental-new-pass-manager -x ir %t1.bo -fthinlto-index=%t.thinlto.bc 
-fprofile-instrument-use-path=%t2.profdata -emit-obj 2>&1 | FileCheck %s 
-allow-empty -check-prefix=CHECK-NOWARNING
 
 int sum;
 __attribute__((noinline)) void bar() {


Index: clang/test/CodeGen/thinlto-clang-diagnostic-handler-in-be.c
===
--- clang/test/CodeGen/thinlto-clang-diagnostic-handler-in-be.c
+++ clang/test/CodeGen/thinlto-clang-diagnostic-handler-in-be.c
@@ -3,11 +3,11 @@
 // REQUIRES: x86-registered-target
 
 // RUN: llvm-profdata merge -o %t1.profdata %S/Inputs/thinlto_expect1.proftext
-// RUN: %clang -O2 -fexperimental-new-pass-manager -flto=thin -g -fprofile-use=%t1.profdata -c -o %t1.bo %s
+// RUN: %clang -target x86_64-linux-gnu -O2 -fexperimental-new-pass-manager -flto=thin -g -fprofile-use=%t1.profdata -c -o %t1.bo %s
 // RUN: llvm-lto -thinlto -o %t %t1.bo
-// RUN: %clang -cc1 -O2 -fexperimental-new-pass-manager -x ir %t1.bo -fthinlto-index=%t.thinlto.bc -emit-obj -Rpass-analysis=info 2>&1 | FileCheck %s -check-prefix=CHECK-REMARK
+// RUN: %clang -cc1 -triple x86_64-linux-gnu -O2 -fexperimental-new-pass-manager -x ir %t1.bo -fthinlto-index=%t.thinlto.bc -emit-obj -Rpass-analysis=info 2>&1 | FileCheck %s -check-prefix=CHECK-REMARK
 // RUN: llvm-profdata merge -o %t2.profdata %S/Inputs/thinlto_expect2.proftext
-// RUN: %clang -cc1 -O2 -fexperimental-new-pass-manager -x ir %t1.bo -fthinlto-index=%t.thinlto.bc -fprofile-instrument-use-path=%t2.profdata -emit-obj 2>&1 | FileCheck %s -allow-empty -check-prefix=CHECK-NOWARNING
+// RUN: %clang -cc1 -triple x86_64-linux-gnu -O2 -fexperimental-new-pass-manager -x ir %t1.bo -fthinlto-index=%t.thinlto.bc -fprofile-instrument-use-path=%t2.profdata -emit-obj 2>&1 | FileCheck %s -allow-empty -check-prefix=CHECK-NOWARNING
 
 int sum;
 __attribute__((noinline)) void bar() {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D107633: Set supported target for asan-use-callbacks test

2021-08-10 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre updated this revision to Diff 365465.
thopre added a comment.

Remove REQUIRES


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107633/new/

https://reviews.llvm.org/D107633

Files:
  clang/test/CodeGen/asan-use-callbacks.cpp


Index: clang/test/CodeGen/asan-use-callbacks.cpp
===
--- clang/test/CodeGen/asan-use-callbacks.cpp
+++ clang/test/CodeGen/asan-use-callbacks.cpp
@@ -1,7 +1,8 @@
-// RUN: %clang -S -fsanitize=address -emit-llvm -o - -fsanitize=address %s \
+// RUN: %clang -target x86_64-linux-gnu -S -emit-llvm -fsanitize=address \
+// RUN: -o - %s \
 // RUN: | FileCheck %s --check-prefixes=CHECK-NO-OUTLINE
-// RUN: %clang -S -fsanitize=address -emit-llvm -o - -fsanitize=address %s \
-// RUN: -fsanitize-address-outline-instrumentation \
+// RUN: %clang -target x86_64-linux-gnu -S -emit-llvm -o - \
+// RUN: -fsanitize=address %s -fsanitize-address-outline-instrumentation \
 // RUN: | FileCheck %s --check-prefixes=CHECK-OUTLINE
 
 // CHECK-NO-OUTLINE-NOT: call{{.*}}@__asan_load4


Index: clang/test/CodeGen/asan-use-callbacks.cpp
===
--- clang/test/CodeGen/asan-use-callbacks.cpp
+++ clang/test/CodeGen/asan-use-callbacks.cpp
@@ -1,7 +1,8 @@
-// RUN: %clang -S -fsanitize=address -emit-llvm -o - -fsanitize=address %s \
+// RUN: %clang -target x86_64-linux-gnu -S -emit-llvm -fsanitize=address \
+// RUN: -o - %s \
 // RUN: | FileCheck %s --check-prefixes=CHECK-NO-OUTLINE
-// RUN: %clang -S -fsanitize=address -emit-llvm -o - -fsanitize=address %s \
-// RUN: -fsanitize-address-outline-instrumentation \
+// RUN: %clang -target x86_64-linux-gnu -S -emit-llvm -o - \
+// RUN: -fsanitize=address %s -fsanitize-address-outline-instrumentation \
 // RUN: | FileCheck %s --check-prefixes=CHECK-OUTLINE
 
 // CHECK-NO-OUTLINE-NOT: call{{.*}}@__asan_load4
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D107633: Set supported target for asan-use-callbacks test

2021-08-10 Thread Thomas Preud'homme via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1397e19129ef: Set supported target for asan-use-callbacks 
test (authored by thopre).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107633/new/

https://reviews.llvm.org/D107633

Files:
  clang/test/CodeGen/asan-use-callbacks.cpp


Index: clang/test/CodeGen/asan-use-callbacks.cpp
===
--- clang/test/CodeGen/asan-use-callbacks.cpp
+++ clang/test/CodeGen/asan-use-callbacks.cpp
@@ -1,7 +1,8 @@
-// RUN: %clang -S -fsanitize=address -emit-llvm -o - -fsanitize=address %s \
+// RUN: %clang -target x86_64-linux-gnu -S -emit-llvm -fsanitize=address \
+// RUN: -o - %s \
 // RUN: | FileCheck %s --check-prefixes=CHECK-NO-OUTLINE
-// RUN: %clang -S -fsanitize=address -emit-llvm -o - -fsanitize=address %s \
-// RUN: -fsanitize-address-outline-instrumentation \
+// RUN: %clang -target x86_64-linux-gnu -S -emit-llvm -o - \
+// RUN: -fsanitize=address %s -fsanitize-address-outline-instrumentation \
 // RUN: | FileCheck %s --check-prefixes=CHECK-OUTLINE
 
 // CHECK-NO-OUTLINE-NOT: call{{.*}}@__asan_load4


Index: clang/test/CodeGen/asan-use-callbacks.cpp
===
--- clang/test/CodeGen/asan-use-callbacks.cpp
+++ clang/test/CodeGen/asan-use-callbacks.cpp
@@ -1,7 +1,8 @@
-// RUN: %clang -S -fsanitize=address -emit-llvm -o - -fsanitize=address %s \
+// RUN: %clang -target x86_64-linux-gnu -S -emit-llvm -fsanitize=address \
+// RUN: -o - %s \
 // RUN: | FileCheck %s --check-prefixes=CHECK-NO-OUTLINE
-// RUN: %clang -S -fsanitize=address -emit-llvm -o - -fsanitize=address %s \
-// RUN: -fsanitize-address-outline-instrumentation \
+// RUN: %clang -target x86_64-linux-gnu -S -emit-llvm -o - \
+// RUN: -fsanitize=address %s -fsanitize-address-outline-instrumentation \
 // RUN: | FileCheck %s --check-prefixes=CHECK-OUTLINE
 
 // CHECK-NO-OUTLINE-NOT: call{{.*}}@__asan_load4
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D107667: [clang/test] Run thinlto-clang-diagnostic-handler-in-be.c on x86

2021-08-12 Thread Thomas Preud'homme via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1e11ccad837c: [clang/test] Run 
thinlto-clang-diagnostic-handler-in-be.c on x86 (authored by thopre).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107667/new/

https://reviews.llvm.org/D107667

Files:
  clang/test/CodeGen/thinlto-clang-diagnostic-handler-in-be.c


Index: clang/test/CodeGen/thinlto-clang-diagnostic-handler-in-be.c
===
--- clang/test/CodeGen/thinlto-clang-diagnostic-handler-in-be.c
+++ clang/test/CodeGen/thinlto-clang-diagnostic-handler-in-be.c
@@ -3,11 +3,11 @@
 // REQUIRES: x86-registered-target
 
 // RUN: llvm-profdata merge -o %t1.profdata %S/Inputs/thinlto_expect1.proftext
-// RUN: %clang -O2 -fexperimental-new-pass-manager -flto=thin -g 
-fprofile-use=%t1.profdata -c -o %t1.bo %s
+// RUN: %clang -target x86_64-linux-gnu -O2 -fexperimental-new-pass-manager 
-flto=thin -g -fprofile-use=%t1.profdata -c -o %t1.bo %s
 // RUN: llvm-lto -thinlto -o %t %t1.bo
-// RUN: %clang -cc1 -O2 -fexperimental-new-pass-manager -x ir %t1.bo 
-fthinlto-index=%t.thinlto.bc -emit-obj -Rpass-analysis=info 2>&1 | FileCheck 
%s -check-prefix=CHECK-REMARK
+// RUN: %clang -cc1 -triple x86_64-linux-gnu -O2 
-fexperimental-new-pass-manager -x ir %t1.bo -fthinlto-index=%t.thinlto.bc 
-emit-obj -Rpass-analysis=info 2>&1 | FileCheck %s -check-prefix=CHECK-REMARK
 // RUN: llvm-profdata merge -o %t2.profdata %S/Inputs/thinlto_expect2.proftext
-// RUN: %clang -cc1 -O2 -fexperimental-new-pass-manager -x ir %t1.bo 
-fthinlto-index=%t.thinlto.bc -fprofile-instrument-use-path=%t2.profdata 
-emit-obj 2>&1 | FileCheck %s -allow-empty -check-prefix=CHECK-NOWARNING
+// RUN: %clang -cc1 -triple x86_64-linux-gnu -O2 
-fexperimental-new-pass-manager -x ir %t1.bo -fthinlto-index=%t.thinlto.bc 
-fprofile-instrument-use-path=%t2.profdata -emit-obj 2>&1 | FileCheck %s 
-allow-empty -check-prefix=CHECK-NOWARNING
 
 int sum;
 __attribute__((noinline)) void bar() {


Index: clang/test/CodeGen/thinlto-clang-diagnostic-handler-in-be.c
===
--- clang/test/CodeGen/thinlto-clang-diagnostic-handler-in-be.c
+++ clang/test/CodeGen/thinlto-clang-diagnostic-handler-in-be.c
@@ -3,11 +3,11 @@
 // REQUIRES: x86-registered-target
 
 // RUN: llvm-profdata merge -o %t1.profdata %S/Inputs/thinlto_expect1.proftext
-// RUN: %clang -O2 -fexperimental-new-pass-manager -flto=thin -g -fprofile-use=%t1.profdata -c -o %t1.bo %s
+// RUN: %clang -target x86_64-linux-gnu -O2 -fexperimental-new-pass-manager -flto=thin -g -fprofile-use=%t1.profdata -c -o %t1.bo %s
 // RUN: llvm-lto -thinlto -o %t %t1.bo
-// RUN: %clang -cc1 -O2 -fexperimental-new-pass-manager -x ir %t1.bo -fthinlto-index=%t.thinlto.bc -emit-obj -Rpass-analysis=info 2>&1 | FileCheck %s -check-prefix=CHECK-REMARK
+// RUN: %clang -cc1 -triple x86_64-linux-gnu -O2 -fexperimental-new-pass-manager -x ir %t1.bo -fthinlto-index=%t.thinlto.bc -emit-obj -Rpass-analysis=info 2>&1 | FileCheck %s -check-prefix=CHECK-REMARK
 // RUN: llvm-profdata merge -o %t2.profdata %S/Inputs/thinlto_expect2.proftext
-// RUN: %clang -cc1 -O2 -fexperimental-new-pass-manager -x ir %t1.bo -fthinlto-index=%t.thinlto.bc -fprofile-instrument-use-path=%t2.profdata -emit-obj 2>&1 | FileCheck %s -allow-empty -check-prefix=CHECK-NOWARNING
+// RUN: %clang -cc1 -triple x86_64-linux-gnu -O2 -fexperimental-new-pass-manager -x ir %t1.bo -fthinlto-index=%t.thinlto.bc -fprofile-instrument-use-path=%t2.profdata -emit-obj 2>&1 | FileCheck %s -allow-empty -check-prefix=CHECK-NOWARNING
 
 int sum;
 __attribute__((noinline)) void bar() {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D104854: Introduce intrinsic llvm.isnan

2021-06-25 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre added a comment.

LGTM (besides comment fix) but I'm not too familiar with the vector side of 
things




Comment at: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:6967
+  // NaN has all exp bits set and a non zero significand. Therefore:
+  // isnan(V) == ((exp mask - (abs(V) & exp mask)) < 0)
+  unsigned BitSize = OperandVT.getScalarSizeInBits();

I seem to have made a mistake when I wrote this.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104854/new/

https://reviews.llvm.org/D104854

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


[PATCH] D93347: [Test] Fix undef var in attr-speculative-load-hardening.c

2021-02-26 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre added reviewers: rsmith, rnk, kristof.beyls.
thopre added a comment.

Ping?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93347/new/

https://reviews.llvm.org/D93347

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


[PATCH] D97125: Stop traping on sNaN in __builtin_isinf

2021-03-02 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre added a comment.

Ping?




Comment at: clang/test/CodeGen/builtin_float_strictfp.c:21
+  // NOFP16-NEXT:  [[IHALF:%.*]]  = load i16, i16* [[LDADDR]], align 2
+  // NOFP16-NEXT:  [[CONV:%.*]]   = call float @llvm.convert.from.fp16.f32(i16 
[[IHALF]])
+  // NOFP16-NEXT:  [[IFLOAT:%.*]] = bitcast float [[CONV]] to i32

thopre wrote:
> Am I right to think that clang should not use llvm.convert here since it's a 
> constrained operation? Any idea why that happens?
Nvm, that's for when fp16 is not supported. I'm guessing this ought to not 
throw an exception.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97125/new/

https://reviews.llvm.org/D97125

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


[PATCH] D97125: Stop traping on sNaN in __builtin_isinf

2021-03-02 Thread Thomas Preud'homme via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1b6eb56aa0ea: Stop traping on sNaN in __builtin_isinf 
(authored by thopre).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97125/new/

https://reviews.llvm.org/D97125

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/test/CodeGen/X86/strictfp_builtins.c
  clang/test/CodeGen/aarch64-strictfp-builtins.c
  clang/test/CodeGen/builtin_float_strictfp.c
  clang/test/CodeGen/strictfp_builtins.c

Index: clang/test/CodeGen/strictfp_builtins.c
===
--- clang/test/CodeGen/strictfp_builtins.c
+++ clang/test/CodeGen/strictfp_builtins.c
@@ -1,5 +1,5 @@
 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
-// RUN: %clang_cc1 %s -emit-llvm -ffp-exception-behavior=maytrap -o - -triple x86_64-unknown-unknown | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -ffp-exception-behavior=maytrap -fallow-half-arguments-and-returns -o - -triple x86_64-unknown-unknown | FileCheck %s
 
 // Test that the constrained intrinsics are picking up the exception
 // metadata from the AST instead of the global default from the command line.
@@ -55,18 +55,55 @@
   return;
 }
 
-// CHECK-LABEL: @test_isinf(
+// CHECK-LABEL: @test_fp16_isinf(
 // CHECK-NEXT:  entry:
-// CHECK-NEXT:[[D_ADDR:%.*]] = alloca double, align 8
-// CHECK-NEXT:store double [[D:%.*]], double* [[D_ADDR]], align 8
-// CHECK-NEXT:[[TMP0:%.*]] = load double, double* [[D_ADDR]], align 8
-// CHECK-NEXT:[[TMP1:%.*]] = call double @llvm.fabs.f64(double [[TMP0]]) [[ATTR5]]
-// CHECK-NEXT:[[CMPINF:%.*]] = call i1 @llvm.experimental.constrained.fcmp.f64(double [[TMP1]], double 0x7FF0, metadata !"oeq", metadata !"fpexcept.strict") [[ATTR4]]
-// CHECK-NEXT:[[TMP2:%.*]] = zext i1 [[CMPINF]] to i32
-// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 [[TMP2]]) [[ATTR4]]
+// CHECK-NEXT:[[LD_ADDR:%.*]] = alloca half, align 2
+// CHECK-NEXT:store half [[H:%.*]], half* [[LD_ADDR]], align 2
+// CHECK-NEXT:[[TMP0:%.*]] = load half, half* [[LD_ADDR]], align 2
+// CHECK-NEXT:[[BITCAST:%.*]] = bitcast half [[TMP0]] to i16
+// CHECK-NEXT:[[SHL1:%.*]] = shl i16 [[BITCAST]], 1
+// CHECK-NEXT:[[CMP:%.*]] = icmp eq i16 [[SHL1]], -2048
+// CHECK-NEXT:[[RES:%.*]] = zext i1 [[CMP]] to i32
+// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.[[#STRID:2]], i64 0, i64 0), i32 [[RES]]) [[ATTR4]]
+// CHECK-NEXT:ret void
+//
+void test_fp16_isinf(__fp16 h) {
+  P(isinf, (h));
+
+  return;
+}
+
+// CHECK-LABEL: @test_float_isinf(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[LD_ADDR:%.*]] = alloca float, align 4
+// CHECK-NEXT:store float [[F:%.*]], float* [[LD_ADDR]], align 4
+// CHECK-NEXT:[[TMP0:%.*]] = load float, float* [[LD_ADDR]], align 4
+// CHECK-NEXT:[[BITCAST:%.*]] = bitcast float [[TMP0]] to i32
+// CHECK-NEXT:[[SHL1:%.*]] = shl i32 [[BITCAST]], 1
+// CHECK-NEXT:[[CMP:%.*]] = icmp eq i32 [[SHL1]], -16777216
+// CHECK-NEXT:[[RES:%.*]] = zext i1 [[CMP]] to i32
+// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.[[#STRID:STRID+1]], i64 0, i64 0), i32 [[RES]]) [[ATTR4]]
+// CHECK-NEXT:ret void
+//
+void test_float_isinf(float f) {
+  P(isinf, (f));
+
+  return;
+}
+
+// CHECK-LABEL: @test_double_isinf(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[LD_ADDR:%.*]] = alloca double, align 8
+// CHECK-NEXT:store double [[D:%.*]], double* [[LD_ADDR]], align 8
+// CHECK-NEXT:[[TMP0:%.*]] = load double, double* [[LD_ADDR]], align 8
+// CHECK-NEXT:[[BITCAST:%.*]] = bitcast double [[TMP0]] to i64
+// CHECK-NEXT:[[SHL1:%.*]] = shl i64 [[BITCAST]], 1
+// CHECK-NEXT:[[CMP:%.*]] = icmp eq i64 [[SHL1]], -9007199254740992
+// CHECK-NEXT:[[RES:%.*]] = zext i1 [[CMP]] to i32
+// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.[[#STRID:STRID+1]], i64 0, i64 0), i32 [[RES]]) [[ATTR4]]
 // CHECK-NEXT:ret void
 //
-void test_isinf(double d) {
+void test_double_isinf(double d) {
   P(isinf, (d));
 
   return;
@@ -83,7 +120,7 @@
 // CHECK-NEXT:[[TMP3:%.*]] = icmp slt i64 [[TMP2]], 0
 // CHECK-NEXT:[[TMP4:%.*]] = select i1 [[TMP3]], i32 -1, i32 1
 // CHECK-NEXT:[[TMP5:%.*]] = select i1 [[ISINF]], i32 [[TMP4]], i32 0
-// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 [[TMP5]]) [[ATTR4]]
+// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.[[#STRID:STRID+1]], i64 0, i64 0), i32 [[TMP5]]) [[ATTR4]]
 // CHECK-NEXT:ret void
 //
 void test_isinf_sign(double d) {
@@ -101,7 +138,7 @@
 // CHECK-NEXT:[[ABS:%.*]] = and i32 [[BITCAST]], [[#%u,0x7FFF]]
 // CHECK-NEXT:[[T

[PATCH] D97777: Add __builtin_isnan(__fp16) testcase

2021-03-02 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre created this revision.
thopre added reviewers: mibintc, kpn, efriedma, sepavloff, rjmccall, jonpa.
thopre requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D9

Files:
  clang/test/CodeGen/strictfp_builtins.c


Index: clang/test/CodeGen/strictfp_builtins.c
===
--- clang/test/CodeGen/strictfp_builtins.c
+++ clang/test/CodeGen/strictfp_builtins.c
@@ -129,6 +129,25 @@
   return;
 }
 
+// CHECK-LABEL: @test_fp16_isnan(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[H_ADDR:%.*]] = alloca half, align 2
+// CHECK-NEXT:store half [[H:%.*]], half* [[H_ADDR]], align 2
+// CHECK-NEXT:[[TMP0:%.*]] = load half, half* [[H_ADDR]], align 2
+// CHECK-NEXT:[[BITCAST:%.*]] = bitcast half [[TMP0]] to i16
+// CHECK-NEXT:[[ABS:%.*]] = and i16 [[BITCAST]], [[#%u,0x7FFF]]
+// CHECK-NEXT:[[TMP1:%.*]] = sub i16 [[#%u,0x7C00]], [[ABS]]
+// CHECK-NEXT:[[ISNAN:%.*]] = lshr i16 [[TMP1]], 15
+// CHECK-NEXT:[[RES:%.*]] = zext i16 [[ISNAN]] to i32
+// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* 
@.str.[[#STRID:STRID+1]], i64 0, i64 0), i32 [[RES]]) [[ATTR4]]
+// CHECK-NEXT:ret void
+//
+void test_fp16_isnan(__fp16 h) {
+  P(isnan, (h));
+
+  return;
+}
+
 // CHECK-LABEL: @test_float_isnan(
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:[[F_ADDR:%.*]] = alloca float, align 4


Index: clang/test/CodeGen/strictfp_builtins.c
===
--- clang/test/CodeGen/strictfp_builtins.c
+++ clang/test/CodeGen/strictfp_builtins.c
@@ -129,6 +129,25 @@
   return;
 }
 
+// CHECK-LABEL: @test_fp16_isnan(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[H_ADDR:%.*]] = alloca half, align 2
+// CHECK-NEXT:store half [[H:%.*]], half* [[H_ADDR]], align 2
+// CHECK-NEXT:[[TMP0:%.*]] = load half, half* [[H_ADDR]], align 2
+// CHECK-NEXT:[[BITCAST:%.*]] = bitcast half [[TMP0]] to i16
+// CHECK-NEXT:[[ABS:%.*]] = and i16 [[BITCAST]], [[#%u,0x7FFF]]
+// CHECK-NEXT:[[TMP1:%.*]] = sub i16 [[#%u,0x7C00]], [[ABS]]
+// CHECK-NEXT:[[ISNAN:%.*]] = lshr i16 [[TMP1]], 15
+// CHECK-NEXT:[[RES:%.*]] = zext i16 [[ISNAN]] to i32
+// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.[[#STRID:STRID+1]], i64 0, i64 0), i32 [[RES]]) [[ATTR4]]
+// CHECK-NEXT:ret void
+//
+void test_fp16_isnan(__fp16 h) {
+  P(isnan, (h));
+
+  return;
+}
+
 // CHECK-LABEL: @test_float_isnan(
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:[[F_ADDR:%.*]] = alloca float, align 4
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D97777: Add __builtin_isnan(__fp16) testcase

2021-03-02 Thread Thomas Preud'homme via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGe77b5c40d576: Add __builtin_isnan(__fp16) testcase (authored 
by thopre).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D9/new/

https://reviews.llvm.org/D9

Files:
  clang/test/CodeGen/strictfp_builtins.c


Index: clang/test/CodeGen/strictfp_builtins.c
===
--- clang/test/CodeGen/strictfp_builtins.c
+++ clang/test/CodeGen/strictfp_builtins.c
@@ -129,6 +129,25 @@
   return;
 }
 
+// CHECK-LABEL: @test_fp16_isnan(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[H_ADDR:%.*]] = alloca half, align 2
+// CHECK-NEXT:store half [[H:%.*]], half* [[H_ADDR]], align 2
+// CHECK-NEXT:[[TMP0:%.*]] = load half, half* [[H_ADDR]], align 2
+// CHECK-NEXT:[[BITCAST:%.*]] = bitcast half [[TMP0]] to i16
+// CHECK-NEXT:[[ABS:%.*]] = and i16 [[BITCAST]], [[#%u,0x7FFF]]
+// CHECK-NEXT:[[TMP1:%.*]] = sub i16 [[#%u,0x7C00]], [[ABS]]
+// CHECK-NEXT:[[ISNAN:%.*]] = lshr i16 [[TMP1]], 15
+// CHECK-NEXT:[[RES:%.*]] = zext i16 [[ISNAN]] to i32
+// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* 
@.str.[[#STRID:STRID+1]], i64 0, i64 0), i32 [[RES]]) [[ATTR4]]
+// CHECK-NEXT:ret void
+//
+void test_fp16_isnan(__fp16 h) {
+  P(isnan, (h));
+
+  return;
+}
+
 // CHECK-LABEL: @test_float_isnan(
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:[[F_ADDR:%.*]] = alloca float, align 4


Index: clang/test/CodeGen/strictfp_builtins.c
===
--- clang/test/CodeGen/strictfp_builtins.c
+++ clang/test/CodeGen/strictfp_builtins.c
@@ -129,6 +129,25 @@
   return;
 }
 
+// CHECK-LABEL: @test_fp16_isnan(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[H_ADDR:%.*]] = alloca half, align 2
+// CHECK-NEXT:store half [[H:%.*]], half* [[H_ADDR]], align 2
+// CHECK-NEXT:[[TMP0:%.*]] = load half, half* [[H_ADDR]], align 2
+// CHECK-NEXT:[[BITCAST:%.*]] = bitcast half [[TMP0]] to i16
+// CHECK-NEXT:[[ABS:%.*]] = and i16 [[BITCAST]], [[#%u,0x7FFF]]
+// CHECK-NEXT:[[TMP1:%.*]] = sub i16 [[#%u,0x7C00]], [[ABS]]
+// CHECK-NEXT:[[ISNAN:%.*]] = lshr i16 [[TMP1]], 15
+// CHECK-NEXT:[[RES:%.*]] = zext i16 [[ISNAN]] to i32
+// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.[[#STRID:STRID+1]], i64 0, i64 0), i32 [[RES]]) [[ATTR4]]
+// CHECK-NEXT:ret void
+//
+void test_fp16_isnan(__fp16 h) {
+  P(isnan, (h));
+
+  return;
+}
+
 // CHECK-LABEL: @test_float_isnan(
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:[[F_ADDR:%.*]] = alloca float, align 4
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D97901: [SystemZ] Test for infinity in testFPKind().

2021-03-04 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre added inline comments.



Comment at: clang/lib/CodeGen/TargetInfo.cpp:7229
+  case Builtin::BI__builtin_isfinite:
+Invert = true;
+LLVM_FALLTHROUGH;

jonpa wrote:
> What are these variants all about...?
> 
They were introduced in https://reviews.llvm.org/D24483


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97901/new/

https://reviews.llvm.org/D97901

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


[PATCH] D97901: [SystemZ] Test for infinity in testFPKind().

2021-03-04 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre added inline comments.



Comment at: clang/lib/CodeGen/TargetInfo.cpp:7229
+  case Builtin::BI__builtin_isfinite:
+Invert = true;
+LLVM_FALLTHROUGH;

uweigand wrote:
> thopre wrote:
> > jonpa wrote:
> > > What are these variants all about...?
> > > 
> > They were introduced in https://reviews.llvm.org/D24483
> This "invert" logic doesn't look correct.   "isfinite" and "isinf" **both** 
> need to return false on NaNs.  I think you should just drop the invert logic 
> and use a TDC mask of 0xFC0 (zero, normal, or subnormal) to implement 
> "isfinite".
My bad, I made the same mistake in https://reviews.llvm.org/D97125. I'll revert 
for now and will notify this review once I've got it fixed.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97901/new/

https://reviews.llvm.org/D97901

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


[PATCH] D97777: Add __builtin_isnan(__fp16) testcase

2021-03-04 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre updated this revision to Diff 328130.
thopre added a comment.

Adapt to revert of __builtin_isinf


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D9/new/

https://reviews.llvm.org/D9

Files:
  clang/test/CodeGen/strictfp_builtins.c


Index: clang/test/CodeGen/strictfp_builtins.c
===
--- clang/test/CodeGen/strictfp_builtins.c
+++ clang/test/CodeGen/strictfp_builtins.c
@@ -1,5 +1,5 @@
 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
-// RUN: %clang_cc1 %s -emit-llvm -ffp-exception-behavior=maytrap -o - -triple 
x86_64-unknown-unknown | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -ffp-exception-behavior=maytrap 
-fallow-half-arguments-and-returns -o - -triple x86_64-unknown-unknown | 
FileCheck %s
 
 // Test that the constrained intrinsics are picking up the exception
 // metadata from the AST instead of the global default from the command line.
@@ -92,6 +92,25 @@
   return;
 }
 
+// CHECK-LABEL: @test_fp16_isnan(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[H_ADDR:%.*]] = alloca half, align 2
+// CHECK-NEXT:store half [[H:%.*]], half* [[H_ADDR]], align 2
+// CHECK-NEXT:[[TMP0:%.*]] = load half, half* [[H_ADDR]], align 2
+// CHECK-NEXT:[[BITCAST:%.*]] = bitcast half [[TMP0]] to i16
+// CHECK-NEXT:[[ABS:%.*]] = and i16 [[BITCAST]], [[#%u,0x7FFF]]
+// CHECK-NEXT:[[TMP1:%.*]] = sub i16 [[#%u,0x7C00]], [[ABS]]
+// CHECK-NEXT:[[ISNAN:%.*]] = lshr i16 [[TMP1]], 15
+// CHECK-NEXT:[[RES:%.*]] = zext i16 [[ISNAN]] to i32
+// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* 
@.str.4, i64 0, i64 0), i32 [[RES]]) [[ATTR4]]
+// CHECK-NEXT:ret void
+//
+void test_fp16_isnan(__fp16 h) {
+  P(isnan, (h));
+
+  return;
+}
+
 // CHECK-LABEL: @test_float_isnan(
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:[[F_ADDR:%.*]] = alloca float, align 4
@@ -101,7 +120,7 @@
 // CHECK-NEXT:[[ABS:%.*]] = and i32 [[BITCAST]], [[#%u,0x7FFF]]
 // CHECK-NEXT:[[TMP1:%.*]] = sub i32 [[#%u,0x7F80]], [[ABS]]
 // CHECK-NEXT:[[ISNAN:%.*]] = lshr i32 [[TMP1]], 31
-// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* 
@.str.4, i64 0, i64 0), i32 [[ISNAN]]) [[ATTR4]]
+// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* 
@.str.5, i64 0, i64 0), i32 [[ISNAN]]) [[ATTR4]]
 // CHECK-NEXT:ret void
 //
 void test_float_isnan(float f) {
@@ -120,7 +139,7 @@
 // CHECK-NEXT:[[TMP1:%.*]] = sub i64 [[#%u,0x7FF0]], [[ABS]]
 // CHECK-NEXT:[[ISNAN:%.*]] = lshr i64 [[TMP1]], 63
 // CHECK-NEXT:[[RES:%.*]] = trunc i64 [[ISNAN]] to i32
-// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* 
@.str.5, i64 0, i64 0), i32 [[RES]]) [[ATTR4]]
+// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* 
@.str.6, i64 0, i64 0), i32 [[RES]]) [[ATTR4]]
 // CHECK-NEXT:ret void
 //
 void test_double_isnan(double d) {
@@ -141,7 +160,7 @@
 // CHECK-NEXT:[[AND:%.*]] = and i1 [[ISEQ]], [[ISINF]]
 // CHECK-NEXT:[[AND1:%.*]] = and i1 [[AND]], [[ISNORMAL]]
 // CHECK-NEXT:[[TMP2:%.*]] = zext i1 [[AND1]] to i32
-// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([12 x i8], [12 x 
i8]* @.str.6, i64 0, i64 0), i32 [[TMP2]]) [[ATTR4]]
+// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([12 x i8], [12 x 
i8]* @.str.7, i64 0, i64 0), i32 [[TMP2]]) [[ATTR4]]
 // CHECK-NEXT:ret void
 //
 void test_isnormal(double d) {


Index: clang/test/CodeGen/strictfp_builtins.c
===
--- clang/test/CodeGen/strictfp_builtins.c
+++ clang/test/CodeGen/strictfp_builtins.c
@@ -1,5 +1,5 @@
 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
-// RUN: %clang_cc1 %s -emit-llvm -ffp-exception-behavior=maytrap -o - -triple x86_64-unknown-unknown | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -ffp-exception-behavior=maytrap -fallow-half-arguments-and-returns -o - -triple x86_64-unknown-unknown | FileCheck %s
 
 // Test that the constrained intrinsics are picking up the exception
 // metadata from the AST instead of the global default from the command line.
@@ -92,6 +92,25 @@
   return;
 }
 
+// CHECK-LABEL: @test_fp16_isnan(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[H_ADDR:%.*]] = alloca half, align 2
+// CHECK-NEXT:store half [[H:%.*]], half* [[H_ADDR]], align 2
+// CHECK-NEXT:[[TMP0:%.*]] = load half, half* [[H_ADDR]], align 2
+// CHECK-NEXT:[[BITCAST:%.*]] = bitcast half [[TMP0]] to i16
+// CHECK-NEXT:[[ABS:%.*]] = and i16 [[BITCAST]], [[#%u,0x7FFF]]
+// CHECK-NEXT:[[TMP1:%.*]] = sub i16 [[#%u,0x7C00]], [[ABS]]
+// CHECK-NEXT:[[ISNAN:%.*]] = lshr i16 [[TMP1]], 15
+// CHECK-NEXT:[[RES:%.*]] = zext i16 [[ISNAN]] to i32
+// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i

[PATCH] D97777: Add __builtin_isnan(__fp16) testcase

2021-03-04 Thread Thomas Preud'homme via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG52bfe6605ab7: Add __builtin_isnan(__fp16) testcase (authored 
by thopre).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D9/new/

https://reviews.llvm.org/D9

Files:
  clang/test/CodeGen/strictfp_builtins.c


Index: clang/test/CodeGen/strictfp_builtins.c
===
--- clang/test/CodeGen/strictfp_builtins.c
+++ clang/test/CodeGen/strictfp_builtins.c
@@ -1,5 +1,5 @@
 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
-// RUN: %clang_cc1 %s -emit-llvm -ffp-exception-behavior=maytrap -o - -triple 
x86_64-unknown-unknown | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -ffp-exception-behavior=maytrap 
-fallow-half-arguments-and-returns -o - -triple x86_64-unknown-unknown | 
FileCheck %s
 
 // Test that the constrained intrinsics are picking up the exception
 // metadata from the AST instead of the global default from the command line.
@@ -92,6 +92,25 @@
   return;
 }
 
+// CHECK-LABEL: @test_fp16_isnan(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[H_ADDR:%.*]] = alloca half, align 2
+// CHECK-NEXT:store half [[H:%.*]], half* [[H_ADDR]], align 2
+// CHECK-NEXT:[[TMP0:%.*]] = load half, half* [[H_ADDR]], align 2
+// CHECK-NEXT:[[BITCAST:%.*]] = bitcast half [[TMP0]] to i16
+// CHECK-NEXT:[[ABS:%.*]] = and i16 [[BITCAST]], [[#%u,0x7FFF]]
+// CHECK-NEXT:[[TMP1:%.*]] = sub i16 [[#%u,0x7C00]], [[ABS]]
+// CHECK-NEXT:[[ISNAN:%.*]] = lshr i16 [[TMP1]], 15
+// CHECK-NEXT:[[RES:%.*]] = zext i16 [[ISNAN]] to i32
+// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* 
@.str.4, i64 0, i64 0), i32 [[RES]]) [[ATTR4]]
+// CHECK-NEXT:ret void
+//
+void test_fp16_isnan(__fp16 h) {
+  P(isnan, (h));
+
+  return;
+}
+
 // CHECK-LABEL: @test_float_isnan(
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:[[F_ADDR:%.*]] = alloca float, align 4
@@ -101,7 +120,7 @@
 // CHECK-NEXT:[[ABS:%.*]] = and i32 [[BITCAST]], [[#%u,0x7FFF]]
 // CHECK-NEXT:[[TMP1:%.*]] = sub i32 [[#%u,0x7F80]], [[ABS]]
 // CHECK-NEXT:[[ISNAN:%.*]] = lshr i32 [[TMP1]], 31
-// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* 
@.str.4, i64 0, i64 0), i32 [[ISNAN]]) [[ATTR4]]
+// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* 
@.str.5, i64 0, i64 0), i32 [[ISNAN]]) [[ATTR4]]
 // CHECK-NEXT:ret void
 //
 void test_float_isnan(float f) {
@@ -120,7 +139,7 @@
 // CHECK-NEXT:[[TMP1:%.*]] = sub i64 [[#%u,0x7FF0]], [[ABS]]
 // CHECK-NEXT:[[ISNAN:%.*]] = lshr i64 [[TMP1]], 63
 // CHECK-NEXT:[[RES:%.*]] = trunc i64 [[ISNAN]] to i32
-// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* 
@.str.5, i64 0, i64 0), i32 [[RES]]) [[ATTR4]]
+// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* 
@.str.6, i64 0, i64 0), i32 [[RES]]) [[ATTR4]]
 // CHECK-NEXT:ret void
 //
 void test_double_isnan(double d) {
@@ -141,7 +160,7 @@
 // CHECK-NEXT:[[AND:%.*]] = and i1 [[ISEQ]], [[ISINF]]
 // CHECK-NEXT:[[AND1:%.*]] = and i1 [[AND]], [[ISNORMAL]]
 // CHECK-NEXT:[[TMP2:%.*]] = zext i1 [[AND1]] to i32
-// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([12 x i8], [12 x 
i8]* @.str.6, i64 0, i64 0), i32 [[TMP2]]) [[ATTR4]]
+// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([12 x i8], [12 x 
i8]* @.str.7, i64 0, i64 0), i32 [[TMP2]]) [[ATTR4]]
 // CHECK-NEXT:ret void
 //
 void test_isnormal(double d) {


Index: clang/test/CodeGen/strictfp_builtins.c
===
--- clang/test/CodeGen/strictfp_builtins.c
+++ clang/test/CodeGen/strictfp_builtins.c
@@ -1,5 +1,5 @@
 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
-// RUN: %clang_cc1 %s -emit-llvm -ffp-exception-behavior=maytrap -o - -triple x86_64-unknown-unknown | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -ffp-exception-behavior=maytrap -fallow-half-arguments-and-returns -o - -triple x86_64-unknown-unknown | FileCheck %s
 
 // Test that the constrained intrinsics are picking up the exception
 // metadata from the AST instead of the global default from the command line.
@@ -92,6 +92,25 @@
   return;
 }
 
+// CHECK-LABEL: @test_fp16_isnan(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[H_ADDR:%.*]] = alloca half, align 2
+// CHECK-NEXT:store half [[H:%.*]], half* [[H_ADDR]], align 2
+// CHECK-NEXT:[[TMP0:%.*]] = load half, half* [[H_ADDR]], align 2
+// CHECK-NEXT:[[BITCAST:%.*]] = bitcast half [[TMP0]] to i16
+// CHECK-NEXT:[[ABS:%.*]] = and i16 [[BITCAST]], [[#%u,0x7FFF]]
+// CHECK-NEXT:[[TMP1:%.*]] = sub i16 [[#%u,0x7C00]], [[ABS]]
+// CHECK-NEXT:[[ISNAN:%.*]] = lshr i16 [[TMP1]], 15
+// CHECK-NEXT:[[RES:%.*]] = zext i

[PATCH] D97125: Stop traping on sNaN in __builtin_isinf

2021-03-04 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre updated this revision to Diff 328170.
thopre added a comment.

Fix isfinite logic


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97125/new/

https://reviews.llvm.org/D97125

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/test/CodeGen/X86/strictfp_builtins.c
  clang/test/CodeGen/aarch64-strictfp-builtins.c
  clang/test/CodeGen/builtin_float_strictfp.c
  clang/test/CodeGen/strictfp_builtins.c

Index: clang/test/CodeGen/strictfp_builtins.c
===
--- clang/test/CodeGen/strictfp_builtins.c
+++ clang/test/CodeGen/strictfp_builtins.c
@@ -55,18 +55,55 @@
   return;
 }
 
-// CHECK-LABEL: @test_isinf(
+// CHECK-LABEL: @test_fp16_isinf(
 // CHECK-NEXT:  entry:
-// CHECK-NEXT:[[D_ADDR:%.*]] = alloca double, align 8
-// CHECK-NEXT:store double [[D:%.*]], double* [[D_ADDR]], align 8
-// CHECK-NEXT:[[TMP0:%.*]] = load double, double* [[D_ADDR]], align 8
-// CHECK-NEXT:[[TMP1:%.*]] = call double @llvm.fabs.f64(double [[TMP0]]) [[ATTR5]]
-// CHECK-NEXT:[[CMPINF:%.*]] = call i1 @llvm.experimental.constrained.fcmp.f64(double [[TMP1]], double 0x7FF0, metadata !"oeq", metadata !"fpexcept.strict") [[ATTR4]]
-// CHECK-NEXT:[[TMP2:%.*]] = zext i1 [[CMPINF]] to i32
-// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 [[TMP2]]) [[ATTR4]]
+// CHECK-NEXT:[[LD_ADDR:%.*]] = alloca half, align 2
+// CHECK-NEXT:store half [[H:%.*]], half* [[LD_ADDR]], align 2
+// CHECK-NEXT:[[TMP0:%.*]] = load half, half* [[LD_ADDR]], align 2
+// CHECK-NEXT:[[BITCAST:%.*]] = bitcast half [[TMP0]] to i16
+// CHECK-NEXT:[[SHL1:%.*]] = shl i16 [[BITCAST]], 1
+// CHECK-NEXT:[[CMP:%.*]] = icmp eq i16 [[SHL1]], -2048
+// CHECK-NEXT:[[RES:%.*]] = zext i1 [[CMP]] to i32
+// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.[[#STRID:2]], i64 0, i64 0), i32 [[RES]]) [[ATTR4]]
+// CHECK-NEXT:ret void
+//
+void test_fp16_isinf(__fp16 h) {
+  P(isinf, (h));
+
+  return;
+}
+
+// CHECK-LABEL: @test_float_isinf(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[LD_ADDR:%.*]] = alloca float, align 4
+// CHECK-NEXT:store float [[F:%.*]], float* [[LD_ADDR]], align 4
+// CHECK-NEXT:[[TMP0:%.*]] = load float, float* [[LD_ADDR]], align 4
+// CHECK-NEXT:[[BITCAST:%.*]] = bitcast float [[TMP0]] to i32
+// CHECK-NEXT:[[SHL1:%.*]] = shl i32 [[BITCAST]], 1
+// CHECK-NEXT:[[CMP:%.*]] = icmp eq i32 [[SHL1]], -16777216
+// CHECK-NEXT:[[RES:%.*]] = zext i1 [[CMP]] to i32
+// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.[[#STRID:STRID+1]], i64 0, i64 0), i32 [[RES]]) [[ATTR4]]
+// CHECK-NEXT:ret void
+//
+void test_float_isinf(float f) {
+  P(isinf, (f));
+
+  return;
+}
+
+// CHECK-LABEL: @test_double_isinf(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[LD_ADDR:%.*]] = alloca double, align 8
+// CHECK-NEXT:store double [[D:%.*]], double* [[LD_ADDR]], align 8
+// CHECK-NEXT:[[TMP0:%.*]] = load double, double* [[LD_ADDR]], align 8
+// CHECK-NEXT:[[BITCAST:%.*]] = bitcast double [[TMP0]] to i64
+// CHECK-NEXT:[[SHL1:%.*]] = shl i64 [[BITCAST]], 1
+// CHECK-NEXT:[[CMP:%.*]] = icmp eq i64 [[SHL1]], -9007199254740992
+// CHECK-NEXT:[[RES:%.*]] = zext i1 [[CMP]] to i32
+// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.[[#STRID:STRID+1]], i64 0, i64 0), i32 [[RES]]) [[ATTR4]]
 // CHECK-NEXT:ret void
 //
-void test_isinf(double d) {
+void test_double_isinf(double d) {
   P(isinf, (d));
 
   return;
@@ -83,7 +120,7 @@
 // CHECK-NEXT:[[TMP3:%.*]] = icmp slt i64 [[TMP2]], 0
 // CHECK-NEXT:[[TMP4:%.*]] = select i1 [[TMP3]], i32 -1, i32 1
 // CHECK-NEXT:[[TMP5:%.*]] = select i1 [[ISINF]], i32 [[TMP4]], i32 0
-// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 [[TMP5]]) [[ATTR4]]
+// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.[[#STRID:STRID+1]], i64 0, i64 0), i32 [[TMP5]]) [[ATTR4]]
 // CHECK-NEXT:ret void
 //
 void test_isinf_sign(double d) {
@@ -102,7 +139,7 @@
 // CHECK-NEXT:[[TMP1:%.*]] = sub i16 [[#%u,0x7C00]], [[ABS]]
 // CHECK-NEXT:[[ISNAN:%.*]] = lshr i16 [[TMP1]], 15
 // CHECK-NEXT:[[RES:%.*]] = zext i16 [[ISNAN]] to i32
-// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32 [[RES]]) [[ATTR4]]
+// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.[[#STRID:STRID+1]], i64 0, i64 0), i32 [[RES]]) [[ATTR4]]
 // CHECK-NEXT:ret void
 //
 void test_fp16_isnan(__fp16 h) {
@@ -120,7 +157,7 @@
 // CHECK-NEXT:[[ABS:%.*]] = and i32 [[BITCAST]], [[#%u,0x7FFF]]
 // CHECK-NEXT:[[TMP1:%.*]] = sub i32 [[#%u,0x7F80]], [[ABS]]
 // CHECK-NEXT:[[ISNAN:%.*]] = lshr i32 [[TMP1]], 31
-// CHE

[PATCH] D97125: Stop traping on sNaN in __builtin_isinf

2021-03-04 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre updated this revision to Diff 328171.
thopre added a comment.

Add isfinite testcases


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97125/new/

https://reviews.llvm.org/D97125

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/test/CodeGen/X86/strictfp_builtins.c
  clang/test/CodeGen/aarch64-strictfp-builtins.c
  clang/test/CodeGen/builtin_float_strictfp.c
  clang/test/CodeGen/strictfp_builtins.c

Index: clang/test/CodeGen/strictfp_builtins.c
===
--- clang/test/CodeGen/strictfp_builtins.c
+++ clang/test/CodeGen/strictfp_builtins.c
@@ -55,23 +55,114 @@
   return;
 }
 
-// CHECK-LABEL: @test_isinf(
+// CHECK-LABEL: @test_fp16_isinf(
 // CHECK-NEXT:  entry:
-// CHECK-NEXT:[[D_ADDR:%.*]] = alloca double, align 8
-// CHECK-NEXT:store double [[D:%.*]], double* [[D_ADDR]], align 8
-// CHECK-NEXT:[[TMP0:%.*]] = load double, double* [[D_ADDR]], align 8
-// CHECK-NEXT:[[TMP1:%.*]] = call double @llvm.fabs.f64(double [[TMP0]]) [[ATTR5]]
-// CHECK-NEXT:[[CMPINF:%.*]] = call i1 @llvm.experimental.constrained.fcmp.f64(double [[TMP1]], double 0x7FF0, metadata !"oeq", metadata !"fpexcept.strict") [[ATTR4]]
-// CHECK-NEXT:[[TMP2:%.*]] = zext i1 [[CMPINF]] to i32
-// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 [[TMP2]]) [[ATTR4]]
+// CHECK-NEXT:[[LD_ADDR:%.*]] = alloca half, align 2
+// CHECK-NEXT:store half [[H:%.*]], half* [[LD_ADDR]], align 2
+// CHECK-NEXT:[[TMP0:%.*]] = load half, half* [[LD_ADDR]], align 2
+// CHECK-NEXT:[[BITCAST:%.*]] = bitcast half [[TMP0]] to i16
+// CHECK-NEXT:[[SHL1:%.*]] = shl i16 [[BITCAST]], 1
+// CHECK-NEXT:[[CMP:%.*]] = icmp eq i16 [[SHL1]], -2048
+// CHECK-NEXT:[[RES:%.*]] = zext i1 [[CMP]] to i32
+// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.[[#STRID:2]], i64 0, i64 0), i32 [[RES]]) [[ATTR4]]
 // CHECK-NEXT:ret void
 //
-void test_isinf(double d) {
+void test_fp16_isinf(__fp16 h) {
+  P(isinf, (h));
+
+  return;
+}
+
+// CHECK-LABEL: @test_float_isinf(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[LD_ADDR:%.*]] = alloca float, align 4
+// CHECK-NEXT:store float [[F:%.*]], float* [[LD_ADDR]], align 4
+// CHECK-NEXT:[[TMP0:%.*]] = load float, float* [[LD_ADDR]], align 4
+// CHECK-NEXT:[[BITCAST:%.*]] = bitcast float [[TMP0]] to i32
+// CHECK-NEXT:[[SHL1:%.*]] = shl i32 [[BITCAST]], 1
+// CHECK-NEXT:[[CMP:%.*]] = icmp eq i32 [[SHL1]], -16777216
+// CHECK-NEXT:[[RES:%.*]] = zext i1 [[CMP]] to i32
+// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.[[#STRID:STRID+1]], i64 0, i64 0), i32 [[RES]]) [[ATTR4]]
+// CHECK-NEXT:ret void
+//
+void test_float_isinf(float f) {
+  P(isinf, (f));
+
+  return;
+}
+
+// CHECK-LABEL: @test_double_isinf(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[LD_ADDR:%.*]] = alloca double, align 8
+// CHECK-NEXT:store double [[D:%.*]], double* [[LD_ADDR]], align 8
+// CHECK-NEXT:[[TMP0:%.*]] = load double, double* [[LD_ADDR]], align 8
+// CHECK-NEXT:[[BITCAST:%.*]] = bitcast double [[TMP0]] to i64
+// CHECK-NEXT:[[SHL1:%.*]] = shl i64 [[BITCAST]], 1
+// CHECK-NEXT:[[CMP:%.*]] = icmp eq i64 [[SHL1]], -9007199254740992
+// CHECK-NEXT:[[RES:%.*]] = zext i1 [[CMP]] to i32
+// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.[[#STRID:STRID+1]], i64 0, i64 0), i32 [[RES]]) [[ATTR4]]
+// CHECK-NEXT:ret void
+//
+void test_double_isinf(double d) {
   P(isinf, (d));
 
   return;
 }
 
+// CHECK-LABEL: @test_fp16_isfinite(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[LD_ADDR:%.*]] = alloca half, align 2
+// CHECK-NEXT:store half [[H:%.*]], half* [[LD_ADDR]], align 2
+// CHECK-NEXT:[[TMP0:%.*]] = load half, half* [[LD_ADDR]], align 2
+// CHECK-NEXT:[[BITCAST:%.*]] = bitcast half [[TMP0]] to i16
+// CHECK-NEXT:[[SHL1:%.*]] = shl i16 [[BITCAST]], 1
+// CHECK-NEXT:[[CMP:%.*]] = icmp ult i16 [[SHL1]], -2048
+// CHECK-NEXT:[[RES:%.*]] = zext i1 [[CMP]] to i32
+// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.[[#STRID:STRID+1]], i64 0, i64 0), i32 [[RES]]) [[ATTR4]]
+// CHECK-NEXT:ret void
+//
+void test_fp16_isfinite(__fp16 h) {
+  P(isfinite, (h));
+
+  return;
+}
+
+// CHECK-LABEL: @test_float_isfinite(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[LD_ADDR:%.*]] = alloca float, align 4
+// CHECK-NEXT:store float [[F:%.*]], float* [[LD_ADDR]], align 4
+// CHECK-NEXT:[[TMP0:%.*]] = load float, float* [[LD_ADDR]], align 4
+// CHECK-NEXT:[[BITCAST:%.*]] = bitcast float [[TMP0]] to i32
+// CHECK-NEXT:[[SHL1:%.*]] = shl i32 [[BITCAST]], 1
+// CHECK-NEXT:[[CMP:%.*]] = icmp ult i32 [[SHL1]], -16777216
+// CHECK-NEXT:[[RES:%.*]] = zext i1 [[CMP]] to i32
+// CHECK-NEXT:call void @p(i8* getelementptr inb

[PATCH] D97901: [SystemZ] Test for infinity in testFPKind().

2021-03-04 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre added inline comments.



Comment at: clang/lib/CodeGen/TargetInfo.cpp:7229
+  case Builtin::BI__builtin_isfinite:
+Invert = true;
+LLVM_FALLTHROUGH;

thopre wrote:
> uweigand wrote:
> > thopre wrote:
> > > jonpa wrote:
> > > > What are these variants all about...?
> > > > 
> > > They were introduced in https://reviews.llvm.org/D24483
> > This "invert" logic doesn't look correct.   "isfinite" and "isinf" **both** 
> > need to return false on NaNs.  I think you should just drop the invert 
> > logic and use a TDC mask of 0xFC0 (zero, normal, or subnormal) to implement 
> > "isfinite".
> My bad, I made the same mistake in https://reviews.llvm.org/D97125. I'll 
> revert for now and will notify this review once I've got it fixed.
I've fixed https://reviews.llvm.org/D97125 and added some isfinite cases.. 
Thanks @uweigand for pointing the NaN case.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97901/new/

https://reviews.llvm.org/D97901

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


[PATCH] D97125: Stop traping on sNaN in __builtin_isinf

2021-03-04 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre requested review of this revision.
thopre added a comment.

Requesting review since the logic has changed. This time I've also tested 
isfinite against glibc's result. All looks good.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97125/new/

https://reviews.llvm.org/D97125

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


[PATCH] D97125: Stop traping on sNaN in __builtin_isinf

2021-03-15 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre added a comment.

In D97125#2603832 , @thopre wrote:

> Requesting review since the logic has changed. This time I've also tested 
> isfinite against glibc's result. All looks good.

Ping?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97125/new/

https://reviews.llvm.org/D97125

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


[PATCH] D97125: Stop traping on sNaN in __builtin_isinf

2021-03-15 Thread Thomas Preud'homme via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf60b35340fd7: Stop traping on sNaN in __builtin_isinf 
(authored by thopre).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97125/new/

https://reviews.llvm.org/D97125

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/test/CodeGen/X86/strictfp_builtins.c
  clang/test/CodeGen/aarch64-strictfp-builtins.c
  clang/test/CodeGen/builtin_float_strictfp.c
  clang/test/CodeGen/strictfp_builtins.c

Index: clang/test/CodeGen/strictfp_builtins.c
===
--- clang/test/CodeGen/strictfp_builtins.c
+++ clang/test/CodeGen/strictfp_builtins.c
@@ -55,23 +55,114 @@
   return;
 }
 
-// CHECK-LABEL: @test_isinf(
+// CHECK-LABEL: @test_fp16_isinf(
 // CHECK-NEXT:  entry:
-// CHECK-NEXT:[[D_ADDR:%.*]] = alloca double, align 8
-// CHECK-NEXT:store double [[D:%.*]], double* [[D_ADDR]], align 8
-// CHECK-NEXT:[[TMP0:%.*]] = load double, double* [[D_ADDR]], align 8
-// CHECK-NEXT:[[TMP1:%.*]] = call double @llvm.fabs.f64(double [[TMP0]]) [[ATTR5]]
-// CHECK-NEXT:[[CMPINF:%.*]] = call i1 @llvm.experimental.constrained.fcmp.f64(double [[TMP1]], double 0x7FF0, metadata !"oeq", metadata !"fpexcept.strict") [[ATTR4]]
-// CHECK-NEXT:[[TMP2:%.*]] = zext i1 [[CMPINF]] to i32
-// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 [[TMP2]]) [[ATTR4]]
+// CHECK-NEXT:[[LD_ADDR:%.*]] = alloca half, align 2
+// CHECK-NEXT:store half [[H:%.*]], half* [[LD_ADDR]], align 2
+// CHECK-NEXT:[[TMP0:%.*]] = load half, half* [[LD_ADDR]], align 2
+// CHECK-NEXT:[[BITCAST:%.*]] = bitcast half [[TMP0]] to i16
+// CHECK-NEXT:[[SHL1:%.*]] = shl i16 [[BITCAST]], 1
+// CHECK-NEXT:[[CMP:%.*]] = icmp eq i16 [[SHL1]], -2048
+// CHECK-NEXT:[[RES:%.*]] = zext i1 [[CMP]] to i32
+// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.[[#STRID:2]], i64 0, i64 0), i32 [[RES]]) [[ATTR4]]
 // CHECK-NEXT:ret void
 //
-void test_isinf(double d) {
+void test_fp16_isinf(__fp16 h) {
+  P(isinf, (h));
+
+  return;
+}
+
+// CHECK-LABEL: @test_float_isinf(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[LD_ADDR:%.*]] = alloca float, align 4
+// CHECK-NEXT:store float [[F:%.*]], float* [[LD_ADDR]], align 4
+// CHECK-NEXT:[[TMP0:%.*]] = load float, float* [[LD_ADDR]], align 4
+// CHECK-NEXT:[[BITCAST:%.*]] = bitcast float [[TMP0]] to i32
+// CHECK-NEXT:[[SHL1:%.*]] = shl i32 [[BITCAST]], 1
+// CHECK-NEXT:[[CMP:%.*]] = icmp eq i32 [[SHL1]], -16777216
+// CHECK-NEXT:[[RES:%.*]] = zext i1 [[CMP]] to i32
+// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.[[#STRID:STRID+1]], i64 0, i64 0), i32 [[RES]]) [[ATTR4]]
+// CHECK-NEXT:ret void
+//
+void test_float_isinf(float f) {
+  P(isinf, (f));
+
+  return;
+}
+
+// CHECK-LABEL: @test_double_isinf(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[LD_ADDR:%.*]] = alloca double, align 8
+// CHECK-NEXT:store double [[D:%.*]], double* [[LD_ADDR]], align 8
+// CHECK-NEXT:[[TMP0:%.*]] = load double, double* [[LD_ADDR]], align 8
+// CHECK-NEXT:[[BITCAST:%.*]] = bitcast double [[TMP0]] to i64
+// CHECK-NEXT:[[SHL1:%.*]] = shl i64 [[BITCAST]], 1
+// CHECK-NEXT:[[CMP:%.*]] = icmp eq i64 [[SHL1]], -9007199254740992
+// CHECK-NEXT:[[RES:%.*]] = zext i1 [[CMP]] to i32
+// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.[[#STRID:STRID+1]], i64 0, i64 0), i32 [[RES]]) [[ATTR4]]
+// CHECK-NEXT:ret void
+//
+void test_double_isinf(double d) {
   P(isinf, (d));
 
   return;
 }
 
+// CHECK-LABEL: @test_fp16_isfinite(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[LD_ADDR:%.*]] = alloca half, align 2
+// CHECK-NEXT:store half [[H:%.*]], half* [[LD_ADDR]], align 2
+// CHECK-NEXT:[[TMP0:%.*]] = load half, half* [[LD_ADDR]], align 2
+// CHECK-NEXT:[[BITCAST:%.*]] = bitcast half [[TMP0]] to i16
+// CHECK-NEXT:[[SHL1:%.*]] = shl i16 [[BITCAST]], 1
+// CHECK-NEXT:[[CMP:%.*]] = icmp ult i16 [[SHL1]], -2048
+// CHECK-NEXT:[[RES:%.*]] = zext i1 [[CMP]] to i32
+// CHECK-NEXT:call void @p(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.[[#STRID:STRID+1]], i64 0, i64 0), i32 [[RES]]) [[ATTR4]]
+// CHECK-NEXT:ret void
+//
+void test_fp16_isfinite(__fp16 h) {
+  P(isfinite, (h));
+
+  return;
+}
+
+// CHECK-LABEL: @test_float_isfinite(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[LD_ADDR:%.*]] = alloca float, align 4
+// CHECK-NEXT:store float [[F:%.*]], float* [[LD_ADDR]], align 4
+// CHECK-NEXT:[[TMP0:%.*]] = load float, float* [[LD_ADDR]], align 4
+// CHECK-NEXT:[[BITCAST:%.*]] = bitcast float [[TMP0]] to i32
+// CHECK-NEXT:[[SHL1:%.*]] = shl i32 [[BITCAST]], 1
+// CHECK-NEXT:[[CMP:%.*]] = icmp ult i32 [[SHL1]], -16777216
+// CHECK-NEXT:[[RES:%.*]] = 

[PATCH] D137484: [Test] Fix driverkit-path.c with lib64 dir

2022-11-05 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre created this revision.
thopre added reviewers: yln, rsmith.
Herald added a project: All.
thopre requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D137484

Files:
  clang/test/Driver/driverkit-path.c


Index: clang/test/Driver/driverkit-path.c
===
--- clang/test/Driver/driverkit-path.c
+++ clang/test/Driver/driverkit-path.c
@@ -29,6 +29,6 @@
 // INC:   -isysroot [[PATH:[^ ]*/Inputs/DriverKit19.0.sdk]]
 // INC-LABEL: #include <...> search starts here:
 // INC:   [[PATH]]/System/DriverKit/usr/local/include
-// INC:   /lib/clang/{{[^/ ]+}}/include
+// INC:   /lib{{(64)?}}/clang/{{[^/ ]+}}/include
 // INC:   [[PATH]]/System/DriverKit/usr/include
 // INC:   [[PATH]]/System/DriverKit/System/Library/Frameworks (framework 
directory)


Index: clang/test/Driver/driverkit-path.c
===
--- clang/test/Driver/driverkit-path.c
+++ clang/test/Driver/driverkit-path.c
@@ -29,6 +29,6 @@
 // INC:   -isysroot [[PATH:[^ ]*/Inputs/DriverKit19.0.sdk]]
 // INC-LABEL: #include <...> search starts here:
 // INC:   [[PATH]]/System/DriverKit/usr/local/include
-// INC:   /lib/clang/{{[^/ ]+}}/include
+// INC:   /lib{{(64)?}}/clang/{{[^/ ]+}}/include
 // INC:   [[PATH]]/System/DriverKit/usr/include
 // INC:   [[PATH]]/System/DriverKit/System/Library/Frameworks (framework directory)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D137484: [Test] Fix driverkit-path.c with lib64 dir

2022-11-08 Thread Thomas Preud'homme via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf3a86a23c10d: [Test] Fix driverkit-path.c with lib64 dir 
(authored by thopre).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137484/new/

https://reviews.llvm.org/D137484

Files:
  clang/test/Driver/driverkit-path.c


Index: clang/test/Driver/driverkit-path.c
===
--- clang/test/Driver/driverkit-path.c
+++ clang/test/Driver/driverkit-path.c
@@ -29,6 +29,6 @@
 // INC:   -isysroot [[PATH:[^ ]*/Inputs/DriverKit19.0.sdk]]
 // INC-LABEL: #include <...> search starts here:
 // INC:   [[PATH]]/System/DriverKit/usr/local/include
-// INC:   /lib/clang/{{[^/ ]+}}/include
+// INC:   /lib{{(64)?}}/clang/{{[^/ ]+}}/include
 // INC:   [[PATH]]/System/DriverKit/usr/include
 // INC:   [[PATH]]/System/DriverKit/System/Library/Frameworks (framework 
directory)


Index: clang/test/Driver/driverkit-path.c
===
--- clang/test/Driver/driverkit-path.c
+++ clang/test/Driver/driverkit-path.c
@@ -29,6 +29,6 @@
 // INC:   -isysroot [[PATH:[^ ]*/Inputs/DriverKit19.0.sdk]]
 // INC-LABEL: #include <...> search starts here:
 // INC:   [[PATH]]/System/DriverKit/usr/local/include
-// INC:   /lib/clang/{{[^/ ]+}}/include
+// INC:   /lib{{(64)?}}/clang/{{[^/ ]+}}/include
 // INC:   [[PATH]]/System/DriverKit/usr/include
 // INC:   [[PATH]]/System/DriverKit/System/Library/Frameworks (framework directory)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D138274: Add version to all LLVM cmake package

2022-11-18 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre created this revision.
thopre added reviewers: smeenai, arsenm, stella.stamenova, stellaraccident, 
Ericson2314, pmccormick, beanz.
Herald added a reviewer: bollu.
Herald added subscribers: Moerafaat, zero9178, bzcheeseman, sdasgup3, 
wenzhicui, wrengr, cota, teijeong, rdzhabarov, tatianashp, msifontes, jurahul, 
Kayjukh, grosul1, Joonsoo, liufengdb, aartbik, mgester, arpith-jacob, 
antiagainst, shauheen, rriddle, mehdi_amini.
Herald added a reviewer: sscalpone.
Herald added projects: Flang, All.
thopre requested review of this revision.
Herald added subscribers: cfe-commits, stephenneuendorffer, nicolasvasilache, 
jdoerfert, wdng.
Herald added projects: clang, MLIR.

Add a version to non-LLVM cmake package so that users needing an exact
version match can use the version parameter to find_package. Also adjust
the find_package(LLVM) to use an exact version match as well.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D138274

Files:
  clang/cmake/modules/CMakeLists.txt
  clang/cmake/modules/ClangConfig.cmake.in
  clang/cmake/modules/ClangConfigVersion.cmake.in
  flang/cmake/modules/CMakeLists.txt
  flang/cmake/modules/FlangConfig.cmake.in
  flang/cmake/modules/FlangConfigVersion.cmake.in
  lld/cmake/modules/CMakeLists.txt
  lld/cmake/modules/LLDConfig.cmake.in
  lld/cmake/modules/LLDConfigVersion.cmake.in
  mlir/cmake/modules/CMakeLists.txt
  mlir/cmake/modules/MLIRConfig.cmake.in
  mlir/cmake/modules/MLIRConfigVersion.cmake.in
  polly/cmake/CMakeLists.txt
  polly/cmake/PollyConfig.cmake.in
  polly/cmake/PollyConfigVersion.cmake.in

Index: polly/cmake/PollyConfigVersion.cmake.in
===
--- /dev/null
+++ polly/cmake/PollyConfigVersion.cmake.in
@@ -0,0 +1,13 @@
+set(PACKAGE_VERSION "@PACKAGE_VERSION@")
+
+# LLVM is API-compatible only with matching major.minor versions
+# and patch versions not less than that requested.
+if("@LLVM_VERSION_MAJOR@.@LLVM_VERSION_MINOR@" VERSION_EQUAL
+"${PACKAGE_FIND_VERSION_MAJOR}.${PACKAGE_FIND_VERSION_MINOR}"
+   AND NOT "@LLVM_VERSION_PATCH@" VERSION_LESS "${PACKAGE_FIND_VERSION_PATCH}")
+  set(PACKAGE_VERSION_COMPATIBLE 1)
+  if("@LLVM_VERSION_PATCH@" VERSION_EQUAL
+  "${PACKAGE_FIND_VERSION_PATCH}")
+set(PACKAGE_VERSION_EXACT 1)
+  endif()
+endif()
Index: polly/cmake/PollyConfig.cmake.in
===
--- polly/cmake/PollyConfig.cmake.in
+++ polly/cmake/PollyConfig.cmake.in
@@ -2,7 +2,8 @@
 
 @POLLY_CONFIG_CODE@
 
-find_package(LLVM REQUIRED CONFIG
+set(LLVM_VERSION ${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH})
+find_package(LLVM @LLVM_VERSION@ EXACT REQUIRED CONFIG
  HINTS "@POLLY_CONFIG_LLVM_CMAKE_DIR@")
 
 set(Polly_CMAKE_DIR ${CMAKE_CURRENT_LIST_DIR})
Index: polly/cmake/CMakeLists.txt
===
--- polly/cmake/CMakeLists.txt
+++ polly/cmake/CMakeLists.txt
@@ -82,6 +82,10 @@
   ${CMAKE_CURRENT_SOURCE_DIR}/PollyConfig.cmake.in
   ${polly_cmake_builddir}/PollyConfig.cmake
   @ONLY)
+configure_file(
+  ${CMAKE_CURRENT_SOURCE_DIR}/PollyConfigVersion.cmake.in
+  ${polly_cmake_builddir}/PollyConfigVersion.cmake
+  @ONLY)
 
 file(GENERATE
   OUTPUT ${polly_cmake_builddir}/${POLLY_EXPORTS_FILE_NAME}
@@ -138,6 +142,10 @@
   ${CMAKE_CURRENT_SOURCE_DIR}/PollyConfig.cmake.in
   ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/PollyConfig.cmake
   @ONLY)
+configure_file(
+  ${CMAKE_CURRENT_SOURCE_DIR}/PollyConfigVersion.cmake.in
+  ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/PollyConfigVersion.cmake
+  @ONLY)
 file(GENERATE OUTPUT
   ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${POLLY_EXPORTS_FILE_NAME}
   CONTENT "${POLLY_EXPORTS}")
@@ -146,6 +154,7 @@
   install(
 FILES
 "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/PollyConfig.cmake"
+"${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/PollyConfigVersion.cmake"
 "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${POLLY_EXPORTS_FILE_NAME}"
 DESTINATION "${POLLY_INSTALL_PACKAGE_DIR}")
 endif ()
Index: mlir/cmake/modules/MLIRConfigVersion.cmake.in
===
--- /dev/null
+++ mlir/cmake/modules/MLIRConfigVersion.cmake.in
@@ -0,0 +1,13 @@
+set(PACKAGE_VERSION "@PACKAGE_VERSION@")
+
+# LLVM is API-compatible only with matching major.minor versions
+# and patch versions not less than that requested.
+if("@LLVM_VERSION_MAJOR@.@LLVM_VERSION_MINOR@" VERSION_EQUAL
+"${PACKAGE_FIND_VERSION_MAJOR}.${PACKAGE_FIND_VERSION_MINOR}"
+   AND NOT "@LLVM_VERSION_PATCH@" VERSION_LESS "${PACKAGE_FIND_VERSION_PATCH}")
+  set(PACKAGE_VERSION_COMPATIBLE 1)
+  if("@LLVM_VERSION_PATCH@" VERSION_EQUAL
+  "${PACKAGE_FIND_VERSION_PATCH}")
+set(PACKAGE_VERSION_EXACT 1)
+  endif()
+endif()
Index: mlir/cmake/modules/MLIRConfig.cmake.in
===
--- mlir/cmake/modules/MLIRConfig.cmake.in
+++ mlir/cmake/modules/MLIRConfig.cmak

[PATCH] D138274: Add version to all LLVM cmake package

2022-11-19 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre added a comment.

In D138274#3938218 , @arsenm wrote:

> I thought we had this already. The amount of boiler plate required repeated 
> in each component is depressing, but I wouldn't be surprised if it's really 
> needed

I could configure the LLVMVersion file in llvm/cmake/module directly but I 
would need to refer to it from all those modified CMakeLists.txt and it didn't 
feel very clean either.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138274/new/

https://reviews.llvm.org/D138274

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


[PATCH] D138274: Add version to all LLVM cmake package

2022-11-20 Thread Thomas Preud'homme via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGad485b71b511: Add version to all LLVM cmake package 
(authored by thopre).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138274/new/

https://reviews.llvm.org/D138274

Files:
  clang/cmake/modules/CMakeLists.txt
  clang/cmake/modules/ClangConfig.cmake.in
  clang/cmake/modules/ClangConfigVersion.cmake.in
  flang/cmake/modules/CMakeLists.txt
  flang/cmake/modules/FlangConfig.cmake.in
  flang/cmake/modules/FlangConfigVersion.cmake.in
  lld/cmake/modules/CMakeLists.txt
  lld/cmake/modules/LLDConfig.cmake.in
  lld/cmake/modules/LLDConfigVersion.cmake.in
  mlir/cmake/modules/CMakeLists.txt
  mlir/cmake/modules/MLIRConfig.cmake.in
  mlir/cmake/modules/MLIRConfigVersion.cmake.in
  polly/cmake/CMakeLists.txt
  polly/cmake/PollyConfig.cmake.in
  polly/cmake/PollyConfigVersion.cmake.in

Index: polly/cmake/PollyConfigVersion.cmake.in
===
--- /dev/null
+++ polly/cmake/PollyConfigVersion.cmake.in
@@ -0,0 +1,13 @@
+set(PACKAGE_VERSION "@PACKAGE_VERSION@")
+
+# LLVM is API-compatible only with matching major.minor versions
+# and patch versions not less than that requested.
+if("@LLVM_VERSION_MAJOR@.@LLVM_VERSION_MINOR@" VERSION_EQUAL
+"${PACKAGE_FIND_VERSION_MAJOR}.${PACKAGE_FIND_VERSION_MINOR}"
+   AND NOT "@LLVM_VERSION_PATCH@" VERSION_LESS "${PACKAGE_FIND_VERSION_PATCH}")
+  set(PACKAGE_VERSION_COMPATIBLE 1)
+  if("@LLVM_VERSION_PATCH@" VERSION_EQUAL
+  "${PACKAGE_FIND_VERSION_PATCH}")
+set(PACKAGE_VERSION_EXACT 1)
+  endif()
+endif()
Index: polly/cmake/PollyConfig.cmake.in
===
--- polly/cmake/PollyConfig.cmake.in
+++ polly/cmake/PollyConfig.cmake.in
@@ -2,7 +2,8 @@
 
 @POLLY_CONFIG_CODE@
 
-find_package(LLVM REQUIRED CONFIG
+set(LLVM_VERSION ${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH})
+find_package(LLVM @LLVM_VERSION@ EXACT REQUIRED CONFIG
  HINTS "@POLLY_CONFIG_LLVM_CMAKE_DIR@")
 
 set(Polly_CMAKE_DIR ${CMAKE_CURRENT_LIST_DIR})
Index: polly/cmake/CMakeLists.txt
===
--- polly/cmake/CMakeLists.txt
+++ polly/cmake/CMakeLists.txt
@@ -82,6 +82,10 @@
   ${CMAKE_CURRENT_SOURCE_DIR}/PollyConfig.cmake.in
   ${polly_cmake_builddir}/PollyConfig.cmake
   @ONLY)
+configure_file(
+  ${CMAKE_CURRENT_SOURCE_DIR}/PollyConfigVersion.cmake.in
+  ${polly_cmake_builddir}/PollyConfigVersion.cmake
+  @ONLY)
 
 file(GENERATE
   OUTPUT ${polly_cmake_builddir}/${POLLY_EXPORTS_FILE_NAME}
@@ -138,6 +142,10 @@
   ${CMAKE_CURRENT_SOURCE_DIR}/PollyConfig.cmake.in
   ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/PollyConfig.cmake
   @ONLY)
+configure_file(
+  ${CMAKE_CURRENT_SOURCE_DIR}/PollyConfigVersion.cmake.in
+  ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/PollyConfigVersion.cmake
+  @ONLY)
 file(GENERATE OUTPUT
   ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${POLLY_EXPORTS_FILE_NAME}
   CONTENT "${POLLY_EXPORTS}")
@@ -146,6 +154,7 @@
   install(
 FILES
 "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/PollyConfig.cmake"
+"${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/PollyConfigVersion.cmake"
 "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${POLLY_EXPORTS_FILE_NAME}"
 DESTINATION "${POLLY_INSTALL_PACKAGE_DIR}")
 endif ()
Index: mlir/cmake/modules/MLIRConfigVersion.cmake.in
===
--- /dev/null
+++ mlir/cmake/modules/MLIRConfigVersion.cmake.in
@@ -0,0 +1,13 @@
+set(PACKAGE_VERSION "@PACKAGE_VERSION@")
+
+# LLVM is API-compatible only with matching major.minor versions
+# and patch versions not less than that requested.
+if("@LLVM_VERSION_MAJOR@.@LLVM_VERSION_MINOR@" VERSION_EQUAL
+"${PACKAGE_FIND_VERSION_MAJOR}.${PACKAGE_FIND_VERSION_MINOR}"
+   AND NOT "@LLVM_VERSION_PATCH@" VERSION_LESS "${PACKAGE_FIND_VERSION_PATCH}")
+  set(PACKAGE_VERSION_COMPATIBLE 1)
+  if("@LLVM_VERSION_PATCH@" VERSION_EQUAL
+  "${PACKAGE_FIND_VERSION_PATCH}")
+set(PACKAGE_VERSION_EXACT 1)
+  endif()
+endif()
Index: mlir/cmake/modules/MLIRConfig.cmake.in
===
--- mlir/cmake/modules/MLIRConfig.cmake.in
+++ mlir/cmake/modules/MLIRConfig.cmake.in
@@ -2,7 +2,8 @@
 
 @MLIR_CONFIG_CODE@
 
-find_package(LLVM REQUIRED CONFIG
+set(LLVM_VERSION ${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH})
+find_package(LLVM @LLVM_VERSION@ EXACT REQUIRED CONFIG
  HINTS "@MLIR_CONFIG_LLVM_CMAKE_DIR@")
 
 set(MLIR_EXPORTED_TARGETS "@MLIR_EXPORTS@")
Index: mlir/cmake/modules/CMakeLists.txt
===
--- mlir/cmake/modules/CMakeLists.txt
+++ mlir/cmake/modules/CMakeLists.txt
@@ -41,6 +41,10 @@
   ${CMAKE_CURRENT_SOURCE_DIR}/MLIRConfig.cmake.in
   ${mlir_cmake_builddir}/MLIRConfig.cmake
   @ONLY)
+configure_file(
+  ${CMAKE_

[PATCH] D138274: Add version to all LLVM cmake package

2022-11-25 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre reopened this revision.
thopre added inline comments.
This revision is now accepted and ready to land.



Comment at: clang/cmake/modules/ClangConfig.cmake.in:6
+set(LLVM_VERSION 
${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH})
+find_package(LLVM @LLVM_VERSION@ EXACT REQUIRED CONFIG
  HINTS "@CLANG_CONFIG_LLVM_CMAKE_DIR@")

mceier wrote:
> I think instead of  `@LLVM_VERSION@` it should be `${LLVM_VERSION}` since 
> `@LLVM_VERSION@` can be something like `16.0.0gitfce7a7aa` when 
> LLVM_VERSION_SUFFIX is set and that value is incorrect according to cmake 
> find_package:
> 
> >  find_package called with invalid argument "16.0.0gitfce7a7aa"
> 
> This error message is produced by cmake when configuring standalone build of 
> lldb:
> 
> > CMake Error at /usr/lib/llvm/16/lib64/cmake/clang/ClangConfig.cmake:10 
> > (find_package):
> > find_package called with invalid argument "16.0.0gitfce7a7aa"
> > Call Stack (most recent call first):
> > cmake/modules/LLDBStandalone.cmake:10 (find_package)
> > CMakeLists.txt:30 (include)
> 
> 
> 
Doh, yeah it was meant to use the variable above. I used PACKAGE_VERSION 
initially which is why I had those @@. Weird that it worked on my test despite 
using a git build. I've reverted and will upload a new version here.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138274/new/

https://reviews.llvm.org/D138274

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


[PATCH] D138274: Add version to all LLVM cmake package

2022-11-25 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre updated this revision to Diff 477916.
thopre added a comment.

Use LLVM_VERSION as a CMake variable and LLVM_VERSION_* as substitutions


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138274/new/

https://reviews.llvm.org/D138274

Files:
  clang/cmake/modules/CMakeLists.txt
  clang/cmake/modules/ClangConfig.cmake.in
  clang/cmake/modules/ClangConfigVersion.cmake.in
  flang/cmake/modules/CMakeLists.txt
  flang/cmake/modules/FlangConfig.cmake.in
  flang/cmake/modules/FlangConfigVersion.cmake.in
  lld/cmake/modules/CMakeLists.txt
  lld/cmake/modules/LLDConfig.cmake.in
  lld/cmake/modules/LLDConfigVersion.cmake.in
  mlir/cmake/modules/CMakeLists.txt
  mlir/cmake/modules/MLIRConfig.cmake.in
  mlir/cmake/modules/MLIRConfigVersion.cmake.in
  polly/cmake/CMakeLists.txt
  polly/cmake/PollyConfig.cmake.in
  polly/cmake/PollyConfigVersion.cmake.in

Index: polly/cmake/PollyConfigVersion.cmake.in
===
--- /dev/null
+++ polly/cmake/PollyConfigVersion.cmake.in
@@ -0,0 +1,13 @@
+set(PACKAGE_VERSION "@PACKAGE_VERSION@")
+
+# LLVM is API-compatible only with matching major.minor versions
+# and patch versions not less than that requested.
+if("@LLVM_VERSION_MAJOR@.@LLVM_VERSION_MINOR@" VERSION_EQUAL
+"${PACKAGE_FIND_VERSION_MAJOR}.${PACKAGE_FIND_VERSION_MINOR}"
+   AND NOT "@LLVM_VERSION_PATCH@" VERSION_LESS "${PACKAGE_FIND_VERSION_PATCH}")
+  set(PACKAGE_VERSION_COMPATIBLE 1)
+  if("@LLVM_VERSION_PATCH@" VERSION_EQUAL
+  "${PACKAGE_FIND_VERSION_PATCH}")
+set(PACKAGE_VERSION_EXACT 1)
+  endif()
+endif()
Index: polly/cmake/PollyConfig.cmake.in
===
--- polly/cmake/PollyConfig.cmake.in
+++ polly/cmake/PollyConfig.cmake.in
@@ -2,7 +2,8 @@
 
 @POLLY_CONFIG_CODE@
 
-find_package(LLVM REQUIRED CONFIG
+set(LLVM_VERSION @LLVM_VERSION_MAJOR@.@LLVM_VERSION_MINOR@.@LLVM_VERSION_PATCH@)
+find_package(LLVM ${LLVM_VERSION} EXACT REQUIRED CONFIG
  HINTS "@POLLY_CONFIG_LLVM_CMAKE_DIR@")
 
 set(Polly_CMAKE_DIR ${CMAKE_CURRENT_LIST_DIR})
Index: polly/cmake/CMakeLists.txt
===
--- polly/cmake/CMakeLists.txt
+++ polly/cmake/CMakeLists.txt
@@ -82,6 +82,10 @@
   ${CMAKE_CURRENT_SOURCE_DIR}/PollyConfig.cmake.in
   ${polly_cmake_builddir}/PollyConfig.cmake
   @ONLY)
+configure_file(
+  ${CMAKE_CURRENT_SOURCE_DIR}/PollyConfigVersion.cmake.in
+  ${polly_cmake_builddir}/PollyConfigVersion.cmake
+  @ONLY)
 
 file(GENERATE
   OUTPUT ${polly_cmake_builddir}/${POLLY_EXPORTS_FILE_NAME}
@@ -138,6 +142,10 @@
   ${CMAKE_CURRENT_SOURCE_DIR}/PollyConfig.cmake.in
   ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/PollyConfig.cmake
   @ONLY)
+configure_file(
+  ${CMAKE_CURRENT_SOURCE_DIR}/PollyConfigVersion.cmake.in
+  ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/PollyConfigVersion.cmake
+  @ONLY)
 file(GENERATE OUTPUT
   ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${POLLY_EXPORTS_FILE_NAME}
   CONTENT "${POLLY_EXPORTS}")
@@ -146,6 +154,7 @@
   install(
 FILES
 "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/PollyConfig.cmake"
+"${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/PollyConfigVersion.cmake"
 "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${POLLY_EXPORTS_FILE_NAME}"
 DESTINATION "${POLLY_INSTALL_PACKAGE_DIR}")
 endif ()
Index: mlir/cmake/modules/MLIRConfigVersion.cmake.in
===
--- /dev/null
+++ mlir/cmake/modules/MLIRConfigVersion.cmake.in
@@ -0,0 +1,13 @@
+set(PACKAGE_VERSION "@PACKAGE_VERSION@")
+
+# LLVM is API-compatible only with matching major.minor versions
+# and patch versions not less than that requested.
+if("@LLVM_VERSION_MAJOR@.@LLVM_VERSION_MINOR@" VERSION_EQUAL
+"${PACKAGE_FIND_VERSION_MAJOR}.${PACKAGE_FIND_VERSION_MINOR}"
+   AND NOT "@LLVM_VERSION_PATCH@" VERSION_LESS "${PACKAGE_FIND_VERSION_PATCH}")
+  set(PACKAGE_VERSION_COMPATIBLE 1)
+  if("@LLVM_VERSION_PATCH@" VERSION_EQUAL
+  "${PACKAGE_FIND_VERSION_PATCH}")
+set(PACKAGE_VERSION_EXACT 1)
+  endif()
+endif()
Index: mlir/cmake/modules/MLIRConfig.cmake.in
===
--- mlir/cmake/modules/MLIRConfig.cmake.in
+++ mlir/cmake/modules/MLIRConfig.cmake.in
@@ -2,7 +2,8 @@
 
 @MLIR_CONFIG_CODE@
 
-find_package(LLVM REQUIRED CONFIG
+set(LLVM_VERSION @LLVM_VERSION_MAJOR@.@LLVM_VERSION_MINOR@.@LLVM_VERSION_PATCH@)
+find_package(LLVM ${LLVM_VERSION} EXACT REQUIRED CONFIG
  HINTS "@MLIR_CONFIG_LLVM_CMAKE_DIR@")
 
 set(MLIR_EXPORTED_TARGETS "@MLIR_EXPORTS@")
Index: mlir/cmake/modules/CMakeLists.txt
===
--- mlir/cmake/modules/CMakeLists.txt
+++ mlir/cmake/modules/CMakeLists.txt
@@ -41,6 +41,10 @@
   ${CMAKE_CURRENT_SOURCE_DIR}/MLIRConfig.cmake.in
   ${mlir_cmake_builddir}/MLIRConfig.cmake
   @ONLY)
+configure_file(
+  ${CMAKE_CURRENT_SOURCE_DIR}/MLIRConf

[PATCH] D138274: Add version to all LLVM cmake package

2022-11-25 Thread Thomas Preud'homme via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGecfa2d3d9943: Add version to all LLVM cmake package 
(authored by thopre).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138274/new/

https://reviews.llvm.org/D138274

Files:
  clang/cmake/modules/CMakeLists.txt
  clang/cmake/modules/ClangConfig.cmake.in
  clang/cmake/modules/ClangConfigVersion.cmake.in
  flang/cmake/modules/CMakeLists.txt
  flang/cmake/modules/FlangConfig.cmake.in
  flang/cmake/modules/FlangConfigVersion.cmake.in
  lld/cmake/modules/CMakeLists.txt
  lld/cmake/modules/LLDConfig.cmake.in
  lld/cmake/modules/LLDConfigVersion.cmake.in
  mlir/cmake/modules/CMakeLists.txt
  mlir/cmake/modules/MLIRConfig.cmake.in
  mlir/cmake/modules/MLIRConfigVersion.cmake.in
  polly/cmake/CMakeLists.txt
  polly/cmake/PollyConfig.cmake.in
  polly/cmake/PollyConfigVersion.cmake.in

Index: polly/cmake/PollyConfigVersion.cmake.in
===
--- /dev/null
+++ polly/cmake/PollyConfigVersion.cmake.in
@@ -0,0 +1,13 @@
+set(PACKAGE_VERSION "@PACKAGE_VERSION@")
+
+# LLVM is API-compatible only with matching major.minor versions
+# and patch versions not less than that requested.
+if("@LLVM_VERSION_MAJOR@.@LLVM_VERSION_MINOR@" VERSION_EQUAL
+"${PACKAGE_FIND_VERSION_MAJOR}.${PACKAGE_FIND_VERSION_MINOR}"
+   AND NOT "@LLVM_VERSION_PATCH@" VERSION_LESS "${PACKAGE_FIND_VERSION_PATCH}")
+  set(PACKAGE_VERSION_COMPATIBLE 1)
+  if("@LLVM_VERSION_PATCH@" VERSION_EQUAL
+  "${PACKAGE_FIND_VERSION_PATCH}")
+set(PACKAGE_VERSION_EXACT 1)
+  endif()
+endif()
Index: polly/cmake/PollyConfig.cmake.in
===
--- polly/cmake/PollyConfig.cmake.in
+++ polly/cmake/PollyConfig.cmake.in
@@ -2,7 +2,8 @@
 
 @POLLY_CONFIG_CODE@
 
-find_package(LLVM REQUIRED CONFIG
+set(LLVM_VERSION @LLVM_VERSION_MAJOR@.@LLVM_VERSION_MINOR@.@LLVM_VERSION_PATCH@)
+find_package(LLVM ${LLVM_VERSION} EXACT REQUIRED CONFIG
  HINTS "@POLLY_CONFIG_LLVM_CMAKE_DIR@")
 
 set(Polly_CMAKE_DIR ${CMAKE_CURRENT_LIST_DIR})
Index: polly/cmake/CMakeLists.txt
===
--- polly/cmake/CMakeLists.txt
+++ polly/cmake/CMakeLists.txt
@@ -82,6 +82,10 @@
   ${CMAKE_CURRENT_SOURCE_DIR}/PollyConfig.cmake.in
   ${polly_cmake_builddir}/PollyConfig.cmake
   @ONLY)
+configure_file(
+  ${CMAKE_CURRENT_SOURCE_DIR}/PollyConfigVersion.cmake.in
+  ${polly_cmake_builddir}/PollyConfigVersion.cmake
+  @ONLY)
 
 file(GENERATE
   OUTPUT ${polly_cmake_builddir}/${POLLY_EXPORTS_FILE_NAME}
@@ -138,6 +142,10 @@
   ${CMAKE_CURRENT_SOURCE_DIR}/PollyConfig.cmake.in
   ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/PollyConfig.cmake
   @ONLY)
+configure_file(
+  ${CMAKE_CURRENT_SOURCE_DIR}/PollyConfigVersion.cmake.in
+  ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/PollyConfigVersion.cmake
+  @ONLY)
 file(GENERATE OUTPUT
   ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${POLLY_EXPORTS_FILE_NAME}
   CONTENT "${POLLY_EXPORTS}")
@@ -146,6 +154,7 @@
   install(
 FILES
 "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/PollyConfig.cmake"
+"${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/PollyConfigVersion.cmake"
 "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${POLLY_EXPORTS_FILE_NAME}"
 DESTINATION "${POLLY_INSTALL_PACKAGE_DIR}")
 endif ()
Index: mlir/cmake/modules/MLIRConfigVersion.cmake.in
===
--- /dev/null
+++ mlir/cmake/modules/MLIRConfigVersion.cmake.in
@@ -0,0 +1,13 @@
+set(PACKAGE_VERSION "@PACKAGE_VERSION@")
+
+# LLVM is API-compatible only with matching major.minor versions
+# and patch versions not less than that requested.
+if("@LLVM_VERSION_MAJOR@.@LLVM_VERSION_MINOR@" VERSION_EQUAL
+"${PACKAGE_FIND_VERSION_MAJOR}.${PACKAGE_FIND_VERSION_MINOR}"
+   AND NOT "@LLVM_VERSION_PATCH@" VERSION_LESS "${PACKAGE_FIND_VERSION_PATCH}")
+  set(PACKAGE_VERSION_COMPATIBLE 1)
+  if("@LLVM_VERSION_PATCH@" VERSION_EQUAL
+  "${PACKAGE_FIND_VERSION_PATCH}")
+set(PACKAGE_VERSION_EXACT 1)
+  endif()
+endif()
Index: mlir/cmake/modules/MLIRConfig.cmake.in
===
--- mlir/cmake/modules/MLIRConfig.cmake.in
+++ mlir/cmake/modules/MLIRConfig.cmake.in
@@ -2,7 +2,8 @@
 
 @MLIR_CONFIG_CODE@
 
-find_package(LLVM REQUIRED CONFIG
+set(LLVM_VERSION @LLVM_VERSION_MAJOR@.@LLVM_VERSION_MINOR@.@LLVM_VERSION_PATCH@)
+find_package(LLVM ${LLVM_VERSION} EXACT REQUIRED CONFIG
  HINTS "@MLIR_CONFIG_LLVM_CMAKE_DIR@")
 
 set(MLIR_EXPORTED_TARGETS "@MLIR_EXPORTS@")
Index: mlir/cmake/modules/CMakeLists.txt
===
--- mlir/cmake/modules/CMakeLists.txt
+++ mlir/cmake/modules/CMakeLists.txt
@@ -41,6 +41,10 @@
   ${CMAKE_CURRENT_SOURCE_DIR}/MLIRConfig.cmake.in
   ${mlir_cmake_builddir}/MLI

[PATCH] D68155: [clang][NFC] Make various uses of Regex const

2019-11-18 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre accepted this revision.
thopre added a comment.
This revision is now accepted and ready to land.

LGTM.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68155/new/

https://reviews.llvm.org/D68155



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


[PATCH] D68155: [clang][NFC] Make various uses of Regex const

2019-11-19 Thread Thomas Preud'homme via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb81cc6032902: [clang][NFC] Make various uses of Regex const 
(authored by thopre).

Changed prior to commit:
  https://reviews.llvm.org/D68155?vs=26&id=230079#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68155/new/

https://reviews.llvm.org/D68155

Files:
  clang/include/clang/Tooling/Inclusions/HeaderIncludes.h
  clang/lib/Format/BreakableToken.cpp
  clang/lib/Format/BreakableToken.h
  clang/lib/Format/NamespaceEndCommentsFixer.cpp
  clang/lib/Format/UnwrappedLineParser.cpp
  clang/tools/clang-refactor/TestSupport.cpp

Index: clang/tools/clang-refactor/TestSupport.cpp
===
--- clang/tools/clang-refactor/TestSupport.cpp
+++ clang/tools/clang-refactor/TestSupport.cpp
@@ -303,9 +303,10 @@
 
   // See the doc comment for this function for the explanation of this
   // syntax.
-  static Regex RangeRegex("range[[:blank:]]*([[:alpha:]_]*)?[[:blank:]]*=[[:"
-  "blank:]]*(\\+[[:digit:]]+)?[[:blank:]]*(->[[:blank:]"
-  "]*[\\+\\:[:digit:]]+)?");
+  static const Regex RangeRegex(
+  "range[[:blank:]]*([[:alpha:]_]*)?[[:blank:]]*=[[:"
+  "blank:]]*(\\+[[:digit:]]+)?[[:blank:]]*(->[[:blank:]"
+  "]*[\\+\\:[:digit:]]+)?");
 
   std::map> GroupedRanges;
 
@@ -352,7 +353,7 @@
 unsigned EndOffset;
 
 if (!Matches[3].empty()) {
-  static Regex EndLocRegex(
+  static const Regex EndLocRegex(
   "->[[:blank:]]*(\\+[[:digit:]]+):([[:digit:]]+)");
   SmallVector EndLocMatches;
   if (!EndLocRegex.match(Matches[3], &EndLocMatches)) {
Index: clang/lib/Format/UnwrappedLineParser.cpp
===
--- clang/lib/Format/UnwrappedLineParser.cpp
+++ clang/lib/Format/UnwrappedLineParser.cpp
@@ -2498,9 +2498,10 @@
 
 // Checks if \p FormatTok is a line comment that continues the line comment
 // section on \p Line.
-static bool continuesLineCommentSection(const FormatToken &FormatTok,
-const UnwrappedLine &Line,
-llvm::Regex &CommentPragmasRegex) {
+static bool
+continuesLineCommentSection(const FormatToken &FormatTok,
+const UnwrappedLine &Line,
+const llvm::Regex &CommentPragmasRegex) {
   if (Line.Tokens.empty())
 return false;
 
Index: clang/lib/Format/NamespaceEndCommentsFixer.cpp
===
--- clang/lib/Format/NamespaceEndCommentsFixer.cpp
+++ clang/lib/Format/NamespaceEndCommentsFixer.cpp
@@ -92,24 +92,24 @@
 
   // Matches a valid namespace end comment.
   // Valid namespace end comments don't need to be edited.
-  static llvm::Regex *const NamespaceCommentPattern =
-  new llvm::Regex("^/[/*] *(end (of )?)? *(anonymous|unnamed)? *"
-  "namespace( +([a-zA-Z0-9:_]+))?\\.? *(\\*/)?$",
-  llvm::Regex::IgnoreCase);
-  static llvm::Regex *const NamespaceMacroCommentPattern =
-  new llvm::Regex("^/[/*] *(end (of )?)? *(anonymous|unnamed)? *"
-  "([a-zA-Z0-9_]+)\\(([a-zA-Z0-9:_]*)\\)\\.? *(\\*/)?$",
-  llvm::Regex::IgnoreCase);
+  static const llvm::Regex NamespaceCommentPattern =
+  llvm::Regex("^/[/*] *(end (of )?)? *(anonymous|unnamed)? *"
+  "namespace( +([a-zA-Z0-9:_]+))?\\.? *(\\*/)?$",
+  llvm::Regex::IgnoreCase);
+  static const llvm::Regex NamespaceMacroCommentPattern =
+  llvm::Regex("^/[/*] *(end (of )?)? *(anonymous|unnamed)? *"
+  "([a-zA-Z0-9_]+)\\(([a-zA-Z0-9:_]*)\\)\\.? *(\\*/)?$",
+  llvm::Regex::IgnoreCase);
 
   SmallVector Groups;
   if (NamespaceTok->is(TT_NamespaceMacro) &&
-  NamespaceMacroCommentPattern->match(Comment->TokenText, &Groups)) {
+  NamespaceMacroCommentPattern.match(Comment->TokenText, &Groups)) {
 StringRef NamespaceTokenText = Groups.size() > 4 ? Groups[4] : "";
 // The name of the macro must be used.
 if (NamespaceTokenText != NamespaceTok->TokenText)
   return false;
   } else if (NamespaceTok->isNot(tok::kw_namespace) ||
- !NamespaceCommentPattern->match(Comment->TokenText, &Groups)) {
+ !NamespaceCommentPattern.match(Comment->TokenText, &Groups)) {
 // Comment does not match regex.
 return false;
   }
Index: clang/lib/Format/BreakableToken.h
===
--- clang/lib/Format/BreakableToken.h
+++ clang/lib/Format/BreakableToken.h
@@ -155,7 +155,7 @@
   /// file.
   virtual Split getSplit(unsigned LineIndex, unsigned TailOffset,
  unsigned ColumnLimit, unsigned ContentStartColumn,
- llvm::Regex &CommentPragmasRegex) const = 0;
+ 

[PATCH] D68155: [clang][NFC] Make various uses of Regex const

2019-11-19 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre added a comment.

My sincere apologies, I forgot to change the author in the commit. I don't 
often commit on behalf of others so didn't think enough.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68155/new/

https://reviews.llvm.org/D68155



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


[PATCH] D70748: [clang test] Do not assume default target

2019-11-26 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre created this revision.
thopre added a reviewer: thegameg.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

clang test Driver/darwin-opt-record.c assumes the default target is
x86_64 by its uses of the -arch x86_64 and -arch x86_64h and thus fail
on systems where it is not the case. Adding a target
x86_64-apple-darwin10 reveals another problem: the driver refuses 2
-arch for an assembly output so this commit also changes the output to
be an object file.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D70748

Files:
  clang/test/Driver/darwin-opt-record.c


Index: clang/test/Driver/darwin-opt-record.c
===
--- clang/test/Driver/darwin-opt-record.c
+++ clang/test/Driver/darwin-opt-record.c
@@ -1,6 +1,6 @@
 // REQUIRES: system-darwin
 
-// RUN: %clang -### -S -o FOO -fsave-optimization-record -arch x86_64 -arch 
x86_64h %s 2>&1 | FileCheck %s --check-prefix=CHECK-MULTIPLE-ARCH
+// RUN: %clang -target x86_64-apple-darwin10 -### -c -o FOO 
-fsave-optimization-record -arch x86_64 -arch x86_64h %s 2>&1 | FileCheck %s 
--check-prefix=CHECK-MULTIPLE-ARCH
 //
 // CHECK-MULTIPLE-ARCH: "-cc1"
 // CHECK-MULTIPLE-ARCH: "-opt-record-file" "FOO-x86_64.opt.yaml"


Index: clang/test/Driver/darwin-opt-record.c
===
--- clang/test/Driver/darwin-opt-record.c
+++ clang/test/Driver/darwin-opt-record.c
@@ -1,6 +1,6 @@
 // REQUIRES: system-darwin
 
-// RUN: %clang -### -S -o FOO -fsave-optimization-record -arch x86_64 -arch x86_64h %s 2>&1 | FileCheck %s --check-prefix=CHECK-MULTIPLE-ARCH
+// RUN: %clang -target x86_64-apple-darwin10 -### -c -o FOO -fsave-optimization-record -arch x86_64 -arch x86_64h %s 2>&1 | FileCheck %s --check-prefix=CHECK-MULTIPLE-ARCH
 //
 // CHECK-MULTIPLE-ARCH: "-cc1"
 // CHECK-MULTIPLE-ARCH: "-opt-record-file" "FOO-x86_64.opt.yaml"
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D70748: [clang test] Do not assume default target

2019-12-02 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre closed this revision.
thopre added a comment.

Committed as 717140a0dcc651ca2fec23248d1675fb2d388b9c 



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70748/new/

https://reviews.llvm.org/D70748



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


[PATCH] D71408: [lit] Remove lit's REQUIRES-ANY directive

2019-12-12 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre updated this revision to Diff 233712.
thopre added a comment.
Herald added subscribers: Sanitizers, cfe-commits, luismarques, apazos, 
sameer.abuasal, pzheng, s.egerton, lenary, jocewei, PkmX, the_o, brucehoult, 
MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, delcypher, niosHD, 
sabuasal, simoncook, johnrusso, rbar, asb.
Herald added projects: clang, Sanitizers.

Remove REQUIRES-ANY lit directive


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71408/new/

https://reviews.llvm.org/D71408

Files:
  clang/test/Driver/XRay/xray-instrument-macos.c
  clang/test/Driver/XRay/xray-instrument-os.c
  clang/test/Driver/XRay/xray-instrumentation-bundles-flags.cpp
  clang/test/Driver/XRay/xray-mode-flags.cpp
  clang/test/Driver/XRay/xray-nolinkdeps.cpp
  compiler-rt/test/builtins/Unit/arm/aeabi_cdcmpeq_test.c
  compiler-rt/test/builtins/Unit/arm/aeabi_cdcmple_test.c
  compiler-rt/test/builtins/Unit/arm/aeabi_cfcmpeq_test.c
  compiler-rt/test/builtins/Unit/arm/aeabi_cfcmple_test.c
  compiler-rt/test/builtins/Unit/arm/aeabi_drsub_test.c
  compiler-rt/test/builtins/Unit/arm/aeabi_frsub_test.c
  compiler-rt/test/builtins/Unit/arm/aeabi_idivmod_test.c
  compiler-rt/test/builtins/Unit/arm/aeabi_uidivmod_test.c
  compiler-rt/test/builtins/Unit/arm/aeabi_uldivmod_test.c
  compiler-rt/test/builtins/Unit/riscv/mulsi3_test.c
  llvm/utils/lit/lit/TestRunner.py
  llvm/utils/lit/tests/Inputs/shtest-format/requires-any-missing.txt
  llvm/utils/lit/tests/Inputs/shtest-format/requires-any-present.txt

Index: llvm/utils/lit/tests/Inputs/shtest-format/requires-any-present.txt
===
--- llvm/utils/lit/tests/Inputs/shtest-format/requires-any-present.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-RUN: true
-REQUIRES-ANY: a-missing-feature, a-present-feature
Index: llvm/utils/lit/tests/Inputs/shtest-format/requires-any-missing.txt
===
--- llvm/utils/lit/tests/Inputs/shtest-format/requires-any-missing.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-RUN: true
-REQUIRES-ANY: a-missing-feature, a-missing-feature-2
Index: llvm/utils/lit/lit/TestRunner.py
===
--- llvm/utils/lit/lit/TestRunner.py
+++ llvm/utils/lit/lit/TestRunner.py
@@ -1304,20 +1304,6 @@
 BooleanExpression.evaluate(s, [])
 return output
 
-@staticmethod
-def _handleRequiresAny(line_number, line, output):
-"""A custom parser to transform REQUIRES-ANY: into REQUIRES:"""
-
-# Extract the conditions specified in REQUIRES-ANY: as written.
-conditions = []
-IntegratedTestKeywordParser._handleList(line_number, line, conditions)
-
-# Output a `REQUIRES: a || b || c` expression in its place.
-expression = ' || '.join(conditions)
-IntegratedTestKeywordParser._handleBooleanExpr(line_number,
-   expression, output)
-return output
-
 def parseIntegratedTestScript(test, additional_parsers=[],
   require_script=True):
 """parseIntegratedTestScript - Scan an LLVM/Clang style integrated test
@@ -1341,9 +1327,6 @@
 initial_value=test.xfails),
 IntegratedTestKeywordParser('REQUIRES:', ParserKind.BOOLEAN_EXPR,
 initial_value=test.requires),
-IntegratedTestKeywordParser('REQUIRES-ANY:', ParserKind.CUSTOM,
-IntegratedTestKeywordParser._handleRequiresAny, 
-initial_value=test.requires), 
 IntegratedTestKeywordParser('UNSUPPORTED:', ParserKind.BOOLEAN_EXPR,
 initial_value=test.unsupported),
 IntegratedTestKeywordParser('END.', ParserKind.TAG)
Index: compiler-rt/test/builtins/Unit/riscv/mulsi3_test.c
===
--- compiler-rt/test/builtins/Unit/riscv/mulsi3_test.c
+++ compiler-rt/test/builtins/Unit/riscv/mulsi3_test.c
@@ -1,4 +1,4 @@
-// REQUIRES-ANY: riscv32-target-arch
+// REQUIRES: riscv32-target-arch
 // RUN: %clang_builtins %s %librt -o %t && %run %t
 //===-- mulsi3_test.c - Test __mulsi3 -===//
 //
Index: compiler-rt/test/builtins/Unit/arm/aeabi_uldivmod_test.c
===
--- compiler-rt/test/builtins/Unit/arm/aeabi_uldivmod_test.c
+++ compiler-rt/test/builtins/Unit/arm/aeabi_uldivmod_test.c
@@ -1,4 +1,4 @@
-// REQUIRES-ANY: arm-target-arch,armv6m-target-arch
+// REQUIRES: arm-target-arch || armv6m-target-arch
 // RUN: %clang_builtins %s %librt -o %t && %run %t
 //===-- aeabi_uldivmod_test.c - Test aeabi_uldivmod ---===//
 //
Index: compiler-rt/test/builtins/Unit/arm/aeabi_uidivmod_test.c
=

[PATCH] D71408: [lit] Remove lit's REQUIRES-ANY directive

2019-12-17 Thread Thomas Preud'homme via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGddd0bb8dba2a: [lit] Remove lit's REQUIRES-ANY directive 
(authored by thopre).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71408/new/

https://reviews.llvm.org/D71408

Files:
  clang/test/Driver/XRay/xray-instrument-macos.c
  clang/test/Driver/XRay/xray-instrument-os.c
  clang/test/Driver/XRay/xray-instrumentation-bundles-flags.cpp
  clang/test/Driver/XRay/xray-mode-flags.cpp
  clang/test/Driver/XRay/xray-nolinkdeps.cpp
  compiler-rt/test/builtins/Unit/arm/aeabi_cdcmpeq_test.c
  compiler-rt/test/builtins/Unit/arm/aeabi_cdcmple_test.c
  compiler-rt/test/builtins/Unit/arm/aeabi_cfcmpeq_test.c
  compiler-rt/test/builtins/Unit/arm/aeabi_cfcmple_test.c
  compiler-rt/test/builtins/Unit/arm/aeabi_drsub_test.c
  compiler-rt/test/builtins/Unit/arm/aeabi_frsub_test.c
  compiler-rt/test/builtins/Unit/arm/aeabi_idivmod_test.c
  compiler-rt/test/builtins/Unit/arm/aeabi_uidivmod_test.c
  compiler-rt/test/builtins/Unit/arm/aeabi_uldivmod_test.c
  compiler-rt/test/builtins/Unit/riscv/mulsi3_test.c
  llvm/utils/lit/lit/TestRunner.py
  llvm/utils/lit/tests/Inputs/shtest-format/requires-any-missing.txt
  llvm/utils/lit/tests/Inputs/shtest-format/requires-any-present.txt

Index: llvm/utils/lit/tests/Inputs/shtest-format/requires-any-present.txt
===
--- llvm/utils/lit/tests/Inputs/shtest-format/requires-any-present.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-RUN: true
-REQUIRES-ANY: a-missing-feature, a-present-feature
Index: llvm/utils/lit/tests/Inputs/shtest-format/requires-any-missing.txt
===
--- llvm/utils/lit/tests/Inputs/shtest-format/requires-any-missing.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-RUN: true
-REQUIRES-ANY: a-missing-feature, a-missing-feature-2
Index: llvm/utils/lit/lit/TestRunner.py
===
--- llvm/utils/lit/lit/TestRunner.py
+++ llvm/utils/lit/lit/TestRunner.py
@@ -1304,20 +1304,6 @@
 BooleanExpression.evaluate(s, [])
 return output
 
-@staticmethod
-def _handleRequiresAny(line_number, line, output):
-"""A custom parser to transform REQUIRES-ANY: into REQUIRES:"""
-
-# Extract the conditions specified in REQUIRES-ANY: as written.
-conditions = []
-IntegratedTestKeywordParser._handleList(line_number, line, conditions)
-
-# Output a `REQUIRES: a || b || c` expression in its place.
-expression = ' || '.join(conditions)
-IntegratedTestKeywordParser._handleBooleanExpr(line_number,
-   expression, output)
-return output
-
 def parseIntegratedTestScript(test, additional_parsers=[],
   require_script=True):
 """parseIntegratedTestScript - Scan an LLVM/Clang style integrated test
@@ -1341,9 +1327,6 @@
 initial_value=test.xfails),
 IntegratedTestKeywordParser('REQUIRES:', ParserKind.BOOLEAN_EXPR,
 initial_value=test.requires),
-IntegratedTestKeywordParser('REQUIRES-ANY:', ParserKind.CUSTOM,
-IntegratedTestKeywordParser._handleRequiresAny, 
-initial_value=test.requires), 
 IntegratedTestKeywordParser('UNSUPPORTED:', ParserKind.BOOLEAN_EXPR,
 initial_value=test.unsupported),
 IntegratedTestKeywordParser('END.', ParserKind.TAG)
Index: compiler-rt/test/builtins/Unit/riscv/mulsi3_test.c
===
--- compiler-rt/test/builtins/Unit/riscv/mulsi3_test.c
+++ compiler-rt/test/builtins/Unit/riscv/mulsi3_test.c
@@ -1,4 +1,4 @@
-// REQUIRES-ANY: riscv32-target-arch
+// REQUIRES: riscv32-target-arch
 // RUN: %clang_builtins %s %librt -o %t && %run %t
 //===-- mulsi3_test.c - Test __mulsi3 -===//
 //
Index: compiler-rt/test/builtins/Unit/arm/aeabi_uldivmod_test.c
===
--- compiler-rt/test/builtins/Unit/arm/aeabi_uldivmod_test.c
+++ compiler-rt/test/builtins/Unit/arm/aeabi_uldivmod_test.c
@@ -1,4 +1,4 @@
-// REQUIRES-ANY: arm-target-arch,armv6m-target-arch
+// REQUIRES: arm-target-arch || armv6m-target-arch
 // RUN: %clang_builtins %s %librt -o %t && %run %t
 //===-- aeabi_uldivmod_test.c - Test aeabi_uldivmod ---===//
 //
Index: compiler-rt/test/builtins/Unit/arm/aeabi_uidivmod_test.c
===
--- compiler-rt/test/builtins/Unit/arm/aeabi_uidivmod_test.c
+++ compiler-rt/test/builtins/Unit/arm/aeabi_uidivmod_test.c
@@ -1,4 +1,4 @@
-// REQUIRES-ANY: arm-target-arch,armv6m-target-arch
+// REQUIRES: arm-targ

[PATCH] D71408: [lit] Remove lit's REQUIRES-ANY directive

2019-12-17 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre added a subscriber: nemanjai.
thopre added a comment.
Herald added a subscriber: wuzish.

In D71408#1787959 , @jdenny wrote:

> This breaks the lit test suite.  `llvm/utils/lit/tests/shtest-format.py` 
> needs to be updated for the removed tests.


This is embarrassing. Thanks @nemanjai for fixing this. I did run the tests and 
remember having one FAIL which I could reproduce without the patch applied. I 
presume ninja check-all includes those 2 tests so I'm not sure how I missed it. 
On a related note, I used to receive mail notification when one of my commit 
would make a buildbot fail but don't anymore. Is there a way to register for 
those mail notification?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71408/new/

https://reviews.llvm.org/D71408



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


[PATCH] D100226: [funcattrs] Add the maximal set of implied attributes to definitions

2021-04-27 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre added inline comments.



Comment at: llvm/test/Transforms/FunctionAttrs/2008-09-03-ReadOnly.ll:14-15
 
-; CHECK: attributes #0 = { readonly }
+; CHECK: attributes #0 = { nofree readonly }
+; CHECK: attributes #1 = { readonly }

I'm getting #0 for both functions. Any idea why that might happen?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D100226/new/

https://reviews.llvm.org/D100226

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


[PATCH] D100226: [funcattrs] Add the maximal set of implied attributes to definitions

2021-04-27 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre added inline comments.



Comment at: llvm/test/Transforms/FunctionAttrs/2008-09-03-ReadOnly.ll:14-15
 
-; CHECK: attributes #0 = { readonly }
+; CHECK: attributes #0 = { nofree readonly }
+; CHECK: attributes #1 = { readonly }

jdoerfert wrote:
> thopre wrote:
> > I'm getting #0 for both functions. Any idea why that might happen?
> Random guess: your cmake was not rebuild since we switched to the new-PM and 
> `opt` defaults to the old one?
That's a good guess! We are still using the old PM. Thanks!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D100226/new/

https://reviews.llvm.org/D100226

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


[PATCH] D93347: [Test] Fix undef var in attr-speculative-load-hardening.c

2021-03-17 Thread Thomas Preud'homme via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG2426b1fa66f9: [Test] Fix undef var in 
attr-speculative-load-hardening.c (authored by thopre).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93347/new/

https://reviews.llvm.org/D93347

Files:
  clang/test/CodeGen/attr-speculative-load-hardening.c


Index: clang/test/CodeGen/attr-speculative-load-hardening.c
===
--- clang/test/CodeGen/attr-speculative-load-hardening.c
+++ clang/test/CodeGen/attr-speculative-load-hardening.c
@@ -12,4 +12,4 @@
 
 // NOSLH: @{{.*}}test1{{.*}}[[NOSLH:#[0-9]+]]
 
-// NOSLH-NOT: attributes [[SLH]] = { {{.*}}speculative_load_hardening{{.*}} }
+// NOSLH-NOT: attributes [[NOSLH]] = { {{.*}}speculative_load_hardening{{.*}} }


Index: clang/test/CodeGen/attr-speculative-load-hardening.c
===
--- clang/test/CodeGen/attr-speculative-load-hardening.c
+++ clang/test/CodeGen/attr-speculative-load-hardening.c
@@ -12,4 +12,4 @@
 
 // NOSLH: @{{.*}}test1{{.*}}[[NOSLH:#[0-9]+]]
 
-// NOSLH-NOT: attributes [[SLH]] = { {{.*}}speculative_load_hardening{{.*}} }
+// NOSLH-NOT: attributes [[NOSLH]] = { {{.*}}speculative_load_hardening{{.*}} }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D98852: [test] Fix variable definition in acle_sve_ld1.sh

2021-03-18 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre created this revision.
thopre added reviewers: andwar, david-arm, sdesmalen, SjoerdMeijer, kmclaughlin.
Herald added a subscriber: tschuett.
thopre requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Clang test acle_sve_ld1.sh is missing the colon in one of the string
variable definition separating the variable name from the regex. This
leads the substitution block to be parsed as a numeric variable use.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D98852

Files:
  clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_ld1sh.c


Index: clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_ld1sh.c
===
--- clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_ld1sh.c
+++ clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_ld1sh.c
@@ -114,7 +114,7 @@
 
 svint64_t test_svld1sh_gather_u64base_s64(svbool_t pg, svuint64_t bases) {
   // CHECK-LABEL: test_svld1sh_gather_u64base_s64
-  // CHECK: %[[PG.*]] = call  
@llvm.aarch64.sve.convert.from.svbool.nxv2i1( %pg)
+  // CHECK: %[[PG:.*]] = call  
@llvm.aarch64.sve.convert.from.svbool.nxv2i1( %pg)
   // CHECK: %[[LOAD:.*]] = call  
@llvm.aarch64.sve.ld1.gather.scalar.offset.nxv2i16.nxv2i64( 
%[[PG]],  %bases, i64 0)
   // CHECK: %[[SEXT:.*]] = sext  %[[LOAD]] to 
   // CHECK: ret  %[[SEXT]]


Index: clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_ld1sh.c
===
--- clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_ld1sh.c
+++ clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_ld1sh.c
@@ -114,7 +114,7 @@
 
 svint64_t test_svld1sh_gather_u64base_s64(svbool_t pg, svuint64_t bases) {
   // CHECK-LABEL: test_svld1sh_gather_u64base_s64
-  // CHECK: %[[PG.*]] = call  @llvm.aarch64.sve.convert.from.svbool.nxv2i1( %pg)
+  // CHECK: %[[PG:.*]] = call  @llvm.aarch64.sve.convert.from.svbool.nxv2i1( %pg)
   // CHECK: %[[LOAD:.*]] = call  @llvm.aarch64.sve.ld1.gather.scalar.offset.nxv2i16.nxv2i64( %[[PG]],  %bases, i64 0)
   // CHECK: %[[SEXT:.*]] = sext  %[[LOAD]] to 
   // CHECK: ret  %[[SEXT]]
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D98852: [test] Fix variable definition in acle_sve_ld1.sh

2021-03-18 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre added a comment.

In D98852#2634189 , @sdesmalen wrote:

> LGTM, thanks for fixing!
>
> I'm curious, how did you find this case? :)

The issue was caught by a patch of mine to FileCheck: 
https://reviews.llvm.org/D98691


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D98852/new/

https://reviews.llvm.org/D98852

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


  1   2   >