Skip to content

Commit f32b8c8

Browse files
author
Shashwathi N
committed
modifications done
1 parent 2ce56c2 commit f32b8c8

File tree

3 files changed

+59
-4
lines changed

3 files changed

+59
-4
lines changed

clang/include/clang/AST/OpenMPClause.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7614,7 +7614,7 @@ class OMPToClause final : public OMPMappableExprListClause<OMPToClause>,
76147614
"Requested modifier exceeds the total number of modifiers.");
76157615
return MotionModifiers[Cnt];
76167616
}
7617-
Expr *getIteratorModifier() {
7617+
Expr *getIteratorModifier() const {
76187618
return getTrailingObjects<Expr *>()[2 * varlist_size()];
76197619
}
76207620
/// Fetches the motion-modifier location at 'Cnt' index of array of modifiers'
@@ -7819,7 +7819,7 @@ class OMPFromClause final
78197819
"Requested modifier exceeds the total number of modifiers.");
78207820
return MotionModifiers[Cnt];
78217821
}
7822-
Expr *getIteratorModifier() {
7822+
Expr *getIteratorModifier() const {
78237823
return getTrailingObjects<Expr *>()[2 * varlist_size()];
78247824
}
78257825
/// Fetches the motion-modifier location at 'Cnt' index of array of modifiers'

clang/lib/AST/OpenMPClause.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2570,9 +2570,9 @@ template <typename T> void OMPClausePrinter::VisitOMPMotionClause(T *Node) {
25702570
OS << '(';
25712571
for (unsigned I = 0; I < NumberOfOMPMotionModifiers; ++I) {
25722572
if (Node->getMotionModifier(I) != OMPC_MOTION_MODIFIER_unknown) {
2573-
if (Node->getMotionModifier(I) == OMPC_MOTION_MODIFIER_iterator)
2573+
if (Node->getMotionModifier(I) == OMPC_MOTION_MODIFIER_iterator) {
25742574
PrintIterator(OS, Node, Policy);
2575-
else {
2575+
} else {
25762576
OS << getOpenMPSimpleClauseTypeName(Node->getClauseKind(),
25772577
Node->getMotionModifier(I));
25782578
if (Node->getMotionModifier(I) == OMPC_MOTION_MODIFIER_mapper)

clang/test/OpenMP/target_update_codegen.cpp

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1560,5 +1560,60 @@ void foo(int arg) {
15601560
{ ++arg; }
15611561
}
15621562

1563+
#endif
1564+
// RUN: %clang_cc1 -DCK26 -verify -Wno-vla -fopenmp -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK26 --check-prefix CK26-64
1565+
// RUN: %clang_cc1 -DCK26 -fopenmp -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
1566+
// RUN: %clang_cc1 -fopenmp -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify -Wno-vla %s -emit-llvm -o - | FileCheck %s --check-prefix CK26 --check-prefix CK26-64
1567+
// RUN: %clang_cc1 -DCK26 -fopenmp-version=51 -verify -Wno-vla -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK26 --check-prefix CK26-32
1568+
// RUN: %clang_cc1 -DCK26 -fopenmp -fopenmp-version=51 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
1569+
// RUN: %clang_cc1 -fopenmp -fopenmp-version=51 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify -Wno-vla %s -emit-llvm -o - | FileCheck %s --check-prefix CK26 --check-prefix CK26-32
1570+
1571+
// RUN: %clang_cc1 -DCK26 -verify -Wno-vla -fopenmp-simd -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY19 %s
1572+
// RUN: %clang_cc1 -DCK26 -fopenmp-simd -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
1573+
// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify -Wno-vla %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY19 %s
1574+
// RUN: %clang_cc1 -DCK26 -verify -Wno-vla -fopenmp-simd -fopenmp-version=51 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY19 %s
1575+
// RUN: %clang_cc1 -DCK26 -fopenmp-simd -fopenmp-version=51 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
1576+
// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=51 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify -Wno-vla %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY19 %s
1577+
// SIMD-ONLY19-NOT: {{__kmpc|__tgt}}
1578+
#ifdef CK26
1579+
// CK26: [[IDENT_T:%.+]] = type { i32, i32, i32, i32, ptr }
1580+
// CK26: @[[ITER:[a-zA-Z0-9_]+]] = internal global i32 0, align 4
1581+
void foo(){
1582+
int a[10];
1583+
#pragma omp target update to(iterator(int it = 0:10) : a[it])
1584+
// CHECK: define dso_local void @_Z4testv()
1585+
// CHECK-NEXT: %[[A1:.*]] = alloca \[10 x i32\], align 16
1586+
// CHECK-NEXT: %[[A2:.*]] = alloca \[1 x ptr\], align 8
1587+
// CHECK-NEXT: %[[A3:.*]] = alloca \[1 x ptr\], align 8
1588+
// CHECK-NEXT: %[[A4:.*]] = alloca \[1 x ptr\], align 8
1589+
// CHECK-NEXT: %[[A5:.*]] = alloca \[1 x ptr\], align 8
1590+
// CHECK-NEXT: %[[A6:.*]] = alloca \[1 x ptr\], align 8
1591+
// CHECK-NEXT: %[[A7:.*]] = alloca \[1 x ptr\], align 8
1592+
// CHECK: %[[LOAD1:.*]] = load i32, ptr @_ZZ4testvE16iteratorvariable, align 4
1593+
// CHECK: %[[SEXT1:.*]] = sext i32 %[[LOAD1]] to i64
1594+
// CHECK: %[[GEP1:.*]] = getelementptr inbounds \[10 x i32\], ptr %[[A1]], i64 0, i64 %[[SEXT1]]
1595+
// CHECK: %[[GEP2:.*]] = getelementptr inbounds \[1 x ptr\], ptr %[[A2]], i32 0, i32 0
1596+
// CHECK: store ptr %[[A1]], ptr %[[GEP2]], align 8
1597+
// CHECK: %[[GEP3:.*]] = getelementptr inbounds \[1 x ptr\], ptr %[[A3]], i32 0, i32 0
1598+
// CHECK: store ptr %[[GEP1]], ptr %[[GEP3]], align 8
1599+
// CHECK: %[[GEP4:.*]] = getelementptr inbounds \[1 x ptr\], ptr %[[A4]], i64 0, i64 0
1600+
// CHECK: store ptr null, ptr %[[GEP4]], align 8
1601+
// CHECK: %[[GEP5:.*]] = getelementptr inbounds \[1 x ptr\], ptr %[[A2]], i32 0, i32 0
1602+
// CHECK: %[[GEP6:.*]] = getelementptr inbounds \[1 x ptr\], ptr %[[A3]], i32 0, i32 0
1603+
// CHECK: call void @__tgt_target_data_update_mapper(ptr @2, i64 -1, i32 1, ptr %[[GEP5]], ptr %[[GEP6]], ptr @.offload_sizes, ptr @.offload_maptypes, ptr @.offload_mapnames, ptr null)
1604+
// CHECK: %[[LOAD2:.*]] = load i32, ptr @[[ITER]], align 4
1605+
// CHECK: %[[SEXT2:.*]] = sext i32 %[[LOAD2]] to i64
1606+
// CHECK: %[[GEP7:.*]] = getelementptr inbounds \[10 x i32\], ptr %[[A1]], i64 0, i64 %[[SEXT2]]
1607+
// CHECK: %[[GEP8:.*]] = getelementptr inbounds \[1 x ptr\], ptr %[[A5]], i32 0, i32 0
1608+
// CHECK: store ptr %[[A1]], ptr %[[GEP8]], align 8
1609+
// CHECK: %[[GEP9:.*]] = getelementptr inbounds \[1 x ptr\], ptr %[[A6]], i32 0, i32 0
1610+
// CHECK: store ptr %[[GEP7]], ptr %[[GEP9]], align 8
1611+
// CHECK: %[[GEP10:.*]] = getelementptr inbounds \[1 x ptr\], ptr %[[A7]], i64 0, i64 0
1612+
// CHECK: store ptr null, ptr %[[GEP10]], align 8
1613+
// CHECK: %[[GEP11:.*]] = getelementptr inbounds \[1 x ptr\], ptr %[[A5]], i32 0, i32 0
1614+
// CHECK: %[[GEP12:.*]] = getelementptr inbounds \[1 x ptr\], ptr %[[A6]], i32 0, i32 0
1615+
// CHECK: call void @__tgt_target_data_update_mapper(ptr @4, i64 -1, i32 1, ptr %[[GEP11]], ptr %[[GEP12]], ptr @.offload_sizes.1, ptr @.offload_maptypes.2, ptr @.offload_mapnames.3, ptr null)
1616+
// CHECK: ret void
1617+
}
15631618
#endif
15641619
#endif

0 commit comments

Comments
 (0)