Home | History | Annotate | Download | only in libbcc
      1 ; Per https://llvm.org/bugs/show_bug.cgi?id=26619, check that for DIGlobalVariable of floating-point type,
      2 ; we emit its constant value (if any) in debug info.
      3 
      4 ; Debug metadata doesn't survive passage through llvm-rs-as.  Therefore, we represent
      5 ;   the test case as a separate bitcode file, rather than as the ASCII IR in this file.
      6 ; There doesn't seem to be any way to compute the basename of %s, hence the unfortunate
      7 ;   explicit uses of "debug_info_static_const_fp" below.
      8 
      9 ; RUN: bcc -o debug_info_static_const_fp -output_path %T -bclib libclcore.bc -mtriple armv7-none-linux-gnueabi %S/debug_info_static_const_fp.bc
     10 ; RUN: llvm-dwarfdump -debug-dump=info %T/debug_info_static_const_fp.o | FileCheck %s
     11 
     12 ; 32-bit bitcode compiled from the following (-O0 -g):
     13 ;
     14 ;   #pragma version(1)
     15 ;   #pragma rs java_package_name(debug_info_static_const_fp)
     16 ;
     17 ;   static const __fp16 hVal = 29/13.0f;            //    2.2307692307692307692     (2.23046875)
     18 ;
     19 ;   static const float fVal = -147/17.0f;           //   -8.6470588235294117647     (-8.64705849)
     20 ;
     21 ;   static const double dVal = 19637/7.0;           // 2805.2857142857142857        (2805.2857142857142)
     22 ;
     23 ;   int iVal;
     24 ;
     25 ;   void compute() {
     26 ;     iVal = hVal + fVal + dVal;
     27 ;   }
     28 
     29 ; CHECK: DW_TAG_variable
     30 ; CHECK-NOT: {{DW_TAG|NULL}}
     31 ; CHECK: DW_AT_name {{.*}} "hVal"
     32 ; CHECK-NOT: {{DW_TAG|NULL}}
     33 ; CHECK: DW_AT_const_value {{.*}} (16502)
     34 
     35 ; CHECK: DW_TAG_variable
     36 ; CHECK-NOT: {{DW_TAG|NULL}}
     37 ; CHECK: DW_AT_name {{.*}} "fVal"
     38 ; CHECK-NOT: {{DW_TAG|NULL}}
     39 ; CHECK: DW_AT_const_value {{.*}} (3238681178)
     40 
     41 ; CHECK: DW_TAG_variable
     42 ; CHECK-NOT: {{DW_TAG|NULL}}
     43 ; CHECK: DW_AT_name {{.*}} "dVal"
     44 ; CHECK-NOT: {{DW_TAG|NULL}}
     45 ; CHECK: DW_AT_const_value {{.*}} (4658387303597904457)
     46