David Gross | 1118d59 | 2016-12-08 20:02:46 +0000 | [diff] [blame^] | 1 | // RUN: %clang -emit-llvm -O0 -S -g %s -o - | FileCheck %s |
| 2 | |
| 3 | // Per PR26619, check that for referenced static const of floating-point type, |
| 4 | // we emit its constant value in debug info. NOTE that PR26619 is not yet fixed for long double. |
| 5 | |
| 6 | static const __fp16 hVal = 29/13.0f; // 2.2307692307692307692 (2.23046875) |
| 7 | |
| 8 | static const float fVal = -147/17.0f; // -8.6470588235294117647 (-8.64705849) |
| 9 | |
| 10 | static const double dVal = 19637/7.0; // 2805.2857142857142857 (2805.2857142857142) |
| 11 | |
| 12 | static const long double ldVal = 3/1234567.0L; // 2.4300017739012949479e-06 (<optimized out>) |
| 13 | |
| 14 | int main() { |
| 15 | return hVal + fVal + dVal + ldVal; |
| 16 | } |
| 17 | |
| 18 | // CHECK: !DIGlobalVariable(name: "hVal", {{.*}}, isLocal: true, isDefinition: true, expr: ![[HEXPR:[0-9]+]] |
| 19 | // CHECK: ![[HEXPR]] = !DIExpression(DW_OP_constu, 16502, DW_OP_stack_value) |
| 20 | |
| 21 | // CHECK: !DIGlobalVariable(name: "fVal", {{.*}}, isLocal: true, isDefinition: true, expr: ![[FEXPR:[0-9]+]] |
| 22 | // CHECK: ![[FEXPR]] = !DIExpression(DW_OP_constu, 3238681178, DW_OP_stack_value) |
| 23 | |
| 24 | // CHECK: !DIGlobalVariable(name: "dVal", {{.*}}, isLocal: true, isDefinition: true, expr: ![[DEXPR:[0-9]+]] |
| 25 | // CHECK: ![[DEXPR]] = !DIExpression(DW_OP_constu, 4658387303597904457, DW_OP_stack_value) |
| 26 | |
| 27 | // CHECK: !DIGlobalVariable(name: "ldVal", {{.*}}, isLocal: true, isDefinition: true) |