Index: test/CodeGen/debug-info-static-const-fp.c =================================================================== --- test/CodeGen/debug-info-static-const-fp.c +++ test/CodeGen/debug-info-static-const-fp.c @@ -1,7 +1,23 @@ -// RUN: %clang -emit-llvm -O0 -S -g %s -o - | FileCheck %s +// RUN: %clang -emit-llvm -O0 -S -g %s -o %t +// RUN: perl <%t >%t-check-prefix -n -e \ +// RUN: 'if (/"long double".*size:\s+(\d+)/) { \ +// RUN: printf "--check-prefix CHECK-LD%%s", ($1 <= 64 ? "sm" : "lg"); \ +// RUN: last; \ +// RUN: }' +// RUN: FileCheck --check-prefix CHECK $(cat %t-check-prefix) %s <%t // Per PR26619, check that for referenced static const of floating-point type, -// we emit its constant value in debug info. NOTE that PR26619 is not yet fixed for long double. +// we emit its constant value in debug info. +// +// NOTE that __fp16 is assumed to be 16 bits, float is assumed to be +// 32 bits, and double is assumed to be 64 bits. Size of long double +// is not known (for example, it is 64 bits for hexagon-unknown--elf, +// but 128 bits for x86_64-unknown-linux-gnu) Therefore, we test for +// the absence of a constant (CHECK-LDlg) when the size exceeds 64 +// bits, and for the presence of a constant (CHECK-LDsm) but not its +// value when the size does not exceed 64 bits. +// +// NOTE that PR26619 is not yet fixed for types greater than 64 bits. static const __fp16 hVal = 29/13.0f; // 2.2307692307692307692 (2.23046875) @@ -24,8 +40,5 @@ // CHECK: !DIGlobalVariable(name: "dVal", {{.*}}, isLocal: true, isDefinition: true, expr: ![[DEXPR:[0-9]+]] // CHECK: ![[DEXPR]] = !DIExpression(DW_OP_constu, 4658387303597904457, DW_OP_stack_value) -// Temporarily removing this check -- for some targets (such as -// "--target=hexagon-unknown-elf"), long double does not exceed 64 -// bits, and so we actually do get the constant value (expr) emitted. -// -// DO-NOT-CHECK: !DIGlobalVariable(name: "ldVal", {{.*}}, isLocal: true, isDefinition: true) +// CHECK-LDlg: !DIGlobalVariable(name: "ldVal", {{.*}}, isLocal: true, isDefinition: true) +// CHECK-LDsm: !DIGlobalVariable(name: "ldVal", {{.*}}, isLocal: true, isDefinition: true, expr: