Ignore:
Timestamp:
Jan 26, 2025, 6:37:05 PM (11 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
master
Children:
a950021
Parents:
0f070a4 (diff), 11f92fac (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/BasicTypes-gen.cpp

    r0f070a4 rde8a0a4b  
    9999
    100100        { Float16, "Float16", "_FH", "_Float16", "DF16_", Floating, Float32, Float16Complex, -1, 7 },
    101         { Float16Complex, "Float16Complex", "_FHC", "_Float16 _Complex", "CDF16_", Floating, Float32Complex, -1, -1, 7 },
    102 
    103         { Float32, "Float32", "_F", "_Float32", "DF32_", Floating, Float, Float32Complex, -1, 8 },
    104         { Float32Complex, "Float32Complex", "_FC", "_Float32 _Complex", "CDF32_", Floating, FloatComplex, -1, -1, 8 },
    105         { Float, "Float", "F", "float", "f", Floating, Float32x, FloatComplex, -1, 9 },
    106         { FloatComplex, "FloatComplex", "FC", "float _Complex", "Cf", Floating, Float32xComplex, -1, -1, 9 },
    107         { Float32x, "Float32x", "_FX", "_Float32x", "DF32x_", Floating, Float64, Float32xComplex, -1, 10 },
    108         { Float32xComplex, "Float32xComplex", "_FXC", "_Float32x _Complex", "CDF32x_", Floating, Float64Complex, -1, -1, 10 },
    109 
    110         { Float64, "Float64", "_FD", "_Float64", "DF64_", Floating, Double, Float64Complex, -1, 11 },
    111         { Float64Complex, "Float64Complex", "_FDC", "_Float64 _Complex", "CDF64_", Floating, DoubleComplex, -1, -1, 11 },
    112         { Double, "Double", "D", "double", "d", Floating, Float64x, DoubleComplex, -1, 12 },
    113         { DoubleComplex, "DoubleComplex", "DC", "double _Complex", "Cd", Floating, Float64xComplex, -1, -1, 12 },
    114         { Float64x, "Float64x", "_FDX", "_Float64x", "DF64x_", Floating, Float80, Float64xComplex, -1, 13 },
    115         { Float64xComplex, "Float64xComplex", "_FDXC", "_Float64x _Complex", "CDF64x_", Floating, LongDoubleComplex, -1, -1, 13 },
    116 
    117         { Float80, "Float80", "_F80", "__float80", "Dq", Floating, LongDouble, LongDoubleComplex, -1, 14 },
     101        { Float16Complex, "Float16Complex", "_FHC", "_Float16 _Complex", "CDF16_", Floating, Float32Complex, -1, -1, 8 },
     102
     103        { Float32, "Float32", "_F", "_Float32", "DF32_", Floating, Float, Float32Complex, -1, 9 },
     104        { Float32Complex, "Float32Complex", "_FC", "_Float32 _Complex", "CDF32_", Floating, FloatComplex, -1, -1, 10 },
     105        { Float, "Float", "F", "float", "f", Floating, Float32x, FloatComplex, -1, 11 },
     106        { FloatComplex, "FloatComplex", "FC", "float _Complex", "Cf", Floating, Float32xComplex, -1, -1, 12 },
     107        { Float32x, "Float32x", "_FX", "_Float32x", "DF32x_", Floating, Float64, Float32xComplex, -1, 13 },
     108        { Float32xComplex, "Float32xComplex", "_FXC", "_Float32x _Complex", "CDF32x_", Floating, Float64Complex, -1, -1, 14 },
     109
     110        { Float64, "Float64", "_FD", "_Float64", "DF64_", Floating, Double, Float64Complex, -1, 15 },
     111        { Float64Complex, "Float64Complex", "_FDC", "_Float64 _Complex", "CDF64_", Floating, DoubleComplex, -1, -1, 16 },
     112        { Double, "Double", "D", "double", "d", Floating, Float64x, DoubleComplex, -1, 17 },
     113        { DoubleComplex, "DoubleComplex", "DC", "double _Complex", "Cd", Floating, Float64xComplex, -1, -1, 18 },
     114        { Float64x, "Float64x", "_FDX", "_Float64x", "DF64x_", Floating, Float80, Float64xComplex, -1, 19 },
     115        { Float64xComplex, "Float64xComplex", "_FDXC", "_Float64x _Complex", "CDF64x_", Floating, LongDoubleComplex, -1, -1, 20 },
     116
     117        { Float80, "Float80", "_F80", "__float80", "Dq", Floating, LongDouble, LongDoubleComplex, -1, 21 },
    118118        // __float80 _Complex, no complex counterpart
    119119        // gcc implements long double as float80 (12 bytes)
    120         { LongDouble, "LongDouble", "LD", "long double", "e", Floating, uuFloat128, LongDoubleComplex, -1, 15 },
    121         { LongDoubleComplex, "LongDoubleComplex", "LDC", "long double _Complex", "Ce", Floating, Float128Complex, -1, -1, 15 },
    122 
    123         { uuFloat128, "uuFloat128", "__FLD", "__float128", "g", Floating, Float128, Float128Complex, -1, 16 },
     120        { LongDouble, "LongDouble", "LD", "long double", "e", Floating, uuFloat128, LongDoubleComplex, -1, 22 },
     121        { LongDoubleComplex, "LongDoubleComplex", "LDC", "long double _Complex", "Ce", Floating, Float128Complex, -1, -1, 23 },
     122
     123        { uuFloat128, "uuFloat128", "__FLD", "__float128", "g", Floating, Float128, Float128Complex, -1, 24 },
    124124        // __float128 _Complex, no complex counterpart
    125         { Float128, "Float128", "_FLD", "_Float128", "DF128_", Floating, Float128x, Float128Complex, -1, 17 },
    126         { Float128Complex, "Float128Complex", "_FLDC", "_Float128 _Complex", "CDF128_", Floating, Float128xComplex, -1, -1, 17 },
     125        { Float128, "Float128", "_FLD", "_Float128", "DF128_", Floating, Float128x, Float128Complex, -1, 25 },
     126        { Float128Complex, "Float128Complex", "_FLDC", "_Float128 _Complex", "CDF128_", Floating, Float128xComplex, -1, -1, 26 },
    127127
    128128        // may not be supported
    129         { Float128x, "Float128x", "_FLDX", "_Float128x", "DF128x_", Floating, Float128xComplex, -1, -1, 18 },
    130         { Float128xComplex, "Float128xComplex", "_FLDXC", "_Float128x _Complex", "CDF128x_", Floating, -1, -1, -1, 18 }
     129        { Float128x, "Float128x", "_FLDX", "_Float128x", "DF128x_", Floating, Float128xComplex, -1, -1, 27 },
     130        { Float128xComplex, "Float128xComplex", "_FLDXC", "_Float128x _Complex", "CDF128x_", Floating, -1, -1, -1, 28 }
    131131}; // graph
    132132
     
    135135static Kind commonTypeMatrix[NUMBER_OF_BASIC_TYPES][NUMBER_OF_BASIC_TYPES];
    136136
    137 // Fangren explain shortest cost algorithm.
     137// Compute the minimal conversion costs using Dijkstra's algorithm
    138138void generateCosts( int row ) {
    139139        bool seen[NUMBER_OF_BASIC_TYPES] = { false /*, ... */ };
     
    176176
    177177                // traverse children
    178                 // Fangren explain "max"
     178                // any conversion should have a cost of at least 1, even if between types of equal rank
    179179                int i = graph[col].left;
    180180                if ( i == -1 ) continue;                                                // leaf
     
    191191} // generateCosts
    192192
    193 // Fangren explain this routine if you can.
     193// Note: this algorithm is not general.
     194// It relies on the specific structure of the conversion graph.
     195// When the common type is not one of the two given types, we should always have a real and a complex floating point type,
     196// in which case the common type is the next complex type ranked higher than the real type.
    194197void generateCommonType( int row, int col ) {                   // row <= col
    195198        if ( costMatrix[row][col] >= 0 ) {
Note: See TracChangeset for help on using the changeset viewer.