llvm.org GIT mirror llvm / 999f90b
Add a pinned metadata name for fpaccuracy, and document it git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143135 91177308-0d34-0410-b5e6-96231b3b80d8 Peter Collingbourne 8 years ago
3 changed file(s) with 37 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
102102
  • Metadata Nodes and Metadata Strings
  • 103103
    104104
  • 'tbaa' Metadata
  • 105
  • 'fpaccuracy' Metadata
  • 105106
    106107
    107108
    29652966
    29662967
    29672968
    2969

    2970 'fpaccuracy' Metadata
    2971
    2972
    2973
    2974
    2975

    fpaccuracy metadata may be attached to any instruction of floating

    2976 point type. It expresses the maximum relative error of the result of
    2977 that instruction, in ULPs. ULP is defined as follows:

    2978
    2979

    2980 If x is a real number that lies between two finite consecutive floating-point
    2981 numbers a and b, without being equal to one of them, then ulp(x) = |b - a|,
    2982 otherwise ulp(x) is the distance between the two non-equal finite
    2983 floating-point numbers nearest x. Moreover, ulp(NaN) is NaN.
    2984

    2985
    2986

    The maximum relative error may be any rational number. The metadata node

    2987 shall consist of a pair of unsigned integers respectively representing
    2988 the numerator and denominator. For example, 2.5 ULP:

    2989
    2990
    2991
    
                      
                    
    2992 !0 = metadata !{ i32 5, i32 2 }
    2993
    2994
    2995
    2996
    2997
    29682998
    29692999
    29703000
    3939 enum {
    4040 MD_dbg = 0, // "dbg"
    4141 MD_tbaa = 1, // "tbaa"
    42 MD_prof = 2 // "prof"
    42 MD_prof = 2, // "prof"
    43 MD_fpaccuracy = 3 // "fpaccuracy"
    4344 };
    4445
    4546 /// getMDKindID - Return a unique non-zero ID for the specified metadata kind.
    4242 // Create the 'prof' metadata kind.
    4343 unsigned ProfID = getMDKindID("prof");
    4444 assert(ProfID == MD_prof && "prof kind id drifted"); (void)ProfID;
    45
    46 // Create the 'fpaccuracy' metadata kind.
    47 unsigned FPAccuracyID = getMDKindID("fpaccuracy");
    48 assert(FPAccuracyID == MD_fpaccuracy && "fpaccuracy kind id drifted");
    49 (void)FPAccuracyID;
    4550 }
    4651 LLVMContext::~LLVMContext() { delete pImpl; }
    4752