Files
llvm-tms34010/clang/test/OpenMP/declare_target_constexpr_codegen.cpp
Joshua Cranmer 41c214f0b1 [AsmWriter] Change the output syntax of floating-point literals. (#190649)
This makes infinities and NaNs return the new, more explicit formats
added in 8d9299cd7a
and extends the base decimal output literal to support non-double types.
In addition, the legacy hexadecimal floating-point literal format is no
longer output in any circumstance.

In general, this means that NaNs are reported as +/-qnan,
+/-nan(payload), or +/-snan(payload), depending on their payload and
infinities as +/-inf. The hexadecimal output generally changes to `f0x...`
notation, and is used when 6 decimal digits are insufficient to accurately
represent the number, or for noncanonical ppc_fp128 values.

A script to change the output for most test files is available at
https://gist.github.com/jcranmer-intel/d279296ad91884c98b77fb23a9112a5a.
Full disclosure: the python portion of the script was written with the
use of AI tools. The C++ portion was written entirely by hand, reusing
LLVM's existing helpers for output.

The test changes included in this commit are *only* those which do not
work with that script, either because the script mangled the conversion
(e.g., intentionally matching only a prefix to allow some imprecision)
or because the tests were too unusual for the script to find the
floating-point literals being compared against.
2026-05-07 13:16:14 -04:00

41 lines
1.5 KiB
C++

// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --check-globals --prefix-filecheck-ir-name _ --global-value-regex "llvm.compiler.used" "_[0-9a-zA-Z]+A[0-9a-zA-Z]+pi[0-9a-zA-Z]+" "_[0-9a-zA-Z]+anotherPi" --version 2
// REQUIRES: amdgpu-registered-target
// Test target codegen - host bc file has to be created first.
// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm-bc %s -o %t-ppc-host.bc
// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple nvptx64-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm %s -fopenmp-target-debug -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s --check-prefix=CHECK
// expected-no-diagnostics
#ifndef HEADER
#define HEADER
#pragma omp declare target
class A {
public:
static constexpr double pi = 3.141592653589793116;
//.
// CHECK: @_ZN1A2piE = linkonce_odr constant double f0x400921FB54442D18, comdat, align 8
// CHECK: @_ZL9anotherPi = internal constant double 3.140000e+00, align 8
// CHECK: @llvm.compiler.used = appending global [2 x ptr] [ptr @"__ZN1A2piE$ref", ptr @"__ZL9anotherPi$ref"], section "llvm.metadata"
//.
A() { ; }
~A() { ; }
};
#pragma omp end declare target
void F(const double &);
void Test() { F(A::pi); }
#pragma omp declare target
constexpr static double anotherPi = 3.14;
#pragma omp end declare target
#endif
//
//// NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
// CHECK: {{.*}}