brintos

brintos / llvm-project-archived public Read only

0
0
Text · 8.2 KiB · e6b0e1b Raw
194 lines · cpp
1// RUN: %clang_cc1 -fopenmp -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -debug-info-kind=limited -emit-llvm %s -o - | FileCheck %s --check-prefix DEBUG2// RUN: %clang_cc1 -fopenmp -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix CHECK3#ifndef HEADER4#define HEADER5 6// DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] c";d;{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"7// DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] c";i;{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"8// DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] c";i[1:23];{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"9// DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] c";p;{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"10// DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] c";p[1:24];{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"11// DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] c";s;{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"12// DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] c";s.i;{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"13// DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] c";s.s.f;{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"14// DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] c";s.p[:22];{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"15// DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] c";s.ps->s.i;{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"16// DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] c";s.ps->ps;{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"17// DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] c";s.ps->ps->ps;{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"18// DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] c";s.ps->ps->s.f[:22];{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"19// DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] c";ps;{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"20// DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] c";ps->i;{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"21// DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] c";ps->s.f;{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"22// DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] c";ps->p[:22];{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"23// DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] c";ps->ps->s.i;{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"24// DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] c";ps->ps->ps;{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"25// DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] c";ps->ps->ps->ps;{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"26// DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] c";ps->ps->ps->s.f[:22];{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"27// DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] c";s.f[:22];{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"28// DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] c";s.p[:33];{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"29// DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] c";ps->p[:33];{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"30// DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] c";s.s;{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"31 32struct S1 {33    int i;34    float f[50];35};36 37struct S2 {38    int i;39    float f[50];40    S1 s;41    double *p;42    struct S2 *ps;43};44 45void foo() {46  double d;47  int i[100];48  float *p;49 50  S2 s;51  S2 *ps;52 53  [[omp::directive(target map(d))]]54  { }55  [[omp::directive(target map(i))]]56  { }57  [[omp::directive(target map(i[1:23]))]]58  { }59  [[omp::directive(target map(p))]]60  { }61  [[omp::directive(target map(p[1:24]))]]62  { }63  [[omp::directive(target map(s))]]64  { }65  [[omp::directive(target map(s.i))]]66  { }67  [[omp::directive(target map(s.s.f))]]68  { }69  [[omp::directive(target map(s.p))]]70  { }71  [[omp::directive(target map(to: s.p[:22]))]]72  { }73  [[omp::directive(target map(s.ps))]]74  { }75  [[omp::directive(target map(from: s.ps->s.i))]]76  { }77  [[omp::directive(target map(to: s.ps->ps))]]78  { }79  [[omp::directive(target map(s.ps->ps->ps))]]80  { }81  [[omp::directive(target map(to: s.ps->ps->s.f[:22]))]]82  { }83  [[omp::directive(target map(ps))]]84  { }85  [[omp::directive(target map(ps->i))]]86  { }87  [[omp::directive(target map(ps->s.f))]]88  { }89  [[omp::directive(target map(from: ps->p))]]90  { }91  [[omp::directive(target map(to: ps->p[:22]))]]92  { }93  [[omp::directive(target map(ps->ps))]]94  { }95  [[omp::directive(target map(from: ps->ps->s.i))]]96  { }97  [[omp::directive(target map(from: ps->ps->ps))]]98  { }99  [[omp::directive(target map(ps->ps->ps->ps))]]100  { }101  [[omp::directive(target map(to: ps->ps->ps->s.f[:22]))]]102  { }103  [[omp::directive(target map(to: s.f[:22]) map(from: s.p[:33]))]]104  { }105  [[omp::directive(target map(from: s.f[:22]) map(to: ps->p[:33]))]]106  { }107  [[omp::directive(target map(from: s.f[:22], s.s) map(to: ps->p[:33]))]]108  { }109}110 111// DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] c";B;{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"112// DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] c";unknown;unknown;0;0;;\00"113// DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] c";A;{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"114// DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] c";x;{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"115// DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] c";fn;{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"116// DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] c";s;{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"117// DEBUG: @{{.+}} = private constant [7 x ptr] [ptr @{{[0-9]+}}, ptr @{{[0-9]+}}, ptr @{{[0-9]+}}, ptr @{{[0-9]+}}, ptr @{{[0-9]+}}, ptr @{{[0-9]+}}, ptr @{{[0-9]+}}]118 119void bar(int N) {120  double B[10];121  double A[N];122  double x;123  S1 s;124  auto fn = [&x]() { return x; };125  [[omp::directive(target)]]126  {127    (void)B;128    (void)A;129    (void)fn();130    (void)s.f;131  }132}133 134// DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] c";t;{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"135 136[[omp::directive(declare target)]];137double t;138[[omp::directive(end declare target)]];139 140void baz() {141  [[omp::directive(target map(to:t))]]142  { }143  [[omp::directive(target map(to:t) nowait)]]144  { }145  [[omp::directive(target teams map(to:t))]]146  { }147  [[omp::directive(target teams map(to:t) nowait)]]148  { }149  [[omp::directive(target data map(to:t))]]150  { }151  [[omp::sequence(directive(target enter data map(to:t)),152                  directive(target enter data map(to:t) nowait),153                  directive(target exit data map(from:t)),154                  directive(target exit data map(from:t) nowait),155                  directive(target update from(t)),156                  directive(target update to(t)),157                  directive(target update from(t) nowait),158                  directive(target update to(t) nowait))]];159}160 161struct S3 {162  double Z[64];163};164 165[[omp::directive(declare mapper(id: S3 s) map(s.Z[0:64]))]]166void qux() {167  S3 s;168  [[omp::directive(target map(mapper(id), to:s))]]169  { }170}171 172// DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] c";s.Z[0:64];{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"173 174// Clang used to mistakenly generate the map name "x" for both x and y on this175// directive.  Conditions to reproduce the bug: a single map clause has two176// variables, and at least the second is used in the associated statement.177//178// DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] c";x;{{.*}}.cpp;[[@LINE+3]];7;;\00"179// DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] c";y;{{.*}}.cpp;[[@LINE+2]];10;;\00"180void secondMapNameInClause() {181  int x, y;182  [[omp::directive(target map(to: x, y))]];183  x = y = 1;184}185 186// DEBUG: store ptr @[[NAME:.offload_mapnames.[0-9]+]], ptr %[[ARG:.+]]187// CHECK-NOT: store ptr @[[NAME:.offload_mapnames.[0-9]+]], ptr %[[ARG:.+]]188 189// DEBUG: void @.omp_mapper._ZTS2S3.id(ptr {{.*}}, ptr {{.*}}, ptr {{.*}}, i64 {{.*}}, i64 {{.*}}, ptr noundef [[MAPPER_NAME:%.+]])190// DEBUG: call void @__tgt_push_mapper_component(ptr %{{.*}}, ptr %{{.*}}, ptr %{{.*}}, i64 %{{.*}}, i64 %{{.*}}, ptr [[MAPPER_NAME]])191 192#endif193 194