forked from OSchip/llvm-project
[OPENMP]Fix the float point semantics handling on the device.
The device should use the same float point representation as the host. Previous patch fixed the handling of the sizes of the float point types, but did not fixed the fp semantics. This patch makes target device to use the host fp semantics. this is required for the correct data transfer between host and device and correct codegen. llvm-svn: 365485
This commit is contained in:
parent
e6d10f97dd
commit
e509af3cd6
|
@ -1524,8 +1524,16 @@ const llvm::fltSemantics &ASTContext::getFloatTypeSemantics(QualType T) const {
|
|||
return Target->getHalfFormat();
|
||||
case BuiltinType::Float: return Target->getFloatFormat();
|
||||
case BuiltinType::Double: return Target->getDoubleFormat();
|
||||
case BuiltinType::LongDouble: return Target->getLongDoubleFormat();
|
||||
case BuiltinType::Float128: return Target->getFloat128Format();
|
||||
case BuiltinType::LongDouble:
|
||||
if (getLangOpts().OpenMP && getLangOpts().OpenMPIsDevice &&
|
||||
&Target->getLongDoubleFormat() != &AuxTarget->getLongDoubleFormat())
|
||||
return AuxTarget->getLongDoubleFormat();
|
||||
return Target->getLongDoubleFormat();
|
||||
case BuiltinType::Float128:
|
||||
if (getLangOpts().OpenMP && getLangOpts().OpenMPIsDevice &&
|
||||
&Target->getFloat128Format() != &AuxTarget->getFloat128Format())
|
||||
return AuxTarget->getFloat128Format();
|
||||
return Target->getFloat128Format();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// RUN: %clang_cc1 -fopenmp -x c -triple i386-unknown-unknown -fopenmp-targets=nvptx-nvidia-cuda -emit-llvm-bc %s -o %t-x86-host.bc
|
||||
// RUN: %clang_cc1 -verify -fopenmp -x c -triple nvptx-unknown-unknown -fopenmp-targets=nvptx-nvidia-cuda %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-x86-host.bc -fsyntax-only -Wuninitialized
|
||||
// RUN: %clang_cc1 -verify -DDIAGS -DIMMEDIATE -fopenmp -x c -triple nvptx-unknown-unknown -fopenmp-targets=nvptx-nvidia-cuda %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-x86-host.bc -fsyntax-only -Wuninitialized
|
||||
// RUN: %clang_cc1 -verify -DDIAGS -DDELAYED -fopenmp -x c -triple nvptx-unknown-unknown -fopenmp-targets=nvptx-nvidia-cuda %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-x86-host.bc -fsyntax-only -Wuninitialized
|
||||
// RUN: %clang_cc1 -verify -fopenmp -x c -triple nvptx-unknown-unknown -aux-triple i386-unknown-unknown -fopenmp-targets=nvptx-nvidia-cuda %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-x86-host.bc -fsyntax-only -Wuninitialized
|
||||
// RUN: %clang_cc1 -verify -DDIAGS -DIMMEDIATE -fopenmp -x c -triple nvptx-unknown-unknown -aux-triple i386-unknown-unknown -fopenmp-targets=nvptx-nvidia-cuda %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-x86-host.bc -fsyntax-only -Wuninitialized
|
||||
// RUN: %clang_cc1 -verify -DDIAGS -DDELAYED -fopenmp -x c -triple nvptx-unknown-unknown -aux-triple i386-unknown-unknown -fopenmp-targets=nvptx-nvidia-cuda %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-x86-host.bc -fsyntax-only -Wuninitialized
|
||||
// REQUIRES: x86-registered-target
|
||||
// REQUIRES: nvptx-registered-target
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
// Test target codegen - host bc file has to be created first.
|
||||
// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple x86_64-unknown-linux -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm-bc %s -o %t-host.bc
|
||||
// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple nvptx64-unknown-unknown -aux-triple x86_64-unknown-linux -fopenmp-targets=nvptx64-nvidia-cuda -aux-triple x86_64-unknown-linux -emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-host.bc -o - | FileCheck %s
|
||||
// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple nvptx64-unknown-unknown -aux-triple x86_64-unknown-linux -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-host.bc -o - | FileCheck %s
|
||||
// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple powerpc64le-unknown-linux-gnu -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm-bc %s -o %t-host.bc
|
||||
// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple nvptx64-unknown-unknown -aux-triple powerpc64le-unknown-linux-gnu -fopenmp-targets=nvptx64-nvidia-cuda -aux-triple x86_64-unknown-linux -emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-host.bc -o - | FileCheck %s
|
||||
// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple nvptx64-unknown-unknown -aux-triple powerpc64le-unknown-linux-gnu -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-host.bc -o - | FileCheck %s
|
||||
// expected-no-diagnostics
|
||||
|
||||
// CHECK-DAG: [[T:%.+]] = type {{.+}}, fp128,
|
||||
// CHECK-DAG: [[T:%.+]] = type {{.+}}, {{fp128|ppc_fp128}},
|
||||
// CHECK-DAG: [[T1:%.+]] = type {{.+}}, i128, i128,
|
||||
|
||||
#ifndef _ARCH_PPC
|
||||
|
@ -78,4 +78,4 @@ BIGTYPE foo(BIGTYPE f) {
|
|||
}
|
||||
|
||||
// CHECK: define weak void @__omp_offloading_{{.+}}foo{{.+}}_l75([[BIGTYPE:.+]]*
|
||||
// CHECK: store [[BIGTYPE]] 0xL00000000000000003FFF000000000000, [[BIGTYPE]]* %
|
||||
// CHECK: store [[BIGTYPE]] {{0xL00000000000000003FFF000000000000|0xM3FF00000000000000000000000000000}}, [[BIGTYPE]]* %
|
||||
|
|
Loading…
Reference in New Issue