1 // Test without serialization: 2 // RUN: %clang_cc1 -x c -ffixed-point -ast-dump %s | FileCheck %s --strict-whitespace 3 // 4 // Test with serialization: 5 // RUN: %clang_cc1 -ffixed-point -emit-pch -o %t %s 6 // RUN: %clang_cc1 -x c -ffixed-point -include-pch %t -ast-dump-all /dev/null \ 7 // RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \ 8 // RUN: | FileCheck %s --strict-whitespace 9 10 /* Various contexts where type _Accum can appear. */ 11 12 // Primary fixed point types 13 signed short _Accum s_short_accum; 14 signed _Accum s_accum; 15 signed long _Accum s_long_accum; 16 unsigned short _Accum u_short_accum; 17 unsigned _Accum u_accum; 18 unsigned long _Accum u_long_accum; 19 signed short _Fract s_short_fract; 20 signed _Fract s_fract; 21 signed long _Fract s_long_fract; 22 unsigned short _Fract u_short_fract; 23 unsigned _Fract u_fract; 24 unsigned long _Fract u_long_fract; 25 26 // Aliased fixed point types 27 short _Accum short_accum; 28 _Accum accum; 29 long _Accum long_accum; 30 short _Fract short_fract; 31 _Fract fract; 32 long _Fract long_fract; 33 34 // Saturated fixed point types 35 _Sat signed short _Accum sat_s_short_accum; 36 _Sat signed _Accum sat_s_accum; 37 _Sat signed long _Accum sat_s_long_accum; 38 _Sat unsigned short _Accum sat_u_short_accum; 39 _Sat unsigned _Accum sat_u_accum; 40 _Sat unsigned long _Accum sat_u_long_accum; 41 _Sat signed short _Fract sat_s_short_fract; 42 _Sat signed _Fract sat_s_fract; 43 _Sat signed long _Fract sat_s_long_fract; 44 _Sat unsigned short _Fract sat_u_short_fract; 45 _Sat unsigned _Fract sat_u_fract; 46 _Sat unsigned long _Fract sat_u_long_fract; 47 48 // Aliased saturated fixed point types 49 _Sat short _Accum sat_short_accum; 50 _Sat _Accum sat_accum; 51 _Sat long _Accum sat_long_accum; 52 _Sat short _Fract sat_short_fract; 53 _Sat _Fract sat_fract; 54 _Sat long _Fract sat_long_fract; 55 56 //CHECK: |-VarDecl {{.*}} s_short_accum 'short _Accum' 57 //CHECK-NEXT: |-VarDecl {{.*}} s_accum '_Accum' 58 //CHECK-NEXT: |-VarDecl {{.*}} s_long_accum 'long _Accum' 59 //CHECK-NEXT: |-VarDecl {{.*}} u_short_accum 'unsigned short _Accum' 60 //CHECK-NEXT: |-VarDecl {{.*}} u_accum 'unsigned _Accum' 61 //CHECK-NEXT: |-VarDecl {{.*}} u_long_accum 'unsigned long _Accum' 62 //CHECK-NEXT: |-VarDecl {{.*}} s_short_fract 'short _Fract' 63 //CHECK-NEXT: |-VarDecl {{.*}} s_fract '_Fract' 64 //CHECK-NEXT: |-VarDecl {{.*}} s_long_fract 'long _Fract' 65 //CHECK-NEXT: |-VarDecl {{.*}} u_short_fract 'unsigned short _Fract' 66 //CHECK-NEXT: |-VarDecl {{.*}} u_fract 'unsigned _Fract' 67 //CHECK-NEXT: |-VarDecl {{.*}} u_long_fract 'unsigned long _Fract' 68 //CHECK-NEXT: |-VarDecl {{.*}} short_accum 'short _Accum' 69 //CHECK-NEXT: |-VarDecl {{.*}} accum '_Accum' 70 //CHECK-NEXT: |-VarDecl {{.*}} long_accum 'long _Accum' 71 //CHECK-NEXT: |-VarDecl {{.*}} short_fract 'short _Fract' 72 //CHECK-NEXT: |-VarDecl {{.*}} fract '_Fract' 73 //CHECK-NEXT: |-VarDecl {{.*}} long_fract 'long _Fract' 74 //CHECK-NEXT: |-VarDecl {{.*}} sat_s_short_accum '_Sat short _Accum' 75 //CHECK-NEXT: |-VarDecl {{.*}} sat_s_accum '_Sat _Accum' 76 //CHECK-NEXT: |-VarDecl {{.*}} sat_s_long_accum '_Sat long _Accum' 77 //CHECK-NEXT: |-VarDecl {{.*}} sat_u_short_accum '_Sat unsigned short _Accum' 78 //CHECK-NEXT: |-VarDecl {{.*}} sat_u_accum '_Sat unsigned _Accum' 79 //CHECK-NEXT: |-VarDecl {{.*}} sat_u_long_accum '_Sat unsigned long _Accum' 80 //CHECK-NEXT: |-VarDecl {{.*}} sat_s_short_fract '_Sat short _Fract' 81 //CHECK-NEXT: |-VarDecl {{.*}} sat_s_fract '_Sat _Fract' 82 //CHECK-NEXT: |-VarDecl {{.*}} sat_s_long_fract '_Sat long _Fract' 83 //CHECK-NEXT: |-VarDecl {{.*}} sat_u_short_fract '_Sat unsigned short _Fract' 84 //CHECK-NEXT: |-VarDecl {{.*}} sat_u_fract '_Sat unsigned _Fract' 85 //CHECK-NEXT: |-VarDecl {{.*}} sat_u_long_fract '_Sat unsigned long _Fract' 86 //CHECK-NEXT: |-VarDecl {{.*}} sat_short_accum '_Sat short _Accum' 87 //CHECK-NEXT: |-VarDecl {{.*}} sat_accum '_Sat _Accum' 88 //CHECK-NEXT: |-VarDecl {{.*}} sat_long_accum '_Sat long _Accum' 89 //CHECK-NEXT: |-VarDecl {{.*}} sat_short_fract '_Sat short _Fract' 90 //CHECK-NEXT: |-VarDecl {{.*}} sat_fract '_Sat _Fract' 91 //CHECK-NEXT: |-VarDecl {{.*}} sat_long_fract '_Sat long _Fract' 92 93 #define MIX_TYPE_SPEC(SPEC, SIGN, SIZE, ID) \ 94 SPEC SIGN SIZE _Accum ID; \ 95 SIGN SPEC SIZE _Accum ID ## 2; \ 96 SIGN SIZE SPEC _Accum ID ## 3; \ 97 SIGN SIZE _Accum SPEC ID ## 4; 98 99 /* Mixing fixed point types with other type specifiers */ 100 101 #define MIX_VOLATILE(SIGN, SIZE, ID) MIX_TYPE_SPEC(volatile, SIGN, SIZE, ID) 102 #define MIX_ATOMIC(SIGN, SIZE, ID) MIX_TYPE_SPEC(_Atomic, SIGN, SIZE, ID) 103 #define MIX_CONST(SIGN, SIZE, ID) MIX_TYPE_SPEC(const, SIGN, SIZE, ID) 104 105 MIX_VOLATILE(signed, short, vol_s_short_accum) 106 MIX_ATOMIC(signed, short, atm_s_short_accum) 107 MIX_CONST(signed, short, const_s_short_accum) 108 109 // CHECK-NEXT: |-VarDecl {{.*}} vol_s_short_accum 'volatile short _Accum' 110 // CHECK-NEXT: |-VarDecl {{.*}} vol_s_short_accum2 'volatile short _Accum' 111 // CHECK-NEXT: |-VarDecl {{.*}} vol_s_short_accum3 'volatile short _Accum' 112 // CHECK-NEXT: |-VarDecl {{.*}} vol_s_short_accum4 'volatile short _Accum' 113 114 // CHECK-NEXT: |-VarDecl {{.*}} atm_s_short_accum '_Atomic(short _Accum)' 115 // CHECK-NEXT: |-VarDecl {{.*}} atm_s_short_accum2 '_Atomic(short _Accum)' 116 // CHECK-NEXT: |-VarDecl {{.*}} atm_s_short_accum3 '_Atomic(short _Accum)' 117 // CHECK-NEXT: |-VarDecl {{.*}} atm_s_short_accum4 '_Atomic(short _Accum)' 118 119 // CHECK-NEXT: |-VarDecl {{.*}} const_s_short_accum 'const short _Accum' 120 // CHECK-NEXT: |-VarDecl {{.*}} const_s_short_accum2 'const short _Accum' 121 // CHECK-NEXT: |-VarDecl {{.*}} const_s_short_accum3 'const short _Accum' 122 // CHECK-NEXT: |-VarDecl {{.*}} const_s_short_accum4 'const short _Accum' 123 124 /* Typedefs */ 125 126 // Primary fixed point types 127 typedef signed short _Accum SsA_t; 128 typedef signed _Accum SA_t; 129 typedef signed long _Accum SlA_t; 130 typedef unsigned short _Accum UsA_t; 131 typedef unsigned _Accum UA_t; 132 typedef unsigned long _Accum UlA_t; 133 typedef signed short _Fract SsF_t; 134 typedef signed _Fract SF_t; 135 typedef signed long _Fract SlF_t; 136 typedef unsigned short _Fract UsF_t; 137 typedef unsigned _Fract UF_t; 138 typedef unsigned long _Fract UlF_t; 139 140 // Aliased fixed point types 141 typedef short _Accum sA_t; 142 typedef _Accum A_t; 143 typedef long _Accum lA_t; 144 typedef short _Fract sF_t; 145 typedef _Fract F_t; 146 typedef long _Fract lF_t; 147 148 // Saturated fixed point types 149 typedef _Sat signed short _Accum SatSsA_t; 150 typedef _Sat signed _Accum SatSA_t; 151 typedef _Sat signed long _Accum SatSlA_t; 152 typedef _Sat unsigned short _Accum SatUsA_t; 153 typedef _Sat unsigned _Accum SatUA_t; 154 typedef _Sat unsigned long _Accum SatUlA_t; 155 typedef _Sat signed short _Fract SatSsF_t; 156 typedef _Sat signed _Fract SatSF_t; 157 typedef _Sat signed long _Fract SatSlF_t; 158 typedef _Sat unsigned short _Fract SatUsF_t; 159 typedef _Sat unsigned _Fract SatUF_t; 160 typedef _Sat unsigned long _Fract SatUlF_t; 161 162 // Aliased saturated fixed point types 163 typedef _Sat short _Accum SatsA_t; 164 typedef _Sat _Accum SatA_t; 165 typedef _Sat long _Accum SatlA_t; 166 typedef _Sat short _Fract SatsF_t; 167 typedef _Sat _Fract SatF_t; 168 typedef _Sat long _Fract SatlF_t; 169 170 SsA_t SsA_type; 171 SA_t SA_type; 172 SlA_t SlA_type; 173 UsA_t UsA_type; 174 UA_t UA_type; 175 UlA_t UlA_type; 176 SsF_t SsF_type; 177 SF_t SF_type; 178 SlF_t SlF_type; 179 UsF_t UsF_type; 180 UF_t UF_type; 181 UlF_t UlF_type; 182 183 sA_t sA_type; 184 A_t A_type; 185 lA_t lA_type; 186 sF_t sF_type; 187 F_t F_type; 188 lF_t lF_type; 189 190 SatSsA_t SatSsA_type; 191 SatSA_t SatSA_type; 192 SatSlA_t SatSlA_type; 193 SatUsA_t SatUsA_type; 194 SatUA_t SatUA_type; 195 SatUlA_t SatUlA_type; 196 SatSsF_t SatSsF_type; 197 SatSF_t SatSF_type; 198 SatSlF_t SatSlF_type; 199 SatUsF_t SatUsF_type; 200 SatUF_t SatUF_type; 201 SatUlF_t SatUlF_type; 202 203 SatsA_t SatsA_type; 204 SatA_t SatA_type; 205 SatlA_t SatlA_type; 206 SatsF_t SatsF_type; 207 SatF_t SatF_type; 208 SatlF_t SatlF_type; 209 210 //CHECK: |-VarDecl {{.*}} SsA_type 'SsA_t':'short _Accum' 211 //CHECK-NEXT: |-VarDecl {{.*}} SA_type 'SA_t':'_Accum' 212 //CHECK-NEXT: |-VarDecl {{.*}} SlA_type 'SlA_t':'long _Accum' 213 //CHECK-NEXT: |-VarDecl {{.*}} UsA_type 'UsA_t':'unsigned short _Accum' 214 //CHECK-NEXT: |-VarDecl {{.*}} UA_type 'UA_t':'unsigned _Accum' 215 //CHECK-NEXT: |-VarDecl {{.*}} UlA_type 'UlA_t':'unsigned long _Accum' 216 //CHECK-NEXT: |-VarDecl {{.*}} SsF_type 'SsF_t':'short _Fract' 217 //CHECK-NEXT: |-VarDecl {{.*}} SF_type 'SF_t':'_Fract' 218 //CHECK-NEXT: |-VarDecl {{.*}} SlF_type 'SlF_t':'long _Fract' 219 //CHECK-NEXT: |-VarDecl {{.*}} UsF_type 'UsF_t':'unsigned short _Fract' 220 //CHECK-NEXT: |-VarDecl {{.*}} UF_type 'UF_t':'unsigned _Fract' 221 //CHECK-NEXT: |-VarDecl {{.*}} UlF_type 'UlF_t':'unsigned long _Fract' 222 //CHECK-NEXT: |-VarDecl {{.*}} sA_type 'sA_t':'short _Accum' 223 //CHECK-NEXT: |-VarDecl {{.*}} A_type 'A_t':'_Accum' 224 //CHECK-NEXT: |-VarDecl {{.*}} lA_type 'lA_t':'long _Accum' 225 //CHECK-NEXT: |-VarDecl {{.*}} sF_type 'sF_t':'short _Fract' 226 //CHECK-NEXT: |-VarDecl {{.*}} F_type 'F_t':'_Fract' 227 //CHECK-NEXT: |-VarDecl {{.*}} lF_type 'lF_t':'long _Fract' 228 229 //CHECK-NEXT: |-VarDecl {{.*}} SatSsA_type 'SatSsA_t':'_Sat short _Accum' 230 //CHECK-NEXT: |-VarDecl {{.*}} SatSA_type 'SatSA_t':'_Sat _Accum' 231 //CHECK-NEXT: |-VarDecl {{.*}} SatSlA_type 'SatSlA_t':'_Sat long _Accum' 232 //CHECK-NEXT: |-VarDecl {{.*}} SatUsA_type 'SatUsA_t':'_Sat unsigned short _Accum' 233 //CHECK-NEXT: |-VarDecl {{.*}} SatUA_type 'SatUA_t':'_Sat unsigned _Accum' 234 //CHECK-NEXT: |-VarDecl {{.*}} SatUlA_type 'SatUlA_t':'_Sat unsigned long _Accum' 235 //CHECK-NEXT: |-VarDecl {{.*}} SatSsF_type 'SatSsF_t':'_Sat short _Fract' 236 //CHECK-NEXT: |-VarDecl {{.*}} SatSF_type 'SatSF_t':'_Sat _Fract' 237 //CHECK-NEXT: |-VarDecl {{.*}} SatSlF_type 'SatSlF_t':'_Sat long _Fract' 238 //CHECK-NEXT: |-VarDecl {{.*}} SatUsF_type 'SatUsF_t':'_Sat unsigned short _Fract' 239 //CHECK-NEXT: |-VarDecl {{.*}} SatUF_type 'SatUF_t':'_Sat unsigned _Fract' 240 //CHECK-NEXT: |-VarDecl {{.*}} SatUlF_type 'SatUlF_t':'_Sat unsigned long _Fract' 241 //CHECK-NEXT: |-VarDecl {{.*}} SatsA_type 'SatsA_t':'_Sat short _Accum' 242 //CHECK-NEXT: |-VarDecl {{.*}} SatA_type 'SatA_t':'_Sat _Accum' 243 //CHECK-NEXT: |-VarDecl {{.*}} SatlA_type 'SatlA_t':'_Sat long _Accum' 244 //CHECK-NEXT: |-VarDecl {{.*}} SatsF_type 'SatsF_t':'_Sat short _Fract' 245 //CHECK-NEXT: |-VarDecl {{.*}} SatF_type 'SatF_t':'_Sat _Fract' 246 //CHECK-NEXT: |-VarDecl {{.*}} SatlF_type 'SatlF_t':'_Sat long _Fract' 247 248 // Fixed point literal exponent syntax 249 _Accum decexp1 = 1.575e1k; 250 _Accum decexp2 = 1.575E1k; 251 _Accum decexp3 = 1575e-2k; 252 _Accum decexp4 = 1575E-2k; 253 254 _Accum hexexp1 = 0x0.3p10k; 255 _Accum hexexp2 = 0x0.3P10k; 256 _Accum hexexp3 = 0x30000p-10k; 257 _Accum hexexp4 = 0x30000P-10k; 258 259 _Accum zeroexp1 = 1e0k; 260 _Accum zeroexp2 = 1e-0k; 261 262 //CHECK-NEXT: |-VarDecl {{.*}} decexp1 '_Accum' cinit 263 //CHECK-NEXT: `-FixedPointLiteral {{.*}} '_Accum' 15.75 264 //CHECK-NEXT: |-VarDecl {{.*}} decexp2 '_Accum' cinit 265 //CHECK-NEXT: `-FixedPointLiteral {{.*}} '_Accum' 15.75 266 //CHECK-NEXT: |-VarDecl {{.*}} decexp3 '_Accum' cinit 267 //CHECK-NEXT: `-FixedPointLiteral {{.*}} '_Accum' 15.75 268 //CHECK-NEXT: |-VarDecl {{.*}} decexp4 '_Accum' cinit 269 //CHECK-NEXT: `-FixedPointLiteral {{.*}} '_Accum' 15.75 270 271 //CHECK-NEXT: |-VarDecl {{.*}} hexexp1 '_Accum' cinit 272 //CHECK-NEXT: `-FixedPointLiteral {{.*}} '_Accum' 192.0 273 //CHECK-NEXT: |-VarDecl {{.*}} hexexp2 '_Accum' cinit 274 //CHECK-NEXT: `-FixedPointLiteral {{.*}} '_Accum' 192.0 275 //CHECK-NEXT: |-VarDecl {{.*}} hexexp3 '_Accum' cinit 276 //CHECK-NEXT: `-FixedPointLiteral {{.*}} '_Accum' 192.0 277 //CHECK-NEXT: |-VarDecl {{.*}} hexexp4 '_Accum' cinit 278 //CHECK-NEXT: `-FixedPointLiteral {{.*}} '_Accum' 192.0 279 280 //CHECK-NEXT: |-VarDecl {{.*}} zeroexp1 '_Accum' cinit 281 //CHECK-NEXT: `-FixedPointLiteral {{.*}} '_Accum' 1.0 282 //CHECK-NEXT: |-VarDecl {{.*}} zeroexp2 '_Accum' cinit 283 //CHECK-NEXT: `-FixedPointLiteral {{.*}} '_Accum' 1.0 284 285 // Fixed point literal values 286 _Accum literal1 = 2.5k; // Precise decimal 287 _Accum literal2 = 0.0k; // Zero 288 _Accum literal3 = 1.1k; // Imprecise decimal 289 _Accum literal4 = 1.11k; 290 _Accum literal5 = 1.111k; 291 _Accum literal6 = 1.1111k; 292 _Accum literal7 = 1.11111k; // After some point after the radix, adding any more 293 // digits to the literal will not result in any 294 // further precision since the nth digit added may 295 // be less than the precision that can be 296 // represented by the fractional bits of the type. 297 // This results in the same value being stored for 298 // the type. 299 300 //CHECK-NEXT: |-VarDecl {{.*}} literal1 '_Accum' cinit 301 //CHECK-NEXT: `-FixedPointLiteral {{.*}} '_Accum' 2.5 302 //CHECK-NEXT: |-VarDecl {{.*}} literal2 '_Accum' cinit 303 //CHECK-NEXT: `-FixedPointLiteral {{.*}} '_Accum' 0.0 304 //CHECK-NEXT: |-VarDecl {{.*}} literal3 '_Accum' cinit 305 //CHECK-NEXT: `-FixedPointLiteral {{.*}} '_Accum' 1.0999755859375 306 //CHECK-NEXT: |-VarDecl {{.*}} literal4 '_Accum' cinit 307 //CHECK-NEXT: `-FixedPointLiteral {{.*}} '_Accum' 1.1099853515625 308 //CHECK-NEXT: |-VarDecl {{.*}} literal5 '_Accum' cinit 309 //CHECK-NEXT: `-FixedPointLiteral {{.*}} '_Accum' 1.110992431640625 310 //CHECK-NEXT: |-VarDecl {{.*}} literal6 '_Accum' cinit 311 //CHECK-NEXT: `-FixedPointLiteral {{.*}} '_Accum' 1.111083984375 312 //CHECK-NEXT: |-VarDecl {{.*}} literal7 '_Accum' cinit 313 //CHECK-NEXT: `-FixedPointLiteral {{.*}} '_Accum' 1.111083984375 314 315 long _Accum longaccumliteral = 0.99999999lk; 316 long _Accum longaccumliteral2 = 0.999999999lk; 317 long _Accum verylongaccumliteral = 0.99999999999999999999999999lk; 318 long _Fract longfractliteral = 0.99999999lr; 319 long _Fract longfractliteral2 = 0.999999999lr; 320 long _Fract verylongfractliteral = 0.99999999999999999999999999lr; 321 322 //CHECK-NEXT: |-VarDecl {{.*}} longaccumliteral 'long _Accum' cinit 323 //CHECK-NEXT: `-FixedPointLiteral {{.*}} 'long _Accum' 0.999999989755451679229736328125 324 //CHECK-NEXT: |-VarDecl {{.*}} longaccumliteral2 'long _Accum' cinit 325 //CHECK-NEXT: `-FixedPointLiteral {{.*}} 'long _Accum' 0.9999999986030161380767822265625 326 //CHECK-NEXT: |-VarDecl {{.*}} verylongaccumliteral 'long _Accum' cinit 327 //CHECK-NEXT: `-FixedPointLiteral {{.*}} 'long _Accum' 0.9999999995343387126922607421875 328 //CHECK-NEXT: |-VarDecl {{.*}} longfractliteral 'long _Fract' cinit 329 //CHECK-NEXT: `-FixedPointLiteral {{.*}} 'long _Fract' 0.999999989755451679229736328125 330 //CHECK-NEXT: |-VarDecl {{.*}} longfractliteral2 'long _Fract' cinit 331 //CHECK-NEXT: `-FixedPointLiteral {{.*}} 'long _Fract' 0.9999999986030161380767822265625 332 //CHECK-NEXT: |-VarDecl {{.*}} verylongfractliteral 'long _Fract' cinit 333 //CHECK-NEXT: `-FixedPointLiteral {{.*}} 'long _Fract' 0.9999999995343387126922607421875 334 335 unsigned _Accum uliteral1 = 2.5uk; // Unsigned 336 _Accum literal8 = -2.5k; // Negative 337 338 //CHECK-NEXT: |-VarDecl {{.*}} uliteral1 'unsigned _Accum' cinit 339 //CHECK-NEXT: `-FixedPointLiteral {{.*}} 'unsigned _Accum' 2.5 340 //CHECK-NEXT: |-VarDecl {{.*}} literal8 '_Accum' cinit 341 //CHECK-NEXT: `-UnaryOperator {{.*}} '_Accum' prefix '-' 342 //CHECK-NEXT: `-FixedPointLiteral {{.*}} '_Accum' 2.5 343 344 short _Accum literalexact1 = 0.9921875hk; // Exact value 345 _Accum literalexact2 = 0.999969482421875k; 346 347 //CHECK-NEXT: |-VarDecl {{.*}} literalexact1 'short _Accum' cinit 348 //CHECK-NEXT: `-FixedPointLiteral {{.*}} 'short _Accum' 0.9921875 349 //CHECK-NEXT: |-VarDecl {{.*}} literalexact2 '_Accum' cinit 350 //CHECK-NEXT: `-FixedPointLiteral {{.*}} '_Accum' 0.999969482421875 351 352 // Unfortunately we do not have enough space to store the exact decimal value of 353 // 0.9999999995343387126922607421875 ((1 << 31) - 1), but we can still use a 354 // large number of 9s to get the max fractional value. 355 long _Accum long_accum_max = 0.999999999999999999999999999lk; 356 357 //CHECK-NEXT: |-VarDecl {{.*}} long_accum_max 'long _Accum' cinit 358 //CHECK-NEXT: `-FixedPointLiteral {{.*}} 'long _Accum' 0.9999999995343387126922607421875 359 360 // Epsilon 361 short _Accum short_accum_eps = 0.0078125hk; 362 short _Accum short_accum_eps2 = 0.0078124hk; // Less than epsilon floors to zero 363 _Accum accum_eps = 0.000030517578125k; 364 _Accum accum_eps2 = 0.000030517578124k; 365 long _Accum long_accum_eps = 0x1p-31lk; 366 long _Accum long_accum_eps2 = 0x0.99999999p-31lk; 367 368 //CHECK-NEXT: |-VarDecl {{.*}} short_accum_eps 'short _Accum' cinit 369 //CHECK-NEXT: `-FixedPointLiteral {{.*}} 'short _Accum' 0.0078125 370 //CHECK-NEXT: |-VarDecl {{.*}} short_accum_eps2 'short _Accum' cinit 371 //CHECK-NEXT: `-FixedPointLiteral {{.*}} 'short _Accum' 0.0 372 //CHECK-NEXT: |-VarDecl {{.*}} accum_eps '_Accum' cinit 373 //CHECK-NEXT: `-FixedPointLiteral {{.*}} '_Accum' 0.000030517578125 374 //CHECK-NEXT: |-VarDecl {{.*}} accum_eps2 '_Accum' cinit 375 //CHECK-NEXT: `-FixedPointLiteral {{.*}} '_Accum' 0.0 376 //CHECK-NEXT: |-VarDecl {{.*}} long_accum_eps 'long _Accum' cinit 377 //CHECK-NEXT: `-FixedPointLiteral {{.*}} 'long _Accum' 0.0000000004656612873077392578125 378 //CHECK-NEXT: |-VarDecl {{.*}} long_accum_eps2 'long _Accum' cinit 379 //CHECK-NEXT: `-FixedPointLiteral {{.*}} 'long _Accum' 0.0 380 381 // Fract literals can be one but evaluate to the respective Fract max 382 short _Fract short_fract_one = 1.0hr; 383 _Fract fract_one = 1.0r; 384 long _Fract long_fract_one = 1.0lr; 385 unsigned short _Fract u_short_fract_one = 1.0uhr; 386 unsigned _Fract u_fract_one = 1.0ur; 387 unsigned long _Fract u_long_fract_one = 1.0ulr; 388 389 //CHECK-NEXT: |-VarDecl {{.*}} short_fract_one 'short _Fract' cinit 390 //CHECK-NEXT: `-FixedPointLiteral {{.*}} 'short _Fract' 0.9921875 391 //CHECK-NEXT: |-VarDecl {{.*}} fract_one '_Fract' cinit 392 //CHECK-NEXT: `-FixedPointLiteral {{.*}} '_Fract' 0.999969482421875 393 //CHECK-NEXT: |-VarDecl {{.*}} long_fract_one 'long _Fract' cinit 394 //CHECK-NEXT: `-FixedPointLiteral {{.*}} 'long _Fract' 0.9999999995343387126922607421875 395 396 //CHECK-NEXT: |-VarDecl {{.*}} u_short_fract_one 'unsigned short _Fract' cinit 397 //CHECK-NEXT: `-FixedPointLiteral {{.*}} 'unsigned short _Fract' 0.99609375 398 //CHECK-NEXT: |-VarDecl {{.*}} u_fract_one 'unsigned _Fract' cinit 399 //CHECK-NEXT: `-FixedPointLiteral {{.*}} 'unsigned _Fract' 0.9999847412109375 400 //CHECK-NEXT: |-VarDecl {{.*}} u_long_fract_one 'unsigned long _Fract' cinit 401 //CHECK-NEXT: `-FixedPointLiteral {{.*}} 'unsigned long _Fract' 0.99999999976716935634613037109375 402 403 _Accum literallast = 1.0k; // One 404 405 //CHECK-NEXT: `-VarDecl {{.*}} literallast '_Accum' cinit 406 //CHECK-NEXT: `-FixedPointLiteral {{.*}} '_Accum' 1.0 407