brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.6 KiB · 08d3d2a Raw
106 lines · c
1// RUN: %clang_cc1 -triple powerpc64le-unknown-linux-gnu -emit-llvm \2// RUN:   -target-cpu pwr9 -target-feature +float128 -mabi=ieeelongdouble \3// RUN:   -o - %s | FileCheck %s -check-prefix=IEEE4// RUN: %clang_cc1 -triple powerpc64le-unknown-linux-gnu -emit-llvm \5// RUN:   -target-cpu pwr9 -target-feature +float128 \6// RUN:   -o - %s | FileCheck %s -check-prefix=IBM7 8// RUN: %clang_cc1 -triple ppc64le -emit-llvm-bc %s -target-cpu pwr9 \9// RUN:   -target-feature +float128 -mabi=ieeelongdouble -fopenmp \10// RUN:   -fopenmp-targets=ppc64le -o %t-ppc-host.bc11// RUN: %clang_cc1 -triple ppc64le -aux-triple ppc64le %s -target-cpu pwr9 \12// RUN:   -target-feature +float128 -fopenmp -fopenmp-is-target-device -emit-llvm \13// RUN:   -fopenmp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s \14// RUN:   -check-prefix=OMP-TARGET15// RUN: %clang_cc1 -triple ppc64le %t-ppc-host.bc -emit-llvm -o - | FileCheck %s \16// RUN:   -check-prefix=OMP-HOST17 18#include <stdarg.h>19 20typedef struct { long double x; } ldbl128_s;21 22void foo_ld(long double);23void foo_fq(__float128);24void foo_ls(ldbl128_s);25 26// Verify cases when OpenMP target's and host's long-double semantics differ.27 28// OMP-TARGET-LABEL: define internal void @__omp_offloading_{{.+}}_omp_{{.+}}.omp_outlined(29// OMP-TARGET: %[[CUR:[0-9a-zA-Z_.]+]] = load ptr, ptr30// OMP-TARGET: %[[V3:[0-9a-zA-Z_.]+]] = load ppc_fp128, ptr %[[CUR]], align 831// OMP-TARGET: call void @foo_ld(ppc_fp128 noundef %[[V3]])32 33// OMP-HOST-LABEL: define{{.*}} void @omp(34// OMP-HOST: call void @llvm.va_start.p0(ptr %[[AP:[0-9a-zA-Z_.]+]])35// OMP-HOST: %[[CUR:[0-9a-zA-Z_.]+]] = load ptr, ptr %[[AP]], align 836// OMP-HOST: %[[TMP0:[^ ]+]] = getelementptr inbounds i8, ptr %[[CUR]], i32 1537// OMP-HOST: %[[ALIGN:[^ ]+]] = call ptr @llvm.ptrmask.p0.i64(ptr %[[TMP0]], i64 -16)38// OMP-HOST: %[[V4:[0-9a-zA-Z_.]+]] = load fp128, ptr %[[ALIGN]], align 1639// OMP-HOST: call void @foo_ld(fp128 noundef %[[V4]])40void omp(int n, ...) {41  va_list ap;42  va_start(ap, n);43  foo_ld(va_arg(ap, long double));44  #pragma omp target parallel45  for (int i = 1; i < n; ++i) {46    foo_ld(va_arg(ap, long double));47  }48  va_end(ap);49}50 51// IEEE-LABEL: define{{.*}} void @f12852// IEEE: call void @llvm.va_start.p0(ptr %[[AP:[0-9a-zA-Z_.]+]])53// IEEE: %[[CUR:[0-9a-zA-Z_.]+]] = load ptr, ptr %[[AP]]54// IEEE: %[[TMP0:[^ ]+]] = getelementptr inbounds i8, ptr %[[CUR]], i32 1555// IEEE: %[[ALIGN:[^ ]+]] = call ptr @llvm.ptrmask.p0.i64(ptr %[[TMP0]], i64 -16)56// IEEE: %[[V4:[0-9a-zA-Z_.]+]] = load fp128, ptr %[[ALIGN]], align 1657// IEEE: call void @foo_fq(fp128 noundef %[[V4]])58// IEEE: call void @llvm.va_end.p0(ptr %[[AP]])59void f128(int n, ...) {60  va_list ap;61  va_start(ap, n);62  foo_fq(va_arg(ap, __float128));63  va_end(ap);64}65 66// IEEE-LABEL: define{{.*}} void @long_double67// IEEE: call void @llvm.va_start.p0(ptr %[[AP:[0-9a-zA-Z_.]+]])68// IEEE: %[[CUR:[0-9a-zA-Z_.]+]] = load ptr, ptr %[[AP]]69// IEEE: %[[TMP0:[^ ]+]] = getelementptr inbounds i8, ptr %[[CUR]], i32 1570// IEEE: %[[ALIGN:[^ ]+]] = call ptr @llvm.ptrmask.p0.i64(ptr %[[TMP0]], i64 -16)71// IEEE: %[[V4:[0-9a-zA-Z_.]+]] = load fp128, ptr %[[ALIGN]], align 1672// IEEE: call void @foo_ld(fp128 noundef %[[V4]])73// IEEE: call void @llvm.va_end.p0(ptr %[[AP]])74 75// IBM-LABEL: define{{.*}} void @long_double76// IBM: call void @llvm.va_start.p0(ptr  %[[AP:[0-9a-zA-Z_.]+]])77// IBM: %[[CUR:[0-9a-zA-Z_.]+]] = load ptr, ptr %[[AP]]78// IBM: %[[V4:[0-9a-zA-Z_.]+]] = load ppc_fp128, ptr %[[CUR]], align 879// IBM: call void @foo_ld(ppc_fp128 noundef %[[V4]])80// IBM: call void @llvm.va_end.p0(ptr %[[AP]])81void long_double(int n, ...) {82  va_list ap;83  va_start(ap, n);84  foo_ld(va_arg(ap, long double));85  va_end(ap);86}87 88// IEEE-LABEL: define{{.*}} void @long_double_struct89// IEEE: call void @llvm.va_start.p0(ptr %[[AP:[0-9a-zA-Z_.]+]])90// IEEE: %[[CUR:[0-9a-zA-Z_.]+]] = load ptr, ptr %[[AP]]91// IEEE: %[[TMP0:[^ ]+]] = getelementptr inbounds i8, ptr %[[CUR]], i32 1592// IEEE: %[[ALIGN:[^ ]+]] = call ptr @llvm.ptrmask.p0.i64(ptr %[[TMP0]], i64 -16)93// IEEE: %[[V0:[0-9a-zA-Z_.]+]] = getelementptr inbounds i8, ptr %[[ALIGN]], i64 1694// IEEE: store ptr %[[V0]], ptr %[[AP]], align 895// IEEE: call void @llvm.memcpy.p0.p0.i64(ptr align 16 %[[TMP:[0-9a-zA-Z_.]+]], ptr align 16 %[[ALIGN]], i64 16, i1 false)96// IEEE: %[[COERCE:[0-9a-zA-Z_.]+]] = getelementptr inbounds nuw %struct.ldbl128_s, ptr %[[TMP]], i32 0, i32 097// IEEE: %[[V4:[0-9a-zA-Z_.]+]] = load fp128, ptr %[[COERCE]], align 1698// IEEE: call void @foo_ls(fp128 inreg %[[V4]])99// IEEE: call void @llvm.va_end.p0(ptr %[[AP]])100void long_double_struct(int n, ...) {101  va_list ap;102  va_start(ap, n);103  foo_ls(va_arg(ap, ldbl128_s));104  va_end(ap);105}106