summaryrefslogtreecommitdiffstats
path: root/clang/test/OpenMP/simd_codegen.cpp
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2019-12-19 10:01:10 -0500
committerAlexey Bataev <a.bataev@hotmail.com>2019-12-23 10:04:46 -0500
commit0860db966a7d2ab61b26e41426a55189986924b4 (patch)
treed90f8ba8208077ca27a6ebc27db727c97bda583c /clang/test/OpenMP/simd_codegen.cpp
parente40ac74dacda99ff6330945f0f105252b7c28c9c (diff)
downloadbcm5719-llvm-0860db966a7d2ab61b26e41426a55189986924b4.tar.gz
bcm5719-llvm-0860db966a7d2ab61b26e41426a55189986924b4.zip
[OPENMP50]Codegen for nontemporal clause.
Summary: Basic codegen for the declarations marked as nontemporal. Also, if the base declaration in the member expression is marked as nontemporal, lvalue for member decl access inherits nonteporal flag from the base lvalue. Reviewers: rjmccall, hfinkel, jdoerfert Subscribers: guansong, arphaman, caomhin, kkwli0, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D71708
Diffstat (limited to 'clang/test/OpenMP/simd_codegen.cpp')
-rw-r--r--clang/test/OpenMP/simd_codegen.cpp59
1 files changed, 57 insertions, 2 deletions
diff --git a/clang/test/OpenMP/simd_codegen.cpp b/clang/test/OpenMP/simd_codegen.cpp
index 19ed323af42..aac76ad127d 100644
--- a/clang/test/OpenMP/simd_codegen.cpp
+++ b/clang/test/OpenMP/simd_codegen.cpp
@@ -22,10 +22,15 @@
long long get_val() { return 0; }
double *g_ptr;
+struct S {
+ int a, b;
+};
+
// CHECK-LABEL: define {{.*void}} @{{.*}}simple{{.*}}(float* {{.+}}, float* {{.+}}, float* {{.+}}, float* {{.+}})
void simple(float *a, float *b, float *c, float *d) {
+ S s, *p;
#ifdef OMP5
- #pragma omp simd if (simd: true)
+ #pragma omp simd if (simd: true) nontemporal(a, b, c, d, s)
#else
#pragma omp simd
#endif
@@ -43,8 +48,17 @@ void simple(float *a, float *b, float *c, float *d) {
// CHECK-NEXT: store i32 [[CALC_I_2]], i32* [[LC_I:.+]]{{.*}}!llvm.access.group
// ... loop body ...
// End of body: store into a[i]:
+// OMP45-NOT: load float*,{{.*}}!nontemporal
+// CHECK-NOT: load float,{{.*}}!nontemporal
+// OMP50: load float*,{{.*}}!nontemporal
+// OMP50: load float*,{{.*}}!nontemporal
+// OMP50: load float*,{{.*}}!nontemporal
+// OMP50: load i32,{{.*}}!nontemporal
+// OMP50-NOT: load i32,{{.*}}!nontemporal
+// OMP50: load float*,{{.*}}!nontemporal
+// CHECK-NOT: load float,{{.*}}!nontemporal
// CHECK: store float [[RESULT:%.+]], float* {{%.+}}{{.*}}!llvm.access.group
- a[i] = b[i] * c[i] * d[i];
+ a[i] = b[i] * c[i] * d[i] + s.a + p->a;
// CHECK: [[IV1_2:%.+]] = load i32, i32* [[OMP_IV]]{{.*}}!llvm.access.group
// CHECK-NEXT: [[ADD1_2:%.+]] = add nsw i32 [[IV1_2]], 1
// CHECK-NEXT: store i32 [[ADD1_2]], i32* [[OMP_IV]]{{.*}}!llvm.access.group
@@ -718,6 +732,47 @@ void linear(float *a) {
//
}
+#ifdef OMP5
+// OMP50-LABEL: inner_simd
+void inner_simd() {
+ double a, b;
+#pragma omp simd nontemporal(a)
+ for (int i = 0; i < 10; ++i) {
+#pragma omp simd nontemporal(b)
+ for (int k = 0; k < 10; ++k) {
+ // OMP50: load double,{{.*}}!nontemporal
+ // OMP50: store double{{.*}}!nontemporal
+ a = b;
+ }
+ // OMP50-NOT: load double,{{.*}}!nontemporal
+ // OMP50: load double,
+ // OMP50: store double{{.*}}!nontemporal
+ a = b;
+ }
+}
+
+extern struct T t;
+struct Base {
+ float a;
+};
+struct T : public Base {
+ void foo() {
+#pragma omp simd nontemporal(Base::a)
+ for (int i = 0; i < 10; ++i) {
+ // OMP50: store float{{.*}}!nontemporal
+ // OMP50-NOT: nontemporal
+ // OMP50-NEXT: store float
+ Base::a = 0;
+ t.a = 0;
+ }
+ }
+} t;
+
+void bartfoo() {
+ t.foo();
+}
+
+#endif // OMP5
// TERM_DEBUG-LABEL: bar
int bar() {return 0;};
OpenPOWER on IntegriCloud