[clang] [llvm] Add support for Arm Cortex A78AE CPU (PR #84485)

2024-03-08 Thread Sjoerd Meijer via cfe-commits

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

Thanks for the quick fix. 
This looks okay to me. But let's see if @DavidSpickett has more comments before 
merging this. 

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


[clang] [flang] [llvm] [AArch64][Driver] Better handling of target feature dependencies (PR #78270)

2024-01-17 Thread Sjoerd Meijer via cfe-commits

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

This is a very big patch, but it makes a lot of sense. The idea to do it in 
this way is clearly an improvement. There are quite a number of (new) moving 
parts involved here, but look reasonable to me so let's give this is a try.  

Thanks for cleaning up the mess (also my mess). 

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


[clang] 9bd2730 - [Clang][AArch64] Add TargetParser support for defining CPU aliases

2022-10-25 Thread Sjoerd Meijer via cfe-commits

Author: Sjoerd Meijer
Date: 2022-10-25T15:08:15+05:30
New Revision: 9bd273047d4f66e3f36416acb295a3fd75bc6af4

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

LOG: [Clang][AArch64] Add TargetParser support for defining CPU aliases

This adds AArch64 TargetParser support to define CPU aliases, and
ports the definition of Grace over to that. This is following up
on D136425.

Differential Revision: https://reviews.llvm.org/D136611

Added: 


Modified: 
clang/test/Misc/target-invalid-cpu-note.c
llvm/include/llvm/Support/AArch64TargetParser.def
llvm/include/llvm/Support/AArch64TargetParser.h
llvm/lib/Support/AArch64TargetParser.cpp
llvm/unittests/Support/TargetParserTest.cpp

Removed: 




diff  --git a/clang/test/Misc/target-invalid-cpu-note.c 
b/clang/test/Misc/target-invalid-cpu-note.c
index 7857e72eca06..f2071c866956 100644
--- a/clang/test/Misc/target-invalid-cpu-note.c
+++ b/clang/test/Misc/target-invalid-cpu-note.c
@@ -5,11 +5,11 @@
 
 // RUN: not %clang_cc1 -triple arm64--- -target-cpu not-a-cpu -fsyntax-only %s 
2>&1 | FileCheck %s --check-prefix AARCH64
 // AARCH64: error: unknown target CPU 'not-a-cpu'
-// AARCH64-NEXT: note: valid target CPU values are: cortex-a34, cortex-a35, 
cortex-a53, cortex-a55, cortex-a510, cortex-a57, cortex-a65, cortex-a65ae, 
cortex-a72, cortex-a73, cortex-a75, cortex-a76, cortex-a76ae, cortex-a77, 
cortex-a78, cortex-a78c, cortex-a710, cortex-r82, cortex-x1, cortex-x1c, 
cortex-x2, neoverse-e1, neoverse-n1, neoverse-n2, neoverse-512tvb, neoverse-v1, 
neoverse-v2, cyclone, apple-a7, apple-a8, apple-a9, apple-a10, apple-a11, 
apple-a12, apple-a13, apple-a14, apple-a15, apple-a16, apple-m1, apple-m2, 
apple-s4, apple-s5, exynos-m3, exynos-m4, exynos-m5, falkor, saphira, kryo, 
thunderx2t99, thunderx3t110, thunderx, thunderxt88, thunderxt81, thunderxt83, 
tsv110, a64fx, carmel, ampere1{{$}}
+// AARCH64-NEXT: note: valid target CPU values are: cortex-a34, cortex-a35, 
cortex-a53, cortex-a55, cortex-a510, cortex-a57, cortex-a65, cortex-a65ae, 
cortex-a72, cortex-a73, cortex-a75, cortex-a76, cortex-a76ae, cortex-a77, 
cortex-a78, cortex-a78c, cortex-a710, cortex-r82, cortex-x1, cortex-x1c, 
cortex-x2, neoverse-e1, neoverse-n1, neoverse-n2, neoverse-512tvb, neoverse-v1, 
neoverse-v2, cyclone, apple-a7, apple-a8, apple-a9, apple-a10, apple-a11, 
apple-a12, apple-a13, apple-a14, apple-a15, apple-a16, apple-m1, apple-m2, 
apple-s4, apple-s5, exynos-m3, exynos-m4, exynos-m5, falkor, saphira, kryo, 
thunderx2t99, thunderx3t110, thunderx, thunderxt88, thunderxt81, thunderxt83, 
tsv110, a64fx, carmel, ampere1, grace{{$}}
 
 // RUN: not %clang_cc1 -triple arm64--- -tune-cpu not-a-cpu -fsyntax-only %s 
2>&1 | FileCheck %s --check-prefix TUNE_AARCH64
 // TUNE_AARCH64: error: unknown target CPU 'not-a-cpu'
-// TUNE_AARCH64-NEXT: note: valid target CPU values are: cortex-a34, 
cortex-a35, cortex-a53, cortex-a55, cortex-a510, cortex-a57, cortex-a65, 
cortex-a65ae, cortex-a72, cortex-a73, cortex-a75, cortex-a76, cortex-a76ae, 
cortex-a77, cortex-a78, cortex-a78c, cortex-a710, cortex-r82, cortex-x1, 
cortex-x1c, cortex-x2, neoverse-e1, neoverse-n1, neoverse-n2, neoverse-512tvb, 
neoverse-v1, neoverse-v2, cyclone, apple-a7, apple-a8, apple-a9, apple-a10, 
apple-a11, apple-a12, apple-a13, apple-a14, apple-a15, apple-a16,  apple-m1, 
apple-m2, apple-s4, apple-s5, exynos-m3, exynos-m4, exynos-m5, falkor, saphira, 
kryo, thunderx2t99, thunderx3t110, thunderx, thunderxt88, thunderxt81, 
thunderxt83, tsv110, a64fx, carmel, ampere1{{$}}
+// TUNE_AARCH64-NEXT: note: valid target CPU values are: cortex-a34, 
cortex-a35, cortex-a53, cortex-a55, cortex-a510, cortex-a57, cortex-a65, 
cortex-a65ae, cortex-a72, cortex-a73, cortex-a75, cortex-a76, cortex-a76ae, 
cortex-a77, cortex-a78, cortex-a78c, cortex-a710, cortex-r82, cortex-x1, 
cortex-x1c, cortex-x2, neoverse-e1, neoverse-n1, neoverse-n2, neoverse-512tvb, 
neoverse-v1, neoverse-v2, cyclone, apple-a7, apple-a8, apple-a9, apple-a10, 
apple-a11, apple-a12, apple-a13, apple-a14, apple-a15, apple-a16,  apple-m1, 
apple-m2, apple-s4, apple-s5, exynos-m3, exynos-m4, exynos-m5, falkor, saphira, 
kryo, thunderx2t99, thunderx3t110, thunderx, thunderxt88, thunderxt81, 
thunderxt83, tsv110, a64fx, carmel, ampere1, grace{{$}}
 
 // RUN: not %clang_cc1 -triple i386--- -target-cpu not-a-cpu -fsyntax-only %s 
2>&1 | FileCheck %s --check-prefix X86
 // X86: error: unknown target CPU 'not-a-cpu'

diff  --git a/llvm/include/llvm/Support/AArch64TargetParser.def 
b/llvm/include/llvm/Support/AArch64TargetParser.def
index 49ed806b1d56..2005638e38c3 100644
--- a/llvm/include/llvm/Support/AArch64TargetParser.def
+++ b/llvm/include/llvm/Support/AArch64TargetParser.def
@@ -315,3 +315,9 @@ AARCH64_CPU_NAME("ampere1", ARMV8_6A, 

[clang] 9ec7448 - [Clang][AArch64] Add support for -mcpu=grace

2022-10-24 Thread Sjoerd Meijer via cfe-commits

Author: Sjoerd Meijer
Date: 2022-10-24T17:36:24+05:30
New Revision: 9ec7448857c1bcbc9878e9912167d9453d3be673

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

LOG: [Clang][AArch64] Add support for -mcpu=grace

This adds Clang command line support for the NVIDIA Grace CPU [1], which
we would like to target with -mcpu=grace.

Grace is based on the Arm Neoverse V2 CPU [1], which is why, in the
driver, we pass neoverse-v2 to the compiler when grace is requested.
Thus, for now, it's an alias to Neoverse V2.

This adds support for grace in user-facing tool Clang, but not yet the
developer tools like opt and llc, so we probably want to follow up on
this.

[1] https://www.nvidia.com/en-us/data-center/grace-cpu/

Differential Revision: https://reviews.llvm.org/D136425

Added: 


Modified: 
clang/lib/Driver/ToolChains/Arch/AArch64.cpp
clang/test/Driver/aarch64-mcpu.c
llvm/include/llvm/Support/AArch64TargetParser.h

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/Arch/AArch64.cpp 
b/clang/lib/Driver/ToolChains/Arch/AArch64.cpp
index cf7e201b4972c..7956a0be46280 100644
--- a/clang/lib/Driver/ToolChains/Arch/AArch64.cpp
+++ b/clang/lib/Driver/ToolChains/Arch/AArch64.cpp
@@ -38,6 +38,8 @@ std::string aarch64::getAArch64TargetCPU(const ArgList ,
 CPU = Mcpu.split("+").first.lower();
   }
 
+  CPU = llvm::AArch64::resolveCPUAlias(CPU);
+
   // Handle CPU name is 'native'.
   if (CPU == "native")
 return std::string(llvm::sys::getHostCPUName());
@@ -121,6 +123,8 @@ static bool DecodeAArch64Mcpu(const Driver , StringRef 
Mcpu, StringRef ,
   CPU = Split.first;
   llvm::AArch64::ArchKind ArchKind = llvm::AArch64::ArchKind::ARMV8A;
 
+  CPU = llvm::AArch64::resolveCPUAlias(CPU);
+
   if (CPU == "native")
 CPU = llvm::sys::getHostCPUName();
 

diff  --git a/clang/test/Driver/aarch64-mcpu.c 
b/clang/test/Driver/aarch64-mcpu.c
index 8b2701f27a9eb..0433f6a5b3d3f 100644
--- a/clang/test/Driver/aarch64-mcpu.c
+++ b/clang/test/Driver/aarch64-mcpu.c
@@ -61,6 +61,9 @@
 // RUN: %clang -target aarch64 -mcpu=cortex-r82  -### -c %s 2>&1 | FileCheck 
-check-prefix=CORTEXR82 %s
 // CORTEXR82: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "cortex-r82"
 
+// RUN: %clang -target aarch64 -mcpu=grace -### -c %s 2>&1 | FileCheck 
-check-prefix=GRACE %s
+// GRACE: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "neoverse-v2"
+
 // == Check whether -mcpu and -mtune accept mixed-case values.
 // RUN: %clang -target aarch64 -mcpu=Cortex-a53 -### -c %s 2>&1 | FileCheck 
-check-prefix=CASE-INSENSITIVE-CA53 %s
 // RUN: %clang -target aarch64 -mtune=Cortex-a53 -### -c %s 2>&1 | FileCheck 
-check-prefix=CASE-INSENSITIVE-CA53-TUNE %s

diff  --git a/llvm/include/llvm/Support/AArch64TargetParser.h 
b/llvm/include/llvm/Support/AArch64TargetParser.h
index f4e157cf80562..3f0981d27427b 100644
--- a/llvm/include/llvm/Support/AArch64TargetParser.h
+++ b/llvm/include/llvm/Support/AArch64TargetParser.h
@@ -139,6 +139,13 @@ StringRef getArchExtName(unsigned ArchExtKind);
 StringRef getArchExtFeature(StringRef ArchExt);
 ArchKind convertV9toV8(ArchKind AK);
 
+// FIXME: We should be able to define CPU aliases in TargetParser.
+inline StringRef resolveCPUAlias(StringRef CPU) {
+  if (CPU == "grace")
+return "neoverse-v2";
+  return CPU;
+}
+
 // Information by Name
 unsigned getDefaultFPU(StringRef CPU, ArchKind AK);
 uint64_t getDefaultExtensions(StringRef CPU, ArchKind AK);



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


[clang] 260f90b - [AArch64] Add some missing Neoverse features

2021-02-19 Thread Sjoerd Meijer via cfe-commits

Author: Sjoerd Meijer
Date: 2021-02-19T09:18:35Z
New Revision: 260f90bb3d1aef90764de3506f86dedd1339e37c

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

LOG: [AArch64] Add some missing Neoverse features

This enables AES fusion and the post RA scheduler for the Neoverse cores.
And while we are it also for the A55 that we had missed earlier.

Differential Revision: https://reviews.llvm.org/D96866

Added: 


Modified: 
clang/test/Driver/aarch64-cpus.c
llvm/lib/Target/AArch64/AArch64.td
llvm/test/CodeGen/AArch64/misched-fusion-aes.ll

Removed: 




diff  --git a/clang/test/Driver/aarch64-cpus.c 
b/clang/test/Driver/aarch64-cpus.c
index 7ac2473915e8..5b9bd5207792 100644
--- a/clang/test/Driver/aarch64-cpus.c
+++ b/clang/test/Driver/aarch64-cpus.c
@@ -185,8 +185,14 @@
 // CORTEXA78: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "cortex-a78"
 // RUN: %clang -target aarch64 -mcpu=cortex-a78c  -### -c %s 2>&1 | FileCheck 
-check-prefix=CORTEX-A78C %s
 // CORTEX-A78C: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" 
"cortex-a78c"
+// RUN: %clang -target aarch64 -mcpu=neoverse-e1  -### -c %s 2>&1 | FileCheck 
-check-prefix=NEOVERSE-E1 %s
+// NEOVERSE-E1: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" 
"neoverse-e1"
 // RUN: %clang -target aarch64 -mcpu=neoverse-v1  -### -c %s 2>&1 | FileCheck 
-check-prefix=NEOVERSE-V1 %s
 // NEOVERSE-V1: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" 
"neoverse-v1"
+// RUN: %clang -target aarch64 -mcpu=neoverse-n1 -### -c %s 2>&1 | FileCheck 
-check-prefix=NEOVERSE-N1 %s
+// NEOVERSE-N1: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" 
"neoverse-n1"
+// RUN: %clang -target aarch64 -mcpu=neoverse-n2 -### -c %s 2>&1 | FileCheck 
-check-prefix=NEOVERSE-N2 %s
+// NEOVERSE-N2: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" 
"neoverse-n2"
 
 // RUN: %clang -target aarch64 -mcpu=cortex-r82  -### -c %s 2>&1 | FileCheck 
-check-prefix=CORTEXR82 %s
 // CORTEXR82: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "cortex-r82"
@@ -788,9 +794,6 @@
 // RUN: %clang -target aarch64 -march=armv8-a+ras -### -c %s 2>&1 | FileCheck 
-check-prefix=V8ARAS -check-prefix=GENERIC %s
 // V8ARAS: "-target-feature" "+ras"
 
-// RUN: %clang -target aarch64 -mcpu=neoverse-n2 -### -c %s 2>&1 | FileCheck 
-check-prefix=NEOVERSE-N2 %s
-// NEOVERSE-N2: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" 
"neoverse-n2"
-
 // == Check whether -march accepts mixed-case values.
 // RUN: %clang -target aarch64_be -march=ARMV8.1A -### -c %s 2>&1 | FileCheck 
-check-prefix=GENERICV81A-BE %s
 // RUN: %clang -target aarch64_be -march=ARMV8.1-A -### -c %s 2>&1 | FileCheck 
-check-prefix=GENERICV81A-BE %s

diff  --git a/llvm/lib/Target/AArch64/AArch64.td 
b/llvm/lib/Target/AArch64/AArch64.td
index 762855207d2b..bdf2e517deda 100644
--- a/llvm/lib/Target/AArch64/AArch64.td
+++ b/llvm/lib/Target/AArch64/AArch64.td
@@ -594,7 +594,9 @@ def ProcA55 : SubtargetFeature<"a55", "ARMProcFamily", 
"CortexA55",
FeatureFullFP16,
FeatureDotProd,
FeatureRCPC,
-   FeaturePerfMon
+   FeaturePerfMon,
+   FeaturePostRAScheduler,
+   FeatureUseAA
]>;
 
 def ProcA57 : SubtargetFeature<"a57", "ARMProcFamily", "CortexA57",
@@ -728,7 +730,7 @@ def ProcR82 : SubtargetFeature<"cortex-r82", 
"ARMProcFamily",
"CortexR82",
"Cortex-R82 ARM Processors", [
FeaturePostRAScheduler,
-   // TODO: crypto and FuseAES
+   FeatureUseAA,
// All other features are implied by v8_0r ops:
HasV8_0rOps,
]>;
@@ -977,6 +979,9 @@ def ProcNeoverseE1 : SubtargetFeature<"neoversee1", 
"ARMProcFamily",
   FeatureNEON,
   FeatureRCPC,
   FeatureSSBS,
+  FeaturePostRAScheduler,
+  FeatureUseAA,
+  FeatureFuseAES,
   ]>;
 
 def ProcNeoverseN1 : SubtargetFeature<"neoversen1", "ARMProcFamily",
@@ -991,6 +996,9 @@ def ProcNeoverseN1 : SubtargetFeature<"neoversen1", 
"ARMProcFamily",
   FeatureRCPC,
   FeatureSPE,
   

[clang] 99ad078 - [AArch64] Cortex-R82: remove crypto

2020-12-10 Thread Sjoerd Meijer via cfe-commits

Author: Sjoerd Meijer
Date: 2020-12-10T12:54:51Z
New Revision: 99ad078b91ed601cd19c75a44106a4f86bfa1a41

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

LOG: [AArch64] Cortex-R82: remove crypto

Remove target features crypto for Cortex-R82, because it doesn't have any, and
add LSE which was missing while we are at it.
This also removes crypto from the v8-R architecture description because that
aligns better with GCC and so far none of the R-cores have implemented crypto,
so is probably a more sensible default.

Differential Revision: https://reviews.llvm.org/D91994

Added: 


Modified: 
clang/lib/Driver/ToolChains/Arch/AArch64.cpp
clang/test/Preprocessor/aarch64-target-features.c
llvm/include/llvm/Support/AArch64TargetParser.def
llvm/unittests/Support/TargetParserTest.cpp

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/Arch/AArch64.cpp 
b/clang/lib/Driver/ToolChains/Arch/AArch64.cpp
index fca6d95d361b..13e4cac292d0 100644
--- a/clang/lib/Driver/ToolChains/Arch/AArch64.cpp
+++ b/clang/lib/Driver/ToolChains/Arch/AArch64.cpp
@@ -317,8 +317,7 @@ void aarch64::getAArch64TargetFeatures(const Driver ,
   NoCrypto = true;
   }
 
-  if (std::find(ItBegin, ItEnd, "+v8.4a") != ItEnd ||
-  std::find(ItBegin, ItEnd, "+v8r") != ItEnd) {
+  if (std::find(ItBegin, ItEnd, "+v8.4a") != ItEnd) {
 if (HasCrypto && !NoCrypto) {
   // Check if we have NOT disabled an algorithm with something like:
   //   +crypto, -algorithm

diff  --git a/clang/test/Preprocessor/aarch64-target-features.c 
b/clang/test/Preprocessor/aarch64-target-features.c
index f0b01f519a85..178098197d53 100644
--- a/clang/test/Preprocessor/aarch64-target-features.c
+++ b/clang/test/Preprocessor/aarch64-target-features.c
@@ -240,7 +240,7 @@
 // CHECK-MCPU-A57: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-feature" 
"+neon" "-target-feature" "+crc" "-target-feature" "+crypto"
 // CHECK-MCPU-A72: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-feature" 
"+neon" "-target-feature" "+crc" "-target-feature" "+crypto"
 // CHECK-MCPU-CORTEX-A73: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" 
"-target-feature" "+neon" "-target-feature" "+crc" "-target-feature" "+crypto"
-// CHECK-MCPU-CORTEX-R82: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" 
"-target-feature" "+v8r" "-target-feature" "+fp-armv8" "-target-feature" 
"+neon" "-target-feature" "+crc" "-target-feature" "+crypto" "-target-feature" 
"+dotprod" "-target-feature" "+fp16fml" "-target-feature" "+ras" 
"-target-feature" "+rdm" "-target-feature" "+rcpc" "-target-feature" 
"+fullfp16" "-target-feature" "+sm4" "-target-feature" "+sha3" 
"-target-feature" "+sha2" "-target-feature" "+aes"
+// CHECK-MCPU-CORTEX-R82: "-cc1"{{.*}} "-triple" "aarch64{{.*}}"  
"-target-feature" "+v8r" "-target-feature" "+fp-armv8" "-target-feature" 
"+neon" "-target-feature" "+crc" "-target-feature" "+dotprod" "-target-feature" 
"+fp16fml" "-target-feature" "+ras" "-target-feature" "+lse" "-target-feature" 
"+rdm" "-target-feature" "+rcpc" "-target-feature" "+fullfp16"
 // CHECK-MCPU-M1: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-feature" 
"+neon" "-target-feature" "+crc" "-target-feature" "+crypto"
 // CHECK-MCPU-M4: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-feature" 
"+neon" "-target-feature" "+crc" "-target-feature" "+crypto" "-target-feature" 
"+dotprod" "-target-feature" "+fullfp16"
 // CHECK-MCPU-KRYO: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-feature" 
"+neon" "-target-feature" "+crc" "-target-feature" "+crypto"

diff  --git a/llvm/include/llvm/Support/AArch64TargetParser.def 
b/llvm/include/llvm/Support/AArch64TargetParser.def
index 7625f5a6f6ab..34b6f72d4621 100644
--- a/llvm/include/llvm/Support/AArch64TargetParser.def
+++ b/llvm/include/llvm/Support/AArch64TargetParser.def
@@ -51,14 +51,14 @@ AARCH64_ARCH("armv8.6-a", ARMV8_6A, "8.6-A", "v8.6a",
   AArch64::AEK_RDM  | AArch64::AEK_RCPC | AArch64::AEK_DOTPROD |
   AArch64::AEK_SM4  | AArch64::AEK_SHA3 | AArch64::AEK_BF16|
   AArch64::AEK_SHA2 | AArch64::AEK_AES  | AArch64::AEK_I8MM))
+// For v8-R, we do not enable crypto and align with GCC that enables a more
+// minimal set of optional architecture extensions.
 AARCH64_ARCH("armv8-r", ARMV8R, "8-R", "v8r",
  ARMBuildAttrs::CPUArch::v8_R, FK_CRYPTO_NEON_FP_ARMV8,
- (AArch64::AEK_CRC | AArch64::AEK_RDM  | AArch64::AEK_SSBS|
-  AArch64::AEK_CRYPTO  | AArch64::AEK_SM4  | AArch64::AEK_SHA3|
-  AArch64::AEK_SHA2| AArch64::AEK_AES  | AArch64::AEK_DOTPROD |
-  AArch64::AEK_FP  | AArch64::AEK_SIMD | AArch64::AEK_FP16|
-  AArch64::AEK_FP16FML | AArch64::AEK_RAS  | AArch64::AEK_RCPC|
-  AArch64::AEK_SB))
+ 

[clang] 8825fec - [AArch64] Add CPU Cortex-R82

2020-10-02 Thread Sjoerd Meijer via cfe-commits

Author: Sjoerd Meijer
Date: 2020-10-02T12:47:23+01:00
New Revision: 8825fec37e73eea1bc3e4f5c125e1fd02d002d6c

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

LOG: [AArch64] Add CPU Cortex-R82

This adds support for -mcpu=cortex-r82. Some more information about this
core can be found here:

https://www.arm.com/products/silicon-ip-cpu/cortex-r/cortex-r82

One note about the system register: that is a bit of a refactoring because of
small differences between v8.4-A AArch64 and v8-R AArch64.

This is based on patches from Mark Murray and Mikhail Maltsev.

Differential Revision: https://reviews.llvm.org/D88660

Added: 


Modified: 
clang/lib/Basic/Targets/AArch64.cpp
clang/lib/Driver/ToolChains/Arch/AArch64.cpp
clang/test/Driver/aarch64-cpus.c
clang/test/Driver/aarch64-dotprod.c
clang/test/Preprocessor/aarch64-target-features.c
llvm/include/llvm/Support/AArch64TargetParser.def
llvm/lib/Support/AArch64TargetParser.cpp
llvm/lib/Target/AArch64/AArch64.td
llvm/lib/Target/AArch64/AArch64Subtarget.cpp
llvm/lib/Target/AArch64/AArch64Subtarget.h
llvm/lib/Target/AArch64/AArch64SystemOperands.td
llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
llvm/unittests/Support/TargetParserTest.cpp

Removed: 




diff  --git a/clang/lib/Basic/Targets/AArch64.cpp 
b/clang/lib/Basic/Targets/AArch64.cpp
index 7f0a0f0d86dc..e25a783cfa66 100644
--- a/clang/lib/Basic/Targets/AArch64.cpp
+++ b/clang/lib/Basic/Targets/AArch64.cpp
@@ -481,6 +481,8 @@ bool 
AArch64TargetInfo::handleTargetFeatures(std::vector ,
   ArchKind = llvm::AArch64::ArchKind::ARMV8_5A;
 if (Feature == "+v8.6a")
   ArchKind = llvm::AArch64::ArchKind::ARMV8_6A;
+if (Feature == "+v8r")
+  ArchKind = llvm::AArch64::ArchKind::ARMV8R;
 if (Feature == "+fullfp16")
   HasFullFP16 = true;
 if (Feature == "+dotprod")

diff  --git a/clang/lib/Driver/ToolChains/Arch/AArch64.cpp 
b/clang/lib/Driver/ToolChains/Arch/AArch64.cpp
index 6c5e43704cc4..fe742b4bcfcd 100644
--- a/clang/lib/Driver/ToolChains/Arch/AArch64.cpp
+++ b/clang/lib/Driver/ToolChains/Arch/AArch64.cpp
@@ -306,7 +306,8 @@ void aarch64::getAArch64TargetFeatures(const Driver ,
   NoCrypto = true;
   }
 
-  if (std::find(ItBegin, ItEnd, "+v8.4a") != ItEnd) {
+  if (std::find(ItBegin, ItEnd, "+v8.4a") != ItEnd ||
+  std::find(ItBegin, ItEnd, "+v8r") != ItEnd) {
 if (HasCrypto && !NoCrypto) {
   // Check if we have NOT disabled an algorithm with something like:
   //   +crypto, -algorithm

diff  --git a/clang/test/Driver/aarch64-cpus.c 
b/clang/test/Driver/aarch64-cpus.c
index f39241bee8a6..356674e7a707 100644
--- a/clang/test/Driver/aarch64-cpus.c
+++ b/clang/test/Driver/aarch64-cpus.c
@@ -178,6 +178,9 @@
 // RUN: %clang -target aarch64 -mcpu=cortex-a78  -### -c %s 2>&1 | FileCheck 
-check-prefix=CORTEXA78 %s
 // CORTEXA78: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "cortex-a78"
 
+// RUN: %clang -target aarch64 -mcpu=cortex-r82  -### -c %s 2>&1 | FileCheck 
-check-prefix=CORTEXR82 %s
+// CORTEXR82: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "cortex-r82"
+
 // RUN: %clang -target aarch64_be -mcpu=exynos-m3 -### -c %s 2>&1 | FileCheck 
-check-prefix=M3 %s
 // RUN: %clang -target aarch64 -mbig-endian -mcpu=exynos-m3 -### -c %s 2>&1 | 
FileCheck -check-prefix=M3 %s
 // RUN: %clang -target aarch64_be -mbig-endian -mcpu=exynos-m3 -### -c %s 2>&1 
| FileCheck -check-prefix=M3 %s

diff  --git a/clang/test/Driver/aarch64-dotprod.c 
b/clang/test/Driver/aarch64-dotprod.c
index a6d0c9c4e1ce..3ca79d54daa7 100644
--- a/clang/test/Driver/aarch64-dotprod.c
+++ b/clang/test/Driver/aarch64-dotprod.c
@@ -9,4 +9,5 @@
 // RUN: %clang -### -target aarch64 -mcpu=cortex-a75 %s 2>&1 | FileCheck %s
 // RUN: %clang -### -target aarch64 -mcpu=cortex-a76 %s 2>&1 | FileCheck %s
 // RUN: %clang -### -target aarch64 -mcpu=cortex-a55 %s 2>&1 | FileCheck %s
+// RUN: %clang -### -target aarch64 -mcpu=cortex-r82 %s 2>&1 | FileCheck %s
 // CHECK: "+dotprod"

diff  --git a/clang/test/Preprocessor/aarch64-target-features.c 
b/clang/test/Preprocessor/aarch64-target-features.c
index cb137eea072e..ad84ba93ccf3 100644
--- a/clang/test/Preprocessor/aarch64-target-features.c
+++ b/clang/test/Preprocessor/aarch64-target-features.c
@@ -219,6 +219,7 @@
 // RUN: %clang -target aarch64 -mcpu=cortex-a57 -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-MCPU-A57 %s
 // RUN: %clang -target aarch64 -mcpu=cortex-a72 -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-MCPU-A72 %s
 // RUN: %clang -target aarch64 -mcpu=cortex-a73 -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-MCPU-CORTEX-A73 %s
+// RUN: %clang -target aarch64 -mcpu=cortex-r82 -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-MCPU-CORTEX-R82 %s
 // RUN: %clang 

[clang] 5567c62 - [Matrix] Add LowerMatrixIntrinsics to the NPM

2020-07-22 Thread Sjoerd Meijer via cfe-commits

Author: Sjoerd Meijer
Date: 2020-07-22T09:47:53+01:00
New Revision: 5567c62afa559dc2f2604601ec9269f1e3fbfdab

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

LOG: [Matrix] Add LowerMatrixIntrinsics to the NPM

Pass LowerMatrixIntrinsics wasn't running yet running under the new pass
manager, and this adds LowerMatrixIntrinsics to the pipeline (to the
same place as where it is running in the old PM).

Differential Revision: https://reviews.llvm.org/D84180

Added: 
clang/test/CodeGen/matrix-lowering-opt-levels.c

Modified: 
clang/lib/CodeGen/BackendUtil.cpp
llvm/lib/Passes/PassBuilder.cpp
llvm/lib/Transforms/IPO/PassManagerBuilder.cpp

Removed: 




diff  --git a/clang/lib/CodeGen/BackendUtil.cpp 
b/clang/lib/CodeGen/BackendUtil.cpp
index 3405c48bc389..111ca1981fe3 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -74,6 +74,7 @@
 #include "llvm/Transforms/ObjCARC.h"
 #include "llvm/Transforms/Scalar.h"
 #include "llvm/Transforms/Scalar/GVN.h"
+#include "llvm/Transforms/Scalar/LowerMatrixIntrinsics.h"
 #include "llvm/Transforms/Utils.h"
 #include "llvm/Transforms/Utils/CanonicalizeAliases.h"
 #include "llvm/Transforms/Utils/EntryExitInstrumenter.h"
@@ -1372,6 +1373,13 @@ void EmitAssemblyHelper::EmitAssemblyWithNewPassManager(
 }
 
 if (CodeGenOpts.OptimizationLevel == 0) {
+  // FIXME: the backends do not handle matrix intrinsics currently. Make
+  // sure they are also lowered in O0. A lightweight version of the pass
+  // should run in the backend pipeline on demand.
+  if (LangOpts.MatrixTypes)
+MPM.addPass(
+createModuleToFunctionPassAdaptor(LowerMatrixIntrinsicsPass()));
+
   addCoroutinePassesAtO0(MPM, LangOpts, CodeGenOpts);
   addSanitizersAtO0(MPM, TargetTriple, LangOpts, CodeGenOpts);
 }

diff  --git a/clang/test/CodeGen/matrix-lowering-opt-levels.c 
b/clang/test/CodeGen/matrix-lowering-opt-levels.c
new file mode 100644
index ..73a9458b8bf5
--- /dev/null
+++ b/clang/test/CodeGen/matrix-lowering-opt-levels.c
@@ -0,0 +1,28 @@
+// RUN: %clang -O0 -fenable-matrix -S -emit-llvm %s -o - | FileCheck  %s
+// RUN: %clang -O1 -fenable-matrix -S -emit-llvm %s -o - | FileCheck  %s
+// RUN: %clang -O2 -fenable-matrix -S -emit-llvm %s -o - | FileCheck  %s
+// RUN: %clang -O3 -fenable-matrix -S -emit-llvm %s -o - | FileCheck  %s
+// RUN: %clang -Ofast -fenable-matrix -S -emit-llvm %s -o - | FileCheck  %s
+// RUN: %clang -Os -fenable-matrix -S -emit-llvm %s -o - | FileCheck  %s
+// RUN: %clang -Oz -fenable-matrix -S -emit-llvm %s -o - | FileCheck  %s
+
+// RUN: %clang -O0 -fenable-matrix -fexperimental-new-pass-manager -S 
-emit-llvm %s -o - | FileCheck  %s
+// RUN: %clang -O1 -fenable-matrix -fexperimental-new-pass-manager -S 
-emit-llvm %s -o - | FileCheck  %s
+// RUN: %clang -O2 -fenable-matrix -fexperimental-new-pass-manager -S 
-emit-llvm %s -o - | FileCheck  %s
+// RUN: %clang -O3 -fenable-matrix -fexperimental-new-pass-manager -S 
-emit-llvm %s -o - | FileCheck  %s
+// RUN: %clang -Ofast -fenable-matrix -fexperimental-new-pass-manager -S 
-emit-llvm %s -o - | FileCheck  %s
+// RUN: %clang -Os -fenable-matrix -fexperimental-new-pass-manager -S 
-emit-llvm %s -o - | FileCheck  %s
+// RUN: %clang -Oz -fenable-matrix -fexperimental-new-pass-manager -S 
-emit-llvm %s -o - | FileCheck  %s
+
+// Smoke test that the matrix intrinsics are lowered at any optimisation level.
+
+typedef float m4x4_t __attribute__((matrix_type(4, 4)));
+
+m4x4_t f(m4x4_t a, m4x4_t b, m4x4_t c) {
+  //
+  // CHECK-LABEL: f(
+  // CHECK-NOT: @llvm.matrix
+  // CHECK:   }
+  //
+  return a + b * c;
+}

diff  --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp
index 76c3c8a90f2d..b534853a1213 100644
--- a/llvm/lib/Passes/PassBuilder.cpp
+++ b/llvm/lib/Passes/PassBuilder.cpp
@@ -275,6 +275,8 @@ extern cl::opt FlattenedProfileUsed;
 extern cl::opt AttributorRun;
 extern cl::opt EnableKnowledgeRetention;
 
+extern cl::opt EnableMatrix;
+
 const PassBuilder::OptimizationLevel PassBuilder::OptimizationLevel::O0 = {
 /*SpeedLevel*/ 0,
 /*SizeLevel*/ 0};
@@ -1093,6 +1095,11 @@ ModulePassManager 
PassBuilder::buildModuleOptimizationPipeline(
   OptimizePM.addPass(Float2IntPass());
   OptimizePM.addPass(LowerConstantIntrinsicsPass());
 
+  if (EnableMatrix) {
+OptimizePM.addPass(LowerMatrixIntrinsicsPass());
+OptimizePM.addPass(EarlyCSEPass());
+  }
+
   // FIXME: We need to run some loop optimizations to re-rotate loops after
   // simplify-cfg and others undo their rotation.
 

diff  --git a/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp 
b/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
index 5a3be7580c6e..c045c277706b 100644
--- 

[clang] c2d69d8 - Remove clang matrix lowering test for now as it is still failing under the NPM.

2020-07-17 Thread Sjoerd Meijer via cfe-commits

Author: Sjoerd Meijer
Date: 2020-07-17T22:42:12+01:00
New Revision: c2d69d8d62f2aac941453177e2ae872f5f82feda

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

LOG: Remove clang matrix lowering test for now as it is still failing under the 
NPM.

Added: 


Modified: 


Removed: 
clang/test/CodeGen/matrix-lowering-opt-levels.c



diff  --git a/clang/test/CodeGen/matrix-lowering-opt-levels.c 
b/clang/test/CodeGen/matrix-lowering-opt-levels.c
deleted file mode 100644
index 9edecbe46bc8..
--- a/clang/test/CodeGen/matrix-lowering-opt-levels.c
+++ /dev/null
@@ -1,23 +0,0 @@
-// RUN: %clang -O1 -fenable-matrix -S -emit-llvm %s -o - | FileCheck  %s
-// RUN: %clang -O2 -fenable-matrix -S -emit-llvm %s -o - | FileCheck  %s
-// RUN: %clang -O3 -fenable-matrix -S -emit-llvm %s -o - | FileCheck  %s
-// RUN: %clang -Ofast -fenable-matrix -S -emit-llvm %s -o - | FileCheck  %s
-// RUN: %clang -Os -fenable-matrix -S -emit-llvm %s -o - | FileCheck  %s
-// RUN: %clang -Oz -fenable-matrix -S -emit-llvm %s -o - | FileCheck  %s
-
-// Smoke test that the matrix intrinsics are lowered at any optimisation level.
-
-// FIXME: this fails with the NPM:
-//
-// %clang -O0 -fenable-matrix -S -emit-llvm %s -o - | FileCheck  %s
-
-typedef float m4x4_t __attribute__((matrix_type(4, 4)));
-
-m4x4_t f(m4x4_t a, m4x4_t b, m4x4_t c) {
-  //
-  // CHECK-LABEL: f(
-  // CHECK-NOT: @llvm.matrix
-  // CHECK:   }
-  //
-  return a + b * c;
-}



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


[clang] 0160ad8 - And now really disable that test.

2020-07-16 Thread Sjoerd Meijer via cfe-commits

Author: Sjoerd Meijer
Date: 2020-07-16T16:14:47+01:00
New Revision: 0160ad802e899c2922bc9b29564080c22eb0908c

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

LOG: And now really disable that test.

Added: 


Modified: 
clang/test/CodeGen/matrix-lowering-opt-levels.c

Removed: 




diff  --git a/clang/test/CodeGen/matrix-lowering-opt-levels.c 
b/clang/test/CodeGen/matrix-lowering-opt-levels.c
index db003f140ee8..9edecbe46bc8 100644
--- a/clang/test/CodeGen/matrix-lowering-opt-levels.c
+++ b/clang/test/CodeGen/matrix-lowering-opt-levels.c
@@ -9,7 +9,7 @@
 
 // FIXME: this fails with the NPM:
 //
-// RUN: %clang -O0 -fenable-matrix -S -emit-llvm %s -o - | FileCheck  %s
+// %clang -O0 -fenable-matrix -S -emit-llvm %s -o - | FileCheck  %s
 
 typedef float m4x4_t __attribute__((matrix_type(4, 4)));
 



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


[clang] 31248b4 - Last attempt for rG3a624c327add: one test fails with the NPM,

2020-07-16 Thread Sjoerd Meijer via cfe-commits

Author: Sjoerd Meijer
Date: 2020-07-16T16:12:47+01:00
New Revision: 31248b4785c14e50c1694fc986c69afcea64bd81

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

LOG: Last attempt for rG3a624c327add: one test fails with the NPM,
so disable that one for now.

Added: 


Modified: 
clang/test/CodeGen/matrix-lowering-opt-levels.c

Removed: 




diff  --git a/clang/test/CodeGen/matrix-lowering-opt-levels.c 
b/clang/test/CodeGen/matrix-lowering-opt-levels.c
index a288d18264bf..db003f140ee8 100644
--- a/clang/test/CodeGen/matrix-lowering-opt-levels.c
+++ b/clang/test/CodeGen/matrix-lowering-opt-levels.c
@@ -1,6 +1,3 @@
-// REQUIRES: aarch64-registered-target
-
-// RUN: %clang -O0 -fenable-matrix -S -emit-llvm %s -o - | FileCheck  %s
 // RUN: %clang -O1 -fenable-matrix -S -emit-llvm %s -o - | FileCheck  %s
 // RUN: %clang -O2 -fenable-matrix -S -emit-llvm %s -o - | FileCheck  %s
 // RUN: %clang -O3 -fenable-matrix -S -emit-llvm %s -o - | FileCheck  %s
@@ -10,6 +7,10 @@
 
 // Smoke test that the matrix intrinsics are lowered at any optimisation level.
 
+// FIXME: this fails with the NPM:
+//
+// RUN: %clang -O0 -fenable-matrix -S -emit-llvm %s -o - | FileCheck  %s
+
 typedef float m4x4_t __attribute__((matrix_type(4, 4)));
 
 m4x4_t f(m4x4_t a, m4x4_t b, m4x4_t c) {



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


[clang] a7a07a8 - Follow up of rG3a624c327add: pacify buildbot, add "REQUIRES: aarch64" to test

2020-07-16 Thread Sjoerd Meijer via cfe-commits

Author: Sjoerd Meijer
Date: 2020-07-16T15:38:36+01:00
New Revision: a7a07a8d63b2008750347932e351d479a45bfc2c

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

LOG: Follow up of rG3a624c327add: pacify buildbot, add "REQUIRES: aarch64" to 
test

Added: 


Modified: 
clang/test/CodeGen/matrix-lowering-opt-levels.c

Removed: 




diff  --git a/clang/test/CodeGen/matrix-lowering-opt-levels.c 
b/clang/test/CodeGen/matrix-lowering-opt-levels.c
index 8f86cc158f67..a288d18264bf 100644
--- a/clang/test/CodeGen/matrix-lowering-opt-levels.c
+++ b/clang/test/CodeGen/matrix-lowering-opt-levels.c
@@ -1,3 +1,5 @@
+// REQUIRES: aarch64-registered-target
+
 // RUN: %clang -O0 -fenable-matrix -S -emit-llvm %s -o - | FileCheck  %s
 // RUN: %clang -O1 -fenable-matrix -S -emit-llvm %s -o - | FileCheck  %s
 // RUN: %clang -O2 -fenable-matrix -S -emit-llvm %s -o - | FileCheck  %s



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


[clang] 3a624c3 - [Matrix] Add the matrix test from D83570. NFC.

2020-07-16 Thread Sjoerd Meijer via cfe-commits

Author: Sjoerd Meijer
Date: 2020-07-16T15:19:45+01:00
New Revision: 3a624c327adde62d075a4477e9bb9e6a2c186731

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

LOG: [Matrix] Add the matrix test from D83570. NFC.

Added: 
clang/test/CodeGen/matrix-lowering-opt-levels.c

Modified: 


Removed: 




diff  --git a/clang/test/CodeGen/matrix-lowering-opt-levels.c 
b/clang/test/CodeGen/matrix-lowering-opt-levels.c
new file mode 100644
index ..8f86cc158f67
--- /dev/null
+++ b/clang/test/CodeGen/matrix-lowering-opt-levels.c
@@ -0,0 +1,20 @@
+// RUN: %clang -O0 -fenable-matrix -S -emit-llvm %s -o - | FileCheck  %s
+// RUN: %clang -O1 -fenable-matrix -S -emit-llvm %s -o - | FileCheck  %s
+// RUN: %clang -O2 -fenable-matrix -S -emit-llvm %s -o - | FileCheck  %s
+// RUN: %clang -O3 -fenable-matrix -S -emit-llvm %s -o - | FileCheck  %s
+// RUN: %clang -Ofast -fenable-matrix -S -emit-llvm %s -o - | FileCheck  %s
+// RUN: %clang -Os -fenable-matrix -S -emit-llvm %s -o - | FileCheck  %s
+// RUN: %clang -Oz -fenable-matrix -S -emit-llvm %s -o - | FileCheck  %s
+
+// Smoke test that the matrix intrinsics are lowered at any optimisation level.
+
+typedef float m4x4_t __attribute__((matrix_type(4, 4)));
+
+m4x4_t f(m4x4_t a, m4x4_t b, m4x4_t c) {
+  //
+  // CHECK-LABEL: f(
+  // CHECK-NOT: @llvm.matrix
+  // CHECK:   }
+  //
+  return a + b * c;
+}



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


[clang] 35cf2f4 - [Driver][docs] Document option -mtune as a no-op.

2020-04-22 Thread Sjoerd Meijer via cfe-commits

Author: Sjoerd Meijer
Date: 2020-04-22T09:15:48+01:00
New Revision: 35cf2f42dda4d708741e06570b2dbe91cec4dc41

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

LOG: [Driver][docs] Document option -mtune as a no-op.

This documents that option -mtune is accepted for compatibility with GCC,
currently it has no effect, and thus does not currently perform any CPU type
specific tuning.

Corresponding discussion on the cfe dev list:
http://lists.llvm.org/pipermail/cfe-dev/2020-April/065169.html

Differential Revision: https://reviews.llvm.org/D78511

Added: 


Modified: 
clang/docs/ClangCommandLineReference.rst
clang/include/clang/Driver/Options.td

Removed: 




diff  --git a/clang/docs/ClangCommandLineReference.rst 
b/clang/docs/ClangCommandLineReference.rst
index c7afcf7cf605..a10e747153e2 100644
--- a/clang/docs/ClangCommandLineReference.rst
+++ b/clang/docs/ClangCommandLineReference.rst
@@ -2735,6 +2735,8 @@ Specify bit size of immediate TLS offsets (AArch64 ELF 
only): 12 (for 4KB) \| 24
 .. option:: -mtune=
 .. program:: clang
 
+Accepted for compatibility with GCC. Currently has no effect.
+
 .. option:: -mtvos-version-min=, -mappletvos-version-min=
 
 .. option:: -municode

diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 2ec7269372b1..f9850c60f62d 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -2721,7 +2721,8 @@ def muclibc : Flag<["-"], "muclibc">, 
Group, Flags<[HelpHidden]>;
 def module_file_info : Flag<["-"], "module-file-info">, 
Flags<[DriverOption,CC1Option]>, Group,
   HelpText<"Provide information about a particular module file">;
 def mthumb : Flag<["-"], "mthumb">, Group;
-def mtune_EQ : Joined<["-"], "mtune=">, Group;
+def mtune_EQ : Joined<["-"], "mtune=">, Group,
+  HelpText<"Accepted for compatibility with GCC. Currently has no effect.">;
 def multi__module : Flag<["-"], "multi_module">;
 def multiply__defined__unused : Separate<["-"], "multiply_defined_unused">;
 def multiply__defined : Separate<["-"], "multiply_defined">;



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


[clang] e32f8ef - Follow up of 3d9a0445cce3, clang driver defaulting to -fno-common

2020-03-09 Thread Sjoerd Meijer via cfe-commits

Author: Sjoerd Meijer
Date: 2020-03-09T20:43:05Z
New Revision: e32f8ef9277dbaaeef1fbabe9505683ff5e35edf

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

LOG: Follow up of 3d9a0445cce3, clang driver defaulting to -fno-common

Attempt to pacify windows bot where this failed:

clang/test/CodeGen/vlt_to_pointer.c

Added: 


Modified: 
clang/test/CodeGen/vlt_to_pointer.c

Removed: 




diff  --git a/clang/test/CodeGen/vlt_to_pointer.c 
b/clang/test/CodeGen/vlt_to_pointer.c
index 129a1df3..d46d7275ac77 100644
--- a/clang/test/CodeGen/vlt_to_pointer.c
+++ b/clang/test/CodeGen/vlt_to_pointer.c
@@ -1,7 +1,7 @@
 // RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
 
 int c[1][3*2];
-// CHECK: @{{.+}} = global [1 x [6 x {{i[0-9]+}}]] zeroinitializer
+// CHECK: @{{.+}} ={{.*}}global [1 x [6 x {{i[0-9]+}}]] zeroinitializer
 
 // CHECK-LABEL: @f
 int f(int * const m, int (**v)[*m * 2])



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


[clang] 3d9a044 - Recommit #2 "[Driver] Default to -fno-common for all targets"

2020-03-09 Thread Sjoerd Meijer via cfe-commits

Author: Sjoerd Meijer
Date: 2020-03-09T19:57:03Z
New Revision: 3d9a0445cce368b55dc3a573bc91fe902bbb977f

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

LOG: Recommit #2 "[Driver] Default to -fno-common for all targets"

After a first attempt to fix the test-suite failures, my first recommit
caused the same failures again. I had updated CMakeList.txt files of
tests that needed -fcommon, but it turns out that there are also
Makefiles which are used by some bots, so I've updated these Makefiles
now too.

See the original commit message for more details on this change:
0a9fc9233e172601e26381810d093e02ef410f65

Added: 
clang/test/Driver/no-common.c

Modified: 
clang/docs/ClangCommandLineReference.rst
clang/docs/ReleaseNotes.rst
clang/include/clang/Driver/Options.td
clang/lib/Driver/ToolChains/Clang.cpp
clang/lib/Frontend/CompilerInvocation.cpp
clang/test/CodeGen/2008-07-21-mixed-var-fn-decl.c
clang/test/CodeGen/2009-10-20-GlobalDebug.c
clang/test/CodeGen/aarch64-sve.c
clang/test/CodeGen/address-space.c
clang/test/CodeGen/alias.c
clang/test/CodeGen/align-systemz.c
clang/test/CodeGen/alignment.c
clang/test/CodeGen/asm-label.c
clang/test/CodeGen/attr-weak-import.c
clang/test/CodeGen/attr-weakref2.c
clang/test/CodeGen/attributes.c
clang/test/CodeGen/blocks-windows.c
clang/test/CodeGen/bool-convert.c
clang/test/CodeGen/c11atomics.c
clang/test/CodeGen/cfstring-elf-cfbuild-x86_64.c
clang/test/CodeGen/cfstring-windows.c
clang/test/CodeGen/default-address-space.c
clang/test/CodeGen/dllexport-1.c
clang/test/CodeGen/dllexport.c
clang/test/CodeGen/dllimport.c
clang/test/CodeGen/microsoft-no-common-align.c
clang/test/CodeGen/no-common.c
clang/test/CodeGen/pr25786.c
clang/test/CodeGen/pragma-pack-1.c
clang/test/CodeGen/pragma-weak.c
clang/test/CodeGen/private-extern-redef.c
clang/test/CodeGen/tentative-decls.c
clang/test/CodeGen/tls-model.c
clang/test/CodeGen/visibility.c
clang/test/CodeGen/vlt_to_pointer.c
clang/test/CodeGen/volatile-1.c
clang/test/CodeGen/windows-on-arm-dllimport-dllexport.c
clang/test/CodeGenCXX/clang-sections-tentative.c
clang/test/CodeGenObjC/constant-string-class.m
clang/test/CodeGenObjC/tentative-cfconstantstring.m
clang/test/CodeGenOpenCL/address-spaces.cl
clang/test/CodeGenOpenCL/amdgcn-large-globals.cl
clang/test/CodeGenOpenCL/amdgpu-nullptr.cl
clang/test/Driver/apple-kext-mkernel.c
clang/test/Driver/clang_f_opts.c
clang/test/Driver/fuchsia.c
clang/test/Driver/xcore-opts.c
clang/test/Frontend/ast-codegen.c
clang/test/Headers/xmmintrin.c
clang/test/PCH/chain-external-defs.c
clang/test/PCH/external-defs.c
clang/test/PCH/tentative-defs.c
clang/test/Parser/pragma-visibility2.c
compiler-rt/test/asan/TestCases/Linux/odr_c_test.c
compiler-rt/test/asan/TestCases/set_shadow_test.c

Removed: 
clang/test/CodeGen/weak-global.c



diff  --git a/clang/docs/ClangCommandLineReference.rst 
b/clang/docs/ClangCommandLineReference.rst
index 609e7fa66c00..5af9d64ae0fc 100644
--- a/clang/docs/ClangCommandLineReference.rst
+++ b/clang/docs/ClangCommandLineReference.rst
@@ -1307,6 +1307,10 @@ Use colors in diagnostics
 
 .. option:: -fcommon, -fno-common
 
+Place definitions of variables with no storage class and no initializer
+(tentative definitions) in a common block, instead of generating individual
+zero-initialized definitions (default -fno-common).
+
 .. option:: -fcompile-resource=, --resource , --resource=
 
 .. option:: -fconstant-cfstrings, -fno-constant-cfstrings

diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index ce121ebe6055..664ae4e4167c 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -84,6 +84,13 @@ future versions of Clang.
 Modified Compiler Flags
 ---
 
+- -fno-common has been enabled as the default for all targets.  Therefore, C
+  code that uses tentative definitions as definitions of a variable in multiple
+  translation units will trigger multiple-definition linker errors.  Generally,
+  this occurs when the use of the ``extern`` keyword is neglected in the 
declaration
+  of a variable in a header file. In some cases, no specific translation unit
+  provides a definition of the variable. The previous behavior can be restored 
by
+  specifying ``-fcommon``.
 
 New Pragmas in Clang
 

diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 0d5cba8d682a..bdcd771ff713 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -848,7 +848,8 @@ def fno_record_command_line : Flag<["-"], 

[clang] f35d112 - Revert "Recommit "[Driver] Default to -fno-common for all targets""

2020-03-09 Thread Sjoerd Meijer via cfe-commits

Author: Sjoerd Meijer
Date: 2020-03-09T10:37:28Z
New Revision: f35d112efdb33abee853aeab8a5ed4a4743e204d

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

LOG: Revert "Recommit "[Driver] Default to -fno-common for all targets""

This reverts commit 2c36c23f3476baf3b9283ea387c579419a70b112.

Still problems in the test-suite, which I really thought I had fixed...

Added: 
clang/test/CodeGen/weak-global.c

Modified: 
clang/docs/ClangCommandLineReference.rst
clang/docs/ReleaseNotes.rst
clang/include/clang/Driver/Options.td
clang/lib/Driver/ToolChains/Clang.cpp
clang/lib/Frontend/CompilerInvocation.cpp
clang/test/CodeGen/2008-07-21-mixed-var-fn-decl.c
clang/test/CodeGen/2009-10-20-GlobalDebug.c
clang/test/CodeGen/aarch64-sve.c
clang/test/CodeGen/address-space.c
clang/test/CodeGen/alias.c
clang/test/CodeGen/align-systemz.c
clang/test/CodeGen/alignment.c
clang/test/CodeGen/asm-label.c
clang/test/CodeGen/attr-weak-import.c
clang/test/CodeGen/attr-weakref2.c
clang/test/CodeGen/attributes.c
clang/test/CodeGen/blocks-windows.c
clang/test/CodeGen/bool-convert.c
clang/test/CodeGen/c11atomics.c
clang/test/CodeGen/cfstring-elf-cfbuild-x86_64.c
clang/test/CodeGen/cfstring-windows.c
clang/test/CodeGen/default-address-space.c
clang/test/CodeGen/dllexport-1.c
clang/test/CodeGen/dllexport.c
clang/test/CodeGen/dllimport.c
clang/test/CodeGen/microsoft-no-common-align.c
clang/test/CodeGen/no-common.c
clang/test/CodeGen/pr25786.c
clang/test/CodeGen/pragma-pack-1.c
clang/test/CodeGen/pragma-weak.c
clang/test/CodeGen/private-extern-redef.c
clang/test/CodeGen/tentative-decls.c
clang/test/CodeGen/tls-model.c
clang/test/CodeGen/visibility.c
clang/test/CodeGen/vlt_to_pointer.c
clang/test/CodeGen/volatile-1.c
clang/test/CodeGen/windows-on-arm-dllimport-dllexport.c
clang/test/CodeGenCXX/clang-sections-tentative.c
clang/test/CodeGenObjC/constant-string-class.m
clang/test/CodeGenObjC/tentative-cfconstantstring.m
clang/test/CodeGenOpenCL/address-spaces.cl
clang/test/CodeGenOpenCL/amdgcn-large-globals.cl
clang/test/CodeGenOpenCL/amdgpu-nullptr.cl
clang/test/Driver/apple-kext-mkernel.c
clang/test/Driver/clang_f_opts.c
clang/test/Driver/fuchsia.c
clang/test/Driver/xcore-opts.c
clang/test/Frontend/ast-codegen.c
clang/test/Headers/xmmintrin.c
clang/test/PCH/chain-external-defs.c
clang/test/PCH/external-defs.c
clang/test/PCH/tentative-defs.c
clang/test/Parser/pragma-visibility2.c
compiler-rt/test/asan/TestCases/Linux/odr_c_test.c
compiler-rt/test/asan/TestCases/set_shadow_test.c

Removed: 
clang/test/Driver/no-common.c



diff  --git a/clang/docs/ClangCommandLineReference.rst 
b/clang/docs/ClangCommandLineReference.rst
index 5af9d64ae0fc..609e7fa66c00 100644
--- a/clang/docs/ClangCommandLineReference.rst
+++ b/clang/docs/ClangCommandLineReference.rst
@@ -1307,10 +1307,6 @@ Use colors in diagnostics
 
 .. option:: -fcommon, -fno-common
 
-Place definitions of variables with no storage class and no initializer
-(tentative definitions) in a common block, instead of generating individual
-zero-initialized definitions (default -fno-common).
-
 .. option:: -fcompile-resource=, --resource , --resource=
 
 .. option:: -fconstant-cfstrings, -fno-constant-cfstrings

diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 664ae4e4167c..ce121ebe6055 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -84,13 +84,6 @@ future versions of Clang.
 Modified Compiler Flags
 ---
 
-- -fno-common has been enabled as the default for all targets.  Therefore, C
-  code that uses tentative definitions as definitions of a variable in multiple
-  translation units will trigger multiple-definition linker errors.  Generally,
-  this occurs when the use of the ``extern`` keyword is neglected in the 
declaration
-  of a variable in a header file. In some cases, no specific translation unit
-  provides a definition of the variable. The previous behavior can be restored 
by
-  specifying ``-fcommon``.
 
 New Pragmas in Clang
 

diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index bdcd771ff713..0d5cba8d682a 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -848,8 +848,7 @@ def fno_record_command_line : Flag<["-"], 
"fno-record-command-line">,
   Group;
 def : Flag<["-"], "frecord-gcc-switches">, Alias;
 def : Flag<["-"], "fno-record-gcc-switches">, Alias;
-def fcommon : Flag<["-"], "fcommon">, Group,
-  Flags<[CoreOption, CC1Option]>, HelpText<"Place 

[clang] 2c36c23 - Recommit "[Driver] Default to -fno-common for all targets"

2020-03-09 Thread Sjoerd Meijer via cfe-commits

Author: Sjoerd Meijer
Date: 2020-03-09T10:07:37Z
New Revision: 2c36c23f3476baf3b9283ea387c579419a70b112

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

LOG: Recommit "[Driver] Default to -fno-common for all targets"

This includes fixes for:
- test-suite: some benchmarks need to be compiled with -fcommon, see D75557.
- compiler-rt: one test needed -fcommon, and another a change, see D75520.

Added: 
clang/test/Driver/no-common.c

Modified: 
clang/docs/ClangCommandLineReference.rst
clang/docs/ReleaseNotes.rst
clang/include/clang/Driver/Options.td
clang/lib/Driver/ToolChains/Clang.cpp
clang/lib/Frontend/CompilerInvocation.cpp
clang/test/CodeGen/2008-07-21-mixed-var-fn-decl.c
clang/test/CodeGen/2009-10-20-GlobalDebug.c
clang/test/CodeGen/aarch64-sve.c
clang/test/CodeGen/address-space.c
clang/test/CodeGen/alias.c
clang/test/CodeGen/align-systemz.c
clang/test/CodeGen/alignment.c
clang/test/CodeGen/asm-label.c
clang/test/CodeGen/attr-weak-import.c
clang/test/CodeGen/attr-weakref2.c
clang/test/CodeGen/attributes.c
clang/test/CodeGen/blocks-windows.c
clang/test/CodeGen/bool-convert.c
clang/test/CodeGen/c11atomics.c
clang/test/CodeGen/cfstring-elf-cfbuild-x86_64.c
clang/test/CodeGen/cfstring-windows.c
clang/test/CodeGen/default-address-space.c
clang/test/CodeGen/dllexport-1.c
clang/test/CodeGen/dllexport.c
clang/test/CodeGen/dllimport.c
clang/test/CodeGen/microsoft-no-common-align.c
clang/test/CodeGen/no-common.c
clang/test/CodeGen/pr25786.c
clang/test/CodeGen/pragma-pack-1.c
clang/test/CodeGen/pragma-weak.c
clang/test/CodeGen/private-extern-redef.c
clang/test/CodeGen/tentative-decls.c
clang/test/CodeGen/tls-model.c
clang/test/CodeGen/visibility.c
clang/test/CodeGen/vlt_to_pointer.c
clang/test/CodeGen/volatile-1.c
clang/test/CodeGen/windows-on-arm-dllimport-dllexport.c
clang/test/CodeGenCXX/clang-sections-tentative.c
clang/test/CodeGenObjC/constant-string-class.m
clang/test/CodeGenObjC/tentative-cfconstantstring.m
clang/test/CodeGenOpenCL/address-spaces.cl
clang/test/CodeGenOpenCL/amdgcn-large-globals.cl
clang/test/CodeGenOpenCL/amdgpu-nullptr.cl
clang/test/Driver/apple-kext-mkernel.c
clang/test/Driver/clang_f_opts.c
clang/test/Driver/fuchsia.c
clang/test/Driver/xcore-opts.c
clang/test/Frontend/ast-codegen.c
clang/test/Headers/xmmintrin.c
clang/test/PCH/chain-external-defs.c
clang/test/PCH/external-defs.c
clang/test/PCH/tentative-defs.c
clang/test/Parser/pragma-visibility2.c
compiler-rt/test/asan/TestCases/Linux/odr_c_test.c
compiler-rt/test/asan/TestCases/set_shadow_test.c

Removed: 
clang/test/CodeGen/weak-global.c



diff  --git a/clang/docs/ClangCommandLineReference.rst 
b/clang/docs/ClangCommandLineReference.rst
index 609e7fa66c00..5af9d64ae0fc 100644
--- a/clang/docs/ClangCommandLineReference.rst
+++ b/clang/docs/ClangCommandLineReference.rst
@@ -1307,6 +1307,10 @@ Use colors in diagnostics
 
 .. option:: -fcommon, -fno-common
 
+Place definitions of variables with no storage class and no initializer
+(tentative definitions) in a common block, instead of generating individual
+zero-initialized definitions (default -fno-common).
+
 .. option:: -fcompile-resource=, --resource , --resource=
 
 .. option:: -fconstant-cfstrings, -fno-constant-cfstrings

diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index ce121ebe6055..664ae4e4167c 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -84,6 +84,13 @@ future versions of Clang.
 Modified Compiler Flags
 ---
 
+- -fno-common has been enabled as the default for all targets.  Therefore, C
+  code that uses tentative definitions as definitions of a variable in multiple
+  translation units will trigger multiple-definition linker errors.  Generally,
+  this occurs when the use of the ``extern`` keyword is neglected in the 
declaration
+  of a variable in a header file. In some cases, no specific translation unit
+  provides a definition of the variable. The previous behavior can be restored 
by
+  specifying ``-fcommon``.
 
 New Pragmas in Clang
 

diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 0d5cba8d682a..bdcd771ff713 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -848,7 +848,8 @@ def fno_record_command_line : Flag<["-"], 
"fno-record-command-line">,
   Group;
 def : Flag<["-"], "frecord-gcc-switches">, Alias;
 def : Flag<["-"], "fno-record-gcc-switches">, Alias;
-def fcommon : Flag<["-"], "fcommon">, Group;
+def fcommon : Flag<["-"], 

[clang] 4e36356 - Revert "[Driver] Default to -fno-common for all targets"

2020-03-03 Thread Sjoerd Meijer via cfe-commits

Author: Sjoerd Meijer
Date: 2020-03-03T10:00:36Z
New Revision: 4e363563fa149321514389a031fa063e998d7422

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

LOG: Revert "[Driver] Default to -fno-common for all targets"

This reverts commit 0a9fc9233e172601e26381810d093e02ef410f65.

Going to look at the asan failures.

I find the failures in the test suite weird, because they look
like compile time test and I don't understand how that can be
failing, but will have a brief look at that too.

Added: 
clang/test/CodeGen/weak-global.c

Modified: 
clang/docs/ClangCommandLineReference.rst
clang/docs/ReleaseNotes.rst
clang/include/clang/Driver/Options.td
clang/lib/Driver/ToolChains/Clang.cpp
clang/lib/Frontend/CompilerInvocation.cpp
clang/test/CodeGen/2008-07-21-mixed-var-fn-decl.c
clang/test/CodeGen/2009-10-20-GlobalDebug.c
clang/test/CodeGen/aarch64-sve.c
clang/test/CodeGen/address-space.c
clang/test/CodeGen/alias.c
clang/test/CodeGen/align-systemz.c
clang/test/CodeGen/alignment.c
clang/test/CodeGen/asm-label.c
clang/test/CodeGen/attr-weak-import.c
clang/test/CodeGen/attr-weakref2.c
clang/test/CodeGen/attributes.c
clang/test/CodeGen/blocks-windows.c
clang/test/CodeGen/bool-convert.c
clang/test/CodeGen/c11atomics.c
clang/test/CodeGen/cfstring-elf-cfbuild-x86_64.c
clang/test/CodeGen/cfstring-windows.c
clang/test/CodeGen/default-address-space.c
clang/test/CodeGen/dllexport-1.c
clang/test/CodeGen/dllexport.c
clang/test/CodeGen/dllimport.c
clang/test/CodeGen/microsoft-no-common-align.c
clang/test/CodeGen/no-common.c
clang/test/CodeGen/pr25786.c
clang/test/CodeGen/pragma-pack-1.c
clang/test/CodeGen/pragma-weak.c
clang/test/CodeGen/private-extern-redef.c
clang/test/CodeGen/tentative-decls.c
clang/test/CodeGen/tls-model.c
clang/test/CodeGen/visibility.c
clang/test/CodeGen/vlt_to_pointer.c
clang/test/CodeGen/volatile-1.c
clang/test/CodeGen/windows-on-arm-dllimport-dllexport.c
clang/test/CodeGenCXX/clang-sections-tentative.c
clang/test/CodeGenObjC/constant-string-class.m
clang/test/CodeGenObjC/tentative-cfconstantstring.m
clang/test/CodeGenOpenCL/address-spaces.cl
clang/test/CodeGenOpenCL/amdgcn-large-globals.cl
clang/test/CodeGenOpenCL/amdgpu-nullptr.cl
clang/test/Driver/apple-kext-mkernel.c
clang/test/Driver/clang_f_opts.c
clang/test/Driver/fuchsia.c
clang/test/Driver/xcore-opts.c
clang/test/Frontend/ast-codegen.c
clang/test/Headers/xmmintrin.c
clang/test/PCH/chain-external-defs.c
clang/test/PCH/external-defs.c
clang/test/PCH/tentative-defs.c
clang/test/Parser/pragma-visibility2.c

Removed: 
clang/test/Driver/no-common.c



diff  --git a/clang/docs/ClangCommandLineReference.rst 
b/clang/docs/ClangCommandLineReference.rst
index 5af9d64ae0fc..609e7fa66c00 100644
--- a/clang/docs/ClangCommandLineReference.rst
+++ b/clang/docs/ClangCommandLineReference.rst
@@ -1307,10 +1307,6 @@ Use colors in diagnostics
 
 .. option:: -fcommon, -fno-common
 
-Place definitions of variables with no storage class and no initializer
-(tentative definitions) in a common block, instead of generating individual
-zero-initialized definitions (default -fno-common).
-
 .. option:: -fcompile-resource=, --resource , --resource=
 
 .. option:: -fconstant-cfstrings, -fno-constant-cfstrings

diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 664ae4e4167c..ce121ebe6055 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -84,13 +84,6 @@ future versions of Clang.
 Modified Compiler Flags
 ---
 
-- -fno-common has been enabled as the default for all targets.  Therefore, C
-  code that uses tentative definitions as definitions of a variable in multiple
-  translation units will trigger multiple-definition linker errors.  Generally,
-  this occurs when the use of the ``extern`` keyword is neglected in the 
declaration
-  of a variable in a header file. In some cases, no specific translation unit
-  provides a definition of the variable. The previous behavior can be restored 
by
-  specifying ``-fcommon``.
 
 New Pragmas in Clang
 

diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 8d6256580615..f1801e3e89e7 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -848,8 +848,7 @@ def fno_record_command_line : Flag<["-"], 
"fno-record-command-line">,
   Group;
 def : Flag<["-"], "frecord-gcc-switches">, Alias;
 def : Flag<["-"], "fno-record-gcc-switches">, Alias;
-def fcommon : Flag<["-"], "fcommon">, Group,
-  Flags<[CoreOption, CC1Option]>, 

[clang] 0a9fc92 - [Driver] Default to -fno-common for all targets

2020-03-03 Thread Sjoerd Meijer via cfe-commits

Author: Sjoerd Meijer
Date: 2020-03-03T09:15:07Z
New Revision: 0a9fc9233e172601e26381810d093e02ef410f65

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

LOG: [Driver] Default to -fno-common for all targets

This makes -fno-common the default for all targets because this has performance
and code-size benefits and is more language conforming for C code.
Additionally, GCC10 also defaults to -fno-common and so we get consistent
behaviour with GCC.

With this change, C code that uses tentative definitions as definitions of a
variable in multiple translation units will trigger multiple-definition linker
errors. Generally, this occurs when the use of the extern keyword is neglected
in the declaration of a variable in a header file. In some cases, no specific
translation unit provides a definition of the variable. The previous behavior
can be restored by specifying -fcommon.

As GCC has switched already, we benefit from applications already being ported
and existing documentation how to do this. For example:
- https://gcc.gnu.org/gcc-10/porting_to.html
- https://wiki.gentoo.org/wiki/Gcc_10_porting_notes/fno_common

Differential revision: https://reviews.llvm.org/D75056

Added: 
clang/test/Driver/no-common.c

Modified: 
clang/docs/ClangCommandLineReference.rst
clang/docs/ReleaseNotes.rst
clang/include/clang/Driver/Options.td
clang/lib/Driver/ToolChains/Clang.cpp
clang/lib/Frontend/CompilerInvocation.cpp
clang/test/CodeGen/2008-07-21-mixed-var-fn-decl.c
clang/test/CodeGen/2009-10-20-GlobalDebug.c
clang/test/CodeGen/aarch64-sve.c
clang/test/CodeGen/address-space.c
clang/test/CodeGen/alias.c
clang/test/CodeGen/align-systemz.c
clang/test/CodeGen/alignment.c
clang/test/CodeGen/asm-label.c
clang/test/CodeGen/attr-weak-import.c
clang/test/CodeGen/attr-weakref2.c
clang/test/CodeGen/attributes.c
clang/test/CodeGen/blocks-windows.c
clang/test/CodeGen/bool-convert.c
clang/test/CodeGen/c11atomics.c
clang/test/CodeGen/cfstring-elf-cfbuild-x86_64.c
clang/test/CodeGen/cfstring-windows.c
clang/test/CodeGen/default-address-space.c
clang/test/CodeGen/dllexport-1.c
clang/test/CodeGen/dllexport.c
clang/test/CodeGen/dllimport.c
clang/test/CodeGen/microsoft-no-common-align.c
clang/test/CodeGen/no-common.c
clang/test/CodeGen/pr25786.c
clang/test/CodeGen/pragma-pack-1.c
clang/test/CodeGen/pragma-weak.c
clang/test/CodeGen/private-extern-redef.c
clang/test/CodeGen/tentative-decls.c
clang/test/CodeGen/tls-model.c
clang/test/CodeGen/visibility.c
clang/test/CodeGen/vlt_to_pointer.c
clang/test/CodeGen/volatile-1.c
clang/test/CodeGen/windows-on-arm-dllimport-dllexport.c
clang/test/CodeGenCXX/clang-sections-tentative.c
clang/test/CodeGenObjC/constant-string-class.m
clang/test/CodeGenObjC/tentative-cfconstantstring.m
clang/test/CodeGenOpenCL/address-spaces.cl
clang/test/CodeGenOpenCL/amdgcn-large-globals.cl
clang/test/CodeGenOpenCL/amdgpu-nullptr.cl
clang/test/Driver/apple-kext-mkernel.c
clang/test/Driver/clang_f_opts.c
clang/test/Driver/fuchsia.c
clang/test/Driver/xcore-opts.c
clang/test/Frontend/ast-codegen.c
clang/test/Headers/xmmintrin.c
clang/test/PCH/chain-external-defs.c
clang/test/PCH/external-defs.c
clang/test/PCH/tentative-defs.c
clang/test/Parser/pragma-visibility2.c

Removed: 
clang/test/CodeGen/weak-global.c



diff  --git a/clang/docs/ClangCommandLineReference.rst 
b/clang/docs/ClangCommandLineReference.rst
index 609e7fa66c00..5af9d64ae0fc 100644
--- a/clang/docs/ClangCommandLineReference.rst
+++ b/clang/docs/ClangCommandLineReference.rst
@@ -1307,6 +1307,10 @@ Use colors in diagnostics
 
 .. option:: -fcommon, -fno-common
 
+Place definitions of variables with no storage class and no initializer
+(tentative definitions) in a common block, instead of generating individual
+zero-initialized definitions (default -fno-common).
+
 .. option:: -fcompile-resource=, --resource , --resource=
 
 .. option:: -fconstant-cfstrings, -fno-constant-cfstrings

diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index ce121ebe6055..664ae4e4167c 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -84,6 +84,13 @@ future versions of Clang.
 Modified Compiler Flags
 ---
 
+- -fno-common has been enabled as the default for all targets.  Therefore, C
+  code that uses tentative definitions as definitions of a variable in multiple
+  translation units will trigger multiple-definition linker errors.  Generally,
+  this occurs when the use of the ``extern`` keyword is neglected in the 
declaration
+  of a variable in a header file. In some cases, no specific 

[clang] 0216854 - [Clang] Pragma vectorize_width() implies vectorize(enable)

2019-12-11 Thread Sjoerd Meijer via cfe-commits

Author: Sjoerd Meijer
Date: 2019-12-11T10:37:40Z
New Revision: 021685491727e023aeae9ca272a2d6cd727e20e4

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

LOG: [Clang] Pragma vectorize_width() implies vectorize(enable)

Let's try this again; this has been reverted/recommited a few times. Last time
this got reverted because for this loop:

  void a() {
#pragma clang loop vectorize(disable)
for (;;)
  ;
  }

vectorisation was incorrectly enabled and the vectorize.enable metadata was set
due to a logic error. But with this fixed, we now imply vectorisation when:

1) vectorisation is enabled, which means: VectorizeWidth > 1,
2) and don't want to add it when it is disabled or enabled, otherwise we would
   be incorrectly setting it or duplicating the metadata, respectively.

This should fix PR27643.

Differential Revision: https://reviews.llvm.org/D69628

Added: 
clang/test/CodeGenCXX/pragma-loop-pr27643.cpp

Modified: 
clang/lib/CodeGen/CGLoopInfo.cpp
clang/test/CodeGenCXX/pragma-loop.cpp

Removed: 




diff  --git a/clang/lib/CodeGen/CGLoopInfo.cpp 
b/clang/lib/CodeGen/CGLoopInfo.cpp
index 6822c6286fef..e4b184eb8798 100644
--- a/clang/lib/CodeGen/CGLoopInfo.cpp
+++ b/clang/lib/CodeGen/CGLoopInfo.cpp
@@ -286,17 +286,18 @@ LoopInfo::createLoopVectorizeMetadata(const 
LoopAttributes ,
 Args.push_back(MDNode::get(Ctx, Vals));
   }
 
-  // Setting vectorize.enable
+  // vectorize.enable is set if:
+  // 1) loop hint vectorize.enable is set, or
+  // 2) it is implied when vectorize.predicate is set, or
+  // 3) it is implied when vectorize.width is set.
   if (Attrs.VectorizeEnable != LoopAttributes::Unspecified ||
-  IsVectorPredicateEnabled) {
-Metadata *Vals[] = {
-MDString::get(Ctx, "llvm.loop.vectorize.enable"),
-ConstantAsMetadata::get(ConstantInt::get(
-llvm::Type::getInt1Ty(Ctx),
-IsVectorPredicateEnabled
-? true
-: (Attrs.VectorizeEnable == LoopAttributes::Enable)))};
-Args.push_back(MDNode::get(Ctx, Vals));
+  IsVectorPredicateEnabled ||
+  Attrs.VectorizeWidth > 1 ) {
+bool AttrVal = Attrs.VectorizeEnable != LoopAttributes::Disable;
+Args.push_back(
+MDNode::get(Ctx, {MDString::get(Ctx, "llvm.loop.vectorize.enable"),
+  ConstantAsMetadata::get(ConstantInt::get(
+  llvm::Type::getInt1Ty(Ctx), AttrVal))}));
   }
 
   if (FollowupHasTransforms)

diff  --git a/clang/test/CodeGenCXX/pragma-loop-pr27643.cpp 
b/clang/test/CodeGenCXX/pragma-loop-pr27643.cpp
new file mode 100644
index ..87a225081faa
--- /dev/null
+++ b/clang/test/CodeGenCXX/pragma-loop-pr27643.cpp
@@ -0,0 +1,52 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -emit-llvm -o - %s | 
FileCheck %s
+
+void loop1(int *List, int Length) {
+// CHECK-LABEL: @{{.*}}loop1{{.*}}(
+// CHECK: br label {{.*}}, !llvm.loop ![[LOOP1:.*]]
+
+  #pragma clang loop vectorize(enable) vectorize_width(1)
+  for (int i = 0; i < Length; i++)
+List[i] = i * 2;
+}
+
+// Here, vectorize.enable should be set, obviously, but also check that
+// metadata isn't added twice.
+void loop2(int *List, int Length) {
+// CHECK-LABEL: @{{.*}}loop2{{.*}}(
+// CHECK: br label {{.*}}, !llvm.loop ![[LOOP2:.*]]
+
+  #pragma clang loop vectorize(enable) vectorize_width(2)
+  for (int i = 0; i < Length; i++)
+List[i] = i * 2;
+}
+
+// Test that we do *not* imply vectorize.enable.
+void loop3(int *List, int Length) {
+// CHECK-LABEL: @{{.*}}loop3{{.*}}(
+// CHECK: br label {{.*}}, !llvm.loop ![[LOOP3:.*]]
+
+  #pragma clang loop vectorize_width(1)
+  for (int i = 0; i < Length; i++)
+List[i] = i * 2;
+}
+
+// Test that we *do* imply vectorize.enable.
+void loop4(int *List, int Length) {
+// CHECK-LABEL: @{{.*}}loop4{{.*}}(
+// CHECK: br label {{.*}}, !llvm.loop ![[LOOP4:.*]]
+
+  #pragma clang loop vectorize_width(2)
+  for (int i = 0; i < Length; i++)
+List[i] = i * 2;
+}
+
+// CHECK: ![[LOOP1]] = distinct !{![[LOOP1]], ![[VEC_WIDTH_1:.*]], 
![[VEC_ENABLE:.*]]}
+// CHECK: ![[VEC_WIDTH_1]] = !{!"llvm.loop.vectorize.width", i32 1}
+// CHECK: ![[VEC_ENABLE]] = !{!"llvm.loop.vectorize.enable", i1 true}
+
+// CHECK: ![[LOOP2]] = distinct !{![[LOOP2]], ![[VEC_WIDTH_2:.*]], 
![[VEC_ENABLE]]}
+// CHECK: ![[VEC_WIDTH_2]] = !{!"llvm.loop.vectorize.width", i32 2}
+
+// CHECK: ![[LOOP3]] = distinct !{![[LOOP3]], ![[VEC_WIDTH_1]]}
+
+// CHECK: ![[LOOP4]] = distinct !{![[LOOP4]], ![[VEC_WIDTH_2]], 
![[VEC_ENABLE]]}

diff  --git a/clang/test/CodeGenCXX/pragma-loop.cpp 
b/clang/test/CodeGenCXX/pragma-loop.cpp
index 32075f965cd7..d730f30621a4 100644
--- a/clang/test/CodeGenCXX/pragma-loop.cpp
+++ b/clang/test/CodeGenCXX/pragma-loop.cpp
@@ -161,20 +161,20 @@ void 

Re: r374288 - Recommit "[Clang] Pragma vectorize_width() implies vectorize(enable)"

2019-10-29 Thread Sjoerd Meijer via cfe-commits
Hi All,

Apologies for the delay in responding, I was away from keyboard (llvm dev conf).

This is a real funny patch! It is a (simple) fix that uncovers quite a few 
things. Anyway, thanks Michael for your analysis! As I will need to make some 
changes this time (this wasn't the case last time), I definitely definitely 
open a new review soon.

Cheers,
Sjoerd.

From: Michael Kruse 
Sent: 25 October 2019 23:18
To: Jordan Rupprecht 
Cc: Michael Kruse ; Hans Wennborg 
; cfe-commits ; Hal Finkel 
; Sjoerd Meijer 
Subject: Re: r374288 - Recommit "[Clang] Pragma vectorize_width() implies 
vectorize(enable)"

@sjoerdmeijer

Before recommitting, please re-open the patch review.

Michael

Am Do., 24. Okt. 2019 um 18:45 Uhr schrieb Jordan Rupprecht
:
>
> Reverted in 6d424a161bf3e52730371da0b9439ed93a8ce406 due to the issue 
> described here. Should hopefully be a trivial fix forward.
>
> On Tue, Oct 22, 2019 at 2:46 PM Michael Kruse  
> wrote:
>>
>> Am Mo., 21. Okt. 2019 um 23:44 Uhr schrieb Jordan Rupprecht
>> :
>> > At any rate, it sounds like this is not a codegen bug at all, but just an 
>> > over-eager warning?
>>
>> That interpretation is different from mine. Codgen emits the following
>> from vectorize(disable)
>>
>> !4 = !{!"llvm.loop.vectorize.enable", i1 true}
>>
>> which is is not what I'd expect.
>>
>> Michael
IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not disclose the contents to any 
other person, use it for any purpose, or store or copy the information in any 
medium. Thank you.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r374756 - [docs] loop pragmas: options implying transformations

2019-10-14 Thread Sjoerd Meijer via cfe-commits
Author: sjoerdmeijer
Date: Mon Oct 14 00:40:36 2019
New Revision: 374756

URL: http://llvm.org/viewvc/llvm-project?rev=374756=rev
Log:
[docs] loop pragmas: options implying transformations

Following our discussion on the cfe dev list:
http://lists.llvm.org/pipermail/cfe-dev/2019-August/063054.html,
I have added a paragraph that is explicit about loop pragmas, and
transformation options implying the corresponding transformation.

Differential Revision: https://reviews.llvm.org/D66199

Modified:
cfe/trunk/docs/LanguageExtensions.rst

Modified: cfe/trunk/docs/LanguageExtensions.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LanguageExtensions.rst?rev=374756=374755=374756=diff
==
--- cfe/trunk/docs/LanguageExtensions.rst (original)
+++ cfe/trunk/docs/LanguageExtensions.rst Mon Oct 14 00:40:36 2019
@@ -3027,6 +3027,14 @@ provides options for vectorization, inte
 distribution. Loop hints can be specified before any loop and will be ignored 
if
 the optimization is not safe to apply.
 
+There are loop hints that control transformations (e.g. vectorization, loop
+unrolling) and there are loop hints that set transformation options (e.g.
+``vectorize_width``, ``unroll_count``).  Pragmas setting transformation options
+imply the transformation is enabled, as if it was enabled via the corresponding
+transformation pragma (e.g. ``vectorize(enable)``). If the transformation is
+disabled  (e.g. ``vectorize(disable)``), that takes precedence over
+transformations option pragmas implying that transformation.
+
 Vectorization, Interleaving, and Predication
 
 


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


r374288 - Recommit "[Clang] Pragma vectorize_width() implies vectorize(enable)"

2019-10-10 Thread Sjoerd Meijer via cfe-commits
Author: sjoerdmeijer
Date: Thu Oct 10 01:27:14 2019
New Revision: 374288

URL: http://llvm.org/viewvc/llvm-project?rev=374288=rev
Log:
Recommit "[Clang] Pragma vectorize_width() implies vectorize(enable)"

This was further discussed at the llvm dev list:

http://lists.llvm.org/pipermail/llvm-dev/2019-October/135602.html

I think the brief summary of that is that this change is an improvement,
this is the behaviour that we expect and promise in ours docs, and also
as a result there are cases where we now emit diagnostics whereas before
pragmas were silently ignored. Two areas where we can improve: 1) the
diagnostic message itself, and 2) and in some cases (e.g. -Os and -Oz)
the vectoriser is (quite understandably) not triggering.

Original commit message:

Specifying the vectorization width was supposed to implicitly enable
vectorization, except that it wasn't really doing this. It was only
setting the vectorize.width metadata, but not vectorize.enable.

This should fix PR27643.

Modified:
cfe/trunk/lib/CodeGen/CGLoopInfo.cpp
cfe/trunk/test/CodeGenCXX/pragma-loop-predicate.cpp
cfe/trunk/test/CodeGenCXX/pragma-loop.cpp

Modified: cfe/trunk/lib/CodeGen/CGLoopInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGLoopInfo.cpp?rev=374288=374287=374288=diff
==
--- cfe/trunk/lib/CodeGen/CGLoopInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGLoopInfo.cpp Thu Oct 10 01:27:14 2019
@@ -270,6 +270,14 @@ LoopInfo::createLoopVectorizeMetadata(co
 
   // Setting vectorize.width
   if (Attrs.VectorizeWidth > 0) {
+// This implies vectorize.enable = true, but only add it when it is not
+// already enabled.
+if (Attrs.VectorizeEnable != LoopAttributes::Enable)
+  Args.push_back(
+  MDNode::get(Ctx, {MDString::get(Ctx, "llvm.loop.vectorize.enable"),
+ConstantAsMetadata::get(ConstantInt::get(
+llvm::Type::getInt1Ty(Ctx), 1))}));
+
 Metadata *Vals[] = {
 MDString::get(Ctx, "llvm.loop.vectorize.width"),
 ConstantAsMetadata::get(ConstantInt::get(llvm::Type::getInt32Ty(Ctx),

Modified: cfe/trunk/test/CodeGenCXX/pragma-loop-predicate.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/pragma-loop-predicate.cpp?rev=374288=374287=374288=diff
==
--- cfe/trunk/test/CodeGenCXX/pragma-loop-predicate.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/pragma-loop-predicate.cpp Thu Oct 10 01:27:14 2019
@@ -58,7 +58,6 @@ void test5(int *List, int Length) {
 List[i] = i * 2;
 }
 
-
 // CHECK:  ![[LOOP0]] = distinct !{![[LOOP0]], !3}
 // CHECK-NEXT: !3 = !{!"llvm.loop.vectorize.enable", i1 true}
 
@@ -70,7 +69,7 @@ void test5(int *List, int Length) {
 
 // CHECK-NEXT: ![[LOOP3]] = distinct !{![[LOOP3]], !5, !3}
 
-// CHECK-NEXT: ![[LOOP4]] = distinct !{![[LOOP4]], !10}
+// CHECK-NEXT: ![[LOOP4]] = distinct !{![[LOOP4]], !3, !10}
 // CHECK-NEXT: !10 = !{!"llvm.loop.vectorize.width", i32 1}
 
-// CHECK-NEXT: ![[LOOP5]] = distinct !{![[LOOP5]], !10}
+// CHECK-NEXT: ![[LOOP5]] = distinct !{![[LOOP5]], !3, !10}

Modified: cfe/trunk/test/CodeGenCXX/pragma-loop.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/pragma-loop.cpp?rev=374288=374287=374288=diff
==
--- cfe/trunk/test/CodeGenCXX/pragma-loop.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/pragma-loop.cpp Thu Oct 10 01:27:14 2019
@@ -158,23 +158,41 @@ void template_test(double *List, int Len
   for_template_constant_expression_test(List, Length);
 }
 
+void vec_width_1(int *List, int Length) {
+// CHECK-LABEL: @{{.*}}vec_width_1{{.*}}(
+// CHECK: br label {{.*}}, !llvm.loop ![[LOOP_15:.*]]
+
+  #pragma clang loop vectorize(enable) vectorize_width(1)
+  for (int i = 0; i < Length; i++)
+List[i] = i * 2;
+}
+
+void width_1(int *List, int Length) {
+// CHECK-LABEL: @{{.*}}width_1{{.*}}(
+// CHECK: br label {{.*}}, !llvm.loop ![[LOOP_16:.*]]
+
+  #pragma clang loop vectorize_width(1)
+  for (int i = 0; i < Length; i++)
+List[i] = i * 2;
+}
+
 // CHECK: ![[LOOP_1]] = distinct !{![[LOOP_1]], ![[UNROLL_FULL:.*]]}
 // CHECK: ![[UNROLL_FULL]] = !{!"llvm.loop.unroll.full"}
 
-// CHECK: ![[LOOP_2]] = distinct !{![[LOOP_2]], ![[UNROLL_DISABLE:.*]], 
![[DISTRIBUTE_DISABLE:.*]], ![[WIDTH_8:.*]], ![[INTERLEAVE_4:.*]]}
+// CHECK: ![[LOOP_2]] = distinct !{![[LOOP_2]], ![[UNROLL_DISABLE:.*]], 
![[DISTRIBUTE_DISABLE:.*]], ![[VECTORIZE_ENABLE:.*]], ![[WIDTH_8:.*]], 
![[INTERLEAVE_4:.*]]}
 // CHECK: ![[UNROLL_DISABLE]] = !{!"llvm.loop.unroll.disable"}
 // CHECK: ![[DISTRIBUTE_DISABLE]] = !{!"llvm.loop.distribute.enable", i1 false}
+// CHECK: ![[VECTORIZE_ENABLE]] = !{!"llvm.loop.vectorize.enable", i1 true}
 // CHECK: ![[WIDTH_8]] = !{!"llvm.loop.vectorize.width", i32 8}
 // CHECK: ![[INTERLEAVE_4]] = 

Re: r372082 - [Clang] Pragma vectorize_width() implies vectorize(enable)

2019-09-18 Thread Sjoerd Meijer via cfe-commits
Oopsy daisy! Sorry, and thanks for the revert. I will look into this.

From: Hans Wennborg 
Sent: 18 September 2019 14:41
To: Sjoerd Meijer 
Cc: cfe-commits 
Subject: Re: r372082 - [Clang] Pragma vectorize_width() implies 
vectorize(enable)

I've reverted this in r372225 as it broke the Chromium build. It seems
it doesn't actually manage to enable vectorization of a simple loop at
-Oz, and at -Os it asserts. See details in my commit message.

On Tue, Sep 17, 2019 at 10:41 AM Sjoerd Meijer via cfe-commits
 wrote:
>
> Author: sjoerdmeijer
> Date: Tue Sep 17 01:43:11 2019
> New Revision: 372082
>
> URL: http://llvm.org/viewvc/llvm-project?rev=372082=rev
> Log:
> [Clang] Pragma vectorize_width() implies vectorize(enable)
>
> Specifying the vectorization width was supposed to implicitly enable
> vectorization, except that it wasn't really doing this. It was only
> setting the vectorize.width metadata, but not vectorize.enable.
>
> This should fix PR27643.
>
> Differential Revision: https://reviews.llvm.org/D66290
>
> Modified:
> cfe/trunk/lib/CodeGen/CGLoopInfo.cpp
> cfe/trunk/test/CodeGenCXX/pragma-loop-predicate.cpp
> cfe/trunk/test/CodeGenCXX/pragma-loop.cpp
>
> Modified: cfe/trunk/lib/CodeGen/CGLoopInfo.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGLoopInfo.cpp?rev=372082=372081=372082=diff
> ==
> --- cfe/trunk/lib/CodeGen/CGLoopInfo.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGLoopInfo.cpp Tue Sep 17 01:43:11 2019
> @@ -270,6 +270,14 @@ LoopInfo::createLoopVectorizeMetadata(co
>
>// Setting vectorize.width
>if (Attrs.VectorizeWidth > 0) {
> +// This implies vectorize.enable = true, but only add it when it is not
> +// already enabled.
> +if (Attrs.VectorizeEnable != LoopAttributes::Enable)
> +  Args.push_back(
> +  MDNode::get(Ctx, {MDString::get(Ctx, "llvm.loop.vectorize.enable"),
> +ConstantAsMetadata::get(ConstantInt::get(
> +llvm::Type::getInt1Ty(Ctx), 1))}));
> +
>  Metadata *Vals[] = {
>  MDString::get(Ctx, "llvm.loop.vectorize.width"),
>  ConstantAsMetadata::get(ConstantInt::get(llvm::Type::getInt32Ty(Ctx),
>
> Modified: cfe/trunk/test/CodeGenCXX/pragma-loop-predicate.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/pragma-loop-predicate.cpp?rev=372082=372081=372082=diff
> ==
> --- cfe/trunk/test/CodeGenCXX/pragma-loop-predicate.cpp (original)
> +++ cfe/trunk/test/CodeGenCXX/pragma-loop-predicate.cpp Tue Sep 17 01:43:11 
> 2019
> @@ -58,7 +58,6 @@ void test5(int *List, int Length) {
>  List[i] = i * 2;
>  }
>
> -
>  // CHECK:  ![[LOOP0]] = distinct !{![[LOOP0]], !3}
>  // CHECK-NEXT: !3 = !{!"llvm.loop.vectorize.enable", i1 true}
>
> @@ -70,7 +69,7 @@ void test5(int *List, int Length) {
>
>  // CHECK-NEXT: ![[LOOP3]] = distinct !{![[LOOP3]], !5, !3}
>
> -// CHECK-NEXT: ![[LOOP4]] = distinct !{![[LOOP4]], !10}
> +// CHECK-NEXT: ![[LOOP4]] = distinct !{![[LOOP4]], !3, !10}
>  // CHECK-NEXT: !10 = !{!"llvm.loop.vectorize.width", i32 1}
>
> -// CHECK-NEXT: ![[LOOP5]] = distinct !{![[LOOP5]], !10}
> +// CHECK-NEXT: ![[LOOP5]] = distinct !{![[LOOP5]], !3, !10}
>
> Modified: cfe/trunk/test/CodeGenCXX/pragma-loop.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/pragma-loop.cpp?rev=372082=372081=372082=diff
> ==
> --- cfe/trunk/test/CodeGenCXX/pragma-loop.cpp (original)
> +++ cfe/trunk/test/CodeGenCXX/pragma-loop.cpp Tue Sep 17 01:43:11 2019
> @@ -158,23 +158,41 @@ void template_test(double *List, int Len
>for_template_constant_expression_test(List, Length);
>  }
>
> +void vec_width_1(int *List, int Length) {
> +// CHECK-LABEL: @{{.*}}vec_width_1{{.*}}(
> +// CHECK: br label {{.*}}, !llvm.loop ![[LOOP_15:.*]]
> +
> +  #pragma clang loop vectorize(enable) vectorize_width(1)
> +  for (int i = 0; i < Length; i++)
> +List[i] = i * 2;
> +}
> +
> +void width_1(int *List, int Length) {
> +// CHECK-LABEL: @{{.*}}width_1{{.*}}(
> +// CHECK: br label {{.*}}, !llvm.loop ![[LOOP_16:.*]]
> +
> +  #pragma clang loop vectorize_width(1)
> +  for (int i = 0; i < Length; i++)
> +List[i] = i * 2;
> +}
> +
>  // CHECK: ![[LOOP_1]] = distinct !{![[LOOP_1]], ![[UNROLL_FULL:.*]]}
>  // CHECK: ![[UNROLL_FULL]] = !{!"llvm.loop.unroll.full"}
>
> -// CHECK: ![[LOOP_2]] = distinct !{![[LOOP_2]], ![[

r372082 - [Clang] Pragma vectorize_width() implies vectorize(enable)

2019-09-17 Thread Sjoerd Meijer via cfe-commits
Author: sjoerdmeijer
Date: Tue Sep 17 01:43:11 2019
New Revision: 372082

URL: http://llvm.org/viewvc/llvm-project?rev=372082=rev
Log:
[Clang] Pragma vectorize_width() implies vectorize(enable)

Specifying the vectorization width was supposed to implicitly enable
vectorization, except that it wasn't really doing this. It was only
setting the vectorize.width metadata, but not vectorize.enable.

This should fix PR27643.

Differential Revision: https://reviews.llvm.org/D66290

Modified:
cfe/trunk/lib/CodeGen/CGLoopInfo.cpp
cfe/trunk/test/CodeGenCXX/pragma-loop-predicate.cpp
cfe/trunk/test/CodeGenCXX/pragma-loop.cpp

Modified: cfe/trunk/lib/CodeGen/CGLoopInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGLoopInfo.cpp?rev=372082=372081=372082=diff
==
--- cfe/trunk/lib/CodeGen/CGLoopInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGLoopInfo.cpp Tue Sep 17 01:43:11 2019
@@ -270,6 +270,14 @@ LoopInfo::createLoopVectorizeMetadata(co
 
   // Setting vectorize.width
   if (Attrs.VectorizeWidth > 0) {
+// This implies vectorize.enable = true, but only add it when it is not
+// already enabled.
+if (Attrs.VectorizeEnable != LoopAttributes::Enable)
+  Args.push_back(
+  MDNode::get(Ctx, {MDString::get(Ctx, "llvm.loop.vectorize.enable"),
+ConstantAsMetadata::get(ConstantInt::get(
+llvm::Type::getInt1Ty(Ctx), 1))}));
+
 Metadata *Vals[] = {
 MDString::get(Ctx, "llvm.loop.vectorize.width"),
 ConstantAsMetadata::get(ConstantInt::get(llvm::Type::getInt32Ty(Ctx),

Modified: cfe/trunk/test/CodeGenCXX/pragma-loop-predicate.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/pragma-loop-predicate.cpp?rev=372082=372081=372082=diff
==
--- cfe/trunk/test/CodeGenCXX/pragma-loop-predicate.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/pragma-loop-predicate.cpp Tue Sep 17 01:43:11 2019
@@ -58,7 +58,6 @@ void test5(int *List, int Length) {
 List[i] = i * 2;
 }
 
-
 // CHECK:  ![[LOOP0]] = distinct !{![[LOOP0]], !3}
 // CHECK-NEXT: !3 = !{!"llvm.loop.vectorize.enable", i1 true}
 
@@ -70,7 +69,7 @@ void test5(int *List, int Length) {
 
 // CHECK-NEXT: ![[LOOP3]] = distinct !{![[LOOP3]], !5, !3}
 
-// CHECK-NEXT: ![[LOOP4]] = distinct !{![[LOOP4]], !10}
+// CHECK-NEXT: ![[LOOP4]] = distinct !{![[LOOP4]], !3, !10}
 // CHECK-NEXT: !10 = !{!"llvm.loop.vectorize.width", i32 1}
 
-// CHECK-NEXT: ![[LOOP5]] = distinct !{![[LOOP5]], !10}
+// CHECK-NEXT: ![[LOOP5]] = distinct !{![[LOOP5]], !3, !10}

Modified: cfe/trunk/test/CodeGenCXX/pragma-loop.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/pragma-loop.cpp?rev=372082=372081=372082=diff
==
--- cfe/trunk/test/CodeGenCXX/pragma-loop.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/pragma-loop.cpp Tue Sep 17 01:43:11 2019
@@ -158,23 +158,41 @@ void template_test(double *List, int Len
   for_template_constant_expression_test(List, Length);
 }
 
+void vec_width_1(int *List, int Length) {
+// CHECK-LABEL: @{{.*}}vec_width_1{{.*}}(
+// CHECK: br label {{.*}}, !llvm.loop ![[LOOP_15:.*]]
+
+  #pragma clang loop vectorize(enable) vectorize_width(1)
+  for (int i = 0; i < Length; i++)
+List[i] = i * 2;
+}
+
+void width_1(int *List, int Length) {
+// CHECK-LABEL: @{{.*}}width_1{{.*}}(
+// CHECK: br label {{.*}}, !llvm.loop ![[LOOP_16:.*]]
+
+  #pragma clang loop vectorize_width(1)
+  for (int i = 0; i < Length; i++)
+List[i] = i * 2;
+}
+
 // CHECK: ![[LOOP_1]] = distinct !{![[LOOP_1]], ![[UNROLL_FULL:.*]]}
 // CHECK: ![[UNROLL_FULL]] = !{!"llvm.loop.unroll.full"}
 
-// CHECK: ![[LOOP_2]] = distinct !{![[LOOP_2]], ![[UNROLL_DISABLE:.*]], 
![[DISTRIBUTE_DISABLE:.*]], ![[WIDTH_8:.*]], ![[INTERLEAVE_4:.*]]}
+// CHECK: ![[LOOP_2]] = distinct !{![[LOOP_2]], ![[UNROLL_DISABLE:.*]], 
![[DISTRIBUTE_DISABLE:.*]], ![[VECTORIZE_ENABLE:.*]], ![[WIDTH_8:.*]], 
![[INTERLEAVE_4:.*]]}
 // CHECK: ![[UNROLL_DISABLE]] = !{!"llvm.loop.unroll.disable"}
 // CHECK: ![[DISTRIBUTE_DISABLE]] = !{!"llvm.loop.distribute.enable", i1 false}
+// CHECK: ![[VECTORIZE_ENABLE]] = !{!"llvm.loop.vectorize.enable", i1 true}
 // CHECK: ![[WIDTH_8]] = !{!"llvm.loop.vectorize.width", i32 8}
 // CHECK: ![[INTERLEAVE_4]] = !{!"llvm.loop.interleave.count", i32 4}
 
-// CHECK: ![[LOOP_3]] = distinct !{![[LOOP_3]], ![[INTERLEAVE_4:.*]], 
![[INTENABLE_1:.*]], ![[FOLLOWUP_VECTOR_3:.*]]}
-// CHECK: ![[INTENABLE_1]] = !{!"llvm.loop.vectorize.enable", i1 true}
+// CHECK: ![[LOOP_3]] = distinct !{![[LOOP_3]], ![[INTERLEAVE_4:.*]], 
![[VECTORIZE_ENABLE]], ![[FOLLOWUP_VECTOR_3:.*]]}
 // CHECK: ![[FOLLOWUP_VECTOR_3]] = !{!"llvm.loop.vectorize.followup_all", 
![[AFTER_VECTOR_3:.*]]}
 // CHECK: ![[AFTER_VECTOR_3]] = distinct !{![[AFTER_VECTOR_3]], 

r368976 - [clang] Loop pragma parsing. NFC.

2019-08-15 Thread Sjoerd Meijer via cfe-commits
Author: sjoerdmeijer
Date: Thu Aug 15 00:39:05 2019
New Revision: 368976

URL: http://llvm.org/viewvc/llvm-project?rev=368976=rev
Log:
[clang] Loop pragma parsing. NFC.

Just a refactoring and a tidy up.

Differential Revision: https://reviews.llvm.org/D64564

Modified:
cfe/trunk/lib/Parse/ParsePragma.cpp

Modified: cfe/trunk/lib/Parse/ParsePragma.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParsePragma.cpp?rev=368976=368975=368976=diff
==
--- cfe/trunk/lib/Parse/ParsePragma.cpp (original)
+++ cfe/trunk/lib/Parse/ParsePragma.cpp Thu Aug 15 00:39:05 2019
@@ -1006,18 +1006,13 @@ struct PragmaLoopHintInfo {
 } // end anonymous namespace
 
 static std::string PragmaLoopHintString(Token PragmaName, Token Option) {
-  std::string PragmaString;
-  if (PragmaName.getIdentifierInfo()->getName() == "loop") {
-PragmaString = "clang loop ";
-PragmaString += Option.getIdentifierInfo()->getName();
-  } else if (PragmaName.getIdentifierInfo()->getName() == "unroll_and_jam") {
-PragmaString = "unroll_and_jam";
-  } else {
-assert(PragmaName.getIdentifierInfo()->getName() == "unroll" &&
-   "Unexpected pragma name");
-PragmaString = "unroll";
-  }
-  return PragmaString;
+  StringRef Str = PragmaName.getIdentifierInfo()->getName();
+  std::string ClangLoopStr = (llvm::Twine("clang loop ") + Str).str();
+  return llvm::StringSwitch(Str)
+  .Case("loop", ClangLoopStr)
+  .Case("unroll_and_jam", Str)
+  .Case("unroll", Str)
+  .Default("");
 }
 
 bool Parser::HandlePragmaLoopHint(LoopHint ) {
@@ -1041,12 +1036,12 @@ bool Parser::HandlePragmaLoopHint(LoopHi
 
   // Return a valid hint if pragma unroll or nounroll were specified
   // without an argument.
-  bool PragmaUnroll = PragmaNameInfo->getName() == "unroll";
-  bool PragmaNoUnroll = PragmaNameInfo->getName() == "nounroll";
-  bool PragmaUnrollAndJam = PragmaNameInfo->getName() == "unroll_and_jam";
-  bool PragmaNoUnrollAndJam = PragmaNameInfo->getName() == "nounroll_and_jam";
-  if (Toks.empty() && (PragmaUnroll || PragmaNoUnroll || PragmaUnrollAndJam ||
-   PragmaNoUnrollAndJam)) {
+  auto IsLoopHint = llvm::StringSwitch(PragmaNameInfo->getName())
+.Cases("unroll", "nounroll", "unroll_and_jam",
+   "nounroll_and_jam", true)
+.Default(false);
+
+  if (Toks.empty() && IsLoopHint) {
 ConsumeAnnotationToken();
 Hint.Range = Info->PragmaName.getLocation();
 return true;


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


r368970 - [Clang] Pragma vectorize_predicate implies vectorize

2019-08-15 Thread Sjoerd Meijer via cfe-commits
Author: sjoerdmeijer
Date: Wed Aug 14 23:24:40 2019
New Revision: 368970

URL: http://llvm.org/viewvc/llvm-project?rev=368970=rev
Log:
[Clang] Pragma vectorize_predicate implies vectorize

New pragma "vectorize_predicate(enable)" now implies "vectorize(enable)",
and it is ignored when vectorization is disabled with e.g.
"vectorize(disable) vectorize_predicate(enable)".

Differential Revision: https://reviews.llvm.org/D65776

Modified:
cfe/trunk/lib/CodeGen/CGLoopInfo.cpp
cfe/trunk/test/CodeGenCXX/pragma-loop-predicate.cpp

Modified: cfe/trunk/lib/CodeGen/CGLoopInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGLoopInfo.cpp?rev=368970=368969=368970=diff
==
--- cfe/trunk/lib/CodeGen/CGLoopInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGLoopInfo.cpp Wed Aug 14 23:24:40 2019
@@ -253,12 +253,18 @@ LoopInfo::createLoopVectorizeMetadata(co
   Args.append(LoopProperties.begin(), LoopProperties.end());
 
   // Setting vectorize.predicate
-  if (Attrs.VectorizePredicateEnable != LoopAttributes::Unspecified) {
+  bool IsVectorPredicateEnabled = false;
+  if (Attrs.VectorizePredicateEnable != LoopAttributes::Unspecified &&
+  Attrs.VectorizeEnable != LoopAttributes::Disable &&
+  Attrs.VectorizeWidth < 1) {
+
+IsVectorPredicateEnabled =
+(Attrs.VectorizePredicateEnable == LoopAttributes::Enable);
+
 Metadata *Vals[] = {
 MDString::get(Ctx, "llvm.loop.vectorize.predicate.enable"),
-ConstantAsMetadata::get(ConstantInt::get(
-llvm::Type::getInt1Ty(Ctx),
-(Attrs.VectorizePredicateEnable == LoopAttributes::Enable)))};
+ConstantAsMetadata::get(ConstantInt::get(llvm::Type::getInt1Ty(Ctx),
+ IsVectorPredicateEnabled))};
 Args.push_back(MDNode::get(Ctx, Vals));
   }
 
@@ -281,12 +287,15 @@ LoopInfo::createLoopVectorizeMetadata(co
   }
 
   // Setting vectorize.enable
-  if (Attrs.VectorizeEnable != LoopAttributes::Unspecified) {
+  if (Attrs.VectorizeEnable != LoopAttributes::Unspecified ||
+  IsVectorPredicateEnabled) {
 Metadata *Vals[] = {
 MDString::get(Ctx, "llvm.loop.vectorize.enable"),
 ConstantAsMetadata::get(ConstantInt::get(
 llvm::Type::getInt1Ty(Ctx),
-(Attrs.VectorizeEnable == LoopAttributes::Enable)))};
+IsVectorPredicateEnabled
+? true
+: (Attrs.VectorizeEnable == LoopAttributes::Enable)))};
 Args.push_back(MDNode::get(Ctx, Vals));
   }
 

Modified: cfe/trunk/test/CodeGenCXX/pragma-loop-predicate.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/pragma-loop-predicate.cpp?rev=368970=368969=368970=diff
==
--- cfe/trunk/test/CodeGenCXX/pragma-loop-predicate.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/pragma-loop-predicate.cpp Wed Aug 14 23:24:40 2019
@@ -27,9 +27,50 @@ void test2(int *List, int Length) {
 List[i] = i * 2;
 }
 
+// vectorize_predicate(enable) implies vectorize(enable)
+void test3(int *List, int Length) {
+// CHECK-LABEL: @{{.*}}test3{{.*}}(
+// CHECK:   br label {{.*}}, !llvm.loop ![[LOOP3:.*]]
+
+  #pragma clang loop vectorize_predicate(enable)
+  for (int i = 0; i < Length; i++)
+List[i] = i * 2;
+}
+
+// Check that disabling vectorization means a vectorization width of 1, and
+// also that vectorization_predicate isn't enabled.
+void test4(int *List, int Length) {
+// CHECK-LABEL: @{{.*}}test4{{.*}}(
+// CHECK: br label {{.*}}, !llvm.loop ![[LOOP4:.*]]
+
+  #pragma clang loop vectorize(disable)
+  for (int i = 0; i < Length; i++)
+List[i] = i * 2;
+}
+
+// Check that vectorize and vectorize_predicate are disabled.
+void test5(int *List, int Length) {
+// CHECK-LABEL: @{{.*}}test5{{.*}}(
+// CHECK: br label {{.*}}, !llvm.loop ![[LOOP5:.*]]
+
+  #pragma clang loop vectorize(disable) vectorize_predicate(enable)
+  for (int i = 0; i < Length; i++)
+List[i] = i * 2;
+}
+
+
 // CHECK:  ![[LOOP0]] = distinct !{![[LOOP0]], !3}
 // CHECK-NEXT: !3 = !{!"llvm.loop.vectorize.enable", i1 true}
+
 // CHECK-NEXT: ![[LOOP1]] = distinct !{![[LOOP1]], !5, !3}
 // CHECK-NEXT: !5 = !{!"llvm.loop.vectorize.predicate.enable", i1 true}
+
 // CHECK-NEXT: ![[LOOP2]] = distinct !{![[LOOP2]], !7, !3}
 // CHECK-NEXT: !7 = !{!"llvm.loop.vectorize.predicate.enable", i1 false}
+
+// CHECK-NEXT: ![[LOOP3]] = distinct !{![[LOOP3]], !5, !3}
+
+// CHECK-NEXT: ![[LOOP4]] = distinct !{![[LOOP4]], !10}
+// CHECK-NEXT: !10 = !{!"llvm.loop.vectorize.width", i32 1}
+
+// CHECK-NEXT: ![[LOOP5]] = distinct !{![[LOOP5]], !10}


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


r366989 - [Clang] New loop pragma vectorize_predicate

2019-07-25 Thread Sjoerd Meijer via cfe-commits
Author: sjoerdmeijer
Date: Thu Jul 25 00:33:13 2019
New Revision: 366989

URL: http://llvm.org/viewvc/llvm-project?rev=366989=rev
Log:
[Clang] New loop pragma vectorize_predicate

This adds a new vectorize predication loop hint:

  #pragma clang loop vectorize_predicate(enable)

that can be used to indicate to the vectoriser that all (load/store)
instructions should be predicated (masked). This allows, for example, folding
of the remainder loop into the main loop.

This patch will be followed up with D64916 and D65197. The former is a
refactoring in the loopvectorizer and the groundwork to make tail loop folding
a more general concept, and in the latter the actual tail loop folding
transformation will be implemented.

Differential Revision: https://reviews.llvm.org/D64744

Added:
cfe/trunk/test/CodeGenCXX/pragma-loop-predicate.cpp
Modified:
cfe/trunk/docs/LanguageExtensions.rst
cfe/trunk/include/clang/Basic/Attr.td
cfe/trunk/include/clang/Basic/AttrDocs.td
cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
cfe/trunk/lib/CodeGen/CGLoopInfo.cpp
cfe/trunk/lib/CodeGen/CGLoopInfo.h
cfe/trunk/lib/Parse/ParsePragma.cpp
cfe/trunk/lib/Sema/SemaStmtAttr.cpp
cfe/trunk/test/AST/ast-print-pragmas.cpp
cfe/trunk/test/Parser/pragma-loop.cpp
cfe/trunk/test/Parser/pragma-unroll-and-jam.cpp

Modified: cfe/trunk/docs/LanguageExtensions.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LanguageExtensions.rst?rev=366989=366988=366989=diff
==
--- cfe/trunk/docs/LanguageExtensions.rst (original)
+++ cfe/trunk/docs/LanguageExtensions.rst Thu Jul 25 00:33:13 2019
@@ -2946,12 +2946,12 @@ Extensions for loop hint optimizations
 
 The ``#pragma clang loop`` directive is used to specify hints for optimizing 
the
 subsequent for, while, do-while, or c++11 range-based for loop. The directive
-provides options for vectorization, interleaving, unrolling and
+provides options for vectorization, interleaving, predication, unrolling and
 distribution. Loop hints can be specified before any loop and will be ignored 
if
 the optimization is not safe to apply.
 
-Vectorization and Interleaving
---
+Vectorization, Interleaving, and Predication
+
 
 A vectorized loop performs multiple iterations of the original loop
 in parallel using vector instructions. The instruction set of the target
@@ -2994,6 +2994,21 @@ width/count of the set of target archite
 Specifying a width/count of 1 disables the optimization, and is equivalent to
 ``vectorize(disable)`` or ``interleave(disable)``.
 
+Vector predication is enabled by ``vectorize_predicate(enable)``, for example:
+
+.. code-block:: c++
+
+  #pragma clang loop vectorize(enable)
+  #pragma clang loop vectorize_predicate(enable)
+  for(...) {
+...
+  }
+
+This predicates (masks) all instructions in the loop, which allows the scalar
+remainder loop (the tail) to be folded into the main vectorized loop. This
+might be more efficient when vector predication is efficiently supported by the
+target platform.
+
 Loop Unrolling
 --
 

Modified: cfe/trunk/include/clang/Basic/Attr.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=366989=366988=366989=diff
==
--- cfe/trunk/include/clang/Basic/Attr.td (original)
+++ cfe/trunk/include/clang/Basic/Attr.td Thu Jul 25 00:33:13 2019
@@ -2982,10 +2982,12 @@ def LoopHint : Attr {
   let Args = [EnumArgument<"Option", "OptionType",
   ["vectorize", "vectorize_width", "interleave", 
"interleave_count",
"unroll", "unroll_count", "unroll_and_jam", 
"unroll_and_jam_count",
-   "pipeline", "pipeline_initiation_interval", 
"distribute"],
+   "pipeline", "pipeline_initiation_interval", 
"distribute",
+   "vectorize_predicate"],
   ["Vectorize", "VectorizeWidth", "Interleave", 
"InterleaveCount",
"Unroll", "UnrollCount", "UnrollAndJam", 
"UnrollAndJamCount",
-   "PipelineDisabled", "PipelineInitiationInterval", 
"Distribute"]>,
+   "PipelineDisabled", "PipelineInitiationInterval", 
"Distribute",
+   "VectorizePredicate"]>,
   EnumArgument<"State", "LoopHintState",
["enable", "disable", "numeric", "assume_safety", 
"full"],
["Enable", "Disable", "Numeric", "AssumeSafety", 
"Full"]>,
@@ -3005,6 +3007,7 @@ def LoopHint : Attr {
 case PipelineDisabled: return "pipeline";
 case PipelineInitiationInterval: return "pipeline_initiation_interval";
 case Distribute: return "distribute";
+case VectorizePredicate: return 

r366904 - Test commit. NFC.

2019-07-24 Thread Sjoerd Meijer via cfe-commits
Author: sjoerdmeijer
Date: Wed Jul 24 06:30:36 2019
New Revision: 366904

URL: http://llvm.org/viewvc/llvm-project?rev=366904=rev
Log:
Test commit. NFC.

Removed 2 trailing whitespaces in 2 files that used to be in different
repos to test my new github monorepo workflow.

Modified:
cfe/trunk/lib/Basic/Targets/X86.cpp

Modified: cfe/trunk/lib/Basic/Targets/X86.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/X86.cpp?rev=366904=366903=366904=diff
==
--- cfe/trunk/lib/Basic/Targets/X86.cpp (original)
+++ cfe/trunk/lib/Basic/Targets/X86.cpp Wed Jul 24 06:30:36 2019
@@ -895,7 +895,7 @@ bool X86TargetInfo::handleTargetFeatures
 /// definitions for this particular subtarget.
 void X86TargetInfo::getTargetDefines(const LangOptions ,
  MacroBuilder ) const {
-  // Inline assembly supports X86 flag outputs. 
+  // Inline assembly supports X86 flag outputs.
   Builder.defineMacro("__GCC_ASM_FLAG_OUTPUTS__");
 
   std::string CodeModel = getTargetOpts().CodeModel;


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


r365629 - Loop pragma parsing. NFC.

2019-07-10 Thread Sjoerd Meijer via cfe-commits
Author: sjoerdmeijer
Date: Wed Jul 10 06:34:57 2019
New Revision: 365629

URL: http://llvm.org/viewvc/llvm-project?rev=365629=rev
Log:
Loop pragma parsing. NFC.

I would like to add some pragma handling here, but couldn't resist a little NFC
and tidy up first.

Differential Revision: https://reviews.llvm.org/D64471

Modified:
cfe/trunk/lib/Sema/SemaStmtAttr.cpp

Modified: cfe/trunk/lib/Sema/SemaStmtAttr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaStmtAttr.cpp?rev=365629=365628=365629=diff
==
--- cfe/trunk/lib/Sema/SemaStmtAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaStmtAttr.cpp Wed Jul 10 06:34:57 2019
@@ -82,22 +82,17 @@ static Attr *handleLoopHintAttr(Sema ,
   IdentifierLoc *StateLoc = A.getArgAsIdent(2);
   Expr *ValueExpr = A.getArgAsExpr(3);
 
-  bool PragmaUnroll = PragmaNameLoc->Ident->getName() == "unroll";
-  bool PragmaNoUnroll = PragmaNameLoc->Ident->getName() == "nounroll";
-  bool PragmaUnrollAndJam = PragmaNameLoc->Ident->getName() == 
"unroll_and_jam";
-  bool PragmaNoUnrollAndJam =
-  PragmaNameLoc->Ident->getName() == "nounroll_and_jam";
+  StringRef PragmaName =
+  llvm::StringSwitch(PragmaNameLoc->Ident->getName())
+  .Cases("unroll", "nounroll", "unroll_and_jam", "nounroll_and_jam",
+ PragmaNameLoc->Ident->getName())
+  .Default("clang loop");
+
   if (St->getStmtClass() != Stmt::DoStmtClass &&
   St->getStmtClass() != Stmt::ForStmtClass &&
   St->getStmtClass() != Stmt::CXXForRangeStmtClass &&
   St->getStmtClass() != Stmt::WhileStmtClass) {
-const char *Pragma =
-llvm::StringSwitch(PragmaNameLoc->Ident->getName())
-.Case("unroll", "#pragma unroll")
-.Case("nounroll", "#pragma nounroll")
-.Case("unroll_and_jam", "#pragma unroll_and_jam")
-.Case("nounroll_and_jam", "#pragma nounroll_and_jam")
-.Default("#pragma clang loop");
+std::string Pragma = "#pragma " + std::string(PragmaName);
 S.Diag(St->getBeginLoc(), diag::err_pragma_loop_precedes_nonloop) << 
Pragma;
 return nullptr;
   }
@@ -106,34 +101,29 @@ static Attr *handleLoopHintAttr(Sema ,
   LoopHintAttr::Spelling(A.getAttributeSpellingListIndex());
   LoopHintAttr::OptionType Option;
   LoopHintAttr::LoopHintState State;
-  if (PragmaNoUnroll) {
-// #pragma nounroll
-Option = LoopHintAttr::Unroll;
-State = LoopHintAttr::Disable;
-  } else if (PragmaUnroll) {
-if (ValueExpr) {
-  // #pragma unroll N
-  Option = LoopHintAttr::UnrollCount;
-  State = LoopHintAttr::Numeric;
-} else {
-  // #pragma unroll
-  Option = LoopHintAttr::Unroll;
-  State = LoopHintAttr::Enable;
-}
-  } else if (PragmaNoUnrollAndJam) {
-// #pragma nounroll_and_jam
-Option = LoopHintAttr::UnrollAndJam;
-State = LoopHintAttr::Disable;
-  } else if (PragmaUnrollAndJam) {
-if (ValueExpr) {
-  // #pragma unroll_and_jam N
-  Option = LoopHintAttr::UnrollAndJamCount;
-  State = LoopHintAttr::Numeric;
-} else {
-  // #pragma unroll_and_jam
-  Option = LoopHintAttr::UnrollAndJam;
-  State = LoopHintAttr::Enable;
-}
+
+  auto SetHints = [, ](LoopHintAttr::OptionType O,
+LoopHintAttr::LoopHintState S) {
+Option = O;
+State = S;
+  };
+
+  if (PragmaName == "nounroll") {
+SetHints(LoopHintAttr::Unroll, LoopHintAttr::Disable);
+  } else if (PragmaName == "unroll") {
+// #pragma unroll N
+if (ValueExpr)
+  SetHints(LoopHintAttr::UnrollCount, LoopHintAttr::Numeric);
+else
+  SetHints(LoopHintAttr::Unroll, LoopHintAttr::Enable);
+  } else if (PragmaName == "nounroll_and_jam") {
+SetHints(LoopHintAttr::UnrollAndJam, LoopHintAttr::Disable);
+  } else if (PragmaName == "unroll_and_jam") {
+// #pragma unroll_and_jam N
+if (ValueExpr)
+  SetHints(LoopHintAttr::UnrollAndJamCount, LoopHintAttr::Numeric);
+else
+  SetHints(LoopHintAttr::UnrollAndJam, LoopHintAttr::Enable);
   } else {
 // #pragma clang loop ...
 assert(OptionLoc && OptionLoc->Ident &&


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


r362806 - [ARM] Add ACLE feature macros for MVE

2019-06-07 Thread Sjoerd Meijer via cfe-commits
Author: sjoerdmeijer
Date: Fri Jun  7 08:20:56 2019
New Revision: 362806

URL: http://llvm.org/viewvc/llvm-project?rev=362806=rev
Log:
[ARM] Add ACLE feature macros for MVE

If MVE is present at all, then the macro __ARM_FEATURE_MVE is defined
to a value which has bit 0 set for integer MVE, and bit 1 set for
floating-point MVE.

(Floating-point MVE implies integer MVE, so if this macro is defined
at all then it will be set to 1 or 3, never 2.)

Patch mostly by Simon Tatham

Differential Revision: https://reviews.llvm.org/D60710

Modified:
cfe/trunk/lib/Basic/Targets/ARM.cpp
cfe/trunk/lib/Basic/Targets/ARM.h
cfe/trunk/test/Preprocessor/arm-target-features.c

Modified: cfe/trunk/lib/Basic/Targets/ARM.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/ARM.cpp?rev=362806=362805=362806=diff
==
--- cfe/trunk/lib/Basic/Targets/ARM.cpp (original)
+++ cfe/trunk/lib/Basic/Targets/ARM.cpp Fri Jun  7 08:20:56 2019
@@ -146,6 +146,14 @@ void ARMTargetInfo::setAtomic() {
   }
 }
 
+bool ARMTargetInfo::hasMVE() const {
+  return ArchKind == llvm::ARM::ArchKind::ARMV8_1MMainline && MVE != 0;
+}
+
+bool ARMTargetInfo::hasMVEFloat() const {
+  return hasMVE() && (MVE & MVE_FP);
+}
+
 bool ARMTargetInfo::isThumb() const {
   return ArchISA == llvm::ARM::ISAKind::THUMB;
 }
@@ -460,6 +468,15 @@ bool ARMTargetInfo::handleTargetFeatures
   HasLegalHalfType = true;
 } else if (Feature == "+dotprod") {
   DotProd = true;
+} else if (Feature == "+mve") {
+  DSP = 1;
+  MVE |= MVE_INT;
+} else if (Feature == "+mve.fp") {
+  DSP = 1;
+  HasLegalHalfType = true;
+  FPU |= FPARMV8;
+  MVE |= MVE_INT | MVE_FP;
+  HW_FP |= HW_FP_SP | HW_FP_HP;
 }
   }
 
@@ -510,6 +527,7 @@ bool ARMTargetInfo::hasFeature(StringRef
   .Case("vfp", FPU && !SoftFloat)
   .Case("hwdiv", HWDiv & HWDivThumb)
   .Case("hwdiv-arm", HWDiv & HWDivARM)
+  .Case("mve", hasMVE())
   .Default(false);
 }
 
@@ -725,6 +743,10 @@ void ARMTargetInfo::getTargetDefines(con
 "0x" + Twine::utohexstr(HW_FP & ~HW_FP_DP));
   }
 
+  if (hasMVE()) {
+Builder.defineMacro("__ARM_FEATURE_MVE", hasMVEFloat() ? "3" : "1");
+  }
+
   Builder.defineMacro("__ARM_SIZEOF_WCHAR_T",
   Twine(Opts.WCharSize ? Opts.WCharSize : 4));
 

Modified: cfe/trunk/lib/Basic/Targets/ARM.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/ARM.h?rev=362806=362805=362806=diff
==
--- cfe/trunk/lib/Basic/Targets/ARM.h (original)
+++ cfe/trunk/lib/Basic/Targets/ARM.h Fri Jun  7 08:20:56 2019
@@ -33,6 +33,11 @@ class LLVM_LIBRARY_VISIBILITY ARMTargetI
 FPARMV8 = (1 << 4)
   };
 
+  enum MVEMode {
+  MVE_INT = (1 << 0),
+  MVE_FP  = (1 << 1)
+  };
+
   // Possible HWDiv features.
   enum HWDivMode { HWDivThumb = (1 << 0), HWDivARM = (1 << 1) };
 
@@ -56,6 +61,7 @@ class LLVM_LIBRARY_VISIBILITY ARMTargetI
   unsigned ArchVersion;
 
   unsigned FPU : 5;
+  unsigned MVE : 2;
 
   unsigned IsAAPCS : 1;
   unsigned HWDiv : 2;
@@ -100,6 +106,8 @@ class LLVM_LIBRARY_VISIBILITY ARMTargetI
   bool isThumb() const;
   bool supportsThumb() const;
   bool supportsThumb2() const;
+  bool hasMVE() const;
+  bool hasMVEFloat() const;
 
   StringRef getCPUAttr() const;
   StringRef getCPUProfile() const;

Modified: cfe/trunk/test/Preprocessor/arm-target-features.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/arm-target-features.c?rev=362806=362805=362806=diff
==
--- cfe/trunk/test/Preprocessor/arm-target-features.c (original)
+++ cfe/trunk/test/Preprocessor/arm-target-features.c Fri Jun  7 08:20:56 2019
@@ -748,6 +748,27 @@
 // KRAIT-ALLOW-FP-INSTR:#define __ARM_FEATURE_DSP 1
 // KRAIT-ALLOW-FP-INSTR:#define  __ARM_VFPV4__ 1
 
+// RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main -x c -E -dM %s 
-o - | FileCheck -match-full-lines --check-prefix=CHECK-V81M %s
+// CHECK-V81M: #define __ARM_ARCH 8
+// CHECK-V81M: #define __ARM_ARCH_8_1M_MAIN__ 1
+// CHECK-V81M: #define __ARM_ARCH_ISA_THUMB 2
+// CHECK-V81M: #define __ARM_ARCH_PROFILE 'M'
+// CHECK-V81M-NOT: #define __ARM_FEATURE_DSP
+// CHECK-V81M-NOT: #define __ARM_FEATURE_MVE
+// CHECK-V81M-NOT: #define __ARM_FEATURE_SIMD32
+
+// RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main+mve -x c -E -dM 
%s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V81M-MVE %s
+// CHECK-V81M-MVE: #define __ARM_FEATURE_DSP 1
+// CHECK-V81M-MVE: #define __ARM_FEATURE_MVE 1
+// CHECK-V81M-MVE: #define __ARM_FEATURE_SIMD32 1
+
+// RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main+mve.fp -x c -E 
-dM %s -o - | FileCheck -match-full-lines --check-prefix=CHECK-V81M-MVE-FP %s
+// CHECK-V81M-MVE-FP: #define __ARM_FEATURE_DSP 1
+// 

r362601 - [ARM] Allow "-march=foo+fp" to vary with foo

2019-06-05 Thread Sjoerd Meijer via cfe-commits
Author: sjoerdmeijer
Date: Wed Jun  5 06:12:01 2019
New Revision: 362601

URL: http://llvm.org/viewvc/llvm-project?rev=362601=rev
Log:
[ARM] Allow "-march=foo+fp" to vary with foo

Now, when clang processes an argument of the form "-march=foo+x+y+z",
then instead of calling getArchExtFeature() for each of the extension
names "x", "y", "z" and appending the returned string to its list of
low-level subtarget features, it will call appendArchExtFeatures()
which does the appending itself.

The difference is that appendArchExtFeatures can add _more_ than one
low-level feature name to the output feature list if it has to, and
also, it gets told some information about what base architecture and
CPU the extension is going to go with, which means that "+fp" can now
mean something different for different CPUs. Namely, "+fp" now selects
whatever the _default_ FPU is for the selected CPU and/or
architecture, as defined in the ARM_ARCH or ARM_CPU_NAME macros in
ARMTargetParser.def.

On the clang side, I adjust DecodeARMFeatures to call the new
appendArchExtFeatures function in place of getArchExtFeature. This
means DecodeARMFeatures needs to be passed a CPU name and an ArchKind,
which meant changing its call sites to make those available, and also
sawing getLLVMArchSuffixForARM in half so that you can get an ArchKind
enum value out of it instead of a string.

Also, I add support here for the extension name "+fp.dp", which will
automatically look through the FPU list for something that looks just
like the default FPU except for also supporting double precision.

Differential Revision: https://reviews.llvm.org/D60697

Modified:
cfe/trunk/lib/Driver/ToolChains/Arch/ARM.cpp
cfe/trunk/lib/Driver/ToolChains/Arch/ARM.h
cfe/trunk/test/Driver/armv8.1m.main.c
cfe/trunk/test/Driver/armv8.1m.main.s

Modified: cfe/trunk/lib/Driver/ToolChains/Arch/ARM.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Arch/ARM.cpp?rev=362601=362600=362601=diff
==
--- cfe/trunk/lib/Driver/ToolChains/Arch/ARM.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Arch/ARM.cpp Wed Jun  5 06:12:01 2019
@@ -72,15 +72,13 @@ static void getARMFPUFeatures(const Driv
 
 // Decode ARM features from string like +[no]featureA+[no]featureB+...
 static bool DecodeARMFeatures(const Driver , StringRef text,
+  StringRef CPU, llvm::ARM::ArchKind ArchKind,
   std::vector ) {
   SmallVector Split;
   text.split(Split, StringRef("+"), -1, false);
 
   for (StringRef Feature : Split) {
-StringRef FeatureName = llvm::ARM::getArchExtFeature(Feature);
-if (!FeatureName.empty())
-  Features.push_back(FeatureName);
-else
+if (!appendArchExtFeatures(CPU, ArchKind, Feature, Features))
   return false;
   }
   return true;
@@ -100,14 +98,16 @@ static void DecodeARMFeaturesFromCPU(con
 // getARMArch is used here instead of just checking the -march value in order
 // to handle -march=native correctly.
 static void checkARMArchName(const Driver , const Arg *A, const ArgList 
,
- llvm::StringRef ArchName,
+ llvm::StringRef ArchName, llvm::StringRef CPUName,
  std::vector ,
  const llvm::Triple ) {
   std::pair Split = ArchName.split("+");
 
   std::string MArch = arm::getARMArch(ArchName, Triple);
-  if (llvm::ARM::parseArch(MArch) == llvm::ARM::ArchKind::INVALID ||
-  (Split.second.size() && !DecodeARMFeatures(D, Split.second, Features)))
+  llvm::ARM::ArchKind ArchKind = llvm::ARM::parseArch(MArch);
+  if (ArchKind == llvm::ARM::ArchKind::INVALID ||
+  (Split.second.size() && !DecodeARMFeatures(
+D, Split.second, CPUName, ArchKind, Features)))
 D.Diag(clang::diag::err_drv_clang_unsupported) << A->getAsString(Args);
 }
 
@@ -119,8 +119,11 @@ static void checkARMCPUName(const Driver
   std::pair Split = CPUName.split("+");
 
   std::string CPU = arm::getARMTargetCPU(CPUName, ArchName, Triple);
-  if (arm::getLLVMArchSuffixForARM(CPU, ArchName, Triple).empty() ||
-  (Split.second.size() && !DecodeARMFeatures(D, Split.second, Features)))
+  llvm::ARM::ArchKind ArchKind =
+arm::getLLVMArchKindForARM(CPU, ArchName, Triple);
+  if (ArchKind == llvm::ARM::ArchKind::INVALID ||
+  (Split.second.size() && !DecodeARMFeatures(
+D, Split.second, CPU, ArchKind, Features)))
 D.Diag(clang::diag::err_drv_clang_unsupported) << A->getAsString(Args);
 }
 
@@ -327,25 +330,12 @@ void arm::getARMTargetFeatures(const Too
   if (ThreadPointer == arm::ReadTPMode::Cp15)
 Features.push_back("+read-tp-hard");
 
-  // Check -march. ClangAs gives preference to -Wa,-march=.
   const Arg *ArchArg = Args.getLastArg(options::OPT_march_EQ);
+  const Arg *CPUArg = Args.getLastArg(options::OPT_mcpu_EQ);
   StringRef ArchName;
-  if (WaArch) {
-if (ArchArg)
-  

r362100 - Follow up of r362096

2019-05-30 Thread Sjoerd Meijer via cfe-commits
Author: sjoerdmeijer
Date: Thu May 30 08:04:06 2019
New Revision: 362100

URL: http://llvm.org/viewvc/llvm-project?rev=362100=rev
Log:
Follow up of r362096

The new tests were failing, because I missed dependent patch D60697.
I have removed the failing cases for now, which I will restore once
D60697 is in.

Modified:
cfe/trunk/test/Driver/armv8.1m.main.c
cfe/trunk/test/Driver/armv8.1m.main.s

Modified: cfe/trunk/test/Driver/armv8.1m.main.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/armv8.1m.main.c?rev=362100=362099=362100=diff
==
--- cfe/trunk/test/Driver/armv8.1m.main.c (original)
+++ cfe/trunk/test/Driver/armv8.1m.main.c Thu May 30 08:04:06 2019
@@ -2,20 +2,6 @@
 // RUN: FileCheck --check-prefix=CHECK-DSP < %t %s
 // CHECK-DSP: "-target-feature" "+dsp"
 
-// RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main+fp  -### %s 2> 
%t
-// RUN: FileCheck --check-prefix=CHECK-FP < %t %s
-// CHECK-FP: "-target-feature" "+fp-armv8"
-// CHECK-FP-NOT: "-target-feature" "+fp64"
-// CHECK-FP-NOT: "-target-feature" "+d32"
-// CHECK-FP: "-target-feature" "+fullfp16"
-
-// RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main+fp.dp  -### %s 
2> %t
-// RUN: FileCheck --check-prefix=CHECK-FPDP < %t %s
-// CHECK-FPDP: "-target-feature" "+fp-armv8"
-// CHECK-FPDP: "-target-feature" "+fullfp16"
-// CHECK-FPDP: "-target-feature" "+fp64"
-// CHECK-FPDP-NOT: "-target-feature" "+d32"
-
 // RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main+mve  -### %s 2> 
%t
 // RUN: FileCheck --check-prefix=CHECK-MVE < %t %s
 // CHECK-MVE: "-target-feature" "+mve"
@@ -25,10 +11,4 @@
 // CHECK-MVEFP: "-target-feature" "+mve.fp"
 // CHECK-MVEFP-NOT: "-target-feature" "+fp64"
 
-// RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main+mve.fp+fp.dp  
-### %s 2> %t
-// RUN: FileCheck --check-prefix=CHECK-MVEFP_DP < %t %s
-// CHECK-MVEFP_DP: "-target-feature" "+mve.fp"
-// CHECK-MVEFP_DP: "-target-feature" "+fp64"
-
-// RUN: %clang -target arm-arm-none-eabi -march=armv8.1m.main+fp -S %s
 double foo (double a) { return a; }

Modified: cfe/trunk/test/Driver/armv8.1m.main.s
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/armv8.1m.main.s?rev=362100=362099=362100=diff
==
--- cfe/trunk/test/Driver/armv8.1m.main.s (original)
+++ cfe/trunk/test/Driver/armv8.1m.main.s Thu May 30 08:04:06 2019
@@ -4,17 +4,10 @@
 # RUN:  FileCheck --check-prefix=ERROR-V81M < %t %s
 # RUN: not %clang -c -target arm-none-none-eabi -march=armv8.1-m.main+dsp %s 
2>%t
 # RUN:  FileCheck --check-prefix=ERROR-V81M_DSP < %t %s
-# RUN: not %clang -c -target arm-none-none-eabi -march=armv8.1-m.main+fp %s 
2>%t
-# RUN:  FileCheck --check-prefix=ERROR-V81M_FP < %t %s
-# RUN: not %clang -c -target arm-none-none-eabi -march=armv8.1-m.main+fp.dp %s 
2>%t
-# RUN:  FileCheck --check-prefix=ERROR-V81M_FPDP < %t %s
 # RUN: not %clang -c -target arm-none-none-eabi -march=armv8.1-m.main+mve %s 
2>%t
 # RUN:  FileCheck --check-prefix=ERROR-V81M_MVE < %t %s
-# RUN: not %clang -c -target arm-none-none-eabi -march=armv8.1-m.main+mve+fp 
%s 2>%t
-# RUN:  FileCheck --check-prefix=ERROR-V81M_MVE_FP < %t %s
 # RUN: not %clang -c -target arm-none-none-eabi -march=armv8.1-m.main+mve.fp 
%s 2>%t
 # RUN:  FileCheck --check-prefix=ERROR-V81M_MVEFP < %t %s
-# RUN: %clang -c -target arm-none-none-eabi -march=armv8.1-m.main+mve.fp+fp.dp 
%s
 
 .syntax unified
 .thumb
@@ -45,21 +38,15 @@ vcmp.f64 d0,d1
 # ERROR-V8M: :[[@LINE-1]]:1: error
 # ERROR-V81M: :[[@LINE-2]]:1: error
 # ERROR-V81M_DSP: :[[@LINE-3]]:1: error
-# ERROR-V81M_FP: :[[@LINE-4]]:1: error
-# ERROR-V81M_MVE: :[[@LINE-5]]:1: error
-# ERROR-V81M_MVE_FP: :[[@LINE-6]]:1: error
-# ERROR-V81M_MVEFP: :[[@LINE-7]]:1: error
+# ERROR-V81M_MVE: :[[@LINE-4]]:1: error
+# ERROR-V81M_MVEFP: :[[@LINE-5]]:1: error
 
 asrl r0, r1, r2
 # ERROR-V8M: :[[@LINE-1]]:1: error
 # ERROR-V81M: :[[@LINE-2]]:1: error
 # ERROR-V81M_DSP: :[[@LINE-3]]:1: error
-# ERROR-V81M_FP: :[[@LINE-4]]:1: error
-# ERROR-V81M_FPDP: :[[@LINE-5]]:1: error
 
 vcadd.i8 q0, q1, q2, #90
 # ERROR-V8M: :[[@LINE-1]]:1: error
 # ERROR-V81M: :[[@LINE-2]]:1: error
 # ERROR-V81M_DSP: :[[@LINE-3]]:1: error
-# ERROR-V81M_FP: :[[@LINE-4]]:1: error
-# ERROR-V81M_FPDP: :[[@LINE-5]]:1: error


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


r362096 - [ARM] Add CLI support for Armv8.1-M and MVE

2019-05-30 Thread Sjoerd Meijer via cfe-commits
Author: sjoerdmeijer
Date: Thu May 30 07:22:26 2019
New Revision: 362096

URL: http://llvm.org/viewvc/llvm-project?rev=362096=rev
Log:
[ARM] Add CLI support for Armv8.1-M and MVE

Given the existing infrastructure in LLVM side for +fp and +fp.dp,
this is more or less trivial, needing only one tiny source change and
a couple of tests.

Patch by Simon Tatham.

Differential Revision: https://reviews.llvm.org/D60699

Added:
cfe/trunk/test/Driver/armv8.1m.main.c
cfe/trunk/test/Driver/armv8.1m.main.s
Modified:
cfe/trunk/lib/Basic/Targets/ARM.cpp

Modified: cfe/trunk/lib/Basic/Targets/ARM.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/ARM.cpp?rev=362096=362095=362096=diff
==
--- cfe/trunk/lib/Basic/Targets/ARM.cpp (original)
+++ cfe/trunk/lib/Basic/Targets/ARM.cpp Thu May 30 07:22:26 2019
@@ -197,6 +197,8 @@ StringRef ARMTargetInfo::getCPUAttr() co
 return "8M_MAIN";
   case llvm::ARM::ArchKind::ARMV8R:
 return "8R";
+  case llvm::ARM::ArchKind::ARMV8_1MMainline:
+return "8_1M_MAIN";
   }
 }
 

Added: cfe/trunk/test/Driver/armv8.1m.main.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/armv8.1m.main.c?rev=362096=auto
==
--- cfe/trunk/test/Driver/armv8.1m.main.c (added)
+++ cfe/trunk/test/Driver/armv8.1m.main.c Thu May 30 07:22:26 2019
@@ -0,0 +1,34 @@
+// RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main+dsp  -### %s 2> 
%t
+// RUN: FileCheck --check-prefix=CHECK-DSP < %t %s
+// CHECK-DSP: "-target-feature" "+dsp"
+
+// RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main+fp  -### %s 2> 
%t
+// RUN: FileCheck --check-prefix=CHECK-FP < %t %s
+// CHECK-FP: "-target-feature" "+fp-armv8"
+// CHECK-FP-NOT: "-target-feature" "+fp64"
+// CHECK-FP-NOT: "-target-feature" "+d32"
+// CHECK-FP: "-target-feature" "+fullfp16"
+
+// RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main+fp.dp  -### %s 
2> %t
+// RUN: FileCheck --check-prefix=CHECK-FPDP < %t %s
+// CHECK-FPDP: "-target-feature" "+fp-armv8"
+// CHECK-FPDP: "-target-feature" "+fullfp16"
+// CHECK-FPDP: "-target-feature" "+fp64"
+// CHECK-FPDP-NOT: "-target-feature" "+d32"
+
+// RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main+mve  -### %s 2> 
%t
+// RUN: FileCheck --check-prefix=CHECK-MVE < %t %s
+// CHECK-MVE: "-target-feature" "+mve"
+
+// RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main+mve.fp  -### %s 
2> %t
+// RUN: FileCheck --check-prefix=CHECK-MVEFP < %t %s
+// CHECK-MVEFP: "-target-feature" "+mve.fp"
+// CHECK-MVEFP-NOT: "-target-feature" "+fp64"
+
+// RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main+mve.fp+fp.dp  
-### %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-MVEFP_DP < %t %s
+// CHECK-MVEFP_DP: "-target-feature" "+mve.fp"
+// CHECK-MVEFP_DP: "-target-feature" "+fp64"
+
+// RUN: %clang -target arm-arm-none-eabi -march=armv8.1m.main+fp -S %s
+double foo (double a) { return a; }

Added: cfe/trunk/test/Driver/armv8.1m.main.s
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/armv8.1m.main.s?rev=362096=auto
==
--- cfe/trunk/test/Driver/armv8.1m.main.s (added)
+++ cfe/trunk/test/Driver/armv8.1m.main.s Thu May 30 07:22:26 2019
@@ -0,0 +1,65 @@
+# RUN: not %clang -c -target arm-none-none-eabi -march=armv8-m.main %s 2>%t
+# RUN:  FileCheck --check-prefix=ERROR-V8M < %t %s
+# RUN: not %clang -c -target arm-none-none-eabi -march=armv8.1-m.main %s 2>%t
+# RUN:  FileCheck --check-prefix=ERROR-V81M < %t %s
+# RUN: not %clang -c -target arm-none-none-eabi -march=armv8.1-m.main+dsp %s 
2>%t
+# RUN:  FileCheck --check-prefix=ERROR-V81M_DSP < %t %s
+# RUN: not %clang -c -target arm-none-none-eabi -march=armv8.1-m.main+fp %s 
2>%t
+# RUN:  FileCheck --check-prefix=ERROR-V81M_FP < %t %s
+# RUN: not %clang -c -target arm-none-none-eabi -march=armv8.1-m.main+fp.dp %s 
2>%t
+# RUN:  FileCheck --check-prefix=ERROR-V81M_FPDP < %t %s
+# RUN: not %clang -c -target arm-none-none-eabi -march=armv8.1-m.main+mve %s 
2>%t
+# RUN:  FileCheck --check-prefix=ERROR-V81M_MVE < %t %s
+# RUN: not %clang -c -target arm-none-none-eabi -march=armv8.1-m.main+mve+fp 
%s 2>%t
+# RUN:  FileCheck --check-prefix=ERROR-V81M_MVE_FP < %t %s
+# RUN: not %clang -c -target arm-none-none-eabi -march=armv8.1-m.main+mve.fp 
%s 2>%t
+# RUN:  FileCheck --check-prefix=ERROR-V81M_MVEFP < %t %s
+# RUN: %clang -c -target arm-none-none-eabi -march=armv8.1-m.main+mve.fp+fp.dp 
%s
+
+.syntax unified
+.thumb
+.text
+
+csinc r0, r1, r2, eq
+# ERROR-V8M: :[[@LINE-1]]:1: error
+
+qadd r0, r1, r2
+# ERROR-V8M: :[[@LINE-1]]:1: error
+# ERROR-V81M: :[[@LINE-2]]:1: error
+# ERROR-V81M_FP: :[[@LINE-3]]:1: error
+# ERROR-V81M_FPDP: :[[@LINE-4]]:1: error
+
+vadd.f16 s0, s1, s2
+# ERROR-V8M: :[[@LINE-1]]:1: error
+# ERROR-V81M: 

r343758 - [AArch64][ARM] Context sensitive meaning of crypto

2018-10-04 Thread Sjoerd Meijer via cfe-commits
Author: sjoerdmeijer
Date: Thu Oct  4 00:38:53 2018
New Revision: 343758

URL: http://llvm.org/viewvc/llvm-project?rev=343758=rev
Log:
[AArch64][ARM] Context sensitive meaning of crypto

For AArch64, crypto means:
- sm4 + sha3 + sha2 + aes for Armv8.4-A and up, and
- sha2 + aes for Armv8.3-A and earlier.

For AArch32:
Crypto means sha2 + aes, because the Armv8.2-A crypto instructions
were added to AArch64 only.

Differential Revision: https://reviews.llvm.org/D50179

Modified:
cfe/trunk/lib/Driver/ToolChains/Arch/AArch64.cpp
cfe/trunk/lib/Driver/ToolChains/Arch/ARM.cpp
cfe/trunk/test/Driver/arm-features.c
cfe/trunk/test/Preprocessor/aarch64-target-features.c

Modified: cfe/trunk/lib/Driver/ToolChains/Arch/AArch64.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Arch/AArch64.cpp?rev=343758=343757=343758=diff
==
--- cfe/trunk/lib/Driver/ToolChains/Arch/AArch64.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Arch/AArch64.cpp Thu Oct  4 00:38:53 2018
@@ -219,6 +219,87 @@ fp16_fml_fallthrough:
   Features.push_back("+fullfp16");
   }
 
+  // FIXME: this needs reimplementation too after the TargetParser rewrite
+  //
+  // Context sensitive meaning of Crypto:
+  // 1) For Arch >= ARMv8.4a:  crypto = sm4 + sha3 + sha2 + aes
+  // 2) For Arch <= ARMv8.3a:  crypto = sha2 + aes
+  const auto ItBegin = Features.begin();
+  const auto ItEnd = Features.end();
+  const auto ItRBegin = Features.rbegin();
+  const auto ItREnd = Features.rend();
+  const auto ItRCrypto = std::find(ItRBegin, ItREnd, "+crypto");
+  const auto ItRNoCrypto = std::find(ItRBegin, ItREnd, "-crypto");
+  const auto HasCrypto  = ItRCrypto != ItREnd;
+  const auto HasNoCrypto = ItRNoCrypto != ItREnd;
+  const ptrdiff_t PosCrypto = ItRCrypto - ItRBegin;
+  const ptrdiff_t PosNoCrypto = ItRNoCrypto - ItRBegin;
+
+  bool NoCrypto = false;
+  if (HasCrypto && HasNoCrypto) {
+if (PosNoCrypto < PosCrypto)
+  NoCrypto = true;
+  }
+
+  if (std::find(ItBegin, ItEnd, "+v8.4a") != ItEnd) {
+if (HasCrypto && !NoCrypto) {
+  // Check if we have NOT disabled an algorithm with something like:
+  //   +crypto, -algorithm
+  // And if "-algorithm" does not occur, we enable that crypto algorithm.
+  const bool HasSM4  = (std::find(ItBegin, ItEnd, "-sm4") == ItEnd);
+  const bool HasSHA3 = (std::find(ItBegin, ItEnd, "-sha3") == ItEnd);
+  const bool HasSHA2 = (std::find(ItBegin, ItEnd, "-sha2") == ItEnd);
+  const bool HasAES  = (std::find(ItBegin, ItEnd, "-aes") == ItEnd);
+  if (HasSM4)
+Features.push_back("+sm4");
+  if (HasSHA3)
+Features.push_back("+sha3");
+  if (HasSHA2)
+Features.push_back("+sha2");
+  if (HasAES)
+Features.push_back("+aes");
+} else if (HasNoCrypto) {
+  // Check if we have NOT enabled a crypto algorithm with something like:
+  //   -crypto, +algorithm
+  // And if "+algorithm" does not occur, we disable that crypto algorithm.
+  const bool HasSM4  = (std::find(ItBegin, ItEnd, "+sm4") != ItEnd);
+  const bool HasSHA3 = (std::find(ItBegin, ItEnd, "+sha3") != ItEnd);
+  const bool HasSHA2 = (std::find(ItBegin, ItEnd, "+sha2") != ItEnd);
+  const bool HasAES  = (std::find(ItBegin, ItEnd, "+aes") != ItEnd);
+  if (!HasSM4)
+Features.push_back("-sm4");
+  if (!HasSHA3)
+Features.push_back("-sha3");
+  if (!HasSHA2)
+Features.push_back("-sha2");
+  if (!HasAES)
+Features.push_back("-aes");
+}
+  } else {
+if (HasCrypto && !NoCrypto) {
+  const bool HasSHA2 = (std::find(ItBegin, ItEnd, "-sha2") == ItEnd);
+  const bool HasAES = (std::find(ItBegin, ItEnd, "-aes") == ItEnd);
+  if (HasSHA2)
+Features.push_back("+sha2");
+  if (HasAES)
+Features.push_back("+aes");
+} else if (HasNoCrypto) {
+  const bool HasSHA2 = (std::find(ItBegin, ItEnd, "+sha2") != ItEnd);
+  const bool HasAES  = (std::find(ItBegin, ItEnd, "+aes") != ItEnd);
+  const bool HasV82a = (std::find(ItBegin, ItEnd, "+v8.2a") != ItEnd);
+  const bool HasV83a = (std::find(ItBegin, ItEnd, "+v8.3a") != ItEnd);
+  const bool HasV84a = (std::find(ItBegin, ItEnd, "+v8.4a") != ItEnd);
+  if (!HasSHA2)
+Features.push_back("-sha2");
+  if (!HasAES)
+Features.push_back("-aes");
+  if (HasV82a || HasV83a || HasV84a) {
+Features.push_back("-sm4");
+Features.push_back("-sha3");
+  }
+}
+  }
+
   if (Arg *A = Args.getLastArg(options::OPT_mno_unaligned_access,
options::OPT_munaligned_access))
 if (A->getOption().matches(options::OPT_mno_unaligned_access))

Modified: cfe/trunk/lib/Driver/ToolChains/Arch/ARM.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Arch/ARM.cpp?rev=343758=343757=343758=diff

r342862 - [ARM][AArch64] Add feature +fp16fml

2018-09-24 Thread Sjoerd Meijer via cfe-commits
Author: sjoerdmeijer
Date: Mon Sep 24 00:55:20 2018
New Revision: 342862

URL: http://llvm.org/viewvc/llvm-project?rev=342862=rev
Log:
[ARM][AArch64] Add feature +fp16fml

Armv8.4-A adds a few FP16 instructions that can optionally be implemented
in CPUs of Armv8.2-A and above.

This patch adds a feature to clang to permit selection of these
instructions. This interacts with the +fp16 option as follows:

Prior to Armv8.4-A:
*) +fp16fml implies +fp16
*) +nofp16 implies +nofp16fml

From Armv8.4-A:
*) The above conditions apply, additionally: +fp16 implies +fp16fml

Patch by Bernard Ogden.

Differential Revision: https://reviews.llvm.org/D50229

Modified:
cfe/trunk/lib/Driver/ToolChains/Arch/AArch64.cpp
cfe/trunk/lib/Driver/ToolChains/Arch/ARM.cpp
cfe/trunk/test/Driver/aarch64-cpus.c
cfe/trunk/test/Driver/arm-cortex-cpus.c
cfe/trunk/test/Preprocessor/aarch64-target-features.c
cfe/trunk/test/Preprocessor/arm-target-features.c

Modified: cfe/trunk/lib/Driver/ToolChains/Arch/AArch64.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Arch/AArch64.cpp?rev=342862=342861=342862=diff
==
--- cfe/trunk/lib/Driver/ToolChains/Arch/AArch64.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Arch/AArch64.cpp Mon Sep 24 00:55:20 2018
@@ -193,6 +193,32 @@ void aarch64::getAArch64TargetFeatures(c
   Features.push_back("-crc");
   }
 
+  // Handle (arch-dependent) fp16fml/fullfp16 relationship.
+  // FIXME: this fp16fml option handling will be reimplemented after the
+  // TargetParser rewrite.
+  const auto ItRNoFullFP16 = std::find(Features.rbegin(), Features.rend(), 
"-fullfp16");
+  const auto ItRFP16FML = std::find(Features.rbegin(), Features.rend(), 
"+fp16fml");
+  if (std::find(Features.begin(), Features.end(), "+v8.4a") != Features.end()) 
{
+const auto ItRFullFP16  = std::find(Features.rbegin(), Features.rend(), 
"+fullfp16");
+if (ItRFullFP16 < ItRNoFullFP16 && ItRFullFP16 < ItRFP16FML) {
+  // Only entangled feature that can be to the right of this +fullfp16 is 
-fp16fml.
+  // Only append the +fp16fml if there is no -fp16fml after the +fullfp16.
+  if (std::find(Features.rbegin(), ItRFullFP16, "-fp16fml") == ItRFullFP16)
+Features.push_back("+fp16fml");
+}
+else
+  goto fp16_fml_fallthrough;
+  }
+  else {
+fp16_fml_fallthrough:
+// In both of these cases, putting the 'other' feature on the end of the 
vector will
+// result in the same effect as placing it immediately after the current 
feature.
+if (ItRNoFullFP16 < ItRFP16FML)
+  Features.push_back("-fp16fml");
+else if (ItRNoFullFP16 > ItRFP16FML)
+  Features.push_back("+fullfp16");
+  }
+
   if (Arg *A = Args.getLastArg(options::OPT_mno_unaligned_access,
options::OPT_munaligned_access))
 if (A->getOption().matches(options::OPT_mno_unaligned_access))

Modified: cfe/trunk/lib/Driver/ToolChains/Arch/ARM.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Arch/ARM.cpp?rev=342862=342861=342862=diff
==
--- cfe/trunk/lib/Driver/ToolChains/Arch/ARM.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Arch/ARM.cpp Mon Sep 24 00:55:20 2018
@@ -391,6 +391,33 @@ void arm::getARMTargetFeatures(const Too
   } else if (HDivArg)
 getARMHWDivFeatures(D, HDivArg, Args, HDivArg->getValue(), Features);
 
+  // Handle (arch-dependent) fp16fml/fullfp16 relationship.
+  // Must happen before any features are disabled due to soft-float.
+  // FIXME: this fp16fml option handling will be reimplemented after the
+  // TargetParser rewrite.
+  const auto ItRNoFullFP16 = std::find(Features.rbegin(), Features.rend(), 
"-fullfp16");
+  const auto ItRFP16FML = std::find(Features.rbegin(), Features.rend(), 
"+fp16fml");
+  if (Triple.getSubArch() == llvm::Triple::SubArchType::ARMSubArch_v8_4a) {
+const auto ItRFullFP16  = std::find(Features.rbegin(), Features.rend(), 
"+fullfp16");
+if (ItRFullFP16 < ItRNoFullFP16 && ItRFullFP16 < ItRFP16FML) {
+  // Only entangled feature that can be to the right of this +fullfp16 is 
-fp16fml.
+  // Only append the +fp16fml if there is no -fp16fml after the +fullfp16.
+  if (std::find(Features.rbegin(), ItRFullFP16, "-fp16fml") == ItRFullFP16)
+Features.push_back("+fp16fml");
+}
+else
+  goto fp16_fml_fallthrough;
+  }
+  else {
+fp16_fml_fallthrough:
+// In both of these cases, putting the 'other' feature on the end of the 
vector will
+// result in the same effect as placing it immediately after the current 
feature.
+if (ItRNoFullFP16 < ItRFP16FML)
+  Features.push_back("-fp16fml");
+else if (ItRNoFullFP16 > ItRFP16FML)
+  Features.push_back("+fullfp16");
+  }
+
   // Setting -msoft-float/-mfloat-abi=soft effectively disables the FPU (GCC
   // ignores the -mfpu 

r339347 - [AArch64][NFC] better matching of AArch64 target in aarch64-cpus.c tests

2018-08-09 Thread Sjoerd Meijer via cfe-commits
Author: sjoerdmeijer
Date: Thu Aug  9 07:07:27 2018
New Revision: 339347

URL: http://llvm.org/viewvc/llvm-project?rev=339347=rev
Log:
[AArch64][NFC] better matching of AArch64 target in aarch64-cpus.c tests

Differential Revision: https://reviews.llvm.org/D50175

Modified:
cfe/trunk/test/Driver/aarch64-cpus.c

Modified: cfe/trunk/test/Driver/aarch64-cpus.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/aarch64-cpus.c?rev=339347=339346=339347=diff
==
--- cfe/trunk/test/Driver/aarch64-cpus.c (original)
+++ cfe/trunk/test/Driver/aarch64-cpus.c Thu Aug  9 07:07:27 2018
@@ -6,7 +6,7 @@
 // RUN: %clang -target aarch64 -mlittle-endian -mcpu=generic -### -c %s 2>&1 | 
FileCheck -check-prefix=GENERIC %s
 // RUN: %clang -target aarch64_be -mlittle-endian -### -c %s 2>&1 | FileCheck 
-check-prefix=GENERIC %s
 // RUN: %clang -target aarch64_be -mlittle-endian -mcpu=generic -### -c %s 
2>&1 | FileCheck -check-prefix=GENERIC %s
-// GENERIC: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "generic"
+// GENERIC: "-cc1"{{.*}} "-triple" "aarch64{{(--)?}}"{{.*}} "-target-cpu" 
"generic"
 
 // RUN: %clang -target arm64 -### -c %s 2>&1 | FileCheck 
-check-prefix=ARM64-GENERIC %s
 // RUN: %clang -target arm64 -mcpu=generic -### -c %s 2>&1 | FileCheck 
-check-prefix=ARM64-GENERIC %s
@@ -29,8 +29,8 @@
 // RUN: %clang -target aarch64 -mtune=cortex-a35 -### -c %s 2>&1 | FileCheck 
-check-prefix=CA35-TUNE %s
 // RUN: %clang -target aarch64 -mlittle-endian -mtune=cortex-a35 -### -c %s 
2>&1 | FileCheck -check-prefix=CA35-TUNE %s
 // RUN: %clang -target aarch64_be -mlittle-endian -mtune=cortex-a35 -### -c %s 
2>&1 | FileCheck -check-prefix=CA35-TUNE %s
-// CA35: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "cortex-a35"
-// CA35-TUNE: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "generic"
+// CA35: "-cc1"{{.*}} "-triple" "aarch64{{(--)?}}"{{.*}} "-target-cpu" 
"cortex-a35"
+// CA35-TUNE: "-cc1"{{.*}} "-triple" "aarch64{{(--)?}}"{{.*}} "-target-cpu" 
"generic"
 
 // RUN: %clang -target arm64 -mcpu=cortex-a35 -### -c %s 2>&1 | FileCheck 
-check-prefix=ARM64-CA35 %s
 // RUN: %clang -target arm64 -mlittle-endian -mcpu=cortex-a35 -### -c %s 2>&1 
| FileCheck -check-prefix=ARM64-CA35 %s
@@ -44,8 +44,8 @@
 // RUN: %clang -target aarch64_be -mlittle-endian -mcpu=cortex-a53 -### -c %s 
2>&1 | FileCheck -check-prefix=CA53 %s
 // RUN: %clang -target aarch64 -mtune=cortex-a53 -### -c %s 2>&1 | FileCheck 
-check-prefix=CA53-TUNE %s
 // RUN: %clang -target aarch64_be -mlittle-endian -mtune=cortex-a53 -### -c %s 
2>&1 | FileCheck -check-prefix=CA53-TUNE %s
-// CA53: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "cortex-a53"
-// CA53-TUNE: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "generic"
+// CA53: "-cc1"{{.*}} "-triple" "aarch64{{(--)?}}"{{.*}} "-target-cpu" 
"cortex-a53"
+// CA53-TUNE: "-cc1"{{.*}} "-triple" "aarch64{{(--)?}}"{{.*}} "-target-cpu" 
"generic"
 
 // RUN: %clang -target arm64 -mcpu=cortex-a53 -### -c %s 2>&1 | FileCheck 
-check-prefix=ARM64-CA53 %s
 // RUN: %clang -target arm64 -mlittle-endian -mcpu=cortex-a53 -### -c %s 2>&1 
| FileCheck -check-prefix=ARM64-CA53 %s
@@ -59,8 +59,8 @@
 // RUN: %clang -target aarch64_be -mlittle-endian -mcpu=cortex-a55 -### -c %s 
2>&1 | FileCheck -check-prefix=CA55 %s
 // RUN: %clang -target aarch64 -mtune=cortex-a55 -### -c %s 2>&1 | FileCheck 
-check-prefix=CA55-TUNE %s
 // RUN: %clang -target aarch64_be -mlittle-endian -mtune=cortex-a55 -### -c %s 
2>&1 | FileCheck -check-prefix=CA55-TUNE %s
-// CA55: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "cortex-a55"
-// CA55-TUNE: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "generic"
+// CA55: "-cc1"{{.*}} "-triple" "aarch64{{(--)?}}"{{.*}} "-target-cpu" 
"cortex-a55"
+// CA55-TUNE: "-cc1"{{.*}} "-triple" "aarch64{{(--)?}}"{{.*}} "-target-cpu" 
"generic"
 
 // RUN: %clang -target arm64 -mcpu=cortex-a55 -### -c %s 2>&1 | FileCheck 
-check-prefix=ARM64-CA55 %s
 // RUN: %clang -target arm64 -mlittle-endian -mcpu=cortex-a55 -### -c %s 2>&1 
| FileCheck -check-prefix=ARM64-CA55 %s
@@ -75,8 +75,8 @@
 // RUN: %clang -target aarch64 -mtune=cortex-a57 -### -c %s 2>&1 | FileCheck 
-check-prefix=CA57-TUNE %s
 // RUN: %clang -target aarch64 -mlittle-endian -mtune=cortex-a57 -### -c %s 
2>&1 | FileCheck -check-prefix=CA57-TUNE %s
 // RUN: %clang -target aarch64_be -mlittle-endian -mtune=cortex-a57 -### -c %s 
2>&1 | FileCheck -check-prefix=CA57-TUNE %s
-// CA57: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "cortex-a57"
-// CA57-TUNE: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "generic"
+// CA57: "-cc1"{{.*}} "-triple" "aarch64{{(--)?}}"{{.*}} "-target-cpu" 
"cortex-a57"
+// CA57-TUNE: "-cc1"{{.*}} "-triple" "aarch64{{(--)?}}"{{.*}} "-target-cpu" 
"generic"
 
 // RUN: %clang -target arm64 -mcpu=cortex-a57 -### -c %s 2>&1 | FileCheck 
-check-prefix=ARM64-CA57 %s
 // RUN: %clang -target arm64 

r338525 - [AArch64][ARM] Add Armv8.4-A tests

2018-08-01 Thread Sjoerd Meijer via cfe-commits
Author: sjoerdmeijer
Date: Wed Aug  1 05:41:10 2018
New Revision: 338525

URL: http://llvm.org/viewvc/llvm-project?rev=338525=rev
Log:
[AArch64][ARM] Add Armv8.4-A tests

This adds tests for Armv8.4-A, and also some v8.2 and v8.3 tests that were
missing.

Differential Revision: https://reviews.llvm.org/D50068

Modified:
cfe/trunk/lib/Basic/Targets/ARM.cpp
cfe/trunk/test/Driver/aarch64-cpus.c
cfe/trunk/test/Driver/arm-cortex-cpus.c

Modified: cfe/trunk/lib/Basic/Targets/ARM.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/ARM.cpp?rev=338525=338524=338525=diff
==
--- cfe/trunk/lib/Basic/Targets/ARM.cpp (original)
+++ cfe/trunk/lib/Basic/Targets/ARM.cpp Wed Aug  1 05:41:10 2018
@@ -185,6 +185,10 @@ StringRef ARMTargetInfo::getCPUAttr() co
 return "8_1A";
   case llvm::ARM::ArchKind::ARMV8_2A:
 return "8_2A";
+  case llvm::ARM::ArchKind::ARMV8_3A:
+return "8_3A";
+  case llvm::ARM::ArchKind::ARMV8_4A:
+return "8_4A";
   case llvm::ARM::ArchKind::ARMV8MBaseline:
 return "8M_BASE";
   case llvm::ARM::ArchKind::ARMV8MMainline:

Modified: cfe/trunk/test/Driver/aarch64-cpus.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/aarch64-cpus.c?rev=338525=338524=338525=diff
==
--- cfe/trunk/test/Driver/aarch64-cpus.c (original)
+++ cfe/trunk/test/Driver/aarch64-cpus.c Wed Aug  1 05:41:10 2018
@@ -388,6 +388,14 @@
 // RUN: %clang -target aarch64_be -mlittle-endian -march=armv8.2-a -### -c %s 
2>&1 | FileCheck -check-prefix=GENERICV82A %s
 // GENERICV82A: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "generic" 
"-target-feature" "+neon" "-target-feature" "+v8.2a"
 
+// RUN: %clang -target aarch64_be -march=armv8.2a -### -c %s 2>&1 | FileCheck 
-check-prefix=GENERICV82A-BE %s
+// RUN: %clang -target aarch64_be -march=armv8.2-a -### -c %s 2>&1 | FileCheck 
-check-prefix=GENERICV82A-BE %s
+// RUN: %clang -target aarch64 -mbig-endian -march=armv8.2a -### -c %s 2>&1 | 
FileCheck -check-prefix=GENERICV82A-BE %s
+// RUN: %clang -target aarch64 -mbig-endian -march=armv8.2-a -### -c %s 2>&1 | 
FileCheck -check-prefix=GENERICV82A-BE %s
+// RUN: %clang -target aarch64_be -mbig-endian -march=armv8.2a -### -c %s 2>&1 
| FileCheck -check-prefix=GENERICV82A-BE %s
+// RUN: %clang -target aarch64_be -mbig-endian -march=armv8.2-a -### -c %s 
2>&1 | FileCheck -check-prefix=GENERICV82A-BE %s
+// GENERICV82A-BE: "-cc1"{{.*}} "-triple" "aarch64_be{{.*}}" "-target-cpu" 
"generic" "-target-feature" "+neon" "-target-feature" "+v8.2a"
+
 // RUN: %clang -target aarch64 -march=armv8.2-a+fp16 -### -c %s 2>&1 | 
FileCheck -check-prefix=GENERICV82A-FP16 %s
 // GENERICV82A-FP16: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" 
"generic" "-target-feature" "+neon" "-target-feature" "+v8.2a" 
"-target-feature" "+fullfp16"
 
@@ -397,6 +405,71 @@
 // RUN: %clang -target aarch64 -march=armv8.2-a+fp16+profile -### -c %s 2>&1 | 
FileCheck -check-prefix=GENERICV82A-FP16-SPE %s
 // GENERICV82A-FP16-SPE: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" 
"generic" "-target-feature" "+neon" "-target-feature" "+v8.2a" 
"-target-feature" "+fullfp16" "-target-feature" "+spe"
 
+// RUN: %clang -target aarch64 -march=armv8.3a -### -c %s 2>&1 | FileCheck 
-check-prefix=GENERICV83A %s
+// RUN: %clang -target aarch64 -march=armv8.3-a -### -c %s 2>&1 | FileCheck 
-check-prefix=GENERICV83A %s
+// RUN: %clang -target aarch64 -mlittle-endian -march=armv8.3a -### -c %s 2>&1 
| FileCheck -check-prefix=GENERICV83A %s
+// RUN: %clang -target aarch64 -mlittle-endian -march=armv8.3-a -### -c %s 
2>&1 | FileCheck -check-prefix=GENERICV83A %s
+// RUN: %clang -target aarch64_be -mlittle-endian -march=armv8.3a -### -c %s 
2>&1 | FileCheck -check-prefix=GENERICV83A %s
+// RUN: %clang -target aarch64_be -mlittle-endian -march=armv8.3-a -### -c %s 
2>&1 | FileCheck -check-prefix=GENERICV83A %s
+// GENERICV83A: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "generic" 
"-target-feature" "+neon" "-target-feature" "+v8.3a"
+
+// RUN: %clang -target aarch64_be -march=armv8.3a -### -c %s 2>&1 | FileCheck 
-check-prefix=GENERICV83A-BE %s
+// RUN: %clang -target aarch64_be -march=armv8.3-a -### -c %s 2>&1 | FileCheck 
-check-prefix=GENERICV83A-BE %s
+// RUN: %clang -target aarch64 -mbig-endian -march=armv8.3a -### -c %s 2>&1 | 
FileCheck -check-prefix=GENERICV83A-BE %s
+// RUN: %clang -target aarch64 -mbig-endian -march=armv8.3-a -### -c %s 2>&1 | 
FileCheck -check-prefix=GENERICV83A-BE %s
+// RUN: %clang -target aarch64_be -mbig-endian -march=armv8.3a -### -c %s 2>&1 
| FileCheck -check-prefix=GENERICV83A-BE %s
+// RUN: %clang -target aarch64_be -mbig-endian -march=armv8.3-a -### -c %s 
2>&1 | FileCheck -check-prefix=GENERICV83A-BE %s
+// GENERICV83A-BE: "-cc1"{{.*}} "-triple" "aarch64_be{{.*}}" "-target-cpu" 
"generic" "-target-feature" "+neon" 

r335111 - [SPIR] Prevent SPIR targets from using half conversion intrinsics

2018-06-20 Thread Sjoerd Meijer via cfe-commits
Author: sjoerdmeijer
Date: Wed Jun 20 02:49:40 2018
New Revision: 335111

URL: http://llvm.org/viewvc/llvm-project?rev=335111=rev
Log:
[SPIR] Prevent SPIR targets from using half conversion intrinsics

The SPIR target currently allows for half precision floating point types to be
emitted using the LLVM intrinsic functions which convert half types to floats
and doubles. However, this is illegal in SPIR as the only intrinsic allowed by
SPIR is memcpy, as per section 3 of the SPIR specification. Currently this is
leading to an assert being hit in the Clang CodeGen when attempting to emit a
constant or literal _Float16 type in a comparison operation on a SPIR or SPIR64
target. This assert stems from the CodeGen attempting to emit a constant half
value as an integer because the backend has specified that it is using these
half conversion intrinsics (which represents half as i16). This patch prevents
SPIR targets from using these intrinsics by overloading the responsible target
info method, marks SPIR targets as having a legal half type and provides
additional regression testing for the _Float16 type on SPIR targets.

Patch by: Stephen McGroarty

Differential Revision: https://reviews.llvm.org/D48188

Added:
cfe/trunk/test/CodeGen/spir-half-type.cpp
Modified:
cfe/trunk/lib/Basic/Targets/SPIR.h

Modified: cfe/trunk/lib/Basic/Targets/SPIR.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/SPIR.h?rev=335111=335110=335111=diff
==
--- cfe/trunk/lib/Basic/Targets/SPIR.h (original)
+++ cfe/trunk/lib/Basic/Targets/SPIR.h Wed Jun 20 02:49:40 2018
@@ -47,6 +47,7 @@ public:
 LongWidth = LongAlign = 64;
 AddrSpaceMap = 
 UseAddrSpaceMapMangling = true;
+HasLegalHalfType = true;
 // Define available target features
 // These must be defined in sorted order!
 NoAsmVariants = true;
@@ -59,6 +60,10 @@ public:
 return Feature == "spir";
   }
 
+  // SPIR supports the half type and the only llvm intrinsic allowed in SPIR is
+  // memcpy as per section 3 of the SPIR spec.
+  bool useFP16ConversionIntrinsics() const override { return false; }
+
   ArrayRef getTargetBuiltins() const override { return None; }
 
   const char *getClobbers() const override { return ""; }

Added: cfe/trunk/test/CodeGen/spir-half-type.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/spir-half-type.cpp?rev=335111=auto
==
--- cfe/trunk/test/CodeGen/spir-half-type.cpp (added)
+++ cfe/trunk/test/CodeGen/spir-half-type.cpp Wed Jun 20 02:49:40 2018
@@ -0,0 +1,146 @@
+// RUN: %clang_cc1 -O0 -triple spir -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -O0 -triple spir64 -emit-llvm %s -o - | FileCheck %s
+
+// This file tests that using the _Float16 type with the spir target will not
+// use the llvm intrinsics but instead will use the half arithmetic
+// instructions directly.
+
+// Previously attempting to use a constant _Float16 with a comparison
+// instruction when the target is spir or spir64 lead to an assert being hit.
+bool fcmp_const() {
+  _Float16 a = 0.0f16;
+  const _Float16 b = 1.0f16;
+
+  // CHECK-NOT: llvm.convert.to.fp16
+  // CHECK-NOT: llvm.convert.from.fp16
+
+  // CHECK: [[REG1:%.*]] = load half, half* %a, align 2
+  // CHECK-NEXT: fcmp olt half [[REG1]], 0xH3C00
+
+  // CHECK: [[REG2:%.*]] = load half, half* %a, align 2
+  // CHECK-NEXT: fcmp olt half [[REG2]], 0xH4000
+
+  // CHECK: [[REG3:%.*]] = load half, half* %a, align 2
+  // CHECK-NEXT: fcmp ogt half [[REG3]], 0xH3C00
+
+  // CHECK: [[REG4:%.*]] = load half, half* %a, align 2
+  // CHECK-NEXT: fcmp ogt half [[REG4]], 0xH4200
+
+  // CHECK: [[REG5:%.*]] = load half, half* %a, align 2
+  // CHECK-NEXT: fcmp oeq half [[REG5]], 0xH3C00
+
+  // CHECK: [[REG7:%.*]] = load half, half* %a, align 2
+  // CHECK-NEXT: fcmp oeq half [[REG7]], 0xH4400
+
+  // CHECK: [[REG8:%.*]] = load half, half* %a, align 2
+  // CHECK-NEXT: fcmp une half [[REG8]], 0xH3C00
+
+  // CHECK: [[REG9:%.*]] = load half, half* %a, align 2
+  // CHECK-NEXT: fcmp une half [[REG9]], 0xH4500
+
+  // CHECK: [[REG10:%.*]] = load half, half* %a, align 2
+  // CHECK-NEXT: fcmp ole half [[REG10]], 0xH3C00
+
+  // CHECK: [[REG11:%.*]] = load half, half* %a, align 2
+  // CHECK-NEXT: fcmp ole half [[REG11]], 0xH4600
+
+  // CHECK: [[REG12:%.*]] = load half, half* %a, align 2
+  // CHECK-NEXT: fcmp oge half [[REG12]], 0xH3C00
+
+  // CHECK: [[REG13:%.*]] = load half, half* %a, align 2
+  // CHECK-NEXT: fcmp oge half [[REG13]], 0xH4700
+  return a < b || a < 2.0f16 || a > b || a > 3.0f16 || a == b || a == 4.0f16 ||
+ a != b || a != 5.0f16 || a <= b || a <= 6.0f16 || a >= b ||
+ a >= 7.0f16;
+}
+
+bool fcmp() {
+  _Float16 a = 0.0f16;
+  _Float16 b = 1.0f16;
+
+  // CHECK-NOT: llvm.convert.to.fp16
+  // CHECK-NOT: llvm.convert.from.fp16
+  // CHECK: [[REG1:%.*]] = load half, 

r327836 - [ARM] Pass half or i16 types for NEON intrinsics

2018-03-19 Thread Sjoerd Meijer via cfe-commits
Author: sjoerdmeijer
Date: Mon Mar 19 06:22:49 2018
New Revision: 327836

URL: http://llvm.org/viewvc/llvm-project?rev=327836=rev
Log:
[ARM] Pass half or i16 types for NEON intrinsics

For generating NEON intrinsics, this determines the NEON data type, and whether
it should be a half type or an i16 type. I.e., we always pass a half type for
AArch64, this hasn't changed, but now also for ARM but only when FullFP16 is
enabled, and i16 otherwise.

This is intended to be non-functional change, but together with the backend
work in D44538 which adds support for f16 vectors, this enables adding the
AArch32 FP16 (vector) intrinsics.

Differential Revision: https://reviews.llvm.org/D44561

Modified:
cfe/trunk/include/clang/Basic/TargetInfo.h
cfe/trunk/lib/Basic/TargetInfo.cpp
cfe/trunk/lib/Basic/Targets/AArch64.cpp
cfe/trunk/lib/Basic/Targets/ARM.cpp
cfe/trunk/lib/Basic/Targets/ARM.h
cfe/trunk/lib/CodeGen/CGBuiltin.cpp

Modified: cfe/trunk/include/clang/Basic/TargetInfo.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TargetInfo.h?rev=327836=327835=327836=diff
==
--- cfe/trunk/include/clang/Basic/TargetInfo.h (original)
+++ cfe/trunk/include/clang/Basic/TargetInfo.h Mon Mar 19 06:22:49 2018
@@ -61,6 +61,8 @@ protected:
   bool TLSSupported;
   bool VLASupported;
   bool NoAsmVariants;  // True if {|} are normal characters.
+  bool HasLegalHalfType; // True if the backend supports operations on the half
+ // LLVM IR type.
   bool HasFloat128;
   unsigned char PointerWidth, PointerAlign;
   unsigned char BoolWidth, BoolAlign;
@@ -361,6 +363,9 @@ public:
 return (getPointerWidth(0) >= 64) || getTargetOpts().ForceEnableInt128;
   } // FIXME
 
+  /// \brief Determine whether _Float16 is supported on this target.
+  virtual bool hasLegalHalfType() const { return HasLegalHalfType; }
+
   /// \brief Determine whether the __float128 type is supported on this target.
   virtual bool hasFloat128Type() const { return HasFloat128; }
 

Modified: cfe/trunk/lib/Basic/TargetInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/TargetInfo.cpp?rev=327836=327835=327836=diff
==
--- cfe/trunk/lib/Basic/TargetInfo.cpp (original)
+++ cfe/trunk/lib/Basic/TargetInfo.cpp Mon Mar 19 06:22:49 2018
@@ -32,6 +32,7 @@ TargetInfo::TargetInfo(const llvm::Tripl
   TLSSupported = true;
   VLASupported = true;
   NoAsmVariants = false;
+  HasLegalHalfType = false;
   HasFloat128 = false;
   PointerWidth = PointerAlign = 32;
   BoolWidth = BoolAlign = 8;

Modified: cfe/trunk/lib/Basic/Targets/AArch64.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/AArch64.cpp?rev=327836=327835=327836=diff
==
--- cfe/trunk/lib/Basic/Targets/AArch64.cpp (original)
+++ cfe/trunk/lib/Basic/Targets/AArch64.cpp Mon Mar 19 06:22:49 2018
@@ -49,6 +49,8 @@ AArch64TargetInfo::AArch64TargetInfo(con
 IntMaxType = SignedLong;
   }
 
+  // All AArch64 implementations support ARMv8 FP, which makes half a legal 
type.
+  HasLegalHalfType = true;
 
   LongWidth = LongAlign = PointerWidth = PointerAlign = 64;
   MaxVectorAlign = 128;

Modified: cfe/trunk/lib/Basic/Targets/ARM.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/ARM.cpp?rev=327836=327835=327836=diff
==
--- cfe/trunk/lib/Basic/Targets/ARM.cpp (original)
+++ cfe/trunk/lib/Basic/Targets/ARM.cpp Mon Mar 19 06:22:49 2018
@@ -379,7 +379,6 @@ bool ARMTargetInfo::handleTargetFeatures
   Unaligned = 1;
   SoftFloat = SoftFloatABI = false;
   HWDiv = 0;
-  HasFullFP16 = 0;
 
   // This does not diagnose illegal cases like having both
   // "+vfpv2" and "+vfpv3" or having "+neon" and "+fp-only-sp".
@@ -421,7 +420,7 @@ bool ARMTargetInfo::handleTargetFeatures
 } else if (Feature == "+fp16") {
   HW_FP |= HW_FP_HP;
 } else if (Feature == "+fullfp16") {
-  HasFullFP16 = 1;
+  HasLegalHalfType = true;
 }
   }
   HW_FP &= ~HW_FP_remove;
@@ -714,11 +713,11 @@ void ARMTargetInfo::getTargetDefines(con
 Builder.defineMacro("__ARM_FP_FAST", "1");
 
   // Armv8.2-A FP16 vector intrinsic
-  if ((FPU & NeonFPU) && HasFullFP16)
+  if ((FPU & NeonFPU) && HasLegalHalfType)
 Builder.defineMacro("__ARM_FEATURE_FP16_VECTOR_ARITHMETIC", "1");
 
   // Armv8.2-A FP16 scalar intrinsics
-  if (HasFullFP16)
+  if (HasLegalHalfType)
 Builder.defineMacro("__ARM_FEATURE_FP16_SCALAR_ARITHMETIC", "1");
 
 

Modified: cfe/trunk/lib/Basic/Targets/ARM.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/ARM.h?rev=327836=327835=327836=diff
==
--- cfe/trunk/lib/Basic/Targets/ARM.h (original)

r327623 - [AAch64] Tests for ACLE FP16 macros

2018-03-15 Thread Sjoerd Meijer via cfe-commits
Author: sjoerdmeijer
Date: Thu Mar 15 06:36:30 2018
New Revision: 327623

URL: http://llvm.org/viewvc/llvm-project?rev=327623=rev
Log:
[AAch64] Tests for ACLE FP16 macros

This adds some missing tests for the AArch64 FP16 macros.

Differential Revision: https://reviews.llvm.org/D44512

Modified:
cfe/trunk/test/Preprocessor/aarch64-target-features.c

Modified: cfe/trunk/test/Preprocessor/aarch64-target-features.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/aarch64-target-features.c?rev=327623=327622=327623=diff
==
--- cfe/trunk/test/Preprocessor/aarch64-target-features.c (original)
+++ cfe/trunk/test/Preprocessor/aarch64-target-features.c Thu Mar 15 06:36:30 
2018
@@ -89,6 +89,18 @@
 // RUN: %clang -target aarch64-none-linux-gnu -march=armv8-a+sve -x c -E -dM 
%s -o - | FileCheck --check-prefix=CHECK-SVE %s
 // CHECK-SVE: __ARM_FEATURE_SVE 1
 
+// RUN: %clang -target aarch64-none-linux-gnueabi -march=armv8.2a+fp16 -x c -E 
-dM %s -o - | FileCheck -match-full-lines 
--check-prefix=CHECK-FULLFP16-VECTOR-SCALAR %s
+// CHECK-FULLFP16-VECTOR-SCALAR: #define __ARM_FEATURE_FP16_SCALAR_ARITHMETIC 1
+// CHECK-FULLFP16-VECTOR-SCALAR: #define __ARM_FEATURE_FP16_VECTOR_ARITHMETIC 1
+// CHECK-FULLFP16-VECTOR-SCALAR: #define __ARM_FP 0xE
+// CHECK-FULLFP16-VECTOR-SCALAR: #define __ARM_FP16_FORMAT_IEEE 1
+
+// RUN: %clang -target aarch64-none-linux-gnueabi -march=armv8.2a+fp16+nosimd 
-x c -E -dM %s -o - | FileCheck -match-full-lines 
--check-prefix=CHECK-FULLFP16-SCALAR %s
+// CHECK-FULLFP16-SCALAR:   #define __ARM_FEATURE_FP16_SCALAR_ARITHMETIC 1
+// CHECK-FULLFP16-SCALAR-NOT:   #define __ARM_FEATURE_FP16_VECTOR_ARITHMETIC 1
+// CHECK-FULLFP16-SCALAR:   #define __ARM_FP 0xE
+// CHECK-FULLFP16-SCALAR:   #define __ARM_FP16_FORMAT_IEEE 1
+
 // == Check whether -mtune accepts mixed-case features.
 // RUN: %clang -target aarch64 -mtune=CYCLONE -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-MTUNE-CYCLONE %s
 // CHECK-MTUNE-CYCLONE: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" 
"-target-feature" "+neon" "-target-feature" "+zcm" "-target-feature" "+zcz"


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


r327455 - [ARM] ACLE FP16 feature test macros

2018-03-13 Thread Sjoerd Meijer via cfe-commits
Author: sjoerdmeijer
Date: Tue Mar 13 15:11:06 2018
New Revision: 327455

URL: http://llvm.org/viewvc/llvm-project?rev=327455=rev
Log:
[ARM] ACLE FP16 feature test macros

This is a partial recommit of r327189 that was reverted
due to test issues. I.e., this recommits minimal functional
change, the FP16 feature test macros, and adds tests that 
were missing in the original commit.


Modified:
cfe/trunk/lib/Basic/Targets/ARM.cpp
cfe/trunk/lib/Basic/Targets/ARM.h
cfe/trunk/test/Preprocessor/arm-target-features.c

Modified: cfe/trunk/lib/Basic/Targets/ARM.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/ARM.cpp?rev=327455=327454=327455=diff
==
--- cfe/trunk/lib/Basic/Targets/ARM.cpp (original)
+++ cfe/trunk/lib/Basic/Targets/ARM.cpp Tue Mar 13 15:11:06 2018
@@ -379,6 +379,7 @@ bool ARMTargetInfo::handleTargetFeatures
   Unaligned = 1;
   SoftFloat = SoftFloatABI = false;
   HWDiv = 0;
+  HasFullFP16 = 0;
 
   // This does not diagnose illegal cases like having both
   // "+vfpv2" and "+vfpv3" or having "+neon" and "+fp-only-sp".
@@ -419,6 +420,8 @@ bool ARMTargetInfo::handleTargetFeatures
   Unaligned = 0;
 } else if (Feature == "+fp16") {
   HW_FP |= HW_FP_HP;
+} else if (Feature == "+fullfp16") {
+  HasFullFP16 = 1;
 }
   }
   HW_FP &= ~HW_FP_remove;
@@ -710,6 +713,15 @@ void ARMTargetInfo::getTargetDefines(con
   if (Opts.UnsafeFPMath)
 Builder.defineMacro("__ARM_FP_FAST", "1");
 
+  // Armv8.2-A FP16 vector intrinsic
+  if ((FPU & NeonFPU) && HasFullFP16)
+Builder.defineMacro("__ARM_FEATURE_FP16_VECTOR_ARITHMETIC", "1");
+
+  // Armv8.2-A FP16 scalar intrinsics
+  if (HasFullFP16)
+Builder.defineMacro("__ARM_FEATURE_FP16_SCALAR_ARITHMETIC", "1");
+
+
   switch (ArchKind) {
   default:
 break;

Modified: cfe/trunk/lib/Basic/Targets/ARM.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/ARM.h?rev=327455=327454=327455=diff
==
--- cfe/trunk/lib/Basic/Targets/ARM.h (original)
+++ cfe/trunk/lib/Basic/Targets/ARM.h Tue Mar 13 15:11:06 2018
@@ -69,6 +69,7 @@ class LLVM_LIBRARY_VISIBILITY ARMTargetI
   unsigned Crypto : 1;
   unsigned DSP : 1;
   unsigned Unaligned : 1;
+  unsigned HasFullFP16 : 1;
 
   enum {
 LDREX_B = (1 << 0), /// byte (8-bit)

Modified: cfe/trunk/test/Preprocessor/arm-target-features.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/arm-target-features.c?rev=327455=327454=327455=diff
==
--- cfe/trunk/test/Preprocessor/arm-target-features.c (original)
+++ cfe/trunk/test/Preprocessor/arm-target-features.c Tue Mar 13 15:11:06 2018
@@ -19,6 +19,18 @@
 // CHECK-V8A-ALLOW-FP-INSTR: #define __ARM_FP16_ARGS 1
 // CHECK-V8A-ALLOW-FP-INSTR: #define __ARM_FP16_FORMAT_IEEE 1
 
+// RUN: %clang -target arm-none-linux-gnueabi -march=armv8.2a+fp16 -x c -E -dM 
%s -o - | FileCheck -match-full-lines 
--check-prefix=CHECK-FULLFP16-VECTOR-SCALAR %s
+// CHECK-FULLFP16-VECTOR-SCALAR: #define __ARM_FEATURE_FP16_SCALAR_ARITHMETIC 1
+// CHECK-FULLFP16-VECTOR-SCALAR: #define __ARM_FEATURE_FP16_VECTOR_ARITHMETIC 1
+// CHECK-FULLFP16-VECTOR-SCALAR: #define __ARM_FP 0xe
+// CHECK-FULLFP16-VECTOR-SCALAR: #define __ARM_FP16_FORMAT_IEEE 1
+
+// RUN: %clang -target arm-none-linux-gnueabi -march=armv8.2a+fp16 -mfpu=vfp4 
-x c -E -dM %s -o - | FileCheck -match-full-lines 
--check-prefix=CHECK-FULLFP16-SCALAR %s
+// CHECK-FULLFP16-SCALAR:   #define __ARM_FEATURE_FP16_SCALAR_ARITHMETIC 1
+// CHECK-FULLFP16-SCALAR-NOT:   #define __ARM_FEATURE_FP16_VECTOR_ARITHMETIC 1
+// CHECK-FULLFP16-SCALAR:   #define __ARM_FP 0xe
+// CHECK-FULLFP16-SCALAR:   #define __ARM_FP16_FORMAT_IEEE 1
+
 // RUN: %clang -target armv8r-none-linux-gnu -x c -E -dM %s -o - | FileCheck 
-match-full-lines --check-prefix=CHECK-V8R %s
 // CHECK-V8R: #define __ARMEL__ 1
 // CHECK-V8R: #define __ARM_ARCH 8


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


r327437 - This reverts "r327189 - [ARM] Add ARMv8.2-A FP16 vector intrinsic"

2018-03-13 Thread Sjoerd Meijer via cfe-commits
Author: sjoerdmeijer
Date: Tue Mar 13 12:38:56 2018
New Revision: 327437

URL: http://llvm.org/viewvc/llvm-project?rev=327437=rev
Log:
This reverts "r327189 - [ARM] Add ARMv8.2-A FP16 vector intrinsic"

This is causing problems in testing, and PR36683 was raised.
Reverting it until we have sorted out how to pass f16 vectors.


Removed:
cfe/trunk/test/CodeGen/arm-v8.2a-neon-intrinsics.c
Modified:
cfe/trunk/include/clang/Basic/arm_neon.td
cfe/trunk/lib/Basic/Targets/ARM.cpp
cfe/trunk/lib/Basic/Targets/ARM.h
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/lib/CodeGen/CodeGenFunction.h
cfe/trunk/test/CodeGen/arm_neon_intrinsics.c

Modified: cfe/trunk/include/clang/Basic/arm_neon.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/arm_neon.td?rev=327437=327436=327437=diff
==
--- cfe/trunk/include/clang/Basic/arm_neon.td (original)
+++ cfe/trunk/include/clang/Basic/arm_neon.td Tue Mar 13 12:38:56 2018
@@ -1363,8 +1363,8 @@ def SCALAR_VDUP_LANE : IInst<"vdup_lane"
 def SCALAR_VDUP_LANEQ : IInst<"vdup_laneq", "sji", 
"ScSsSiSlSfSdSUcSUsSUiSUlSPcSPs">;
 }
 
-// ARMv8.2-A FP16 vector intrinsics for A32/A64.
-let ArchGuard = "defined(__ARM_FEATURE_FP16_VECTOR_ARITHMETIC)" in {
+// ARMv8.2-A FP16 intrinsics.
+let ArchGuard = "defined(__ARM_FEATURE_FP16_VECTOR_ARITHMETIC) && 
defined(__aarch64__)" in {
 
   // ARMv8.2-A FP16 one-operand vector intrinsics.
 
@@ -1395,12 +1395,14 @@ let ArchGuard = "defined(__ARM_FEATURE_F
   def FRINTPH  : SInst<"vrndp", "dd", "hQh">;
   def FRINTMH  : SInst<"vrndm", "dd", "hQh">;
   def FRINTXH  : SInst<"vrndx", "dd", "hQh">;
+  def FRINTIH  : SInst<"vrndi", "dd", "hQh">;
 
   // Misc.
   def VABSH: SInst<"vabs", "dd", "hQh">;
   def VNEGH: SOpInst<"vneg", "dd", "hQh", OP_NEG>;
   def VRECPEH  : SInst<"vrecpe", "dd", "hQh">;
   def FRSQRTEH : SInst<"vrsqrte", "dd", "hQh">;
+  def FSQRTH   : SInst<"vsqrt", "dd", "hQh">;
 
   // ARMv8.2-A FP16 two-operands vector intrinsics.
 
@@ -1441,13 +1443,18 @@ let ArchGuard = "defined(__ARM_FEATURE_F
 
   // Multiplication/Division
   def VMULH : SOpInst<"vmul", "ddd", "hQh", OP_MUL>;
+  def MULXH : SInst<"vmulx", "ddd", "hQh">;
+  def FDIVH : IOpInst<"vdiv", "ddd",  "hQh", OP_DIV>;
 
   // Pairwise addition
-  def VPADDH: SInst<"vpadd", "ddd", "h">;
+  def VPADDH: SInst<"vpadd", "ddd", "hQh">;
 
   // Pairwise Max/Min
-  def VPMAXH: SInst<"vpmax", "ddd", "h">;
-  def VPMINH: SInst<"vpmin", "ddd", "h">;
+  def VPMAXH: SInst<"vpmax", "ddd", "hQh">;
+  def VPMINH: SInst<"vpmin", "ddd", "hQh">;
+  // Pairwise MaxNum/MinNum
+  def FMAXNMPH  : SInst<"vpmaxnm", "ddd", "hQh">;
+  def FMINNMPH  : SInst<"vpminnm", "ddd", "hQh">;
 
   // Reciprocal/Sqrt
   def VRECPSH   : SInst<"vrecps", "ddd", "hQh">;
@@ -1461,63 +1468,6 @@ let ArchGuard = "defined(__ARM_FEATURE_F
 
   // ARMv8.2-A FP16 lane vector intrinsics.
 
-  // Mul lane
-  def VMUL_LANEH: IOpInst<"vmul_lane", "ddgi", "hQh", OP_MUL_LN>;
-  def VMUL_NH   : IOpInst<"vmul_n", "dds", "hQh", OP_MUL_N>;
-
-  // Data processing intrinsics - section 5
-
-  // Logical operations
-  let isHiddenLInst = 1 in
-  def VBSLH: SInst<"vbsl", "dudd", "hQh">;
-
-  // Transposition operations
-  def VZIPH: WInst<"vzip", "2dd", "hQh">;
-  def VUZPH: WInst<"vuzp", "2dd", "hQh">;
-  def VTRNH: WInst<"vtrn", "2dd", "hQh">;
-
-
-  let ArchGuard = "!defined(__aarch64__)" in {
-// Set all lanes to same value.
-// Already implemented prior to ARMv8.2-A.
-def VMOV_NH  : WOpInst<"vmov_n", "ds", "hQh", OP_DUP>;
-def VDUP_NH  : WOpInst<"vdup_n", "ds", "hQh", OP_DUP>;
-def VDUP_LANE1H : WOpInst<"vdup_lane", "dgi", "hQh", OP_DUP_LN>;
-  }
-
-  // Vector Extract
-  def VEXTH  : WInst<"vext", "dddi", "hQh">;
-
-  // Reverse vector elements
-  def VREV64H: WOpInst<"vrev64", "dd", "hQh", OP_REV64>;
-}
-
-// ARMv8.2-A FP16 vector intrinsics for A64 only.
-let ArchGuard = "defined(__ARM_FEATURE_FP16_VECTOR_ARITHMETIC) && 
defined(__aarch64__)" in {
-
-  // Vector rounding
-  def FRINTIH  : SInst<"vrndi", "dd", "hQh">;
-
-  // Misc.
-  def FSQRTH   : SInst<"vsqrt", "dd", "hQh">;
-
-  // Multiplication/Division
-  def MULXH : SInst<"vmulx", "ddd", "hQh">;
-  def FDIVH : IOpInst<"vdiv", "ddd",  "hQh", OP_DIV>;
-
-  // Pairwise addition
-  def VPADDH1   : SInst<"vpadd", "ddd", "Qh">;
-
-  // Pairwise Max/Min
-  def VPMAXH1   : SInst<"vpmax", "ddd", "Qh">;
-  def VPMINH1   : SInst<"vpmin", "ddd", "Qh">;
-
-  // Pairwise MaxNum/MinNum
-  def FMAXNMPH  : SInst<"vpmaxnm", "ddd", "hQh">;
-  def FMINNMPH  : SInst<"vpminnm", "ddd", "hQh">;
-
-  // ARMv8.2-A FP16 lane vector intrinsics.
-
   // FMA lane
   def VFMA_LANEH   : IInst<"vfma_lane", "dddgi", "hQh">;
   def VFMA_LANEQH  : IInst<"vfma_laneq", 

r325351 - [ARM] Add tests for the vcvtr builtins

2018-02-16 Thread Sjoerd Meijer via cfe-commits
Author: sjoerdmeijer
Date: Fri Feb 16 08:01:08 2018
New Revision: 325351

URL: http://llvm.org/viewvc/llvm-project?rev=325351=rev
Log:
[ARM] Add tests for the vcvtr builtins

This adds Sema and Codegen tests for the vcvtr builtins
(because they were missing).

Differential Revision: https://reviews.llvm.org/D43372

Modified:
cfe/trunk/test/CodeGen/builtins-arm.c
cfe/trunk/test/Sema/builtins-arm.c

Modified: cfe/trunk/test/CodeGen/builtins-arm.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtins-arm.c?rev=325351=325350=325351=diff
==
--- cfe/trunk/test/CodeGen/builtins-arm.c (original)
+++ cfe/trunk/test/CodeGen/builtins-arm.c Fri Feb 16 08:01:08 2018
@@ -8,69 +8,85 @@ void *f0()
 }
 
 void f1(char *a, char *b) {
+  // CHECK: call {{.*}} @__clear_cache
__clear_cache(a,b);
 }
 
-// CHECK: call {{.*}} @__clear_cache
+float test_vcvtrf0(float f) {
+  // CHECK: call float @llvm.arm.vcvtr.f32(float %f)
+  return __builtin_arm_vcvtr_f(f, 0);
+}
+
+float test_vcvtrf1(float f) {
+  // CHECK: call float @llvm.arm.vcvtru.f32(float %f)
+  return __builtin_arm_vcvtr_f(f, 1);
+}
+
+double test_vcvtrd0(double d) {
+  // CHECK: call float @llvm.arm.vcvtr.f64(double %d)
+  return __builtin_arm_vcvtr_d(d, 0);
+}
+
+double test_vcvtrd1(double d) {
+  // call float @llvm.arm.vcvtru.f64(double %d)
+  return __builtin_arm_vcvtr_d(d, 1);
+}
 
 void test_eh_return_data_regno()
 {
+  // CHECK: store volatile i32 0
+  // CHECK: store volatile i32 1
   volatile int res;
-  res = __builtin_eh_return_data_regno(0);  // CHECK: store volatile i32 0
-  res = __builtin_eh_return_data_regno(1);  // CHECK: store volatile i32 1
+  res = __builtin_eh_return_data_regno(0);
+  res = __builtin_eh_return_data_regno(1);
 }
 
 void nop() {
+  // CHECK: call {{.*}} @llvm.arm.hint(i32 0)
   __builtin_arm_nop();
 }
 
-// CHECK: call {{.*}} @llvm.arm.hint(i32 0)
-
 void yield() {
+  // CHECK: call {{.*}} @llvm.arm.hint(i32 1)
   __builtin_arm_yield();
 }
 
-// CHECK: call {{.*}} @llvm.arm.hint(i32 1)
-
 void wfe() {
+  // CHECK: call {{.*}} @llvm.arm.hint(i32 2)
   __builtin_arm_wfe();
 }
 
-// CHECK: call {{.*}} @llvm.arm.hint(i32 2)
-
 void wfi() {
+  // CHECK: call {{.*}} @llvm.arm.hint(i32 3)
   __builtin_arm_wfi();
 }
 
-// CHECK: call {{.*}} @llvm.arm.hint(i32 3)
-
 void sev() {
+  // CHECK: call {{.*}} @llvm.arm.hint(i32 4)
   __builtin_arm_sev();
 }
 
-// CHECK: call {{.*}} @llvm.arm.hint(i32 4)
-
 void sevl() {
+  // CHECK: call {{.*}} @llvm.arm.hint(i32 5)
   __builtin_arm_sevl();
 }
 
-// CHECK: call {{.*}} @llvm.arm.hint(i32 5)
-
 void dbg() {
+  // CHECK: call {{.*}} @llvm.arm.dbg(i32 0)
   __builtin_arm_dbg(0);
 }
 
-// CHECK: call {{.*}} @llvm.arm.dbg(i32 0)
-
 void test_barrier() {
-  __builtin_arm_dmb(1); //CHECK: call {{.*}} @llvm.arm.dmb(i32 1)
-  __builtin_arm_dsb(2); //CHECK: call {{.*}} @llvm.arm.dsb(i32 2)
-  __builtin_arm_isb(3); //CHECK: call {{.*}} @llvm.arm.isb(i32 3)
+  //CHECK: call {{.*}} @llvm.arm.dmb(i32 1)
+  //CHECK: call {{.*}} @llvm.arm.dsb(i32 2)
+  //CHECK: call {{.*}} @llvm.arm.isb(i32 3)
+  __builtin_arm_dmb(1);
+  __builtin_arm_dsb(2);
+  __builtin_arm_isb(3);
 }
 
-// CHECK: call {{.*}} @llvm.bitreverse.i32(i32 %a)
-
 unsigned rbit(unsigned a) {
+  // CHECK: call {{.*}} @llvm.bitreverse.i32(i32 %a)
   return __builtin_arm_rbit(a);
 }
 

Modified: cfe/trunk/test/Sema/builtins-arm.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/builtins-arm.c?rev=325351=325350=325351=diff
==
--- cfe/trunk/test/Sema/builtins-arm.c (original)
+++ cfe/trunk/test/Sema/builtins-arm.c Fri Feb 16 08:01:08 2018
@@ -320,3 +320,18 @@ void test_9_5_10_parallel_16bit_multipli
   x = __builtin_arm_smusd(a, b);
   x = __builtin_arm_smusdx(a, b);
 }
+
+void test_VFP(float f, double d) {
+  float fr;
+  double dr;
+
+  fr = __builtin_arm_vcvtr_f(f, 0);
+  fr = __builtin_arm_vcvtr_f(f, 1);
+  fr = __builtin_arm_vcvtr_f(f, -1); // expected-error {{argument should be a 
value from 0 to 1}}
+  fr = __builtin_arm_vcvtr_f(f, 2);  // expected-error {{argument should be a 
value from 0 to 1}}
+
+  dr = __builtin_arm_vcvtr_f(d, 0);
+  dr = __builtin_arm_vcvtr_f(d, 1);
+  dr = __builtin_arm_vcvtr_f(d, -1); // expected-error {{argument should be a 
value from 0 to 1}}
+  dr = __builtin_arm_vcvtr_f(d, 2);  // expected-error {{argument should be a 
value from 0 to 1}}
+}


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


r323185 - [ARM] Pass _Float16 as int or float

2018-01-23 Thread Sjoerd Meijer via cfe-commits
Author: sjoerdmeijer
Date: Tue Jan 23 02:13:49 2018
New Revision: 323185

URL: http://llvm.org/viewvc/llvm-project?rev=323185=rev
Log:
[ARM] Pass _Float16 as int or float

Pass and return _Float16 as if it were an int or float for ARM, but with the
top 16 bits unspecified, similarly like we already do for __fp16.

We will implement proper half-precision function argument lowering in the ARM
backend soon, but want to use this workaround in the mean time.

Differential Revision: https://reviews.llvm.org/D42318

Modified:
cfe/trunk/include/clang/AST/Type.h
cfe/trunk/lib/CodeGen/TargetInfo.cpp
cfe/trunk/test/CodeGen/arm-fp16-arguments.c

Modified: cfe/trunk/include/clang/AST/Type.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=323185=323184=323185=diff
==
--- cfe/trunk/include/clang/AST/Type.h (original)
+++ cfe/trunk/include/clang/AST/Type.h Tue Jan 23 02:13:49 2018
@@ -1728,6 +1728,7 @@ public:
   bool isAnyComplexType() const;   // C99 6.2.5p11 (complex) + Complex Int.
   bool isFloatingType() const; // C99 6.2.5p11 (real floating + complex)
   bool isHalfType() const; // OpenCL 6.1.1.1, NEON (IEEE 754-2008 half)
+  bool isFloat16Type() const;  // C11 extension ISO/IEC TS 18661
   bool isRealType() const; // C99 6.2.5p17 (real floating + integer)
   bool isArithmeticType() const;   // C99 6.2.5p18 (integer + floating)
   bool isVoidType() const; // C99 6.2.5p19
@@ -6179,6 +6180,12 @@ inline bool Type::isHalfType() const {
   return false;
 }
 
+inline bool Type::isFloat16Type() const {
+  if (const BuiltinType *BT = dyn_cast(CanonicalType))
+return BT->getKind() == BuiltinType::Float16;
+  return false;
+}
+
 inline bool Type::isNullPtrType() const {
   if (const BuiltinType *BT = getAs())
 return BT->getKind() == BuiltinType::NullPtr;

Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=323185=323184=323185=diff
==
--- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Tue Jan 23 02:13:49 2018
@@ -5721,10 +5721,11 @@ ABIArgInfo ARMABIInfo::classifyArgumentT
 return getNaturalAlignIndirect(Ty, /*ByVal=*/false);
   }
 
-  // __fp16 gets passed as if it were an int or float, but with the top 16 bits
-  // unspecified. This is not done for OpenCL as it handles the half type
-  // natively, and does not need to interwork with AAPCS code.
-  if (Ty->isHalfType() && 
!getContext().getLangOpts().NativeHalfArgsAndReturns) {
+  // _Float16 and __fp16 get passed as if it were an int or float, but with
+  // the top 16 bits unspecified. This is not done for OpenCL as it handles the
+  // half type natively, and does not need to interwork with AAPCS code.
+  if ((Ty->isFloat16Type() || Ty->isHalfType()) &&
+  !getContext().getLangOpts().NativeHalfArgsAndReturns) {
 llvm::Type *ResType = IsEffectivelyAAPCS_VFP ?
   llvm::Type::getFloatTy(getVMContext()) :
   llvm::Type::getInt32Ty(getVMContext());
@@ -5919,10 +5920,11 @@ ABIArgInfo ARMABIInfo::classifyReturnTyp
 return getNaturalAlignIndirect(RetTy);
   }
 
-  // __fp16 gets returned as if it were an int or float, but with the top 16
-  // bits unspecified. This is not done for OpenCL as it handles the half type
-  // natively, and does not need to interwork with AAPCS code.
-  if (RetTy->isHalfType() && 
!getContext().getLangOpts().NativeHalfArgsAndReturns) {
+  // _Float16 and __fp16 get returned as if it were an int or float, but with
+  // the top 16 bits unspecified. This is not done for OpenCL as it handles the
+  // half type natively, and does not need to interwork with AAPCS code.
+  if ((RetTy->isFloat16Type() || RetTy->isHalfType()) &&
+  !getContext().getLangOpts().NativeHalfArgsAndReturns) {
 llvm::Type *ResType = IsEffectivelyAAPCS_VFP ?
   llvm::Type::getFloatTy(getVMContext()) :
   llvm::Type::getInt32Ty(getVMContext());

Modified: cfe/trunk/test/CodeGen/arm-fp16-arguments.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/arm-fp16-arguments.c?rev=323185=323184=323185=diff
==
--- cfe/trunk/test/CodeGen/arm-fp16-arguments.c (original)
+++ cfe/trunk/test/CodeGen/arm-fp16-arguments.c Tue Jan 23 02:13:49 2018
@@ -25,3 +25,27 @@ __fp16 t2() { return g; }
 // HARD: ret float [[BITCAST]]
 // NATIVE: [[LOAD:%.*]] = load half, half* @g
 // NATIVE: ret half [[LOAD]]
+
+_Float16 h;
+
+void t3(_Float16 a) { h = a; }
+// SOFT: define void @t3(i32 [[PARAM:%.*]])
+// SOFT: [[TRUNC:%.*]] = trunc i32 [[PARAM]] to i16
+// HARD: define arm_aapcs_vfpcc void @t3(float [[PARAM:%.*]])
+// HARD: [[BITCAST:%.*]] = bitcast float [[PARAM]] to i32
+// HARD: [[TRUNC:%.*]] = trunc i32 [[BITCAST]] to i16

r320019 - [ARM] ACLE parallel arithmetic and DSP style multiplications

2017-12-07 Thread Sjoerd Meijer via cfe-commits
Author: sjoerdmeijer
Date: Thu Dec  7 01:54:39 2017
New Revision: 320019

URL: http://llvm.org/viewvc/llvm-project?rev=320019=rev
Log:
[ARM] ACLE parallel arithmetic and DSP style multiplications

This is a follow up of r302131, in which we forgot to add SemaChecking
tests. Adding these tests revealed two problems which have been fixed:
- added missing intrinsic __qdbl,
- properly range checking ssat16 and usat16.

Differential Revision: https://reviews.llvm.org/D40888

Modified:
cfe/trunk/include/clang/Basic/BuiltinsARM.def
cfe/trunk/lib/Sema/SemaChecking.cpp
cfe/trunk/test/Sema/builtins-arm.c

Modified: cfe/trunk/include/clang/Basic/BuiltinsARM.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsARM.def?rev=320019=320018=320019=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsARM.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsARM.def Thu Dec  7 01:54:39 2017
@@ -36,6 +36,7 @@ BUILTIN(__builtin_arm_smulwt, "iii", "nc
 // Saturating arithmetic
 BUILTIN(__builtin_arm_qadd, "iii", "nc")
 BUILTIN(__builtin_arm_qsub, "iii", "nc")
+BUILTIN(__builtin_arm_qdbl, "ii", "nc")
 BUILTIN(__builtin_arm_ssat, "iiUi", "nc")
 BUILTIN(__builtin_arm_usat, "UiiUi", "nc")
 

Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=320019=320018=320019=diff
==
--- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
+++ cfe/trunk/lib/Sema/SemaChecking.cpp Thu Dec  7 01:54:39 2017
@@ -1554,21 +1554,26 @@ bool Sema::CheckARMBuiltinFunctionCall(u
 
   // For intrinsics which take an immediate value as part of the instruction,
   // range check them here.
-  unsigned i = 0, l = 0, u = 0;
+  // FIXME: VFP Intrinsics should error if VFP not present.
   switch (BuiltinID) {
   default: return false;
-  case ARM::BI__builtin_arm_ssat: i = 1; l = 1; u = 31; break;
-  case ARM::BI__builtin_arm_usat: i = 1; u = 31; break;
+  case ARM::BI__builtin_arm_ssat:
+return SemaBuiltinConstantArgRange(TheCall, 1, 1, 32);
+  case ARM::BI__builtin_arm_usat:
+return SemaBuiltinConstantArgRange(TheCall, 1, 0, 31);
+  case ARM::BI__builtin_arm_ssat16:
+return SemaBuiltinConstantArgRange(TheCall, 1, 1, 16);
+  case ARM::BI__builtin_arm_usat16:
+return SemaBuiltinConstantArgRange(TheCall, 1, 0, 15);
   case ARM::BI__builtin_arm_vcvtr_f:
-  case ARM::BI__builtin_arm_vcvtr_d: i = 1; u = 1; break;
+  case ARM::BI__builtin_arm_vcvtr_d:
+return SemaBuiltinConstantArgRange(TheCall, 1, 0, 1);
   case ARM::BI__builtin_arm_dmb:
   case ARM::BI__builtin_arm_dsb:
   case ARM::BI__builtin_arm_isb:
-  case ARM::BI__builtin_arm_dbg: l = 0; u = 15; break;
+  case ARM::BI__builtin_arm_dbg:
+return SemaBuiltinConstantArgRange(TheCall, 0, 0, 15);
   }
-
-  // FIXME: VFP Intrinsics should error if VFP not present.
-  return SemaBuiltinConstantArgRange(TheCall, i, l, u + l);
 }
 
 bool Sema::CheckAArch64BuiltinFunctionCall(unsigned BuiltinID,

Modified: cfe/trunk/test/Sema/builtins-arm.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/builtins-arm.c?rev=320019=320018=320019=diff
==
--- cfe/trunk/test/Sema/builtins-arm.c (original)
+++ cfe/trunk/test/Sema/builtins-arm.c Thu Dec  7 01:54:39 2017
@@ -2,6 +2,8 @@
 // RUN: %clang_cc1 -triple armv7 -target-abi apcs-gnu \
 // RUN:   -fsyntax-only -verify %s
 
+#include 
+
 void f(void *a, void *b) {
   __clear_cache(); // expected-error {{too few arguments to function call, 
expected 2, have 0}} // expected-note {{'__clear_cache' is a builtin with type 
'void (void *, void *)}}
   __clear_cache(a); // expected-error {{too few arguments to function call, 
expected 2, have 1}}
@@ -136,3 +138,185 @@ void test6(int a, int b, int c) {
   __builtin_arm_mrrc2(15, a, 0); // expected-error {{argument to 
'__builtin_arm_mrrc2' must be a constant integer}}
   __builtin_arm_mrrc2(15, 0, a); // expected-error {{argument to 
'__builtin_arm_mrrc2' must be a constant integer}}
 }
+
+void test_9_3_multiplications(int a, int b) {
+  int r;
+  r = __builtin_arm_smulbb(a, b);
+  r = __builtin_arm_smulbb(1, -9);
+
+  r = __builtin_arm_smulbt(a, b);
+  r = __builtin_arm_smulbt(0, b);
+
+  r = __builtin_arm_smultb(a, b);
+  r = __builtin_arm_smultb(5, b);
+
+  r = __builtin_arm_smultt(a, b);
+  r = __builtin_arm_smultt(a, -1);
+
+  r = __builtin_arm_smulwb(a, b);
+  r = __builtin_arm_smulwb(1, 2);
+
+  r = __builtin_arm_smulwt(a, b);
+  r = __builtin_arm_smulwt(-1, -2);
+  r = __builtin_arm_smulwt(-1.0f, -2);
+}
+
+void test_9_4_1_width_specified_saturation(int a, int b) {
+  unsigned u;
+  int s;
+
+  s = __builtin_arm_ssat(8, 2);
+  s = __builtin_arm_ssat(a, 1);
+  s = __builtin_arm_ssat(a, 32);
+  s = __builtin_arm_ssat(a, 0);   // expected-error {{argument should be a 

r317558 - [docs] Add section 'Half-Precision Floating Point'

2017-11-07 Thread Sjoerd Meijer via cfe-commits
Author: sjoerdmeijer
Date: Tue Nov  7 02:09:45 2017
New Revision: 317558

URL: http://llvm.org/viewvc/llvm-project?rev=317558=rev
Log:
[docs] Add section 'Half-Precision Floating Point'

This documents the differences/interactions between _Float16 and __fp16
and is a companion change for the _Float16 type implementation (r312794).

Differential Revision:  https://reviews.llvm.org/D35295

Modified:
cfe/trunk/docs/LanguageExtensions.rst

Modified: cfe/trunk/docs/LanguageExtensions.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LanguageExtensions.rst?rev=317558=317557=317558=diff
==
--- cfe/trunk/docs/LanguageExtensions.rst (original)
+++ cfe/trunk/docs/LanguageExtensions.rst Tue Nov  7 02:09:45 2017
@@ -436,6 +436,49 @@ const_cast   no
 
 See also :ref:`langext-__builtin_shufflevector`, 
:ref:`langext-__builtin_convertvector`.
 
+Half-Precision Floating Point
+=
+
+Clang supports two half-precision (16-bit) floating point types: ``__fp16`` and
+``_Float16``. ``__fp16`` is defined in the ARM C Language Extensions (`ACLE
+`_)
+and ``_Float16`` in ISO/IEC TS 18661-3:2015.
+
+``__fp16`` is a storage and interchange format only. This means that values of
+``__fp16`` promote to (at least) float when used in arithmetic operations.
+There are two ``__fp16`` formats. Clang supports the IEEE 754-2008 format and
+not the ARM alternative format.
+
+ISO/IEC TS 18661-3:2015 defines C support for additional floating point types.
+``_FloatN`` is defined as a binary floating type, where the N suffix denotes
+the number of bits and is 16, 32, 64, or greater and equal to 128 and a
+multiple of 32. Clang supports ``_Float16``. The difference from ``__fp16`` is
+that arithmetic on ``_Float16`` is performed in half-precision, thus it is not
+a storage-only format. ``_Float16`` is available as a source language type in
+both C and C++ mode.
+
+It is recommended that portable code use the ``_Float16`` type because
+``__fp16`` is an ARM C-Language Extension (ACLE), whereas ``_Float16`` is
+defined by the C standards committee, so using ``_Float16`` will not prevent
+code from being ported to architectures other than Arm.  Also, ``_Float16``
+arithmetic and operations will directly map on half-precision instructions when
+they are available (e.g. Armv8.2-A), avoiding conversions to/from
+single-precision, and thus will result in more performant code. If
+half-precision instructions are unavailable, values will be promoted to
+single-precision, similar to the semantics of ``__fp16`` except that the
+results will be stored in single-precision.
+
+In an arithmetic operation where one operand is of ``__fp16`` type and the
+other is of ``_Float16`` type, the ``_Float16`` type is first converted to
+``__fp16`` type and then the operation is completed as if both operands were of
+``__fp16`` type.
+
+To define a ``_Float16`` literal, suffix ``f16`` can be appended to the 
compile-time
+constant declaration. There is no default argument promotion for ``_Float16``; 
this
+applies to the standard floating types only. As a consequence, for example, an
+explicit cast is required for printing a ``_Float16`` value (there is no string
+format specifier for ``_Float16``).
+
 Messages on ``deprecated`` and ``unavailable`` Attributes
 =
 


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


r313152 - This adds the _Float16 preprocessor macro definitions.

2017-09-13 Thread Sjoerd Meijer via cfe-commits
Author: sjoerdmeijer
Date: Wed Sep 13 08:23:19 2017
New Revision: 313152

URL: http://llvm.org/viewvc/llvm-project?rev=313152=rev
Log:
This adds the _Float16 preprocessor macro definitions.

Differential Revision: https://reviews.llvm.org/D34695

Added:
cfe/trunk/test/Headers/float16.c
Modified:
cfe/trunk/lib/Frontend/InitPreprocessor.cpp
cfe/trunk/lib/Headers/float.h
cfe/trunk/test/Preprocessor/init.c

Modified: cfe/trunk/lib/Frontend/InitPreprocessor.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitPreprocessor.cpp?rev=313152=313151=313152=diff
==
--- cfe/trunk/lib/Frontend/InitPreprocessor.cpp (original)
+++ cfe/trunk/lib/Frontend/InitPreprocessor.cpp Wed Sep 13 08:23:19 2017
@@ -110,9 +110,11 @@ static void AddImplicitIncludePCH(MacroB
 /// PickFP - This is used to pick a value based on the FP semantics of the
 /// specified FP model.
 template 
-static T PickFP(const llvm::fltSemantics *Sem, T IEEESingleVal,
+static T PickFP(const llvm::fltSemantics *Sem, T IEEEHalfVal, T IEEESingleVal,
 T IEEEDoubleVal, T X87DoubleExtendedVal, T PPCDoubleDoubleVal,
 T IEEEQuadVal) {
+  if (Sem == (const llvm::fltSemantics*)::APFloat::IEEEhalf())
+return IEEEHalfVal;
   if (Sem == (const llvm::fltSemantics*)::APFloat::IEEEsingle())
 return IEEESingleVal;
   if (Sem == (const llvm::fltSemantics*)::APFloat::IEEEdouble())
@@ -128,26 +130,26 @@ static T PickFP(const llvm::fltSemantics
 static void DefineFloatMacros(MacroBuilder , StringRef Prefix,
   const llvm::fltSemantics *Sem, StringRef Ext) {
   const char *DenormMin, *Epsilon, *Max, *Min;
-  DenormMin = PickFP(Sem, "1.40129846e-45", "4.9406564584124654e-324",
- "3.64519953188247460253e-4951",
+  DenormMin = PickFP(Sem, "5.9604644775390625e-8", "1.40129846e-45",
+ "4.9406564584124654e-324", "3.64519953188247460253e-4951",
  "4.94065645841246544176568792868221e-324",
  "6.47517511943802511092443895822764655e-4966");
-  int Digits = PickFP(Sem, 6, 15, 18, 31, 33);
-  int DecimalDigits = PickFP(Sem, 9, 17, 21, 33, 36);
-  Epsilon = PickFP(Sem, "1.19209290e-7", "2.2204460492503131e-16",
-   "1.08420217248550443401e-19",
+  int Digits = PickFP(Sem, 3, 6, 15, 18, 31, 33);
+  int DecimalDigits = PickFP(Sem, 5, 9, 17, 21, 33, 36);
+  Epsilon = PickFP(Sem, "9.765625e-4", "1.19209290e-7",
+   "2.2204460492503131e-16", "1.08420217248550443401e-19",
"4.94065645841246544176568792868221e-324",
"1.92592994438723585305597794258492732e-34");
-  int MantissaDigits = PickFP(Sem, 24, 53, 64, 106, 113);
-  int Min10Exp = PickFP(Sem, -37, -307, -4931, -291, -4931);
-  int Max10Exp = PickFP(Sem, 38, 308, 4932, 308, 4932);
-  int MinExp = PickFP(Sem, -125, -1021, -16381, -968, -16381);
-  int MaxExp = PickFP(Sem, 128, 1024, 16384, 1024, 16384);
-  Min = PickFP(Sem, "1.17549435e-38", "2.2250738585072014e-308",
+  int MantissaDigits = PickFP(Sem, 11, 24, 53, 64, 106, 113);
+  int Min10Exp = PickFP(Sem, -13, -37, -307, -4931, -291, -4931);
+  int Max10Exp = PickFP(Sem, 4, 38, 308, 4932, 308, 4932);
+  int MinExp = PickFP(Sem, -14, -125, -1021, -16381, -968, -16381);
+  int MaxExp = PickFP(Sem, 15, 128, 1024, 16384, 1024, 16384);
+  Min = PickFP(Sem, "6.103515625e-5", "1.17549435e-38", 
"2.2250738585072014e-308",
"3.36210314311209350626e-4932",
"2.00416836000897277799610805135016e-292",
"3.36210314311209350626267781732175260e-4932");
-  Max = PickFP(Sem, "3.40282347e+38", "1.7976931348623157e+308",
+  Max = PickFP(Sem, "6.5504e+4", "3.40282347e+38", "1.7976931348623157e+308",
"1.18973149535723176502e+4932",
"1.79769313486231580793728971405301e+308",
"1.18973149535723176508575932662800702e+4932");
@@ -802,6 +804,7 @@ static void InitializePredefinedMacros(c
   DefineFmt("__UINTPTR", TI.getUIntPtrType(), TI, Builder);
   DefineTypeWidth("__UINTPTR_WIDTH__", TI.getUIntPtrType(), TI, Builder);
 
+  DefineFloatMacros(Builder, "FLT16", (), "F16");
   DefineFloatMacros(Builder, "FLT", (), "F");
   DefineFloatMacros(Builder, "DBL", (), "");
   DefineFloatMacros(Builder, "LDBL", (), "L");

Modified: cfe/trunk/lib/Headers/float.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/float.h?rev=313152=313151=313152=diff
==
--- cfe/trunk/lib/Headers/float.h (original)
+++ cfe/trunk/lib/Headers/float.h Wed Sep 13 08:23:19 2017
@@ -143,4 +143,18 @@
 #  define LDBL_DECIMAL_DIG __LDBL_DECIMAL_DIG__
 #endif
 
+#ifdef __STDC_WANT_IEC_60559_TYPES_EXT__
+#  define FLT16_MANT_DIG__FLT16_MANT_DIG__
+#  define FLT16_DECIMAL_DIG __FLT16_DECIMAL_DIG__
+#  define FLT16_DIG __FLT16_DIG__
+#  define 

r312798 - Add _Float16 as a C/C++ source language type

2017-09-08 Thread Sjoerd Meijer via cfe-commits
Author: sjoerdmeijer
Date: Fri Sep  8 09:43:10 2017
New Revision: 312798

URL: http://llvm.org/viewvc/llvm-project?rev=312798=rev
Log:
Add _Float16 as a C/C++ source language type

Pacify the windows builder; fixed the new test as on Windows some additional
attributes are printed.


Modified:
cfe/trunk/test/Frontend/float16.cpp

Modified: cfe/trunk/test/Frontend/float16.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Frontend/float16.cpp?rev=312798=312797=312798=diff
==
--- cfe/trunk/test/Frontend/float16.cpp (original)
+++ cfe/trunk/test/Frontend/float16.cpp Fri Sep  8 09:43:10 2017
@@ -116,7 +116,7 @@ public:
 //CHECK-NEXT: | |-VarDecl {{.*}} used f2c 'const _Float16' static
 //CHECK-NEXT: | |-FieldDecl {{.*}} f3c 'volatile _Float16'
 //CHECK-NEXT: | |-AccessSpecDecl
-//CHECK-NEXT: | |-CXXConstructorDecl {{.*}} used C1 'void (_Float16)'
+//CHECK-NEXT: | |-CXXConstructorDecl {{.*}} used C1 'void (_Float16)
 //CHECK-NEXT: | | |-ParmVarDecl {{.*}} used arg '_Float16'
 //CHECK-NEXT: | | |-CXXCtorInitializer Field {{.*}} 'f1c' '_Float16'
 //CHECK-NEXT: | | | `-ImplicitCastExpr {{.*}} '_Float16' 
@@ -125,7 +125,7 @@ public:
 //CHECK-NEXT: | | | `-ImplicitCastExpr {{.*}} '_Float16' 
 //CHECK-NEXT: | | |   `-DeclRefExpr {{.*}} '_Float16' lvalue ParmVar 0x{{.*}} 
'arg' '_Float16'
 //CHECK-NEXT: | | `-CompoundStmt
-//CHECK-NEXT: | |-CXXMethodDecl {{.*}} used func1c '_Float16 (_Float16)'
+//CHECK-NEXT: | |-CXXMethodDecl {{.*}} used func1c '_Float16 (_Float16)
 //CHECK-NEXT: | | |-ParmVarDecl {{.*}} used arg '_Float16'
 //CHECK-NEXT: | | `-CompoundStmt
 //CHECK-NEXT: | |   `-ReturnStmt
@@ -209,7 +209,7 @@ int main(void) {
 
   C1 c1(f1l);
 //CHECK:   | `-VarDecl{{.*}} used c1 'class C1' callinit
-//CHECK-NEXT:  |   `-CXXConstructExpr {{.*}} 'class C1' 'void (_Float16)'
+//CHECK-NEXT:  |   `-CXXConstructExpr {{.*}} 'class C1' 'void (_Float16)
 //CHECK-NEXT:  | `-ImplicitCastExpr {{.*}} '_Float16' 
 //CHECK-NEXT:  |   `-DeclRefExpr {{.*}} '_Float16' lvalue Var 0x{{.*}} 
'f1l' '_Float16'
 


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


r312794 - Recommit "Add _Float16 as a C/C++ source language type"

2017-09-08 Thread Sjoerd Meijer via cfe-commits
Author: sjoerdmeijer
Date: Fri Sep  8 08:15:00 2017
New Revision: 312794

URL: http://llvm.org/viewvc/llvm-project?rev=312794=rev
Log:
Recommit "Add _Float16 as a C/C++ source language type"

This is a recommit of r312781; in some build configurations
variable names are omitted, so changed the new regression
test accordingly.

Added:
cfe/trunk/test/CodeGenCXX/float16-declarations.cpp
cfe/trunk/test/Frontend/float16.cpp
Modified:
cfe/trunk/include/clang-c/Index.h
cfe/trunk/include/clang/AST/ASTContext.h
cfe/trunk/include/clang/AST/BuiltinTypes.def
cfe/trunk/include/clang/Basic/Specifiers.h
cfe/trunk/include/clang/Basic/TokenKinds.def
cfe/trunk/include/clang/Lex/LiteralSupport.h
cfe/trunk/include/clang/Sema/DeclSpec.h
cfe/trunk/include/clang/Serialization/ASTBitCodes.h
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/lib/AST/ItaniumMangle.cpp
cfe/trunk/lib/AST/MicrosoftMangle.cpp
cfe/trunk/lib/AST/NSAPI.cpp
cfe/trunk/lib/AST/StmtPrinter.cpp
cfe/trunk/lib/AST/Type.cpp
cfe/trunk/lib/AST/TypeLoc.cpp
cfe/trunk/lib/Analysis/PrintfFormatString.cpp
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
cfe/trunk/lib/CodeGen/CGExprScalar.cpp
cfe/trunk/lib/CodeGen/CodeGenTypes.cpp
cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
cfe/trunk/lib/Format/FormatToken.cpp
cfe/trunk/lib/Index/USRGeneration.cpp
cfe/trunk/lib/Lex/LiteralSupport.cpp
cfe/trunk/lib/Parse/ParseDecl.cpp
cfe/trunk/lib/Parse/ParseExpr.cpp
cfe/trunk/lib/Parse/ParseExprCXX.cpp
cfe/trunk/lib/Parse/ParseTentative.cpp
cfe/trunk/lib/Sema/DeclSpec.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/lib/Sema/SemaTemplateVariadic.cpp
cfe/trunk/lib/Sema/SemaType.cpp
cfe/trunk/lib/Serialization/ASTCommon.cpp
cfe/trunk/lib/Serialization/ASTReader.cpp
cfe/trunk/test/Lexer/half-literal.cpp
cfe/trunk/tools/libclang/CXType.cpp

Modified: cfe/trunk/include/clang-c/Index.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang-c/Index.h?rev=312794=312793=312794=diff
==
--- cfe/trunk/include/clang-c/Index.h (original)
+++ cfe/trunk/include/clang-c/Index.h Fri Sep  8 08:15:00 2017
@@ -3115,8 +3115,9 @@ enum CXTypeKind {
   CXType_ObjCSel = 29,
   CXType_Float128 = 30,
   CXType_Half = 31,
+  CXType_Float16 = 32,
   CXType_FirstBuiltin = CXType_Void,
-  CXType_LastBuiltin  = CXType_Half,
+  CXType_LastBuiltin  = CXType_Float16,
 
   CXType_Complex = 100,
   CXType_Pointer = 101,

Modified: cfe/trunk/include/clang/AST/ASTContext.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=312794=312793=312794=diff
==
--- cfe/trunk/include/clang/AST/ASTContext.h (original)
+++ cfe/trunk/include/clang/AST/ASTContext.h Fri Sep  8 08:15:00 2017
@@ -973,6 +973,7 @@ public:
   CanQualType UnsignedLongLongTy, UnsignedInt128Ty;
   CanQualType FloatTy, DoubleTy, LongDoubleTy, Float128Ty;
   CanQualType HalfTy; // [OpenCL 6.1.1.1], ARM NEON
+  CanQualType Float16Ty; // C11 extension ISO/IEC TS 18661-3
   CanQualType FloatComplexTy, DoubleComplexTy, LongDoubleComplexTy;
   CanQualType Float128ComplexTy;
   CanQualType VoidPtrTy, NullPtrTy;

Modified: cfe/trunk/include/clang/AST/BuiltinTypes.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/BuiltinTypes.def?rev=312794=312793=312794=diff
==
--- cfe/trunk/include/clang/AST/BuiltinTypes.def (original)
+++ cfe/trunk/include/clang/AST/BuiltinTypes.def Fri Sep  8 08:15:00 2017
@@ -133,6 +133,9 @@ FLOATING_TYPE(Double, DoubleTy)
 // 'long double'
 FLOATING_TYPE(LongDouble, LongDoubleTy)
 
+// '_Float16'
+FLOATING_TYPE(Float16, HalfTy)
+
 // '__float128'
 FLOATING_TYPE(Float128, Float128Ty)
 

Modified: cfe/trunk/include/clang/Basic/Specifiers.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Specifiers.h?rev=312794=312793=312794=diff
==
--- cfe/trunk/include/clang/Basic/Specifiers.h (original)
+++ cfe/trunk/include/clang/Basic/Specifiers.h Fri Sep  8 08:15:00 2017
@@ -52,6 +52,7 @@ namespace clang {
 TST_int,
 TST_int128,
 TST_half, // OpenCL half, ARM NEON __fp16
+TST_Float16,  // C11 extension ISO/IEC TS 18661-3
 TST_float,
 TST_double,
 TST_float128,

Modified: cfe/trunk/include/clang/Basic/TokenKinds.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TokenKinds.def?rev=312794=312793=312794=diff
==
--- cfe/trunk/include/clang/Basic/TokenKinds.def (original)
+++ cfe/trunk/include/clang/Basic/TokenKinds.def Fri Sep  8 08:15:00 2017
@@ -379,6 +379,9 @@ KEYWORD(co_yield   

r312784 - Revert "Add _Float16 as a C/C++ source language type"

2017-09-08 Thread Sjoerd Meijer via cfe-commits
Author: sjoerdmeijer
Date: Fri Sep  8 03:20:52 2017
New Revision: 312784

URL: http://llvm.org/viewvc/llvm-project?rev=312784=rev
Log:
Revert "Add _Float16 as a C/C++ source language type"

The clang-with-lto-ubuntu bot didn't like the new regression
test, revert while I investigate the issue.

Removed:
cfe/trunk/test/CodeGenCXX/float16-declarations.cpp
cfe/trunk/test/Frontend/float16.cpp
Modified:
cfe/trunk/include/clang-c/Index.h
cfe/trunk/include/clang/AST/ASTContext.h
cfe/trunk/include/clang/AST/BuiltinTypes.def
cfe/trunk/include/clang/Basic/Specifiers.h
cfe/trunk/include/clang/Basic/TokenKinds.def
cfe/trunk/include/clang/Lex/LiteralSupport.h
cfe/trunk/include/clang/Sema/DeclSpec.h
cfe/trunk/include/clang/Serialization/ASTBitCodes.h
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/lib/AST/ItaniumMangle.cpp
cfe/trunk/lib/AST/MicrosoftMangle.cpp
cfe/trunk/lib/AST/NSAPI.cpp
cfe/trunk/lib/AST/StmtPrinter.cpp
cfe/trunk/lib/AST/Type.cpp
cfe/trunk/lib/AST/TypeLoc.cpp
cfe/trunk/lib/Analysis/PrintfFormatString.cpp
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
cfe/trunk/lib/CodeGen/CGExprScalar.cpp
cfe/trunk/lib/CodeGen/CodeGenTypes.cpp
cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
cfe/trunk/lib/Format/FormatToken.cpp
cfe/trunk/lib/Index/USRGeneration.cpp
cfe/trunk/lib/Lex/LiteralSupport.cpp
cfe/trunk/lib/Parse/ParseDecl.cpp
cfe/trunk/lib/Parse/ParseExpr.cpp
cfe/trunk/lib/Parse/ParseExprCXX.cpp
cfe/trunk/lib/Parse/ParseTentative.cpp
cfe/trunk/lib/Sema/DeclSpec.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/lib/Sema/SemaTemplateVariadic.cpp
cfe/trunk/lib/Sema/SemaType.cpp
cfe/trunk/lib/Serialization/ASTCommon.cpp
cfe/trunk/lib/Serialization/ASTReader.cpp
cfe/trunk/test/Lexer/half-literal.cpp
cfe/trunk/tools/libclang/CXType.cpp

Modified: cfe/trunk/include/clang-c/Index.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang-c/Index.h?rev=312784=312783=312784=diff
==
--- cfe/trunk/include/clang-c/Index.h (original)
+++ cfe/trunk/include/clang-c/Index.h Fri Sep  8 03:20:52 2017
@@ -3115,9 +3115,8 @@ enum CXTypeKind {
   CXType_ObjCSel = 29,
   CXType_Float128 = 30,
   CXType_Half = 31,
-  CXType_Float16 = 32,
   CXType_FirstBuiltin = CXType_Void,
-  CXType_LastBuiltin  = CXType_Float16,
+  CXType_LastBuiltin  = CXType_Half,
 
   CXType_Complex = 100,
   CXType_Pointer = 101,

Modified: cfe/trunk/include/clang/AST/ASTContext.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=312784=312783=312784=diff
==
--- cfe/trunk/include/clang/AST/ASTContext.h (original)
+++ cfe/trunk/include/clang/AST/ASTContext.h Fri Sep  8 03:20:52 2017
@@ -973,7 +973,6 @@ public:
   CanQualType UnsignedLongLongTy, UnsignedInt128Ty;
   CanQualType FloatTy, DoubleTy, LongDoubleTy, Float128Ty;
   CanQualType HalfTy; // [OpenCL 6.1.1.1], ARM NEON
-  CanQualType Float16Ty; // C11 extension ISO/IEC TS 18661-3
   CanQualType FloatComplexTy, DoubleComplexTy, LongDoubleComplexTy;
   CanQualType Float128ComplexTy;
   CanQualType VoidPtrTy, NullPtrTy;

Modified: cfe/trunk/include/clang/AST/BuiltinTypes.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/BuiltinTypes.def?rev=312784=312783=312784=diff
==
--- cfe/trunk/include/clang/AST/BuiltinTypes.def (original)
+++ cfe/trunk/include/clang/AST/BuiltinTypes.def Fri Sep  8 03:20:52 2017
@@ -133,9 +133,6 @@ FLOATING_TYPE(Double, DoubleTy)
 // 'long double'
 FLOATING_TYPE(LongDouble, LongDoubleTy)
 
-// '_Float16'
-FLOATING_TYPE(Float16, HalfTy)
-
 // '__float128'
 FLOATING_TYPE(Float128, Float128Ty)
 

Modified: cfe/trunk/include/clang/Basic/Specifiers.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Specifiers.h?rev=312784=312783=312784=diff
==
--- cfe/trunk/include/clang/Basic/Specifiers.h (original)
+++ cfe/trunk/include/clang/Basic/Specifiers.h Fri Sep  8 03:20:52 2017
@@ -52,7 +52,6 @@ namespace clang {
 TST_int,
 TST_int128,
 TST_half, // OpenCL half, ARM NEON __fp16
-TST_Float16,  // C11 extension ISO/IEC TS 18661-3
 TST_float,
 TST_double,
 TST_float128,

Modified: cfe/trunk/include/clang/Basic/TokenKinds.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TokenKinds.def?rev=312784=312783=312784=diff
==
--- cfe/trunk/include/clang/Basic/TokenKinds.def (original)
+++ cfe/trunk/include/clang/Basic/TokenKinds.def Fri Sep  8 03:20:52 2017
@@ -379,9 +379,6 @@ KEYWORD(co_yield, KE
 

r312781 - Add _Float16 as a C/C++ source language type

2017-09-08 Thread Sjoerd Meijer via cfe-commits
Author: sjoerdmeijer
Date: Fri Sep  8 02:42:32 2017
New Revision: 312781

URL: http://llvm.org/viewvc/llvm-project?rev=312781=rev
Log:
Add _Float16 as a C/C++ source language type

This adds _Float16 as a source language type, which is a 16-bit floating point
type defined in C11 extension ISO/IEC TS 18661-3.

In follow up patches documentation and more tests will be added.

Differential Revision: https://reviews.llvm.org/D33719

Added:
cfe/trunk/test/CodeGenCXX/float16-declarations.cpp
cfe/trunk/test/Frontend/float16.cpp
Modified:
cfe/trunk/include/clang-c/Index.h
cfe/trunk/include/clang/AST/ASTContext.h
cfe/trunk/include/clang/AST/BuiltinTypes.def
cfe/trunk/include/clang/Basic/Specifiers.h
cfe/trunk/include/clang/Basic/TokenKinds.def
cfe/trunk/include/clang/Lex/LiteralSupport.h
cfe/trunk/include/clang/Sema/DeclSpec.h
cfe/trunk/include/clang/Serialization/ASTBitCodes.h
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/lib/AST/ItaniumMangle.cpp
cfe/trunk/lib/AST/MicrosoftMangle.cpp
cfe/trunk/lib/AST/NSAPI.cpp
cfe/trunk/lib/AST/StmtPrinter.cpp
cfe/trunk/lib/AST/Type.cpp
cfe/trunk/lib/AST/TypeLoc.cpp
cfe/trunk/lib/Analysis/PrintfFormatString.cpp
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
cfe/trunk/lib/CodeGen/CGExprScalar.cpp
cfe/trunk/lib/CodeGen/CodeGenTypes.cpp
cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
cfe/trunk/lib/Format/FormatToken.cpp
cfe/trunk/lib/Index/USRGeneration.cpp
cfe/trunk/lib/Lex/LiteralSupport.cpp
cfe/trunk/lib/Parse/ParseDecl.cpp
cfe/trunk/lib/Parse/ParseExpr.cpp
cfe/trunk/lib/Parse/ParseExprCXX.cpp
cfe/trunk/lib/Parse/ParseTentative.cpp
cfe/trunk/lib/Sema/DeclSpec.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/lib/Sema/SemaTemplateVariadic.cpp
cfe/trunk/lib/Sema/SemaType.cpp
cfe/trunk/lib/Serialization/ASTCommon.cpp
cfe/trunk/lib/Serialization/ASTReader.cpp
cfe/trunk/test/Lexer/half-literal.cpp
cfe/trunk/tools/libclang/CXType.cpp

Modified: cfe/trunk/include/clang-c/Index.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang-c/Index.h?rev=312781=312780=312781=diff
==
--- cfe/trunk/include/clang-c/Index.h (original)
+++ cfe/trunk/include/clang-c/Index.h Fri Sep  8 02:42:32 2017
@@ -3115,8 +3115,9 @@ enum CXTypeKind {
   CXType_ObjCSel = 29,
   CXType_Float128 = 30,
   CXType_Half = 31,
+  CXType_Float16 = 32,
   CXType_FirstBuiltin = CXType_Void,
-  CXType_LastBuiltin  = CXType_Half,
+  CXType_LastBuiltin  = CXType_Float16,
 
   CXType_Complex = 100,
   CXType_Pointer = 101,

Modified: cfe/trunk/include/clang/AST/ASTContext.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=312781=312780=312781=diff
==
--- cfe/trunk/include/clang/AST/ASTContext.h (original)
+++ cfe/trunk/include/clang/AST/ASTContext.h Fri Sep  8 02:42:32 2017
@@ -973,6 +973,7 @@ public:
   CanQualType UnsignedLongLongTy, UnsignedInt128Ty;
   CanQualType FloatTy, DoubleTy, LongDoubleTy, Float128Ty;
   CanQualType HalfTy; // [OpenCL 6.1.1.1], ARM NEON
+  CanQualType Float16Ty; // C11 extension ISO/IEC TS 18661-3
   CanQualType FloatComplexTy, DoubleComplexTy, LongDoubleComplexTy;
   CanQualType Float128ComplexTy;
   CanQualType VoidPtrTy, NullPtrTy;

Modified: cfe/trunk/include/clang/AST/BuiltinTypes.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/BuiltinTypes.def?rev=312781=312780=312781=diff
==
--- cfe/trunk/include/clang/AST/BuiltinTypes.def (original)
+++ cfe/trunk/include/clang/AST/BuiltinTypes.def Fri Sep  8 02:42:32 2017
@@ -133,6 +133,9 @@ FLOATING_TYPE(Double, DoubleTy)
 // 'long double'
 FLOATING_TYPE(LongDouble, LongDoubleTy)
 
+// '_Float16'
+FLOATING_TYPE(Float16, HalfTy)
+
 // '__float128'
 FLOATING_TYPE(Float128, Float128Ty)
 

Modified: cfe/trunk/include/clang/Basic/Specifiers.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Specifiers.h?rev=312781=312780=312781=diff
==
--- cfe/trunk/include/clang/Basic/Specifiers.h (original)
+++ cfe/trunk/include/clang/Basic/Specifiers.h Fri Sep  8 02:42:32 2017
@@ -52,6 +52,7 @@ namespace clang {
 TST_int,
 TST_int128,
 TST_half, // OpenCL half, ARM NEON __fp16
+TST_Float16,  // C11 extension ISO/IEC TS 18661-3
 TST_float,
 TST_double,
 TST_float128,

Modified: cfe/trunk/include/clang/Basic/TokenKinds.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TokenKinds.def?rev=312781=312780=312781=diff
==
--- cfe/trunk/include/clang/Basic/TokenKinds.def (original)
+++ 

r306805 - ARMV8-A archkind and target defines helper functions

2017-06-30 Thread Sjoerd Meijer via cfe-commits
Author: sjoerdmeijer
Date: Fri Jun 30 01:07:34 2017
New Revision: 306805

URL: http://llvm.org/viewvc/llvm-project?rev=306805=rev
Log:
ARMV8-A archkind and target defines helper functions

This introduces helper functions that set target defines for different ARMV8-A
architecture kinds. It fixes an issue that the v8.1 define ARM_FEATURE_QRDMX
was not set for v8.2. These helper functions make things more “scalable” if we
want to add ARMv8.3 at some point, and a cleanup has been done to hold the
architecture kind in one variable (instead of one for each).

Differential Revision: https://reviews.llvm.org/D34686

Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/test/Preprocessor/aarch64-target-features.c
cfe/trunk/test/Preprocessor/arm-target-features.c

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=306805=306804=306805=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Fri Jun 30 01:07:34 2017
@@ -5615,6 +5615,17 @@ public:
 
   bool setFPMath(StringRef Name) override;
 
+  void getTargetDefinesARMV81A(const LangOptions ,
+   MacroBuilder ) const {
+Builder.defineMacro("__ARM_FEATURE_QRDMX", "1");
+  }
+
+  void getTargetDefinesARMV82A(const LangOptions ,
+   MacroBuilder ) const {
+// Also include the ARMv8.1-A defines
+getTargetDefinesARMV81A(Opts, Builder);
+  }
+
   void getTargetDefines(const LangOptions ,
 MacroBuilder ) const override {
 // Target identification.
@@ -5813,8 +5824,15 @@ public:
 if (Opts.UnsafeFPMath)
   Builder.defineMacro("__ARM_FP_FAST", "1");
 
-if (ArchKind == llvm::ARM::AK_ARMV8_1A)
-  Builder.defineMacro("__ARM_FEATURE_QRDMX", "1");
+switch(ArchKind) {
+default: break;
+case llvm::ARM::AK_ARMV8_1A:
+  getTargetDefinesARMV81A(Opts, Builder);
+  break;
+case llvm::ARM::AK_ARMV8_2A:
+  getTargetDefinesARMV82A(Opts, Builder);
+  break;
+}
   }
 
   ArrayRef getTargetBuiltins() const override {
@@ -6207,9 +6225,8 @@ class AArch64TargetInfo : public TargetI
   unsigned CRC;
   unsigned Crypto;
   unsigned Unaligned;
-  unsigned V8_1A;
-  unsigned V8_2A;
   unsigned HasFullFP16;
+  llvm::AArch64::ArchKind ArchKind;
 
   static const Builtin::Info BuiltinInfo[];
 
@@ -6275,6 +6292,20 @@ public:
static_cast(llvm::AArch64::ArchKind::AK_INVALID);
   }
 
+  void getTargetDefinesARMV81A(const LangOptions ,
+MacroBuilder ) const {
+Builder.defineMacro("__ARM_FEATURE_QRDMX", "1");
+  }
+
+  void getTargetDefinesARMV82A(const LangOptions ,
+MacroBuilder ) const {
+// Also include the ARMv8.1 defines
+getTargetDefinesARMV81A(Opts, Builder);
+
+if (FPU == NeonMode && HasFullFP16)
+  Builder.defineMacro("__ARM_FEATURE_FP16_VECTOR_ARITHMETIC", "1");
+  }
+
   void getTargetDefines(const LangOptions ,
 MacroBuilder ) const override {
 // Target identification.
@@ -6339,10 +6370,15 @@ public:
 if (Unaligned)
   Builder.defineMacro("__ARM_FEATURE_UNALIGNED", "1");
 
-if (V8_1A)
-  Builder.defineMacro("__ARM_FEATURE_QRDMX", "1");
-if (V8_2A && FPU == NeonMode && HasFullFP16)
-  Builder.defineMacro("__ARM_FEATURE_FP16_VECTOR_ARITHMETIC", "1");
+switch(ArchKind) {
+default: break;
+case llvm::AArch64::ArchKind::AK_ARMV8_1A:
+  getTargetDefinesARMV81A(Opts, Builder);
+  break;
+case llvm::AArch64::ArchKind::AK_ARMV8_2A:
+  getTargetDefinesARMV82A(Opts, Builder);
+  break;
+}
 
 // All of the __sync_(bool|val)_compare_and_swap_(1|2|4|8) builtins work.
 Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1");
@@ -6369,9 +6405,8 @@ public:
 CRC = 0;
 Crypto = 0;
 Unaligned = 1;
-V8_1A = 0;
-V8_2A = 0;
 HasFullFP16 = 0;
+ArchKind = llvm::AArch64::ArchKind::AK_ARMV8A;
 
 for (const auto  : Features) {
   if (Feature == "+neon")
@@ -6383,9 +6418,9 @@ public:
   if (Feature == "+strict-align")
 Unaligned = 0;
   if (Feature == "+v8.1a")
-V8_1A = 1;
+ArchKind = llvm::AArch64::ArchKind::AK_ARMV8_1A;
   if (Feature == "+v8.2a")
-V8_2A = 1;
+ArchKind = llvm::AArch64::ArchKind::AK_ARMV8_2A;
   if (Feature == "+fullfp16")
 HasFullFP16 = 1;
 }

Modified: cfe/trunk/test/Preprocessor/aarch64-target-features.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/aarch64-target-features.c?rev=306805=306804=306805=diff
==
--- cfe/trunk/test/Preprocessor/aarch64-target-features.c (original)
+++ cfe/trunk/test/Preprocessor/aarch64-target-features.c Fri Jun 30 01:07:34 
2017
@@ -71,8 +71,9 @@
 // CHECK-NEON: 

[PATCH] D25479: Guard flag –fdenormal-fp-math with –fno-fast-math

2016-10-13 Thread Sjoerd Meijer via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL284121: Guard flag –fdenormal-fp-math with –fno-fast-math. 
(authored by SjoerdMeijer).

Changed prior to commit:
  https://reviews.llvm.org/D25479?vs=74363=74508#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D25479

Files:
  cfe/trunk/lib/Driver/Tools.cpp
  cfe/trunk/test/Driver/denormal-fp-math.c


Index: cfe/trunk/test/Driver/denormal-fp-math.c
===
--- cfe/trunk/test/Driver/denormal-fp-math.c
+++ cfe/trunk/test/Driver/denormal-fp-math.c
@@ -1,9 +1,12 @@
 // RUN: %clang -### -target arm-unknown-linux-gnu -c %s 
-fdenormal-fp-math=ieee -v 2>&1 | FileCheck -check-prefix=CHECK-IEEE %s
 // RUN: %clang -### -target arm-unknown-linux-gnu -c %s 
-fdenormal-fp-math=preserve-sign -v 2>&1 | FileCheck -check-prefix=CHECK-PS %s
 // RUN: %clang -### -target arm-unknown-linux-gnu -c %s 
-fdenormal-fp-math=positive-zero -v 2>&1 | FileCheck -check-prefix=CHECK-PZ %s
+// RUN: %clang -### -target arm-unknown-linux-gnu -c %s 
-fdenormal-fp-math=ieee -fno-fast-math -v 2>&1 | FileCheck 
-check-prefix=CHECK-NO-UNSAFE %s
+// RUN: %clang -### -target arm-unknown-linux-gnu -c %s 
-fdenormal-fp-math=ieee -fno-unsafe-math-optimizations -v 2>&1 | FileCheck 
-check-prefix=CHECK-NO-UNSAFE %s
 // RUN: not %clang -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=foo 
-v 2>&1 | FileCheck -check-prefix=CHECK-INVALID %s
 
 // CHECK-IEEE: "-fdenormal-fp-math=ieee"
 // CHECK-PS: "-fdenormal-fp-math=preserve-sign"
 // CHECK-PZ: "-fdenormal-fp-math=positive-zero"
+// CHECK-NO-UNSAFE-NOT: "-fdenormal-fp-math=ieee"
 // CHECK-INVALID: error: invalid value 'foo' in '-fdenormal-fp-math=foo'
Index: cfe/trunk/lib/Driver/Tools.cpp
===
--- cfe/trunk/lib/Driver/Tools.cpp
+++ cfe/trunk/lib/Driver/Tools.cpp
@@ -4391,11 +4391,18 @@
   if (ReciprocalMath)
 CmdArgs.push_back("-freciprocal-math");
 
-  if (!TrappingMath) 
+  if (!TrappingMath)
 CmdArgs.push_back("-fno-trapping-math");
 
-  if (Args.hasArg(options::OPT_fdenormal_fp_math_EQ))
-Args.AddLastArg(CmdArgs, options::OPT_fdenormal_fp_math_EQ);
+
+  if (Arg *A = Args.getLastArg(options::OPT_ffast_math, FastMathAliasOption,
+   options::OPT_fno_fast_math,
+   options::OPT_funsafe_math_optimizations,
+   options::OPT_fno_unsafe_math_optimizations,
+   options::OPT_fdenormal_fp_math_EQ))
+if (A->getOption().getID() != options::OPT_fno_fast_math &&
+A->getOption().getID() != options::OPT_fno_unsafe_math_optimizations)
+  Args.AddLastArg(CmdArgs, options::OPT_fdenormal_fp_math_EQ);
 
   // Validate and pass through -fp-contract option.
   if (Arg *A = Args.getLastArg(options::OPT_ffast_math, FastMathAliasOption,


Index: cfe/trunk/test/Driver/denormal-fp-math.c
===
--- cfe/trunk/test/Driver/denormal-fp-math.c
+++ cfe/trunk/test/Driver/denormal-fp-math.c
@@ -1,9 +1,12 @@
 // RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=ieee -v 2>&1 | FileCheck -check-prefix=CHECK-IEEE %s
 // RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=preserve-sign -v 2>&1 | FileCheck -check-prefix=CHECK-PS %s
 // RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=positive-zero -v 2>&1 | FileCheck -check-prefix=CHECK-PZ %s
+// RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=ieee -fno-fast-math -v 2>&1 | FileCheck -check-prefix=CHECK-NO-UNSAFE %s
+// RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=ieee -fno-unsafe-math-optimizations -v 2>&1 | FileCheck -check-prefix=CHECK-NO-UNSAFE %s
 // RUN: not %clang -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=foo -v 2>&1 | FileCheck -check-prefix=CHECK-INVALID %s
 
 // CHECK-IEEE: "-fdenormal-fp-math=ieee"
 // CHECK-PS: "-fdenormal-fp-math=preserve-sign"
 // CHECK-PZ: "-fdenormal-fp-math=positive-zero"
+// CHECK-NO-UNSAFE-NOT: "-fdenormal-fp-math=ieee"
 // CHECK-INVALID: error: invalid value 'foo' in '-fdenormal-fp-math=foo'
Index: cfe/trunk/lib/Driver/Tools.cpp
===
--- cfe/trunk/lib/Driver/Tools.cpp
+++ cfe/trunk/lib/Driver/Tools.cpp
@@ -4391,11 +4391,18 @@
   if (ReciprocalMath)
 CmdArgs.push_back("-freciprocal-math");
 
-  if (!TrappingMath) 
+  if (!TrappingMath)
 CmdArgs.push_back("-fno-trapping-math");
 
-  if (Args.hasArg(options::OPT_fdenormal_fp_math_EQ))
-Args.AddLastArg(CmdArgs, options::OPT_fdenormal_fp_math_EQ);
+
+  if (Arg *A = Args.getLastArg(options::OPT_ffast_math, FastMathAliasOption,
+   options::OPT_fno_fast_math,
+   options::OPT_funsafe_math_optimizations,
+   

[PATCH] D25479: Guard flag –fdenormal-fp-math with –fno-fast-math

2016-10-13 Thread Sjoerd Meijer via cfe-commits
SjoerdMeijer added a comment.

thanks again for reviewing.


https://reviews.llvm.org/D25479



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


[PATCH] D25479: Guard flag –fdenormal-fp-math with –fno-fast-math

2016-10-12 Thread Sjoerd Meijer via cfe-commits
SjoerdMeijer updated this revision to Diff 74363.
SjoerdMeijer added a comment.

Thanks for catching this: the logic and test have been updated.


https://reviews.llvm.org/D25479

Files:
  lib/Driver/Tools.cpp
  test/Driver/denormal-fp-math.c


Index: test/Driver/denormal-fp-math.c
===
--- test/Driver/denormal-fp-math.c
+++ test/Driver/denormal-fp-math.c
@@ -1,9 +1,12 @@
 // RUN: %clang -### -target arm-unknown-linux-gnu -c %s 
-fdenormal-fp-math=ieee -v 2>&1 | FileCheck -check-prefix=CHECK-IEEE %s
 // RUN: %clang -### -target arm-unknown-linux-gnu -c %s 
-fdenormal-fp-math=preserve-sign -v 2>&1 | FileCheck -check-prefix=CHECK-PS %s
 // RUN: %clang -### -target arm-unknown-linux-gnu -c %s 
-fdenormal-fp-math=positive-zero -v 2>&1 | FileCheck -check-prefix=CHECK-PZ %s
+// RUN: %clang -### -target arm-unknown-linux-gnu -c %s 
-fdenormal-fp-math=ieee -fno-fast-math -v 2>&1 | FileCheck 
-check-prefix=CHECK-NO-UNSAFE %s
+// RUN: %clang -### -target arm-unknown-linux-gnu -c %s 
-fdenormal-fp-math=ieee -fno-unsafe-math-optimizations -v 2>&1 | FileCheck 
-check-prefix=CHECK-NO-UNSAFE %s
 // RUN: not %clang -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=foo 
-v 2>&1 | FileCheck -check-prefix=CHECK-INVALID %s
 
 // CHECK-IEEE: "-fdenormal-fp-math=ieee"
 // CHECK-PS: "-fdenormal-fp-math=preserve-sign"
 // CHECK-PZ: "-fdenormal-fp-math=positive-zero"
+// CHECK-NO-UNSAFE-NOT: "-fdenormal-fp-math=ieee"
 // CHECK-INVALID: error: invalid value 'foo' in '-fdenormal-fp-math=foo'
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -4390,11 +4390,18 @@
   if (ReciprocalMath)
 CmdArgs.push_back("-freciprocal-math");
 
-  if (!TrappingMath) 
+  if (!TrappingMath)
 CmdArgs.push_back("-fno-trapping-math");
 
-  if (Args.hasArg(options::OPT_fdenormal_fp_math_EQ))
-Args.AddLastArg(CmdArgs, options::OPT_fdenormal_fp_math_EQ);
+
+  if (Arg *A = Args.getLastArg(options::OPT_ffast_math, FastMathAliasOption,
+   options::OPT_fno_fast_math,
+   options::OPT_funsafe_math_optimizations,
+   options::OPT_fno_unsafe_math_optimizations,
+   options::OPT_fdenormal_fp_math_EQ))
+if (A->getOption().getID() != options::OPT_fno_fast_math &&
+A->getOption().getID() != options::OPT_fno_unsafe_math_optimizations)
+  Args.AddLastArg(CmdArgs, options::OPT_fdenormal_fp_math_EQ);
 
   // Validate and pass through -fp-contract option.
   if (Arg *A = Args.getLastArg(options::OPT_ffast_math, FastMathAliasOption,


Index: test/Driver/denormal-fp-math.c
===
--- test/Driver/denormal-fp-math.c
+++ test/Driver/denormal-fp-math.c
@@ -1,9 +1,12 @@
 // RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=ieee -v 2>&1 | FileCheck -check-prefix=CHECK-IEEE %s
 // RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=preserve-sign -v 2>&1 | FileCheck -check-prefix=CHECK-PS %s
 // RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=positive-zero -v 2>&1 | FileCheck -check-prefix=CHECK-PZ %s
+// RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=ieee -fno-fast-math -v 2>&1 | FileCheck -check-prefix=CHECK-NO-UNSAFE %s
+// RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=ieee -fno-unsafe-math-optimizations -v 2>&1 | FileCheck -check-prefix=CHECK-NO-UNSAFE %s
 // RUN: not %clang -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=foo -v 2>&1 | FileCheck -check-prefix=CHECK-INVALID %s
 
 // CHECK-IEEE: "-fdenormal-fp-math=ieee"
 // CHECK-PS: "-fdenormal-fp-math=preserve-sign"
 // CHECK-PZ: "-fdenormal-fp-math=positive-zero"
+// CHECK-NO-UNSAFE-NOT: "-fdenormal-fp-math=ieee"
 // CHECK-INVALID: error: invalid value 'foo' in '-fdenormal-fp-math=foo'
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -4390,11 +4390,18 @@
   if (ReciprocalMath)
 CmdArgs.push_back("-freciprocal-math");
 
-  if (!TrappingMath) 
+  if (!TrappingMath)
 CmdArgs.push_back("-fno-trapping-math");
 
-  if (Args.hasArg(options::OPT_fdenormal_fp_math_EQ))
-Args.AddLastArg(CmdArgs, options::OPT_fdenormal_fp_math_EQ);
+
+  if (Arg *A = Args.getLastArg(options::OPT_ffast_math, FastMathAliasOption,
+   options::OPT_fno_fast_math,
+   options::OPT_funsafe_math_optimizations,
+   options::OPT_fno_unsafe_math_optimizations,
+   options::OPT_fdenormal_fp_math_EQ))
+if (A->getOption().getID() != options::OPT_fno_fast_math &&
+A->getOption().getID() != options::OPT_fno_unsafe_math_optimizations)
+  

[PATCH] D25479: Guard flag –fdenormal-fp-math with –fno-fast-math

2016-10-11 Thread Sjoerd Meijer via cfe-commits
SjoerdMeijer created this revision.
SjoerdMeijer added reviewers: rengolin, jmolloy.
SjoerdMeijer added a subscriber: cfe-commits.

Guard the -fdenormal-fp-math with -fno-fast-math. This allows disabling the FP 
options with just one flag: –fno-fast-math.


https://reviews.llvm.org/D25479

Files:
  lib/Driver/Tools.cpp
  test/Driver/denormal-fp-math.c


Index: test/Driver/denormal-fp-math.c
===
--- test/Driver/denormal-fp-math.c
+++ test/Driver/denormal-fp-math.c
@@ -1,9 +1,11 @@
 // RUN: %clang -### -target arm-unknown-linux-gnu -c %s 
-fdenormal-fp-math=ieee -v 2>&1 | FileCheck -check-prefix=CHECK-IEEE %s
 // RUN: %clang -### -target arm-unknown-linux-gnu -c %s 
-fdenormal-fp-math=preserve-sign -v 2>&1 | FileCheck -check-prefix=CHECK-PS %s
 // RUN: %clang -### -target arm-unknown-linux-gnu -c %s 
-fdenormal-fp-math=positive-zero -v 2>&1 | FileCheck -check-prefix=CHECK-PZ %s
+// RUN: %clang -### -target arm-unknown-linux-gnu -c %s 
-fdenormal-fp-math=ieee -fno-fast-math -v 2>&1 | FileCheck 
-check-prefix=CHECK-NO-UNSAFE %s
 // RUN: not %clang -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=foo 
-v 2>&1 | FileCheck -check-prefix=CHECK-INVALID %s
 
 // CHECK-IEEE: "-fdenormal-fp-math=ieee"
 // CHECK-PS: "-fdenormal-fp-math=preserve-sign"
 // CHECK-PZ: "-fdenormal-fp-math=positive-zero"
+// CHECK-NO-UNSAFE-NOT: "-fdenormal-fp-math=ieee"
 // CHECK-INVALID: error: invalid value 'foo' in '-fdenormal-fp-math=foo'
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -4390,11 +4390,16 @@
   if (ReciprocalMath)
 CmdArgs.push_back("-freciprocal-math");
 
-  if (!TrappingMath) 
+  if (!TrappingMath)
 CmdArgs.push_back("-fno-trapping-math");
 
-  if (Args.hasArg(options::OPT_fdenormal_fp_math_EQ))
-Args.AddLastArg(CmdArgs, options::OPT_fdenormal_fp_math_EQ);
+
+  if (Arg *A = Args.getLastArg(options::OPT_ffast_math, FastMathAliasOption,
+   options::OPT_fno_fast_math,
+   options::OPT_fdenormal_fp_math_EQ))
+if (A->getOption().getID() != options::OPT_fno_fast_math &&
+A->getOption().getID() != options::OPT_fno_unsafe_math_optimizations)
+  Args.AddLastArg(CmdArgs, options::OPT_fdenormal_fp_math_EQ);
 
   // Validate and pass through -fp-contract option.
   if (Arg *A = Args.getLastArg(options::OPT_ffast_math, FastMathAliasOption,


Index: test/Driver/denormal-fp-math.c
===
--- test/Driver/denormal-fp-math.c
+++ test/Driver/denormal-fp-math.c
@@ -1,9 +1,11 @@
 // RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=ieee -v 2>&1 | FileCheck -check-prefix=CHECK-IEEE %s
 // RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=preserve-sign -v 2>&1 | FileCheck -check-prefix=CHECK-PS %s
 // RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=positive-zero -v 2>&1 | FileCheck -check-prefix=CHECK-PZ %s
+// RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=ieee -fno-fast-math -v 2>&1 | FileCheck -check-prefix=CHECK-NO-UNSAFE %s
 // RUN: not %clang -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=foo -v 2>&1 | FileCheck -check-prefix=CHECK-INVALID %s
 
 // CHECK-IEEE: "-fdenormal-fp-math=ieee"
 // CHECK-PS: "-fdenormal-fp-math=preserve-sign"
 // CHECK-PZ: "-fdenormal-fp-math=positive-zero"
+// CHECK-NO-UNSAFE-NOT: "-fdenormal-fp-math=ieee"
 // CHECK-INVALID: error: invalid value 'foo' in '-fdenormal-fp-math=foo'
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -4390,11 +4390,16 @@
   if (ReciprocalMath)
 CmdArgs.push_back("-freciprocal-math");
 
-  if (!TrappingMath) 
+  if (!TrappingMath)
 CmdArgs.push_back("-fno-trapping-math");
 
-  if (Args.hasArg(options::OPT_fdenormal_fp_math_EQ))
-Args.AddLastArg(CmdArgs, options::OPT_fdenormal_fp_math_EQ);
+
+  if (Arg *A = Args.getLastArg(options::OPT_ffast_math, FastMathAliasOption,
+   options::OPT_fno_fast_math,
+   options::OPT_fdenormal_fp_math_EQ))
+if (A->getOption().getID() != options::OPT_fno_fast_math &&
+A->getOption().getID() != options::OPT_fno_unsafe_math_optimizations)
+  Args.AddLastArg(CmdArgs, options::OPT_fdenormal_fp_math_EQ);
 
   // Validate and pass through -fp-contract option.
   if (Arg *A = Args.getLastArg(options::OPT_ffast_math, FastMathAliasOption,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D24907: NFC: separate file for fp denormal regression tests

2016-10-04 Thread Sjoerd Meijer via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL283109: This adds a separate file for the fp denormal 
regression tests. NFC. (authored by SjoerdMeijer).

Changed prior to commit:
  https://reviews.llvm.org/D24907?vs=72457=73411#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D24907

Files:
  cfe/trunk/test/Driver/fast-math.c


Index: cfe/trunk/test/Driver/fast-math.c
===
--- cfe/trunk/test/Driver/fast-math.c
+++ cfe/trunk/test/Driver/fast-math.c
@@ -234,13 +234,4 @@
 //
 // RUN: %clang -### -ftrapping-math -fno-trapping-math -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-NO-TRAPPING-MATH %s
-// RUN: %clang -### -fdenormal-fp-math=ieee -c %s 2>&1 \
-// RUN:   | FileCheck --check-prefix=CHECK-FP-DENORMAL-IEEE %s
-// RUN: %clang -### -fdenormal-fp-math=preserve-sign -c %s 2>&1 \
-// RUN:   | FileCheck --check-prefix=CHECK-FP-DENORMAL-PS %s
-// RUN: %clang -### -fdenormal-fp-math=positive-zero -c %s 2>&1 \
-// RUN:   | FileCheck --check-prefix=CHECK-FP-DENORMAL-PZ %s
 // CHECK-NO-TRAPPING-MATH: "-fno-trapping-math"
-// CHECK-FP-DENORMAL-IEEE: "-fdenormal-fp-math=ieee"
-// CHECK-FP-DENORMAL-PS: "-fdenormal-fp-math=preserve-sign"
-// CHECK-FP-DENORMAL-PZ: "-fdenormal-fp-math=positive-zero"


Index: cfe/trunk/test/Driver/fast-math.c
===
--- cfe/trunk/test/Driver/fast-math.c
+++ cfe/trunk/test/Driver/fast-math.c
@@ -234,13 +234,4 @@
 //
 // RUN: %clang -### -ftrapping-math -fno-trapping-math -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-NO-TRAPPING-MATH %s
-// RUN: %clang -### -fdenormal-fp-math=ieee -c %s 2>&1 \
-// RUN:   | FileCheck --check-prefix=CHECK-FP-DENORMAL-IEEE %s
-// RUN: %clang -### -fdenormal-fp-math=preserve-sign -c %s 2>&1 \
-// RUN:   | FileCheck --check-prefix=CHECK-FP-DENORMAL-PS %s
-// RUN: %clang -### -fdenormal-fp-math=positive-zero -c %s 2>&1 \
-// RUN:   | FileCheck --check-prefix=CHECK-FP-DENORMAL-PZ %s
 // CHECK-NO-TRAPPING-MATH: "-fno-trapping-math"
-// CHECK-FP-DENORMAL-IEEE: "-fdenormal-fp-math=ieee"
-// CHECK-FP-DENORMAL-PS: "-fdenormal-fp-math=preserve-sign"
-// CHECK-FP-DENORMAL-PZ: "-fdenormal-fp-math=positive-zero"
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D24909: fix for not copying fp denormal and trapping options.

2016-10-04 Thread Sjoerd Meijer via cfe-commits
SjoerdMeijer abandoned this revision.
SjoerdMeijer added a comment.

Ok, thanks for the feedback and looking into this. I will abandon this change.
To still answer your question, there is nothing more to it than emitting an 
AArch64 build attribute symbol (for library selection).  This done based on 
function attributes and options. But I've now noticed that this (downstream) 
logic needs updating. Thanks again.


https://reviews.llvm.org/D24909



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


[PATCH] D24909: fix for not copying fp denormal and trapping options.

2016-10-03 Thread Sjoerd Meijer via cfe-commits
SjoerdMeijer added a comment.

Hi Hal, 
Thanks for reviewing and you're right: this should work. We actually have 
actually some downstream (aarch64) build attribute selection code that would 
work better with this change. Are you okay with committing this change?
Cheers,
Sjoerd.


https://reviews.llvm.org/D24909



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


RE: [llvm-dev] Upgrading phabricator

2016-10-03 Thread Sjoerd Meijer via cfe-commits
Hi,

I just committed to Clang and noticed that the corresponding Phabricator ticket 
does not get automatically closed (I have "Differential Revision:" in my commit 
message and believe I didn't make a typo).
Is it just me, or is this is broken after the upgrade? For committing to LLVM 
this still seems to work.

Cheers,
Sjoerd.


-Original Message-
From: llvm-dev [mailto:llvm-dev-boun...@lists.llvm.org] On Behalf Of Alex 
Bradbury via llvm-dev
Sent: 30 September 2016 15:45
To: Eric Liu
Cc: llvm-dev; Clang Dev; Eric Liu via llvm-commits; cfe-commits
Subject: Re: [llvm-dev] Upgrading phabricator

On 30 September 2016 at 14:21, Eric Liu via llvm-commits 
 wrote:
> Thanks for the feedback Aaron! :)
>
> I've disabled it. I think the annoying part really is the status (e.g.
> Request, Closed etc) in the tag, and I am wondering if a tag with just
> line numbers like "(N Loc)" would be better. But I'm not really sure
> about the trade-off here.

I'd suggest that [PATCH] is a waste of screen real estate too - the `Dn:` 
prefix makes it obvious. I do appreciate there's an argument for having it for 
consistency with people who post patches directly to llvm-commits.

Alex
___
LLVM Developers mailing list
llvm-...@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not disclose the contents to any 
other person, use it for any purpose, or store or copy the information in any 
medium. Thank you.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r283110 - This adds a separate file for the fp denormal regression tests. NFC.

2016-10-03 Thread Sjoerd Meijer via cfe-commits
Author: sjoerdmeijer
Date: Mon Oct  3 08:13:50 2016
New Revision: 283110

URL: http://llvm.org/viewvc/llvm-project?rev=283110=rev
Log:
This adds a separate file for the fp denormal regression tests. NFC.
I forgot to svn add the new file in my previous commit.


Added:
cfe/trunk/test/Driver/denormal-fp-math.c

Added: cfe/trunk/test/Driver/denormal-fp-math.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/denormal-fp-math.c?rev=283110=auto
==
--- cfe/trunk/test/Driver/denormal-fp-math.c (added)
+++ cfe/trunk/test/Driver/denormal-fp-math.c Mon Oct  3 08:13:50 2016
@@ -0,0 +1,9 @@
+// RUN: %clang -### -target arm-unknown-linux-gnu -c %s 
-fdenormal-fp-math=ieee -v 2>&1 | FileCheck -check-prefix=CHECK-IEEE %s
+// RUN: %clang -### -target arm-unknown-linux-gnu -c %s 
-fdenormal-fp-math=preserve-sign -v 2>&1 | FileCheck -check-prefix=CHECK-PS %s
+// RUN: %clang -### -target arm-unknown-linux-gnu -c %s 
-fdenormal-fp-math=positive-zero -v 2>&1 | FileCheck -check-prefix=CHECK-PZ %s
+// RUN: not %clang -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=foo 
-v 2>&1 | FileCheck -check-prefix=CHECK-INVALID %s
+
+// CHECK-IEEE: "-fdenormal-fp-math=ieee"
+// CHECK-PS: "-fdenormal-fp-math=preserve-sign"
+// CHECK-PZ: "-fdenormal-fp-math=positive-zero"
+// CHECK-INVALID: error: invalid value 'foo' in '-fdenormal-fp-math=foo'


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


r283109 - This adds a separate file for the fp denormal regression tests. NFC.

2016-10-03 Thread Sjoerd Meijer via cfe-commits
Author: sjoerdmeijer
Date: Mon Oct  3 08:12:20 2016
New Revision: 283109

URL: http://llvm.org/viewvc/llvm-project?rev=283109=rev
Log:
This adds a separate file for the fp denormal regression tests. NFC.

Differential Revision: https://reviews.llvm.org/D24907

Modified:
cfe/trunk/test/Driver/fast-math.c

Modified: cfe/trunk/test/Driver/fast-math.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/fast-math.c?rev=283109=283108=283109=diff
==
--- cfe/trunk/test/Driver/fast-math.c (original)
+++ cfe/trunk/test/Driver/fast-math.c Mon Oct  3 08:12:20 2016
@@ -234,13 +234,4 @@
 //
 // RUN: %clang -### -ftrapping-math -fno-trapping-math -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-NO-TRAPPING-MATH %s
-// RUN: %clang -### -fdenormal-fp-math=ieee -c %s 2>&1 \
-// RUN:   | FileCheck --check-prefix=CHECK-FP-DENORMAL-IEEE %s
-// RUN: %clang -### -fdenormal-fp-math=preserve-sign -c %s 2>&1 \
-// RUN:   | FileCheck --check-prefix=CHECK-FP-DENORMAL-PS %s
-// RUN: %clang -### -fdenormal-fp-math=positive-zero -c %s 2>&1 \
-// RUN:   | FileCheck --check-prefix=CHECK-FP-DENORMAL-PZ %s
 // CHECK-NO-TRAPPING-MATH: "-fno-trapping-math"
-// CHECK-FP-DENORMAL-IEEE: "-fdenormal-fp-math=ieee"
-// CHECK-FP-DENORMAL-PS: "-fdenormal-fp-math=preserve-sign"
-// CHECK-FP-DENORMAL-PZ: "-fdenormal-fp-math=positive-zero"


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


[PATCH] D24907: NFC: separate file for fp denormal regression tests

2016-10-03 Thread Sjoerd Meijer via cfe-commits
SjoerdMeijer added a comment.

Yes, excellent, I will rename it to denormal-fp-math.c and commit. Thanks for 
reviewing!


https://reviews.llvm.org/D24907



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


[PATCH] D24909: fix for not copying fp denormal and trapping options.

2016-10-03 Thread Sjoerd Meijer via cfe-commits
SjoerdMeijer added a comment.

Ping


https://reviews.llvm.org/D24909



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


[PATCH] D24909: fix for not copying fp denormal and trapping options.

2016-09-26 Thread Sjoerd Meijer via cfe-commits
SjoerdMeijer created this revision.
SjoerdMeijer added reviewers: rengolin, jmolloy, olista01.
SjoerdMeijer added a subscriber: cfe-commits.

This is a fix for not copying fp denormal and trapping options, and depends on 
the nfc cleanups in D24906 and D24907.

https://reviews.llvm.org/D24909

Files:
  lib/CodeGen/BackendUtil.cpp

Index: lib/CodeGen/BackendUtil.cpp
===
--- lib/CodeGen/BackendUtil.cpp
+++ lib/CodeGen/BackendUtil.cpp
@@ -537,6 +537,13 @@
   .Case("posix", llvm::ThreadModel::POSIX)
   .Case("single", llvm::ThreadModel::Single);
 
+  Options.FPDenormalMode =
+
llvm::StringSwitch(CodeGenOpts.FPDenormalMode)
+  .Case("ieee", llvm::FPDenormal::IEEE)
+  .Case("preserve-sign", llvm::FPDenormal::PreserveSign)
+  .Case("positive-zero", llvm::FPDenormal::PositiveZero)
+  .Default(llvm::FPDenormal::IEEE);
+
   // Set float ABI type.
   assert((CodeGenOpts.FloatABI == "soft" || CodeGenOpts.FloatABI == "softfp" ||
   CodeGenOpts.FloatABI == "hard" || CodeGenOpts.FloatABI.empty()) &&
@@ -579,6 +586,7 @@
   Options.LessPreciseFPMADOption = CodeGenOpts.LessPreciseFPMAD;
   Options.NoInfsFPMath = CodeGenOpts.NoInfsFPMath;
   Options.NoNaNsFPMath = CodeGenOpts.NoNaNsFPMath;
+  Options.NoTrappingFPMath = CodeGenOpts.NoTrappingMath;
   Options.NoZerosInBSS = CodeGenOpts.NoZeroInitializedInBSS;
   Options.UnsafeFPMath = CodeGenOpts.UnsafeFPMath;
   Options.StackAlignmentOverride = CodeGenOpts.StackAlignment;


Index: lib/CodeGen/BackendUtil.cpp
===
--- lib/CodeGen/BackendUtil.cpp
+++ lib/CodeGen/BackendUtil.cpp
@@ -537,6 +537,13 @@
   .Case("posix", llvm::ThreadModel::POSIX)
   .Case("single", llvm::ThreadModel::Single);
 
+  Options.FPDenormalMode =
+llvm::StringSwitch(CodeGenOpts.FPDenormalMode)
+  .Case("ieee", llvm::FPDenormal::IEEE)
+  .Case("preserve-sign", llvm::FPDenormal::PreserveSign)
+  .Case("positive-zero", llvm::FPDenormal::PositiveZero)
+  .Default(llvm::FPDenormal::IEEE);
+
   // Set float ABI type.
   assert((CodeGenOpts.FloatABI == "soft" || CodeGenOpts.FloatABI == "softfp" ||
   CodeGenOpts.FloatABI == "hard" || CodeGenOpts.FloatABI.empty()) &&
@@ -579,6 +586,7 @@
   Options.LessPreciseFPMADOption = CodeGenOpts.LessPreciseFPMAD;
   Options.NoInfsFPMath = CodeGenOpts.NoInfsFPMath;
   Options.NoNaNsFPMath = CodeGenOpts.NoNaNsFPMath;
+  Options.NoTrappingFPMath = CodeGenOpts.NoTrappingMath;
   Options.NoZerosInBSS = CodeGenOpts.NoZeroInitializedInBSS;
   Options.UnsafeFPMath = CodeGenOpts.UnsafeFPMath;
   Options.StackAlignmentOverride = CodeGenOpts.StackAlignment;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D24907: NFC: separate file for fp denormal regression tests

2016-09-26 Thread Sjoerd Meijer via cfe-commits
SjoerdMeijer created this revision.
SjoerdMeijer added reviewers: rengolin, jmolloy, olista01.
SjoerdMeijer added a subscriber: cfe-commits.

For clarity, this moves checks for -fdenormal-fp-math values from fast-math.c 
to a new separate file.

https://reviews.llvm.org/D24907

Files:
  test/Driver/denormalfpmode.c
  test/Driver/fast-math.c

Index: test/Driver/fast-math.c
===
--- test/Driver/fast-math.c
+++ test/Driver/fast-math.c
@@ -234,13 +234,4 @@
 //
 // RUN: %clang -### -ftrapping-math -fno-trapping-math -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-NO-TRAPPING-MATH %s
-// RUN: %clang -### -fdenormal-fp-math=ieee -c %s 2>&1 \
-// RUN:   | FileCheck --check-prefix=CHECK-FP-DENORMAL-IEEE %s
-// RUN: %clang -### -fdenormal-fp-math=preserve-sign -c %s 2>&1 \
-// RUN:   | FileCheck --check-prefix=CHECK-FP-DENORMAL-PS %s
-// RUN: %clang -### -fdenormal-fp-math=positive-zero -c %s 2>&1 \
-// RUN:   | FileCheck --check-prefix=CHECK-FP-DENORMAL-PZ %s
 // CHECK-NO-TRAPPING-MATH: "-fno-trapping-math"
-// CHECK-FP-DENORMAL-IEEE: "-fdenormal-fp-math=ieee"
-// CHECK-FP-DENORMAL-PS: "-fdenormal-fp-math=preserve-sign"
-// CHECK-FP-DENORMAL-PZ: "-fdenormal-fp-math=positive-zero"
Index: test/Driver/denormalfpmode.c
===
--- /dev/null
+++ test/Driver/denormalfpmode.c
@@ -0,0 +1,9 @@
+// RUN: %clang -### -target arm-unknown-linux-gnu -c %s 
-fdenormal-fp-math=ieee -v 2>&1 | FileCheck -check-prefix=CHECK-IEEE %s
+// RUN: %clang -### -target arm-unknown-linux-gnu -c %s 
-fdenormal-fp-math=preserve-sign -v 2>&1 | FileCheck -check-prefix=CHECK-PS %s
+// RUN: %clang -### -target arm-unknown-linux-gnu -c %s 
-fdenormal-fp-math=positive-zero -v 2>&1 | FileCheck -check-prefix=CHECK-PZ %s
+// RUN: not %clang -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=foo 
-v 2>&1 | FileCheck -check-prefix=CHECK-INVALID %s
+
+// CHECK-IEEE: "-fdenormal-fp-math=ieee"
+// CHECK-PS: "-fdenormal-fp-math=preserve-sign"
+// CHECK-PZ: "-fdenormal-fp-math=positive-zero"
+// CHECK-INVALID: error: invalid value 'foo' in '-fdenormal-fp-math=foo'


Index: test/Driver/fast-math.c
===
--- test/Driver/fast-math.c
+++ test/Driver/fast-math.c
@@ -234,13 +234,4 @@
 //
 // RUN: %clang -### -ftrapping-math -fno-trapping-math -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-NO-TRAPPING-MATH %s
-// RUN: %clang -### -fdenormal-fp-math=ieee -c %s 2>&1 \
-// RUN:   | FileCheck --check-prefix=CHECK-FP-DENORMAL-IEEE %s
-// RUN: %clang -### -fdenormal-fp-math=preserve-sign -c %s 2>&1 \
-// RUN:   | FileCheck --check-prefix=CHECK-FP-DENORMAL-PS %s
-// RUN: %clang -### -fdenormal-fp-math=positive-zero -c %s 2>&1 \
-// RUN:   | FileCheck --check-prefix=CHECK-FP-DENORMAL-PZ %s
 // CHECK-NO-TRAPPING-MATH: "-fno-trapping-math"
-// CHECK-FP-DENORMAL-IEEE: "-fdenormal-fp-math=ieee"
-// CHECK-FP-DENORMAL-PS: "-fdenormal-fp-math=preserve-sign"
-// CHECK-FP-DENORMAL-PZ: "-fdenormal-fp-math=positive-zero"
Index: test/Driver/denormalfpmode.c
===
--- /dev/null
+++ test/Driver/denormalfpmode.c
@@ -0,0 +1,9 @@
+// RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=ieee -v 2>&1 | FileCheck -check-prefix=CHECK-IEEE %s
+// RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=preserve-sign -v 2>&1 | FileCheck -check-prefix=CHECK-PS %s
+// RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=positive-zero -v 2>&1 | FileCheck -check-prefix=CHECK-PZ %s
+// RUN: not %clang -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=foo -v 2>&1 | FileCheck -check-prefix=CHECK-INVALID %s
+
+// CHECK-IEEE: "-fdenormal-fp-math=ieee"
+// CHECK-PS: "-fdenormal-fp-math=preserve-sign"
+// CHECK-PZ: "-fdenormal-fp-math=positive-zero"
+// CHECK-INVALID: error: invalid value 'foo' in '-fdenormal-fp-math=foo'
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


RE: r282255 - Fix for r280064 that added options for fp denormals and exceptions.

2016-09-23 Thread Sjoerd Meijer via cfe-commits
Nothing was breaking, but it wasn't working either (because those options were 
not copied).
I've reverted the patch directly after the first buildbot failure.

I don't think I am committing at will:  I thought it was okay to commit 
directly because it is a simple fix (or should be) for my own  previous 
half-working patch, but I don't mind going through phab.

I am indeed suspecting it is missing default case (probably got confused 
because e.g. ThreadModel also doesn't have one, at least not there).

Cheers,
Sjoerd.

-Original Message-
From: Renato Golin [mailto:renato.go...@linaro.org]
Sent: 23 September 2016 17:00
To: Sjoerd Meijer
Cc: Clang Commits
Subject: Re: r282255 - Fix for r280064 that added options for fp denormals and 
exceptions.

On 23 September 2016 at 16:21, Sjoerd Meijer via cfe-commits 
<cfe-commits@lists.llvm.org> wrote:
> Author: sjoerdmeijer
> Date: Fri Sep 23 10:21:33 2016
> New Revision: 282255
>
> URL: http://llvm.org/viewvc/llvm-project?rev=282255=rev
> Log:
> Fix for r280064 that added options for fp denormals and exceptions.
> These options were forgotten to be copied in setCommandLineOpts.

This broke:

http://lab.llvm.org:8011/builders/clang-cmake-aarch64-42vma/builds/12164


> +  Options.FPDenormalType =
> +
> llvm::StringSwitch(CodeGenOpts.FPDenormalMode)
> +  .Case("ieee", llvm::FPDenormal::IEEE)
> +  .Case("preserve-sign", llvm::FPDenormal::PreserveSign)
> +  .Case("positive-zero", llvm::FPDenormal::PositiveZero);

No Default case?



> +  Options.NoTrappingFPMath = CodeGenOpts.NoTrappingMath;

This is not the same as the one above. Are you sure this patch is correct?

Has this been reviewed at all?

Please, don't commit patches at will when nothing is breaking, and put the 
patch for review next time.

thanks,
--renato

IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not disclose the contents to any 
other person, use it for any purpose, or store or copy the information in any 
medium. Thank you.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r282257 - Revert of r282255 because of "Fell off the end of a string-switch" buildbot

2016-09-23 Thread Sjoerd Meijer via cfe-commits
Author: sjoerdmeijer
Date: Fri Sep 23 10:37:17 2016
New Revision: 282257

URL: http://llvm.org/viewvc/llvm-project?rev=282257=rev
Log:
Revert of r282255 because of "Fell off the end of a string-switch" buildbot
failures.

Modified:
cfe/trunk/lib/CodeGen/BackendUtil.cpp

Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=282257=282256=282257=diff
==
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original)
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Fri Sep 23 10:37:17 2016
@@ -537,12 +537,6 @@ void EmitAssemblyHelper::CreateTargetMac
   .Case("posix", llvm::ThreadModel::POSIX)
   .Case("single", llvm::ThreadModel::Single);
 
-  Options.FPDenormalType =
-
llvm::StringSwitch(CodeGenOpts.FPDenormalMode)
-  .Case("ieee", llvm::FPDenormal::IEEE)
-  .Case("preserve-sign", llvm::FPDenormal::PreserveSign)
-  .Case("positive-zero", llvm::FPDenormal::PositiveZero);
-
   // Set float ABI type.
   assert((CodeGenOpts.FloatABI == "soft" || CodeGenOpts.FloatABI == "softfp" ||
   CodeGenOpts.FloatABI == "hard" || CodeGenOpts.FloatABI.empty()) &&
@@ -585,7 +579,6 @@ void EmitAssemblyHelper::CreateTargetMac
   Options.LessPreciseFPMADOption = CodeGenOpts.LessPreciseFPMAD;
   Options.NoInfsFPMath = CodeGenOpts.NoInfsFPMath;
   Options.NoNaNsFPMath = CodeGenOpts.NoNaNsFPMath;
-  Options.NoTrappingFPMath = CodeGenOpts.NoTrappingMath;
   Options.NoZerosInBSS = CodeGenOpts.NoZeroInitializedInBSS;
   Options.UnsafeFPMath = CodeGenOpts.UnsafeFPMath;
   Options.StackAlignmentOverride = CodeGenOpts.StackAlignment;


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


r282255 - Fix for r280064 that added options for fp denormals and exceptions.

2016-09-23 Thread Sjoerd Meijer via cfe-commits
Author: sjoerdmeijer
Date: Fri Sep 23 10:21:33 2016
New Revision: 282255

URL: http://llvm.org/viewvc/llvm-project?rev=282255=rev
Log:
Fix for r280064 that added options for fp denormals and exceptions.
These options were forgotten to be copied in setCommandLineOpts.

Modified:
cfe/trunk/lib/CodeGen/BackendUtil.cpp

Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=282255=282254=282255=diff
==
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original)
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Fri Sep 23 10:21:33 2016
@@ -537,6 +537,12 @@ void EmitAssemblyHelper::CreateTargetMac
   .Case("posix", llvm::ThreadModel::POSIX)
   .Case("single", llvm::ThreadModel::Single);
 
+  Options.FPDenormalType =
+
llvm::StringSwitch(CodeGenOpts.FPDenormalMode)
+  .Case("ieee", llvm::FPDenormal::IEEE)
+  .Case("preserve-sign", llvm::FPDenormal::PreserveSign)
+  .Case("positive-zero", llvm::FPDenormal::PositiveZero);
+
   // Set float ABI type.
   assert((CodeGenOpts.FloatABI == "soft" || CodeGenOpts.FloatABI == "softfp" ||
   CodeGenOpts.FloatABI == "hard" || CodeGenOpts.FloatABI.empty()) &&
@@ -579,6 +585,7 @@ void EmitAssemblyHelper::CreateTargetMac
   Options.LessPreciseFPMADOption = CodeGenOpts.LessPreciseFPMAD;
   Options.NoInfsFPMath = CodeGenOpts.NoInfsFPMath;
   Options.NoNaNsFPMath = CodeGenOpts.NoNaNsFPMath;
+  Options.NoTrappingFPMath = CodeGenOpts.NoTrappingMath;
   Options.NoZerosInBSS = CodeGenOpts.NoZeroInitializedInBSS;
   Options.UnsafeFPMath = CodeGenOpts.UnsafeFPMath;
   Options.StackAlignmentOverride = CodeGenOpts.StackAlignment;


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


r280227 - Revision r280064 adds new options -fdenormal-fp-math and passes through option

2016-08-31 Thread Sjoerd Meijer via cfe-commits
Author: sjoerdmeijer
Date: Wed Aug 31 07:31:03 2016
New Revision: 280227

URL: http://llvm.org/viewvc/llvm-project?rev=280227=rev
Log:
Revision r280064 adds new options -fdenormal-fp-math and passes through option
-ffast-math to CC1, but it included a wrong llvm regression tests which was
removed in r280065.  Although regression test noexceptionsfpmath.c makes sure
-fno-trapping-math ends up as a function attribute, this adds a test that
explicitly checks the driver output for -fno-trapping-math.

Modified:
cfe/trunk/test/Driver/fast-math.c

Modified: cfe/trunk/test/Driver/fast-math.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/fast-math.c?rev=280227=280226=280227=diff
==
--- cfe/trunk/test/Driver/fast-math.c (original)
+++ cfe/trunk/test/Driver/fast-math.c Wed Aug 31 07:31:03 2016
@@ -232,12 +232,15 @@
 // CHECK-NO-UNSAFE-MATH-NOT: "-menable-unsafe-fp-math"
 // CHECK-NO-UNSAFE-MATH: "-o"
 //
+// RUN: %clang -### -ftrapping-math -fno-trapping-math -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-NO-TRAPPING-MATH %s
 // RUN: %clang -### -fdenormal-fp-math=ieee -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-FP-DENORMAL-IEEE %s
 // RUN: %clang -### -fdenormal-fp-math=preserve-sign -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-FP-DENORMAL-PS %s
 // RUN: %clang -### -fdenormal-fp-math=positive-zero -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-FP-DENORMAL-PZ %s
+// CHECK-NO-TRAPPING-MATH: "-fno-trapping-math"
 // CHECK-FP-DENORMAL-IEEE: "-fdenormal-fp-math=ieee"
 // CHECK-FP-DENORMAL-PS: "-fdenormal-fp-math=preserve-sign"
 // CHECK-FP-DENORMAL-PZ: "-fdenormal-fp-math=positive-zero"


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


RE: r280065 - Fix for commit 280064 that break the build.

2016-08-31 Thread Sjoerd Meijer via cfe-commits
Hi,

I uploaded the incorrect patch, it shouldn't have included the 
-fexceptions-fp-math because we decided to use trapping-math and therefore I 
removed these test lines in the quick fix.

Regression test test/CodeGen/noexceptionsfpmath.c makes sure -fno-trapping-math 
ends up as a function attribute, and I relied on that. Flag -fno-trapping-math 
is used a lot in test/Driver/fast-math.c, but you are right that there is no 
test that test that explicitly test the output for this. I will add a test case 
for that.

Thanks,

Sjoerd.


-Original Message-
From: Renato Golin [mailto:renato.go...@linaro.org]
Sent: 31 August 2016 11:10
To: Sjoerd Meijer
Cc: Clang Commits; Diana Picus; James Molloy
Subject: Re: r280065 - Fix for commit 280064 that break the build.

On 30 August 2016 at 09:56, Sjoerd Meijer via cfe-commits 
<cfe-commits@lists.llvm.org> wrote:
> Author: sjoerdmeijer
> Date: Tue Aug 30 03:56:00 2016
> New Revision: 280065
>
> URL: http://llvm.org/viewvc/llvm-project?rev=280065=rev
> Log:
> Fix for commit 280064 that break the build.

Any more info on this? Is this being worked to replace the deleted tests?

cheers,
-renato

IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not disclose the contents to any 
other person, use it for any purpose, or store or copy the information in any 
medium. Thank you.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r280065 - Fix for commit 280064 that break the build.

2016-08-30 Thread Sjoerd Meijer via cfe-commits
Author: sjoerdmeijer
Date: Tue Aug 30 03:56:00 2016
New Revision: 280065

URL: http://llvm.org/viewvc/llvm-project?rev=280065=rev
Log:
Fix for commit 280064 that break the build.

Modified:
cfe/trunk/test/Driver/fast-math.c

Modified: cfe/trunk/test/Driver/fast-math.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/fast-math.c?rev=280065=280064=280065=diff
==
--- cfe/trunk/test/Driver/fast-math.c (original)
+++ cfe/trunk/test/Driver/fast-math.c Tue Aug 30 03:56:00 2016
@@ -232,13 +232,6 @@
 // CHECK-NO-UNSAFE-MATH-NOT: "-menable-unsafe-fp-math"
 // CHECK-NO-UNSAFE-MATH: "-o"
 //
-// RUN: %clang -### -fexceptions-fp-math -fno-exceptions-fp-math -c %s 2>&1 \
-// RUN:   | FileCheck --check-prefix=CHECK-NO-FP-EXCEPTIONS %s
-// RUN: %clang -### -fno-exceptions-fp-math -fexceptions-fp-math -c %s 2>&1 \
-// RUN:   | FileCheck --check-prefix=CHECK-FP-EXCEPTIONS %s
-// CHECK-NO-FP-EXCEPTIONS: "-fno-exceptions-fp-math"
-// CHECK-FP-EXCEPTIONS-NOT: "-fno-exceptions-fp-math"
-//
 // RUN: %clang -### -fdenormal-fp-math=ieee -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-FP-DENORMAL-IEEE %s
 // RUN: %clang -### -fdenormal-fp-math=preserve-sign -c %s 2>&1 \


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


Re: [PATCH] D23840: New options -fexceptions-fp-math and -fdenormal-fp-math

2016-08-30 Thread Sjoerd Meijer via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL280064: This adds new options -fdenormal-fp-math and passes 
through option -ffast-math (authored by SjoerdMeijer).

Changed prior to commit:
  https://reviews.llvm.org/D23840?vs=69379=69647#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D23840

Files:
  cfe/trunk/docs/UsersManual.rst
  cfe/trunk/include/clang/Driver/Options.td
  cfe/trunk/include/clang/Frontend/CodeGenOptions.def
  cfe/trunk/include/clang/Frontend/CodeGenOptions.h
  cfe/trunk/lib/CodeGen/CGCall.cpp
  cfe/trunk/lib/Driver/Tools.cpp
  cfe/trunk/lib/Frontend/CompilerInvocation.cpp
  cfe/trunk/test/CodeGen/denormalfpmode.c
  cfe/trunk/test/CodeGen/noexceptionsfpmath.c
  cfe/trunk/test/Driver/fast-math.c

Index: cfe/trunk/docs/UsersManual.rst
===
--- cfe/trunk/docs/UsersManual.rst
+++ cfe/trunk/docs/UsersManual.rst
@@ -1075,6 +1075,15 @@
  ``Inf``, and
* ``+0`` and ``-0`` are interchangeable.
 
+.. option:: -fdenormal-fp-math=[values]
+
+   Select which denormal numbers the code is permitted to require.
+
+   Valid values are: ``ieee``, ``preserve-sign``, and ``positive-zero``,
+   which correspond to IEEE 754 denormal numbers, the sign of a
+   flushed-to-zero number is preserved in the sign of 0, denormals are
+   flushed to positive zero, respectively.
+
 .. option:: -fwhole-program-vtables
 
Enable whole-program vtable optimizations, such as single-implementation
Index: cfe/trunk/include/clang/Driver/Options.td
===
--- cfe/trunk/include/clang/Driver/Options.td
+++ cfe/trunk/include/clang/Driver/Options.td
@@ -626,6 +626,7 @@
 def : Flag<["-"], "fextended-identifiers">, Group;
 def : Flag<["-"], "fno-extended-identifiers">, Group, Flags<[Unsupported]>;
 def fhosted : Flag<["-"], "fhosted">, Group;
+def fdenormal_fp_math_EQ : Joined<["-"], "fdenormal-fp-math=">, Group, Flags<[CC1Option]>;
 def ffast_math : Flag<["-"], "ffast-math">, Group, Flags<[CC1Option]>,
   HelpText<"Allow aggressive, lossy floating-point optimizations">;
 def fno_fast_math : Flag<["-"], "fno-fast-math">, Group;
@@ -740,8 +741,8 @@
 // This option was originally misspelt "infinites" [sic].
 def : Flag<["-"], "fhonor-infinites">, Alias;
 def : Flag<["-"], "fno-honor-infinites">, Alias;
-def ftrapping_math : Flag<["-"], "ftrapping-math">, Group;
-def fno_trapping_math : Flag<["-"], "fno-trapping-math">, Group;
+def ftrapping_math : Flag<["-"], "ftrapping-math">, Group, Flags<[CC1Option]>;
+def fno_trapping_math : Flag<["-"], "fno-trapping-math">, Group, Flags<[CC1Option]>;
 def ffp_contract : Joined<["-"], "ffp-contract=">, Group,
   Flags<[CC1Option]>, HelpText<"Form fused FP ops (e.g. FMAs): fast (everywhere)"
   " | on (according to FP_CONTRACT pragma, default) | off (never fuse)">;
Index: cfe/trunk/include/clang/Frontend/CodeGenOptions.def
===
--- cfe/trunk/include/clang/Frontend/CodeGenOptions.def
+++ cfe/trunk/include/clang/Frontend/CodeGenOptions.def
@@ -107,6 +107,7 @@
 CODEGENOPT(NoInfsFPMath  , 1, 0) ///< Assume FP arguments, results not +-Inf.
 CODEGENOPT(NoSignedZeros , 1, 0) ///< Allow ignoring the signedness of FP zero
 CODEGENOPT(ReciprocalMath, 1, 0) ///< Allow FP divisions to be reassociated.
+CODEGENOPT(NoTrappingMath, 1, 0) ///< Set when -fno-trapping-math is enabled.
 CODEGENOPT(NoInline  , 1, 0) ///< Set when -fno-inline is enabled.
  ///< Disables use of the inline keyword.
 CODEGENOPT(NoNaNsFPMath  , 1, 0) ///< Assume FP arguments, results not NaN.
Index: cfe/trunk/include/clang/Frontend/CodeGenOptions.h
===
--- cfe/trunk/include/clang/Frontend/CodeGenOptions.h
+++ cfe/trunk/include/clang/Frontend/CodeGenOptions.h
@@ -121,6 +121,9 @@
   /// The ABI to use for passing floating point arguments.
   std::string FloatABI;
 
+  /// The floating-point denormal mode to use.
+  std::string FPDenormalMode;
+
   /// The float precision limit to use, if non-empty.
   std::string LimitFloatPrecision;
 
Index: cfe/trunk/test/CodeGen/denormalfpmode.c
===
--- cfe/trunk/test/CodeGen/denormalfpmode.c
+++ cfe/trunk/test/CodeGen/denormalfpmode.c
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -S -fdenormal-fp-math=ieee %s -emit-llvm -o - | FileCheck %s --check-prefix=CHECK-IEEE
+// RUN: %clang_cc1 -S -fdenormal-fp-math=preserve-sign %s -emit-llvm -o - | FileCheck %s --check-prefix=CHECK-PS
+// RUN: %clang_cc1 -S -fdenormal-fp-math=positive-zero %s -emit-llvm -o - | FileCheck %s --check-prefix=CHECK-PZ
+
+// CHECK-LABEL: main
+// CHECK-IEEE: attributes #0 = {{.*}}"denormal-fp-math"="ieee"{{.*}}
+// CHECK-PS: attributes #0 = {{.*}}"denormal-fp-math"="preserve-sign"{{.*}}
+// CHECK-PZ: attributes 

r280064 - This adds new options -fdenormal-fp-math and passes through option -ffast-math

2016-08-30 Thread Sjoerd Meijer via cfe-commits
Author: sjoerdmeijer
Date: Tue Aug 30 03:09:45 2016
New Revision: 280064

URL: http://llvm.org/viewvc/llvm-project?rev=280064=rev
Log:
This adds new options -fdenormal-fp-math and passes through option -ffast-math
to CC1, which are translated to function attributes and can e.g. be mapped on
build attributes FP_exceptions and FP_denormal. Setting these build attributes
allows better selection of floating point libraries.

Differential Revision: https://reviews.llvm.org/D23840

Added:
cfe/trunk/test/CodeGen/denormalfpmode.c
cfe/trunk/test/CodeGen/noexceptionsfpmath.c
Modified:
cfe/trunk/docs/UsersManual.rst
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/include/clang/Frontend/CodeGenOptions.def
cfe/trunk/include/clang/Frontend/CodeGenOptions.h
cfe/trunk/lib/CodeGen/CGCall.cpp
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/test/Driver/fast-math.c

Modified: cfe/trunk/docs/UsersManual.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/UsersManual.rst?rev=280064=280063=280064=diff
==
--- cfe/trunk/docs/UsersManual.rst (original)
+++ cfe/trunk/docs/UsersManual.rst Tue Aug 30 03:09:45 2016
@@ -1075,6 +1075,15 @@ are listed below.
  ``Inf``, and
* ``+0`` and ``-0`` are interchangeable.
 
+.. option:: -fdenormal-fp-math=[values]
+
+   Select which denormal numbers the code is permitted to require.
+
+   Valid values are: ``ieee``, ``preserve-sign``, and ``positive-zero``,
+   which correspond to IEEE 754 denormal numbers, the sign of a
+   flushed-to-zero number is preserved in the sign of 0, denormals are
+   flushed to positive zero, respectively.
+
 .. option:: -fwhole-program-vtables
 
Enable whole-program vtable optimizations, such as single-implementation

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=280064=280063=280064=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Tue Aug 30 03:09:45 2016
@@ -626,6 +626,7 @@ def : Flag<["-"], "fno-defer-pop">, Grou
 def : Flag<["-"], "fextended-identifiers">, Group;
 def : Flag<["-"], "fno-extended-identifiers">, Group, 
Flags<[Unsupported]>;
 def fhosted : Flag<["-"], "fhosted">, Group;
+def fdenormal_fp_math_EQ : Joined<["-"], "fdenormal-fp-math=">, 
Group, Flags<[CC1Option]>;
 def ffast_math : Flag<["-"], "ffast-math">, Group, Flags<[CC1Option]>,
   HelpText<"Allow aggressive, lossy floating-point optimizations">;
 def fno_fast_math : Flag<["-"], "fno-fast-math">, Group;
@@ -740,8 +741,8 @@ def fno_honor_infinities : Flag<["-"], "
 // This option was originally misspelt "infinites" [sic].
 def : Flag<["-"], "fhonor-infinites">, Alias;
 def : Flag<["-"], "fno-honor-infinites">, Alias;
-def ftrapping_math : Flag<["-"], "ftrapping-math">, Group;
-def fno_trapping_math : Flag<["-"], "fno-trapping-math">, Group;
+def ftrapping_math : Flag<["-"], "ftrapping-math">, Group, 
Flags<[CC1Option]>;
+def fno_trapping_math : Flag<["-"], "fno-trapping-math">, Group, 
Flags<[CC1Option]>;
 def ffp_contract : Joined<["-"], "ffp-contract=">, Group,
   Flags<[CC1Option]>, HelpText<"Form fused FP ops (e.g. FMAs): fast 
(everywhere)"
   " | on (according to FP_CONTRACT pragma, default) | off (never fuse)">;

Modified: cfe/trunk/include/clang/Frontend/CodeGenOptions.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CodeGenOptions.def?rev=280064=280063=280064=diff
==
--- cfe/trunk/include/clang/Frontend/CodeGenOptions.def (original)
+++ cfe/trunk/include/clang/Frontend/CodeGenOptions.def Tue Aug 30 03:09:45 2016
@@ -107,6 +107,7 @@ CODEGENOPT(NoImplicitFloat   , 1, 0) ///
 CODEGENOPT(NoInfsFPMath  , 1, 0) ///< Assume FP arguments, results not 
+-Inf.
 CODEGENOPT(NoSignedZeros , 1, 0) ///< Allow ignoring the signedness of FP 
zero
 CODEGENOPT(ReciprocalMath, 1, 0) ///< Allow FP divisions to be 
reassociated.
+CODEGENOPT(NoTrappingMath, 1, 0) ///< Set when -fno-trapping-math is 
enabled.
 CODEGENOPT(NoInline  , 1, 0) ///< Set when -fno-inline is enabled.
  ///< Disables use of the inline keyword.
 CODEGENOPT(NoNaNsFPMath  , 1, 0) ///< Assume FP arguments, results not NaN.

Modified: cfe/trunk/include/clang/Frontend/CodeGenOptions.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CodeGenOptions.h?rev=280064=280063=280064=diff
==
--- cfe/trunk/include/clang/Frontend/CodeGenOptions.h (original)
+++ cfe/trunk/include/clang/Frontend/CodeGenOptions.h Tue Aug 30 03:09:45 2016
@@ -121,6 +121,9 @@ public:
   /// The ABI to use 

Re: [PATCH] D23840: New options -fexceptions-fp-math and -fdenormal-fp-math

2016-08-26 Thread Sjoerd Meijer via cfe-commits
SjoerdMeijer updated this revision to Diff 69379.
SjoerdMeijer added a comment.

Sorry, forgot to add the doc patch, but it has been included now.

This will be used in llvm to emit and appropriately set build attributes 
ABI_FP_denormal and ABI_FP_exceptions. I am now trying to get a llvm patch 
ready for that (not uploaded yet, but it will mainly affect only 
ARMAsmPrinter.cpp and perhaps TargetOptions to query buildattributes).


https://reviews.llvm.org/D23840

Files:
  docs/UsersManual.rst
  include/clang/Driver/Options.td
  include/clang/Frontend/CodeGenOptions.def
  include/clang/Frontend/CodeGenOptions.h
  lib/CodeGen/CGCall.cpp
  lib/Driver/Tools.cpp
  lib/Frontend/CompilerInvocation.cpp
  test/CodeGen/denormalfpmode.c
  test/CodeGen/noexceptionsfpmath.c
  test/Driver/fast-math.c

Index: test/Driver/fast-math.c
===
--- test/Driver/fast-math.c
+++ test/Driver/fast-math.c
@@ -231,3 +231,20 @@
 // CHECK-NO-UNSAFE-MATH: "-cc1"
 // CHECK-NO-UNSAFE-MATH-NOT: "-menable-unsafe-fp-math"
 // CHECK-NO-UNSAFE-MATH: "-o"
+//
+// RUN: %clang -### -fexceptions-fp-math -fno-exceptions-fp-math -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-NO-FP-EXCEPTIONS %s
+// RUN: %clang -### -fno-exceptions-fp-math -fexceptions-fp-math -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-FP-EXCEPTIONS %s
+// CHECK-NO-FP-EXCEPTIONS: "-fno-exceptions-fp-math"
+// CHECK-FP-EXCEPTIONS-NOT: "-fno-exceptions-fp-math"
+//
+// RUN: %clang -### -fdenormal-fp-math=ieee -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-FP-DENORMAL-IEEE %s
+// RUN: %clang -### -fdenormal-fp-math=preserve-sign -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-FP-DENORMAL-PS %s
+// RUN: %clang -### -fdenormal-fp-math=positive-zero -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-FP-DENORMAL-PZ %s
+// CHECK-FP-DENORMAL-IEEE: "-fdenormal-fp-math=ieee"
+// CHECK-FP-DENORMAL-PS: "-fdenormal-fp-math=preserve-sign"
+// CHECK-FP-DENORMAL-PZ: "-fdenormal-fp-math=positive-zero"
Index: test/CodeGen/noexceptionsfpmath.c
===
--- /dev/null
+++ test/CodeGen/noexceptionsfpmath.c
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -S -fno-trapping-math %s -emit-llvm -o - | FileCheck %s
+
+// CHECK-LABEL: main
+// CHECK: attributes #0 = {{.*}}"no-trapping-math"="true"{{.*}}
+
+int main() {
+  return 0;
+}
Index: test/CodeGen/denormalfpmode.c
===
--- /dev/null
+++ test/CodeGen/denormalfpmode.c
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -S -fdenormal-fp-math=ieee %s -emit-llvm -o - | FileCheck %s --check-prefix=CHECK-IEEE
+// RUN: %clang_cc1 -S -fdenormal-fp-math=preserve-sign %s -emit-llvm -o - | FileCheck %s --check-prefix=CHECK-PS
+// RUN: %clang_cc1 -S -fdenormal-fp-math=positive-zero %s -emit-llvm -o - | FileCheck %s --check-prefix=CHECK-PZ
+
+// CHECK-LABEL: main
+// CHECK-IEEE: attributes #0 = {{.*}}"denormal-fp-math"="ieee"{{.*}}
+// CHECK-PS: attributes #0 = {{.*}}"denormal-fp-math"="preserve-sign"{{.*}}
+// CHECK-PZ: attributes #0 = {{.*}}"denormal-fp-math"="positive-zero"{{.*}}
+
+int main() {
+  return 0;
+}
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -575,6 +575,7 @@
   Opts.CorrectlyRoundedDivSqrt =
   Args.hasArg(OPT_cl_fp32_correctly_rounded_divide_sqrt);
   Opts.ReciprocalMath = Args.hasArg(OPT_freciprocal_math);
+  Opts.NoTrappingMath = Args.hasArg(OPT_fno_trapping_math);
   Opts.NoZeroInitializedInBSS = Args.hasArg(OPT_mno_zero_initialized_in_bss);
   Opts.BackendOptions = Args.getAllArgValues(OPT_backend_option);
   Opts.NumRegisterParameters = getLastArgIntValue(Args, OPT_mregparm, 0, Diags);
@@ -791,6 +792,18 @@
   Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args) << Val;
   }
 
+  if (Arg *A = Args.getLastArg(OPT_fdenormal_fp_math_EQ)) {
+StringRef Val = A->getValue();
+if (Val == "ieee")
+  Opts.FPDenormalMode = "ieee";
+else if (Val == "preserve-sign")
+  Opts.FPDenormalMode = "preserve-sign";
+else if (Val == "positive-zero")
+  Opts.FPDenormalMode = "positive-zero";
+else
+  Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args) << Val;
+  }
+
   if (Arg *A = Args.getLastArg(OPT_fpcc_struct_return, OPT_freg_struct_return)) {
 if (A->getOption().matches(OPT_fpcc_struct_return)) {
   Opts.setStructReturnConvention(CodeGenOptions::SRCK_OnStack);
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -4362,6 +4362,12 @@
   if (ReciprocalMath)
 CmdArgs.push_back("-freciprocal-math");
 
+  if (!TrappingMath) 
+CmdArgs.push_back("-fno-trapping-math");
+
+  if (Args.hasArg(options::OPT_fdenormal_fp_math_EQ))
+

Re: [PATCH] D23840: New options -fexceptions-fp-math and -fdenormal-fp-math

2016-08-26 Thread Sjoerd Meijer via cfe-commits
SjoerdMeijer updated this revision to Diff 69367.
SjoerdMeijer added a comment.

Hi James,

Thanks for the review. I got rid of that new option -fexceptions-fp-math and 
now use -ftrapping-math for that which indeed was not passed through to CC1.

Cheers.


https://reviews.llvm.org/D23840

Files:
  include/clang/Driver/Options.td
  include/clang/Frontend/CodeGenOptions.def
  include/clang/Frontend/CodeGenOptions.h
  lib/CodeGen/CGCall.cpp
  lib/Driver/Tools.cpp
  lib/Frontend/CompilerInvocation.cpp
  test/CodeGen/denormalfpmode.c
  test/CodeGen/noexceptionsfpmath.c
  test/Driver/fast-math.c

Index: test/Driver/fast-math.c
===
--- test/Driver/fast-math.c
+++ test/Driver/fast-math.c
@@ -231,3 +231,20 @@
 // CHECK-NO-UNSAFE-MATH: "-cc1"
 // CHECK-NO-UNSAFE-MATH-NOT: "-menable-unsafe-fp-math"
 // CHECK-NO-UNSAFE-MATH: "-o"
+//
+// RUN: %clang -### -fexceptions-fp-math -fno-exceptions-fp-math -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-NO-FP-EXCEPTIONS %s
+// RUN: %clang -### -fno-exceptions-fp-math -fexceptions-fp-math -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-FP-EXCEPTIONS %s
+// CHECK-NO-FP-EXCEPTIONS: "-fno-exceptions-fp-math"
+// CHECK-FP-EXCEPTIONS-NOT: "-fno-exceptions-fp-math"
+//
+// RUN: %clang -### -fdenormal-fp-math=ieee -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-FP-DENORMAL-IEEE %s
+// RUN: %clang -### -fdenormal-fp-math=preserve-sign -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-FP-DENORMAL-PS %s
+// RUN: %clang -### -fdenormal-fp-math=positive-zero -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-FP-DENORMAL-PZ %s
+// CHECK-FP-DENORMAL-IEEE: "-fdenormal-fp-math=ieee"
+// CHECK-FP-DENORMAL-PS: "-fdenormal-fp-math=preserve-sign"
+// CHECK-FP-DENORMAL-PZ: "-fdenormal-fp-math=positive-zero"
Index: test/CodeGen/noexceptionsfpmath.c
===
--- /dev/null
+++ test/CodeGen/noexceptionsfpmath.c
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -S -fno-trapping-math %s -emit-llvm -o - | FileCheck %s
+
+// CHECK-LABEL: main
+// CHECK: attributes #0 = {{.*}}"no-trapping-math"="true"{{.*}}
+
+int main() {
+  return 0;
+}
Index: test/CodeGen/denormalfpmode.c
===
--- /dev/null
+++ test/CodeGen/denormalfpmode.c
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -S -fdenormal-fp-math=ieee %s -emit-llvm -o - | FileCheck %s --check-prefix=CHECK-IEEE
+// RUN: %clang_cc1 -S -fdenormal-fp-math=preserve-sign %s -emit-llvm -o - | FileCheck %s --check-prefix=CHECK-PS
+// RUN: %clang_cc1 -S -fdenormal-fp-math=positive-zero %s -emit-llvm -o - | FileCheck %s --check-prefix=CHECK-PZ
+
+// CHECK-LABEL: main
+// CHECK-IEEE: attributes #0 = {{.*}}"denormal-fp-math"="ieee"{{.*}}
+// CHECK-PS: attributes #0 = {{.*}}"denormal-fp-math"="preserve-sign"{{.*}}
+// CHECK-PZ: attributes #0 = {{.*}}"denormal-fp-math"="positive-zero"{{.*}}
+
+int main() {
+  return 0;
+}
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -575,6 +575,7 @@
   Opts.CorrectlyRoundedDivSqrt =
   Args.hasArg(OPT_cl_fp32_correctly_rounded_divide_sqrt);
   Opts.ReciprocalMath = Args.hasArg(OPT_freciprocal_math);
+  Opts.NoTrappingMath = Args.hasArg(OPT_fno_trapping_math);
   Opts.NoZeroInitializedInBSS = Args.hasArg(OPT_mno_zero_initialized_in_bss);
   Opts.BackendOptions = Args.getAllArgValues(OPT_backend_option);
   Opts.NumRegisterParameters = getLastArgIntValue(Args, OPT_mregparm, 0, Diags);
@@ -791,6 +792,18 @@
   Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args) << Val;
   }
 
+  if (Arg *A = Args.getLastArg(OPT_fdenormal_fp_math_EQ)) {
+StringRef Val = A->getValue();
+if (Val == "ieee")
+  Opts.FPDenormalMode = "ieee";
+else if (Val == "preserve-sign")
+  Opts.FPDenormalMode = "preserve-sign";
+else if (Val == "positive-zero")
+  Opts.FPDenormalMode = "positive-zero";
+else
+  Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args) << Val;
+  }
+
   if (Arg *A = Args.getLastArg(OPT_fpcc_struct_return, OPT_freg_struct_return)) {
 if (A->getOption().matches(OPT_fpcc_struct_return)) {
   Opts.setStructReturnConvention(CodeGenOptions::SRCK_OnStack);
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -4362,6 +4362,12 @@
   if (ReciprocalMath)
 CmdArgs.push_back("-freciprocal-math");
 
+  if (!TrappingMath) 
+CmdArgs.push_back("-fno-trapping-math");
+
+  if (Args.hasArg(options::OPT_fdenormal_fp_math_EQ))
+Args.AddLastArg(CmdArgs, options::OPT_fdenormal_fp_math_EQ);
+
   // Validate and pass through -fp-contract option.
   if (Arg *A = Args.getLastArg(options::OPT_ffast_math, FastMathAliasOption,

[PATCH] D23840: New options -fexceptions-fp-math and -fdenormal-fp-math

2016-08-24 Thread Sjoerd Meijer via cfe-commits
SjoerdMeijer created this revision.
SjoerdMeijer added reviewers: jmolloy, ddunbar, rengolin, sanjoy.
SjoerdMeijer added a subscriber: cfe-commits.

This adds options -fexceptions-fp-math and -fdenormal-fp-math, which are 
translated to function attributes. This is intended to be mapped on build 
attributes FP_exceptions and FP_denormal. Setting these build attributes allows 
better selection of floating point libraries.


https://reviews.llvm.org/D23840

Files:
  include/clang/Driver/Options.td
  include/clang/Frontend/CodeGenOptions.def
  include/clang/Frontend/CodeGenOptions.h
  lib/CodeGen/CGCall.cpp
  lib/Driver/Tools.cpp
  lib/Frontend/CompilerInvocation.cpp
  test/CodeGen/denormalfpmode.c
  test/CodeGen/noexceptionsfpmath.c
  test/Driver/fast-math.c

Index: test/Driver/fast-math.c
===
--- test/Driver/fast-math.c
+++ test/Driver/fast-math.c
@@ -231,3 +231,20 @@
 // CHECK-NO-UNSAFE-MATH: "-cc1"
 // CHECK-NO-UNSAFE-MATH-NOT: "-menable-unsafe-fp-math"
 // CHECK-NO-UNSAFE-MATH: "-o"
+//
+// RUN: %clang -### -fexceptions-fp-math -fno-exceptions-fp-math -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-NO-FP-EXCEPTIONS %s
+// RUN: %clang -### -fno-exceptions-fp-math -fexceptions-fp-math -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-FP-EXCEPTIONS %s
+// CHECK-NO-FP-EXCEPTIONS: "-fno-exceptions-fp-math"
+// CHECK-FP-EXCEPTIONS-NOT: "-fno-exceptions-fp-math"
+//
+// RUN: %clang -### -fdenormal-fp-math=ieee -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-FP-DENORMAL-IEEE %s
+// RUN: %clang -### -fdenormal-fp-math=preserve-sign -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-FP-DENORMAL-PS %s
+// RUN: %clang -### -fdenormal-fp-math=positive-zero -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-FP-DENORMAL-PZ %s
+// CHECK-FP-DENORMAL-IEEE: "-fdenormal-fp-math=ieee"
+// CHECK-FP-DENORMAL-PS: "-fdenormal-fp-math=preserve-sign"
+// CHECK-FP-DENORMAL-PZ: "-fdenormal-fp-math=positive-zero"
Index: test/CodeGen/noexceptionsfpmath.c
===
--- /dev/null
+++ test/CodeGen/noexceptionsfpmath.c
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -S -fno-exceptions-fp-math %s -emit-llvm -o - | FileCheck %s
+
+// CHECK-LABEL: main
+// CHECK: attributes #0 = {{.*}}"no-exceptions-fp-math"="true"{{.*}}
+
+int main() {
+  return 0;
+}
Index: test/CodeGen/denormalfpmode.c
===
--- /dev/null
+++ test/CodeGen/denormalfpmode.c
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -S -fdenormal-fp-math=ieee %s -emit-llvm -o - | FileCheck %s --check-prefix=CHECK-IEEE
+// RUN: %clang_cc1 -S -fdenormal-fp-math=preserve-sign %s -emit-llvm -o - | FileCheck %s --check-prefix=CHECK-PS
+// RUN: %clang_cc1 -S -fdenormal-fp-math=positive-zero %s -emit-llvm -o - | FileCheck %s --check-prefix=CHECK-PZ
+
+// CHECK-LABEL: main
+// CHECK-IEEE: attributes #0 = {{.*}}"denormal-fp-math"="ieee"{{.*}}
+// CHECK-PS: attributes #0 = {{.*}}"denormal-fp-math"="preserve-sign"{{.*}}
+// CHECK-PZ: attributes #0 = {{.*}}"denormal-fp-math"="positive-zero"{{.*}}
+
+int main() {
+  return 0;
+}
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -575,6 +575,7 @@
   Opts.CorrectlyRoundedDivSqrt =
   Args.hasArg(OPT_cl_fp32_correctly_rounded_divide_sqrt);
   Opts.ReciprocalMath = Args.hasArg(OPT_freciprocal_math);
+  Opts.NoExceptionsFPMath = Args.hasArg(OPT_fno_exceptions_fp_math);
   Opts.NoZeroInitializedInBSS = Args.hasArg(OPT_mno_zero_initialized_in_bss);
   Opts.BackendOptions = Args.getAllArgValues(OPT_backend_option);
   Opts.NumRegisterParameters = getLastArgIntValue(Args, OPT_mregparm, 0, Diags);
@@ -791,6 +792,18 @@
   Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args) << Val;
   }
 
+  if (Arg *A = Args.getLastArg(OPT_fdenormal_fp_math_EQ)) {
+StringRef Val = A->getValue();
+if (Val == "ieee")
+  Opts.FPDenormalMode = "ieee";
+else if (Val == "preserve-sign")
+  Opts.FPDenormalMode = "preserve-sign";
+else if (Val == "positive-zero")
+  Opts.FPDenormalMode = "positive-zero";
+else
+  Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args) << Val;
+  }
+
   if (Arg *A = Args.getLastArg(OPT_fpcc_struct_return, OPT_freg_struct_return)) {
 if (A->getOption().matches(OPT_fpcc_struct_return)) {
   Opts.setStructReturnConvention(CodeGenOptions::SRCK_OnStack);
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -4362,6 +4362,15 @@
   if (ReciprocalMath)
 CmdArgs.push_back("-freciprocal-math");
 
+  if (Args.hasArg(options::OPT_fdenormal_fp_math_EQ))
+Args.AddLastArg(CmdArgs, options::OPT_fdenormal_fp_math_EQ);
+
+  if (Arg * A = 

Re: [PATCH] D20283: Add ras/noras flag to enable/disable RAS in clang

2016-06-03 Thread Sjoerd Meijer via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL271672: RAS extensions are part of ARMv8.2. (authored by 
SjoerdMeijer).

Changed prior to commit:
  http://reviews.llvm.org/D20283?vs=57451=59551#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20283

Files:
  cfe/trunk/lib/Driver/Tools.cpp
  cfe/trunk/test/Driver/aarch64-ras.c
  cfe/trunk/test/Driver/arm-ras.c

Index: cfe/trunk/test/Driver/arm-ras.c
===
--- cfe/trunk/test/Driver/arm-ras.c
+++ cfe/trunk/test/Driver/arm-ras.c
@@ -0,0 +1,7 @@
+// RUN: %clang -target arm-none-none-eabi -march=armv8a+ras -### -c %s 2>&1 | 
FileCheck --check-prefix=CHECK-RAS %s
+// RUN: %clang -target arm-none-none-eabi -mcpu=generic+ras -### -c %s 2>&1 | 
FileCheck --check-prefix=CHECK-RAS %s
+// CHECK-RAS: "-target-feature" "+ras"
+
+// RUN: %clang -target arm-none-none-eabi -march=armv8a+noras -### -c %s 2>&1 
| FileCheck --check-prefix=CHECK-NORAS %s
+// RUN: %clang -target arm-none-none-eabi -mcpu=generic+noras -### -c %s 2>&1 
| FileCheck --check-prefix=CHECK-NORAS %s
+// CHECK-NORAS: "-target-feature" "-ras"
Index: cfe/trunk/test/Driver/aarch64-ras.c
===
--- cfe/trunk/test/Driver/aarch64-ras.c
+++ cfe/trunk/test/Driver/aarch64-ras.c
@@ -0,0 +1,7 @@
+// RUN: %clang -target aarch64-none-none-eabi -march=armv8a+ras -### -c %s 
2>&1 | FileCheck --check-prefix=CHECK-RAS %s
+// RUN: %clang -target aarch64-none-none-eabi -mcpu=generic+ras -### -c %s 
2>&1 | FileCheck --check-prefix=CHECK-RAS %s
+// CHECK-RAS: "-target-feature" "+ras"
+
+// RUN: %clang -target aarch64-none-none-eabi -march=armv8a+noras -### -c %s 
2>&1 | FileCheck --check-prefix=CHECK-NORAS %s
+// RUN: %clang -target aarch64-none-none-eabi -mcpu=generic+noras -### -c %s 
2>&1 | FileCheck --check-prefix=CHECK-NORAS %s
+// CHECK-NORAS: "-target-feature" "-ras"
Index: cfe/trunk/lib/Driver/Tools.cpp
===
--- cfe/trunk/lib/Driver/Tools.cpp
+++ cfe/trunk/lib/Driver/Tools.cpp
@@ -2282,12 +2282,14 @@
  .Case("crypto", "+crypto")
  .Case("fp16", "+fullfp16")
  .Case("profile", "+spe")
+ .Case("ras", "+ras")
  .Case("nofp", "-fp-armv8")
  .Case("nosimd", "-neon")
  .Case("nocrc", "-crc")
  .Case("nocrypto", "-crypto")
  .Case("nofp16", "-fullfp16")
  .Case("noprofile", "-spe")
+ .Case("noras", "-ras")
  .Default(nullptr);
 if (result)
   Features.push_back(result);


Index: cfe/trunk/test/Driver/arm-ras.c
===
--- cfe/trunk/test/Driver/arm-ras.c
+++ cfe/trunk/test/Driver/arm-ras.c
@@ -0,0 +1,7 @@
+// RUN: %clang -target arm-none-none-eabi -march=armv8a+ras -### -c %s 2>&1 | FileCheck --check-prefix=CHECK-RAS %s
+// RUN: %clang -target arm-none-none-eabi -mcpu=generic+ras -### -c %s 2>&1 | FileCheck --check-prefix=CHECK-RAS %s
+// CHECK-RAS: "-target-feature" "+ras"
+
+// RUN: %clang -target arm-none-none-eabi -march=armv8a+noras -### -c %s 2>&1 | FileCheck --check-prefix=CHECK-NORAS %s
+// RUN: %clang -target arm-none-none-eabi -mcpu=generic+noras -### -c %s 2>&1 | FileCheck --check-prefix=CHECK-NORAS %s
+// CHECK-NORAS: "-target-feature" "-ras"
Index: cfe/trunk/test/Driver/aarch64-ras.c
===
--- cfe/trunk/test/Driver/aarch64-ras.c
+++ cfe/trunk/test/Driver/aarch64-ras.c
@@ -0,0 +1,7 @@
+// RUN: %clang -target aarch64-none-none-eabi -march=armv8a+ras -### -c %s 2>&1 | FileCheck --check-prefix=CHECK-RAS %s
+// RUN: %clang -target aarch64-none-none-eabi -mcpu=generic+ras -### -c %s 2>&1 | FileCheck --check-prefix=CHECK-RAS %s
+// CHECK-RAS: "-target-feature" "+ras"
+
+// RUN: %clang -target aarch64-none-none-eabi -march=armv8a+noras -### -c %s 2>&1 | FileCheck --check-prefix=CHECK-NORAS %s
+// RUN: %clang -target aarch64-none-none-eabi -mcpu=generic+noras -### -c %s 2>&1 | FileCheck --check-prefix=CHECK-NORAS %s
+// CHECK-NORAS: "-target-feature" "-ras"
Index: cfe/trunk/lib/Driver/Tools.cpp
===
--- cfe/trunk/lib/Driver/Tools.cpp
+++ cfe/trunk/lib/Driver/Tools.cpp
@@ -2282,12 +2282,14 @@
  .Case("crypto", "+crypto")
  .Case("fp16", "+fullfp16")
  .Case("profile", "+spe")
+ .Case("ras", "+ras")
  .Case("nofp", "-fp-armv8")
  .Case("nosimd", "-neon")
  .Case("nocrc", "-crc")
 

r271672 - RAS extensions are part of ARMv8.2.

2016-06-03 Thread Sjoerd Meijer via cfe-commits
Author: sjoerdmeijer
Date: Fri Jun  3 09:08:20 2016
New Revision: 271672

URL: http://llvm.org/viewvc/llvm-project?rev=271672=rev
Log:
RAS extensions are part of ARMv8.2.

This patch enables +ras +noras to AArch64 in clang.

Patch by: Roger Ferrer Ibanez and Oliver Stannard

Differential Revision: http://reviews.llvm.org/D20283

Added:
cfe/trunk/test/Driver/aarch64-ras.c
cfe/trunk/test/Driver/arm-ras.c
Modified:
cfe/trunk/lib/Driver/Tools.cpp

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=271672=271671=271672=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Fri Jun  3 09:08:20 2016
@@ -2282,12 +2282,14 @@ static bool DecodeAArch64Features(const
  .Case("crypto", "+crypto")
  .Case("fp16", "+fullfp16")
  .Case("profile", "+spe")
+ .Case("ras", "+ras")
  .Case("nofp", "-fp-armv8")
  .Case("nosimd", "-neon")
  .Case("nocrc", "-crc")
  .Case("nocrypto", "-crypto")
  .Case("nofp16", "-fullfp16")
  .Case("noprofile", "-spe")
+ .Case("noras", "-ras")
  .Default(nullptr);
 if (result)
   Features.push_back(result);

Added: cfe/trunk/test/Driver/aarch64-ras.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/aarch64-ras.c?rev=271672=auto
==
--- cfe/trunk/test/Driver/aarch64-ras.c (added)
+++ cfe/trunk/test/Driver/aarch64-ras.c Fri Jun  3 09:08:20 2016
@@ -0,0 +1,7 @@
+// RUN: %clang -target aarch64-none-none-eabi -march=armv8a+ras -### -c %s 
2>&1 | FileCheck --check-prefix=CHECK-RAS %s
+// RUN: %clang -target aarch64-none-none-eabi -mcpu=generic+ras -### -c %s 
2>&1 | FileCheck --check-prefix=CHECK-RAS %s
+// CHECK-RAS: "-target-feature" "+ras"
+
+// RUN: %clang -target aarch64-none-none-eabi -march=armv8a+noras -### -c %s 
2>&1 | FileCheck --check-prefix=CHECK-NORAS %s
+// RUN: %clang -target aarch64-none-none-eabi -mcpu=generic+noras -### -c %s 
2>&1 | FileCheck --check-prefix=CHECK-NORAS %s
+// CHECK-NORAS: "-target-feature" "-ras"

Added: cfe/trunk/test/Driver/arm-ras.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/arm-ras.c?rev=271672=auto
==
--- cfe/trunk/test/Driver/arm-ras.c (added)
+++ cfe/trunk/test/Driver/arm-ras.c Fri Jun  3 09:08:20 2016
@@ -0,0 +1,7 @@
+// RUN: %clang -target arm-none-none-eabi -march=armv8a+ras -### -c %s 2>&1 | 
FileCheck --check-prefix=CHECK-RAS %s
+// RUN: %clang -target arm-none-none-eabi -mcpu=generic+ras -### -c %s 2>&1 | 
FileCheck --check-prefix=CHECK-RAS %s
+// CHECK-RAS: "-target-feature" "+ras"
+
+// RUN: %clang -target arm-none-none-eabi -march=armv8a+noras -### -c %s 2>&1 
| FileCheck --check-prefix=CHECK-NORAS %s
+// RUN: %clang -target arm-none-none-eabi -mcpu=generic+noras -### -c %s 2>&1 
| FileCheck --check-prefix=CHECK-NORAS %s
+// CHECK-NORAS: "-target-feature" "-ras"


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


r271636 - Add a few missing Clang regression tests for Cortex-A53, Cortex-A57, Cortex-A72

2016-06-03 Thread Sjoerd Meijer via cfe-commits
Author: sjoerdmeijer
Date: Fri Jun  3 03:47:56 2016
New Revision: 271636

URL: http://llvm.org/viewvc/llvm-project?rev=271636=rev
Log:
Add a few missing Clang regression tests for Cortex-A53, Cortex-A57, Cortex-A72

Differential Revision: http://reviews.llvm.org/D20908

Modified:
cfe/trunk/test/Preprocessor/arm-target-features.c

Modified: cfe/trunk/test/Preprocessor/arm-target-features.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/arm-target-features.c?rev=271636=271635=271636=diff
==
--- cfe/trunk/test/Preprocessor/arm-target-features.c (original)
+++ cfe/trunk/test/Preprocessor/arm-target-features.c Fri Jun  3 03:47:56 2016
@@ -301,8 +301,14 @@
 // Test whether predefines are as expected when targeting ARMv8-A Cortex 
implementations
 // RUN: %clang -target armv8 -mcpu=cortex-a32 -x c -E -dM %s -o - | FileCheck 
-match-full-lines --check-prefix=ARMV8 %s
 // RUN: %clang -target armv8 -mthumb -mcpu=cortex-a32 -x c -E -dM %s -o - | 
FileCheck -match-full-lines --check-prefix=ARMV8 %s
+// RUN: %clang -target armv8 -mcpu=cortex-a35 -x c -E -dM %s -o - | FileCheck 
-match-full-lines --check-prefix=ARMV8 %s
+// RUN: %clang -target armv8 -mthumb -mcpu=cortex-a35 -x c -E -dM %s -o - | 
FileCheck -match-full-lines --check-prefix=ARMV8 %s
 // RUN: %clang -target armv8 -mcpu=cortex-a53 -x c -E -dM %s -o - | FileCheck 
-match-full-lines --check-prefix=ARMV8 %s
 // RUN: %clang -target armv8 -mthumb -mcpu=cortex-a53 -x c -E -dM %s -o - | 
FileCheck -match-full-lines --check-prefix=ARMV8 %s
+// RUN: %clang -target armv8 -mcpu=cortex-a57 -x c -E -dM %s -o - | FileCheck 
-match-full-lines --check-prefix=ARMV8 %s
+// RUN: %clang -target armv8 -mthumb -mcpu=cortex-a57 -x c -E -dM %s -o - | 
FileCheck -match-full-lines --check-prefix=ARMV8 %s
+// RUN: %clang -target armv8 -mcpu=cortex-a72 -x c -E -dM %s -o - | FileCheck 
-match-full-lines --check-prefix=ARMV8 %s
+// RUN: %clang -target armv8 -mthumb -mcpu=cortex-a72 -x c -E -dM %s -o - | 
FileCheck -match-full-lines --check-prefix=ARMV8 %s
 // RUN: %clang -target armv8 -mcpu=cortex-a73 -x c -E -dM %s -o - | FileCheck 
-match-full-lines --check-prefix=ARMV8 %s
 // RUN: %clang -target armv8 -mthumb -mcpu=cortex-a73 -x c -E -dM %s -o - | 
FileCheck -match-full-lines --check-prefix=ARMV8 %s
 // ARMV8:#define __ARM_ARCH_EXT_IDIV__ 1


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


Re: [PATCH] D20908: Add a few missing Clang regression tests

2016-06-03 Thread Sjoerd Meijer via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL271636: Add a few missing Clang regression tests for 
Cortex-A53, Cortex-A57, Cortex-A72 (authored by SjoerdMeijer).

Changed prior to commit:
  http://reviews.llvm.org/D20908?vs=59371=59500#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20908

Files:
  cfe/trunk/test/Preprocessor/arm-target-features.c

Index: cfe/trunk/test/Preprocessor/arm-target-features.c
===
--- cfe/trunk/test/Preprocessor/arm-target-features.c
+++ cfe/trunk/test/Preprocessor/arm-target-features.c
@@ -301,8 +301,14 @@
 // Test whether predefines are as expected when targeting ARMv8-A Cortex 
implementations
 // RUN: %clang -target armv8 -mcpu=cortex-a32 -x c -E -dM %s -o - | FileCheck 
-match-full-lines --check-prefix=ARMV8 %s
 // RUN: %clang -target armv8 -mthumb -mcpu=cortex-a32 -x c -E -dM %s -o - | 
FileCheck -match-full-lines --check-prefix=ARMV8 %s
+// RUN: %clang -target armv8 -mcpu=cortex-a35 -x c -E -dM %s -o - | FileCheck 
-match-full-lines --check-prefix=ARMV8 %s
+// RUN: %clang -target armv8 -mthumb -mcpu=cortex-a35 -x c -E -dM %s -o - | 
FileCheck -match-full-lines --check-prefix=ARMV8 %s
 // RUN: %clang -target armv8 -mcpu=cortex-a53 -x c -E -dM %s -o - | FileCheck 
-match-full-lines --check-prefix=ARMV8 %s
 // RUN: %clang -target armv8 -mthumb -mcpu=cortex-a53 -x c -E -dM %s -o - | 
FileCheck -match-full-lines --check-prefix=ARMV8 %s
+// RUN: %clang -target armv8 -mcpu=cortex-a57 -x c -E -dM %s -o - | FileCheck 
-match-full-lines --check-prefix=ARMV8 %s
+// RUN: %clang -target armv8 -mthumb -mcpu=cortex-a57 -x c -E -dM %s -o - | 
FileCheck -match-full-lines --check-prefix=ARMV8 %s
+// RUN: %clang -target armv8 -mcpu=cortex-a72 -x c -E -dM %s -o - | FileCheck 
-match-full-lines --check-prefix=ARMV8 %s
+// RUN: %clang -target armv8 -mthumb -mcpu=cortex-a72 -x c -E -dM %s -o - | 
FileCheck -match-full-lines --check-prefix=ARMV8 %s
 // RUN: %clang -target armv8 -mcpu=cortex-a73 -x c -E -dM %s -o - | FileCheck 
-match-full-lines --check-prefix=ARMV8 %s
 // RUN: %clang -target armv8 -mthumb -mcpu=cortex-a73 -x c -E -dM %s -o - | 
FileCheck -match-full-lines --check-prefix=ARMV8 %s
 // ARMV8:#define __ARM_ARCH_EXT_IDIV__ 1


Index: cfe/trunk/test/Preprocessor/arm-target-features.c
===
--- cfe/trunk/test/Preprocessor/arm-target-features.c
+++ cfe/trunk/test/Preprocessor/arm-target-features.c
@@ -301,8 +301,14 @@
 // Test whether predefines are as expected when targeting ARMv8-A Cortex implementations
 // RUN: %clang -target armv8 -mcpu=cortex-a32 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
 // RUN: %clang -target armv8 -mthumb -mcpu=cortex-a32 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
+// RUN: %clang -target armv8 -mcpu=cortex-a35 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
+// RUN: %clang -target armv8 -mthumb -mcpu=cortex-a35 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
 // RUN: %clang -target armv8 -mcpu=cortex-a53 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
 // RUN: %clang -target armv8 -mthumb -mcpu=cortex-a53 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
+// RUN: %clang -target armv8 -mcpu=cortex-a57 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
+// RUN: %clang -target armv8 -mthumb -mcpu=cortex-a57 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
+// RUN: %clang -target armv8 -mcpu=cortex-a72 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
+// RUN: %clang -target armv8 -mthumb -mcpu=cortex-a72 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
 // RUN: %clang -target armv8 -mcpu=cortex-a73 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
 // RUN: %clang -target armv8 -mthumb -mcpu=cortex-a73 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
 // ARMV8:#define __ARM_ARCH_EXT_IDIV__ 1
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D20908: Add a few missing Clang regression tests

2016-06-02 Thread Sjoerd Meijer via cfe-commits
SjoerdMeijer created this revision.
SjoerdMeijer added a reviewer: rengolin.
SjoerdMeijer added a subscriber: cfe-commits.

Add a few missing Clang regression tests for Cortex-A53, Cortex-A57, Cortex-A72

http://reviews.llvm.org/D20908

Files:
  test/Preprocessor/arm-target-features.c

Index: test/Preprocessor/arm-target-features.c
===
--- test/Preprocessor/arm-target-features.c
+++ test/Preprocessor/arm-target-features.c
@@ -301,8 +301,14 @@
 // Test whether predefines are as expected when targeting ARMv8-A Cortex 
implementations
 // RUN: %clang -target armv8 -mcpu=cortex-a32 -x c -E -dM %s -o - | FileCheck 
-match-full-lines --check-prefix=ARMV8 %s
 // RUN: %clang -target armv8 -mthumb -mcpu=cortex-a32 -x c -E -dM %s -o - | 
FileCheck -match-full-lines --check-prefix=ARMV8 %s
+// RUN: %clang -target armv8 -mcpu=cortex-a35 -x c -E -dM %s -o - | FileCheck 
-match-full-lines --check-prefix=ARMV8 %s
+// RUN: %clang -target armv8 -mthumb -mcpu=cortex-a35 -x c -E -dM %s -o - | 
FileCheck -match-full-lines --check-prefix=ARMV8 %s
 // RUN: %clang -target armv8 -mcpu=cortex-a53 -x c -E -dM %s -o - | FileCheck 
-match-full-lines --check-prefix=ARMV8 %s
 // RUN: %clang -target armv8 -mthumb -mcpu=cortex-a53 -x c -E -dM %s -o - | 
FileCheck -match-full-lines --check-prefix=ARMV8 %s
+// RUN: %clang -target armv8 -mcpu=cortex-a57 -x c -E -dM %s -o - | FileCheck 
-match-full-lines --check-prefix=ARMV8 %s
+// RUN: %clang -target armv8 -mthumb -mcpu=cortex-a57 -x c -E -dM %s -o - | 
FileCheck -match-full-lines --check-prefix=ARMV8 %s
+// RUN: %clang -target armv8 -mcpu=cortex-a72 -x c -E -dM %s -o - | FileCheck 
-match-full-lines --check-prefix=ARMV8 %s
+// RUN: %clang -target armv8 -mthumb -mcpu=cortex-a72 -x c -E -dM %s -o - | 
FileCheck -match-full-lines --check-prefix=ARMV8 %s
 // RUN: %clang -target armv8 -mcpu=cortex-a73 -x c -E -dM %s -o - | FileCheck 
-match-full-lines --check-prefix=ARMV8 %s
 // RUN: %clang -target armv8 -mthumb -mcpu=cortex-a73 -x c -E -dM %s -o - | 
FileCheck -match-full-lines --check-prefix=ARMV8 %s
 // ARMV8:#define __ARM_ARCH_EXT_IDIV__ 1


Index: test/Preprocessor/arm-target-features.c
===
--- test/Preprocessor/arm-target-features.c
+++ test/Preprocessor/arm-target-features.c
@@ -301,8 +301,14 @@
 // Test whether predefines are as expected when targeting ARMv8-A Cortex implementations
 // RUN: %clang -target armv8 -mcpu=cortex-a32 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
 // RUN: %clang -target armv8 -mthumb -mcpu=cortex-a32 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
+// RUN: %clang -target armv8 -mcpu=cortex-a35 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
+// RUN: %clang -target armv8 -mthumb -mcpu=cortex-a35 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
 // RUN: %clang -target armv8 -mcpu=cortex-a53 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
 // RUN: %clang -target armv8 -mthumb -mcpu=cortex-a53 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
+// RUN: %clang -target armv8 -mcpu=cortex-a57 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
+// RUN: %clang -target armv8 -mthumb -mcpu=cortex-a57 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
+// RUN: %clang -target armv8 -mcpu=cortex-a72 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
+// RUN: %clang -target armv8 -mthumb -mcpu=cortex-a72 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
 // RUN: %clang -target armv8 -mcpu=cortex-a73 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
 // RUN: %clang -target armv8 -mthumb -mcpu=cortex-a73 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
 // ARMV8:#define __ARM_ARCH_EXT_IDIV__ 1
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20864: Adding support for Cortex-A73

2016-06-02 Thread Sjoerd Meijer via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL271507: This adds target support and tests for Cortex-A73 
(authored by SjoerdMeijer).

Changed prior to commit:
  http://reviews.llvm.org/D20864?vs=59219=59357#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20864

Files:
  cfe/trunk/lib/Basic/Targets.cpp
  cfe/trunk/lib/Driver/Tools.cpp
  cfe/trunk/test/CodeGen/arm-target-features.c
  cfe/trunk/test/Driver/aarch64-cpus.c
  cfe/trunk/test/Driver/arm-cortex-cpus.c
  cfe/trunk/test/Preprocessor/aarch64-target-features.c
  cfe/trunk/test/Preprocessor/arm-target-features.c

Index: cfe/trunk/test/Driver/arm-cortex-cpus.c
===
--- cfe/trunk/test/Driver/arm-cortex-cpus.c
+++ cfe/trunk/test/Driver/arm-cortex-cpus.c
@@ -468,57 +468,74 @@
 // RUN: %clang -target arm -mcpu=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A %s
 // RUN: %clang -target arm -mcpu=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A %s
 // RUN: %clang -target arm -mcpu=cortex-a72 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A %s
+// RUN: %clang -target arm -mcpu=cortex-a73 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A %s
 // RUN: %clang -target arm -mcpu=exynos-m1 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A %s
 // RUN: %clang -target arm -mcpu=cortex-a32 -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A %s
 // RUN: %clang -target arm -mcpu=cortex-a35 -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A %s
 // RUN: %clang -target arm -mcpu=cortex-a53 -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A %s
 // RUN: %clang -target arm -mcpu=cortex-a57 -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A %s
 // RUN: %clang -target arm -mcpu=cortex-a72 -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A %s
+// RUN: %clang -target arm -mcpu=cortex-a73 -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A %s
 // RUN: %clang -target arm -mcpu=exynos-m1 -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A %s
 // CHECK-CPUV8A: "-cc1"{{.*}} "-triple" "armv8-{{.*}}
 
 // RUN: %clang -target armeb -mcpu=cortex-a32 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A %s
 // RUN: %clang -target armeb -mcpu=cortex-a35 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A %s
 // RUN: %clang -target armeb -mcpu=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A %s
 // RUN: %clang -target armeb -mcpu=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A %s
 // RUN: %clang -target armeb -mcpu=cortex-a72 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A %s
+// RUN: %clang -target armeb -mcpu=cortex-a73 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A %s
 // RUN: %clang -target armeb -mcpu=exynos-m1 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A %s
 // RUN: %clang -target arm -mcpu=cortex-a32 -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A %s
 // RUN: %clang -target arm -mcpu=cortex-a35 -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A %s
 // RUN: %clang -target arm -mcpu=cortex-a53 -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A %s
 // RUN: %clang -target arm -mcpu=cortex-a57 -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A %s
 // RUN: %clang -target arm -mcpu=cortex-a72 -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A %s
+// RUN: %clang -target arm -mcpu=cortex-a73 -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A %s
 // RUN: %clang -target arm -mcpu=exynos-m1 -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A %s
 // CHECK-BE-CPUV8A: "-cc1"{{.*}} "-triple" "armebv8-{{.*}}
 
 // RUN: %clang -target arm -mcpu=cortex-a32 -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A-THUMB %s
 // RUN: %clang -target arm -mcpu=cortex-a35 -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A-THUMB %s
 // RUN: %clang -target arm -mcpu=cortex-a53 -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A-THUMB %s
 // RUN: %clang -target arm -mcpu=cortex-a57 -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A-THUMB %s
 // RUN: %clang -target arm -mcpu=cortex-a72 -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A-THUMB %s
+// RUN: %clang -target arm -mcpu=cortex-a73 -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A-THUMB %s
 // RUN: %clang -target arm -mcpu=exynos-m1 -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A-THUMB %s
 // RUN: %clang -target arm -mcpu=cortex-a32 -mlittle-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A-THUMB %s
 // RUN: %clang -target arm -mcpu=cortex-a35 -mlittle-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A-THUMB %s
 // RUN: 

r271507 - This adds target support and tests for Cortex-A73

2016-06-02 Thread Sjoerd Meijer via cfe-commits
Author: sjoerdmeijer
Date: Thu Jun  2 05:48:37 2016
New Revision: 271507

URL: http://llvm.org/viewvc/llvm-project?rev=271507=rev
Log:
This adds target support and tests for Cortex-A73

Differential Revision: http://reviews.llvm.org/D20864

Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/CodeGen/arm-target-features.c
cfe/trunk/test/Driver/aarch64-cpus.c
cfe/trunk/test/Driver/arm-cortex-cpus.c
cfe/trunk/test/Preprocessor/aarch64-target-features.c
cfe/trunk/test/Preprocessor/arm-target-features.c

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=271507=271506=271507=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Thu Jun  2 05:48:37 2016
@@ -5669,6 +5669,7 @@ public:
 .Case("generic", true)
 .Cases("cortex-a53", "cortex-a57", "cortex-a72",
"cortex-a35", "exynos-m1", true)
+.Case("cortex-a73", true)
 .Case("cyclone", true)
 .Case("kryo", true)
 .Default(false);

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=271507=271506=271507=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Thu Jun  2 05:48:37 2016
@@ -2307,7 +2307,7 @@ static bool DecodeAArch64Mcpu(const Driv
   CPU = Split.first;
   if (CPU == "cortex-a53" || CPU == "cortex-a57" ||
   CPU == "cortex-a72" || CPU == "cortex-a35" || CPU == "exynos-m1" ||
-  CPU == "kryo") {
+  CPU == "kryo"   || CPU == "cortex-a73") {
 Features.push_back("+neon");
 Features.push_back("+crc");
 Features.push_back("+crypto");

Modified: cfe/trunk/test/CodeGen/arm-target-features.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/arm-target-features.c?rev=271507=271506=271507=diff
==
--- cfe/trunk/test/CodeGen/arm-target-features.c (original)
+++ cfe/trunk/test/CodeGen/arm-target-features.c Thu Jun  2 05:48:37 2016
@@ -27,6 +27,7 @@
 // RUN: %clang_cc1 -triple armv8-linux-gnueabi -target-cpu cortex-a53 
-emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-BASIC-V8
 // RUN: %clang_cc1 -triple thumbv8-linux-gnueabihf -target-cpu cortex-a57 
-emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-BASIC-V8
 // RUN: %clang_cc1 -triple thumbv8-linux-gnueabihf -target-cpu cortex-a72 
-emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-BASIC-V8
+// RUN: %clang_cc1 -triple thumbv8-linux-gnueabihf -target-cpu cortex-a73 
-emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-BASIC-V8
 // RUN: %clang_cc1 -triple thumbv8-linux-gnueabihf -target-cpu exynos-m1 
-emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-BASIC-V8
 // CHECK-BASIC-V8: 
"target-features"="+crc,+crypto,+dsp,+fp-armv8,+hwdiv,+hwdiv-arm,+neon"
 

Modified: cfe/trunk/test/Driver/aarch64-cpus.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/aarch64-cpus.c?rev=271507=271506=271507=diff
==
--- cfe/trunk/test/Driver/aarch64-cpus.c (original)
+++ cfe/trunk/test/Driver/aarch64-cpus.c Thu Jun  2 05:48:37 2016
@@ -74,6 +74,20 @@
 // RUN: %clang -target arm64 -mlittle-endian -mtune=cortex-a72 -### -c %s 2>&1 
| FileCheck -check-prefix=ARM64-CA72 %s
 // ARM64-CA72: "-cc1"{{.*}} "-triple" "arm64{{.*}}" "-target-cpu" "cortex-a72"
 
+// RUN: %clang -target aarch64 -mcpu=cortex-a73 -### -c %s 2>&1 | FileCheck 
-check-prefix=CORTEX-A73 %s
+// RUN: %clang -target aarch64 -mlittle-endian -mcpu=cortex-a73 -### -c %s 
2>&1 | FileCheck -check-prefix=CORTEX-A73 %s
+// RUN: %clang -target aarch64_be -mlittle-endian -mcpu=cortex-a73 -### -c %s 
2>&1 | FileCheck -check-prefix=CORTEX-A73 %s
+// RUN: %clang -target aarch64 -mtune=cortex-a73 -### -c %s 2>&1 | FileCheck 
-check-prefix=CORTEX-A73 %s
+// RUN: %clang -target aarch64 -mlittle-endian -mtune=cortex-a73 -### -c %s 
2>&1 | FileCheck -check-prefix=CORTEX-A73 %s
+// RUN: %clang -target aarch64_be -mlittle-endian -mtune=cortex-a73 -### -c %s 
2>&1 | FileCheck -check-prefix=CORTEX-A73 %s
+// CORTEX-A73: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" 
"cortex-a73"
+
+// RUN: %clang -target arm64 -mcpu=cortex-a73 -### -c %s 2>&1 | FileCheck 
-check-prefix=ARM64-CORTEX-A73 %s
+// RUN: %clang -target arm64 -mlittle-endian -mcpu=cortex-a73 -### -c %s 2>&1 
| FileCheck -check-prefix=ARM64-CORTEX-A73 %s
+// RUN: %clang -target arm64 -mtune=cortex-a73 -### -c %s 2>&1 | FileCheck 
-check-prefix=ARM64-CORTEX-A73 %s
+// RUN: %clang -target arm64 -mlittle-endian 

[PATCH] D20864: Adding support for Cortex-A73

2016-06-01 Thread Sjoerd Meijer via cfe-commits
SjoerdMeijer created this revision.
SjoerdMeijer added reviewers: rengolin, t.p.northover.
SjoerdMeijer added a subscriber: cfe-commits.

This adds target support and tests for Cortex-A73

http://reviews.llvm.org/D20864

Files:
  lib/Basic/Targets.cpp
  lib/Driver/Tools.cpp
  test/CodeGen/arm-target-features.c
  test/Driver/aarch64-cpus.c
  test/Driver/arm-cortex-cpus.c
  test/Preprocessor/aarch64-target-features.c
  test/Preprocessor/arm-target-features.c

Index: test/Preprocessor/arm-target-features.c
===
--- test/Preprocessor/arm-target-features.c
+++ test/Preprocessor/arm-target-features.c
@@ -303,6 +303,8 @@
 // RUN: %clang -target armv8 -mthumb -mcpu=cortex-a32 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
 // RUN: %clang -target armv8 -mcpu=cortex-a53 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
 // RUN: %clang -target armv8 -mthumb -mcpu=cortex-a53 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
+// RUN: %clang -target armv8 -mcpu=cortex-a73 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
+// RUN: %clang -target armv8 -mthumb -mcpu=cortex-a73 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARMV8 %s
 // ARMV8:#define __ARM_ARCH_EXT_IDIV__ 1
 // ARMV8:#define __ARM_FEATURE_DSP 1
 // ARMV8:#define __ARM_FP 0xE
Index: test/Preprocessor/aarch64-target-features.c
===
--- test/Preprocessor/aarch64-target-features.c
+++ test/Preprocessor/aarch64-target-features.c
@@ -92,13 +92,15 @@
 // RUN: %clang -target aarch64 -mcpu=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-MCPU-A53 %s
 // RUN: %clang -target aarch64 -mcpu=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-MCPU-A57 %s
 // RUN: %clang -target aarch64 -mcpu=cortex-a72 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-MCPU-A72 %s
+// RUN: %clang -target aarch64 -mcpu=cortex-a73 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-MCPU-CORTEX-A73 %s
 // RUN: %clang -target aarch64 -mcpu=exynos-m1 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-MCPU-M1 %s
 // RUN: %clang -target aarch64 -mcpu=kryo -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-MCPU-KRYO %s
 // CHECK-MCPU-CYCLONE: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-feature" "+neon" "-target-feature" "+crypto" "-target-feature" "+zcm" "-target-feature" "+zcz"
 // CHECK-MCPU-A35: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-feature" "+neon" "-target-feature" "+crc" "-target-feature" "+crypto"
 // CHECK-MCPU-A53: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-feature" "+neon" "-target-feature" "+crc" "-target-feature" "+crypto"
 // CHECK-MCPU-A57: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-feature" "+neon" "-target-feature" "+crc" "-target-feature" "+crypto"
 // CHECK-MCPU-A72: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-feature" "+neon" "-target-feature" "+crc" "-target-feature" "+crypto"
+// CHECK-MCPU-CORTEX-A73: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-feature" "+neon" "-target-feature" "+crc" "-target-feature" "+crypto"
 // CHECK-MCPU-M1: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-feature" "+neon" "-target-feature" "+crc" "-target-feature" "+crypto"
 // CHECK-MCPU-KRYO: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-feature" "+neon" "-target-feature" "+crc" "-target-feature" "+crypto"
 
Index: test/Driver/arm-cortex-cpus.c
===
--- test/Driver/arm-cortex-cpus.c
+++ test/Driver/arm-cortex-cpus.c
@@ -468,57 +468,74 @@
 // RUN: %clang -target arm -mcpu=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A %s
 // RUN: %clang -target arm -mcpu=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A %s
 // RUN: %clang -target arm -mcpu=cortex-a72 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A %s
+// RUN: %clang -target arm -mcpu=cortex-a73 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A %s
 // RUN: %clang -target arm -mcpu=exynos-m1 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A %s
 // RUN: %clang -target arm -mcpu=cortex-a32 -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A %s
 // RUN: %clang -target arm -mcpu=cortex-a35 -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A %s
 // RUN: %clang -target arm -mcpu=cortex-a53 -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A %s
 // RUN: %clang -target arm -mcpu=cortex-a57 -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A %s
 // RUN: %clang -target arm -mcpu=cortex-a72 -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A %s
+// RUN: %clang -target arm -mcpu=cortex-a73 -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A %s
 // RUN: %clang -target arm -mcpu=exynos-m1 -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A %s
 

RE: [PATCH] RE: [cfe-dev] missing return statement for non-void functions in C++

2015-08-24 Thread Sjoerd Meijer via cfe-commits
I've taken the latest suggestions into account, see attached patch. Could you 
have a look?
Thanks.

-Original Message-
From: scott douglass [mailto:sdougl...@arm.com] 
Sent: 18 August 2015 14:16
To: Sjoerd Meijer
Cc: 'Marshall Clow'; 'Gabriel Dos Reis'; 'Richard Smith'; 'cfe-commits'
Subject: RE: [PATCH] RE: [cfe-dev] missing return statement for non-void 
functions in C++

 Please see updated patch file attached, which now includes a 
 fixed/added regression test.

I think it's a good idea; two minor remarks:

+if (!CGM.getCodeGenOpts().OptimizeSize) {
Should this be 'else if'?  I imagine there's no use emitting a trap after the 
sanitizer has emitted a missing_return check.

In the regression test, the CHECK-OPT case is now essentially the same as the 
CHECK case, so remove ' --check-prefix=CHECK-OPT' (but leave the RUN:) and 
these lines
  // CHECK-OPT: call void @llvm.trap
  // CHECK-OPT: unreachable





0001-Always-trap-for-missing-return-statements-except-whe.patch
Description: Binary data
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


RE: [PATCH] RE: [cfe-dev] missing return statement for non-void functions in C++

2015-08-17 Thread Sjoerd Meijer via cfe-commits
Agreed, let’s get that right first.
The attached patch causes the program to trap for all optimizations levels, 
except when optimizing for size.

Sjoerd.

From: dosr...@gmail.com [mailto:dosr...@gmail.com] On Behalf Of Gabriel Dos Reis
Sent: 13 August 2015 21:51
To: Richard Smith
Cc: Sjoerd Meijer; Marshall Clow; cfe-commits
Subject: Re: [PATCH] RE: [cfe-dev] missing return statement for non-void 
functions in C++

Please make such programs crash early and often.  They are a nightmare to 
maintain.  Make them blow in the face of the original authors; not after they 
are gone.

-- Gaby


-- IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not disclose the contents to any 
other person, use it for any purpose, or store or copy the information in any 
medium. Thank you.

ARM Limited, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered 
in England  Wales, Company No: 2557590
ARM Holdings plc, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, 
Registered in England  Wales, Company No: 2548782


0001-Always-trap-for-missing-return-statements-except-whe.patch
Description: 0001-Always-trap-for-missing-return-statements-except-whe.patch
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


RE: [PATCH] RE: [cfe-dev] missing return statement for non-void functions in C++

2015-08-13 Thread Sjoerd Meijer via cfe-commits
Hi Richard,
Thanks for reviewing. Agree, that was a bit confusing. More specifically,
the warning message was confusing (i.e. wrong). This patch is for compiling .c
input in C++ mode. The new flag should be ignored for C++ *input*, and indeed
not when it is in C++ *mode* as the warning message said earlier. So I have
changed the warning message accordingly and hope that solves it, see attached
patch.
Cheers.

From: meta...@gmail.com [mailto:meta...@gmail.com] On Behalf Of Richard Smith
Sent: 12 August 2015 23:06
To: Sjoerd Meijer
Cc: Hal Finkel; Marshall Clow; cfe-commits
Subject: Re: [PATCH] RE: [cfe-dev] missing return statement for non-void 
functions in C++

This patch seems a bit confused. You warn that the flag is ignored in C++, but 
it only has an effect in C++. You have a testcase with a .c extension that is 
built with -x c++.

On Wed, Aug 12, 2015 at 5:23 AM, Sjoerd Meijer 
sjoerd.mei...@arm.commailto:sjoerd.mei...@arm.com wrote:
[ + cfe-commits@lists.llvm.orgmailto:cfe-commits@lists.llvm.org ]

Hi,
The functionality is now available under a flag, see attached patch. Note that 
the flag is ignored in C++ mode, so it will help the use case of compiling 
(legacy) C code with a C++ compiler.
Cheers,
Sjoerd.

From: Sjoerd Meijer [mailto:sjoerd.mei...@arm.com]
Sent: 03 August 2015 11:40
To: 'Richard Smith'
Cc: Hal Finkel; Marshall Clow; cfe-...@cs.uiuc.edumailto:cfe-...@cs.uiuc.edu 
Developers; cfe commits
Subject: RE: [PATCH] RE: [cfe-dev] missing return statement for non-void 
functions in C++

Hi Richard,

I agree with your conclusions and will start preparing a patch for option 3) 
under a flag that is off by default; this enables folks to build/run C code in 
C++. I actually think option 2) would be a good one too, but as it is already 
available under a flag I also don’t see how useful it is combining options 2) 
and 3) with another (or one more) flag that is off by default.

Cheers.

From: meta...@gmail.commailto:meta...@gmail.com [mailto:meta...@gmail.com] On 
Behalf Of Richard Smith
Sent: 31 July 2015 19:46
To: Sjoerd Meijer
Cc: Hal Finkel; Marshall Clow; cfe-...@cs.uiuc.edumailto:cfe-...@cs.uiuc.edu 
Developers; cfe commits
Subject: Re: [PATCH] RE: [cfe-dev] missing return statement for non-void 
functions in C++

On Fri, Jul 31, 2015 at 7:35 AM, Sjoerd Meijer 
sjoerd.mei...@arm.commailto:sjoerd.mei...@arm.com wrote:
Hi, I am not sure if we came to a conclusion. Please find attached a patch. It 
simply removes the two lines that insert an unreachable statement (which cause 
removal of the return statement). Please note that at -O0 the trap instruction 
is still generated. Is this something we could live with?

I don't think this is an improvement:

This doesn't satisfy the folks who want an 'unreachable' for better code size 
and optimization, and it doesn't satisfy the folks who want a guaranteed trap 
for security, and it doesn't satisfy the folks who want their broken code to 
limp along (because it'll still trap at -O0), and it is at best a minor 
improvement for the folks who want missing returns to be more easily debuggable 
(with -On, the code goes wrong in the caller, or appears to work, rather than 
falling into an unrelated function, and debugging this with -O0 was already 
easy).

I think there are three options that are defensible here:
1) The status quo: this is UB and we treat it as such and optimize on that 
basis, but provide a trap as a convenience at -O0
2) The secure approach: this is UB but we always trap
3) Define the behavior to return 'undef' for C types: this allows questionable 
C code that has UB in C++ to keep working when built with a C++ compiler

Note that (3) can be combined with either (1) or (2). (2) is already available 
via the 'return' sanitizer. So this really reduces to: in those cases where C 
says it's OK so long as the caller doesn't look at the returned value (and 
where the return type doesn't have a non-trivial copy constructor or 
destructor, isn't a reference, and so on), should we attempt to preserve the C 
behaviour? I would be OK with putting that behind a `-f` flag (perhaps 
`-fstrict-return` or similar) to support those folks who want to build C code 
in C++, but I would suggest having that flag be off by default, since that is 
not the usual use case for a C++ compiler.

Cheers,
Sjoerd.

From: cfe-dev-boun...@cs.uiuc.edumailto:cfe-dev-boun...@cs.uiuc.edu 
[mailto:cfe-dev-boun...@cs.uiuc.edumailto:cfe-dev-boun...@cs.uiuc.edu] On 
Behalf Of Richard Smith
Sent: 29 July 2015 18:07
To: Hal Finkel
Cc: Marshall Clow; cfe-...@cs.uiuc.edumailto:cfe-...@cs.uiuc.edu Developers

Subject: Re: [cfe-dev] missing return statement for non-void functions in C++


On Jul 29, 2015 7:43 AM, Hal Finkel hfin...@anl.govmailto:hfin...@anl.gov 
wrote:

 - Original Message -
  From: David Blaikie dblai...@gmail.commailto:dblai...@gmail.com
  To: James Molloy ja...@jamesmolloy.co.ukmailto:ja...@jamesmolloy.co.uk
  Cc: Marshall Clow