C++: Support more complex 16-bit float types

This commit is contained in:
Jeroen Ketema
2025-06-24 11:16:44 +02:00
parent 4ece8abc30
commit 8f249c77bc
15 changed files with 10089 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
class BuiltinType extends @builtintype {
string toString() { none() }
}
from BuiltinType type, string name, int kind, int kind_new, int size, int sign, int alignment
where
builtintypes(type, name, kind, size, sign, alignment) and
if
type instanceof @complex_fp16 or
type instanceof @complex_std_bfloat16 or
type instanceof @complex_std_float16
then kind_new = 2
else kind_new = kind
select type, name, kind_new, size, sign, alignment

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,3 @@
description: Introduce new complex 16-bit floating-point types
compatibility: backwards
builtintypes.rel: run builtintypes.qlo

View File

@@ -0,0 +1,4 @@
---
category: minorAnalysis
---
* Added support for `__fp16 _Complex` and `__bf16 _Complex` types

View File

@@ -858,6 +858,15 @@ private predicate floatingPointTypeMapping(
or or
// __mfp8 // __mfp8
kind = 62 and base = 2 and domain = TRealDomain() and realKind = 62 and extended = false kind = 62 and base = 2 and domain = TRealDomain() and realKind = 62 and extended = false
or
// _Complex __fp16
kind = 64 and base = 2 and domain = TComplexDomain() and realKind = 54 and extended = false
or
// _Complex __bf16
kind = 65 and base = 2 and domain = TComplexDomain() and realKind = 55 and extended = false
or
// _Complex std::float16_t
kind = 66 and base = 2 and domain = TComplexDomain() and realKind = 56 and extended = false
} }
/** /**

View File

@@ -693,6 +693,9 @@ case @builtintype.kind of
| 61 = @complex_std_float128 // _Complex _Float128 | 61 = @complex_std_float128 // _Complex _Float128
| 62 = @mfp8 // __mfp8 | 62 = @mfp8 // __mfp8
| 63 = @scalable_vector_count // __SVCount_t | 63 = @scalable_vector_count // __SVCount_t
| 64 = @complex_fp16 // _Complex __fp16
| 65 = @complex_std_bfloat16 // _Complex __bf16
| 66 = @complex_std_float16 // _Complex std::float16_t
; ;
builtintypes( builtintypes(

View File

@@ -336,6 +336,18 @@
<k>@scalable_vector_count</k> <k>@scalable_vector_count</k>
<v>124</v> <v>124</v>
</e> </e>
<e>
<k>@complex_fp16</k>
<v>124</v>
</e>
<e>
<k>@complex_std_bfloat16</k>
<v>124</v>
</e>
<e>
<k>@complex_std_float16</k>
<v>124</v>
</e>
<e> <e>
<k>@pointer</k> <k>@pointer</k>
<v>455609</v> <v>455609</v>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,2 @@
description: Support more complex 16-bit floating-point types
compatibility: full

View File

@@ -5,10 +5,13 @@
| file://:0:0:0:0 | _Complex _Float64 | | file://:0:0:0:0 | _Complex _Float64 |
| file://:0:0:0:0 | _Complex _Float64x | | file://:0:0:0:0 | _Complex _Float64x |
| file://:0:0:0:0 | _Complex _Float128 | | file://:0:0:0:0 | _Complex _Float128 |
| file://:0:0:0:0 | _Complex __bf16 |
| file://:0:0:0:0 | _Complex __float128 | | file://:0:0:0:0 | _Complex __float128 |
| file://:0:0:0:0 | _Complex __fp16 |
| file://:0:0:0:0 | _Complex double | | file://:0:0:0:0 | _Complex double |
| file://:0:0:0:0 | _Complex float | | file://:0:0:0:0 | _Complex float |
| file://:0:0:0:0 | _Complex long double | | file://:0:0:0:0 | _Complex long double |
| file://:0:0:0:0 | _Complex std::float16_t |
| file://:0:0:0:0 | _Decimal32 | | file://:0:0:0:0 | _Decimal32 |
| file://:0:0:0:0 | _Decimal64 | | file://:0:0:0:0 | _Decimal64 |
| file://:0:0:0:0 | _Decimal128 | | file://:0:0:0:0 | _Decimal128 |

View File

@@ -25,10 +25,13 @@
| file://:0:0:0:0 | _Complex _Float64 | 16 | | file://:0:0:0:0 | _Complex _Float64 | 16 |
| file://:0:0:0:0 | _Complex _Float64x | 32 | | file://:0:0:0:0 | _Complex _Float64x | 32 |
| file://:0:0:0:0 | _Complex _Float128 | 32 | | file://:0:0:0:0 | _Complex _Float128 | 32 |
| file://:0:0:0:0 | _Complex __bf16 | 4 |
| file://:0:0:0:0 | _Complex __float128 | 32 | | file://:0:0:0:0 | _Complex __float128 | 32 |
| file://:0:0:0:0 | _Complex __fp16 | 4 |
| file://:0:0:0:0 | _Complex double | 16 | | file://:0:0:0:0 | _Complex double | 16 |
| file://:0:0:0:0 | _Complex float | 8 | | file://:0:0:0:0 | _Complex float | 8 |
| file://:0:0:0:0 | _Complex long double | 32 | | file://:0:0:0:0 | _Complex long double | 32 |
| file://:0:0:0:0 | _Complex std::float16_t | 4 |
| file://:0:0:0:0 | _Decimal32 | 4 | | file://:0:0:0:0 | _Decimal32 | 4 |
| file://:0:0:0:0 | _Decimal64 | 8 | | file://:0:0:0:0 | _Decimal64 | 8 |
| file://:0:0:0:0 | _Decimal128 | 16 | | file://:0:0:0:0 | _Decimal128 | 16 |

View File

@@ -7,10 +7,13 @@
| file://:0:0:0:0 | _Complex _Float64 | _Complex _Float64 | | file://:0:0:0:0 | _Complex _Float64 | _Complex _Float64 |
| file://:0:0:0:0 | _Complex _Float64x | _Complex _Float64x | | file://:0:0:0:0 | _Complex _Float64x | _Complex _Float64x |
| file://:0:0:0:0 | _Complex _Float128 | _Complex _Float128 | | file://:0:0:0:0 | _Complex _Float128 | _Complex _Float128 |
| file://:0:0:0:0 | _Complex __bf16 | _Complex __bf16 |
| file://:0:0:0:0 | _Complex __float128 | _Complex __float128 | | file://:0:0:0:0 | _Complex __float128 | _Complex __float128 |
| file://:0:0:0:0 | _Complex __fp16 | _Complex __fp16 |
| file://:0:0:0:0 | _Complex double | _Complex double | | file://:0:0:0:0 | _Complex double | _Complex double |
| file://:0:0:0:0 | _Complex float | _Complex float | | file://:0:0:0:0 | _Complex float | _Complex float |
| file://:0:0:0:0 | _Complex long double | _Complex long double | | file://:0:0:0:0 | _Complex long double | _Complex long double |
| file://:0:0:0:0 | _Complex std::float16_t | _Complex std::float16_t |
| file://:0:0:0:0 | _Decimal32 | _Decimal32 | | file://:0:0:0:0 | _Decimal32 | _Decimal32 |
| file://:0:0:0:0 | _Decimal64 | _Decimal64 | | file://:0:0:0:0 | _Decimal64 | _Decimal64 |
| file://:0:0:0:0 | _Decimal128 | _Decimal128 | | file://:0:0:0:0 | _Decimal128 | _Decimal128 |

View File

@@ -6,10 +6,13 @@
| _Complex _Float64 | BinaryFloatingPointType, ComplexNumberType | | | | | | _Complex _Float64 | BinaryFloatingPointType, ComplexNumberType | | | | |
| _Complex _Float64x | BinaryFloatingPointType, ComplexNumberType | | | | | | _Complex _Float64x | BinaryFloatingPointType, ComplexNumberType | | | | |
| _Complex _Float128 | BinaryFloatingPointType, ComplexNumberType | | | | | | _Complex _Float128 | BinaryFloatingPointType, ComplexNumberType | | | | |
| _Complex __bf16 | BinaryFloatingPointType, ComplexNumberType | | | | |
| _Complex __float128 | BinaryFloatingPointType, ComplexNumberType | | | | | | _Complex __float128 | BinaryFloatingPointType, ComplexNumberType | | | | |
| _Complex __fp16 | BinaryFloatingPointType, ComplexNumberType | | | | |
| _Complex double | BinaryFloatingPointType, ComplexNumberType | | | | | | _Complex double | BinaryFloatingPointType, ComplexNumberType | | | | |
| _Complex float | BinaryFloatingPointType, ComplexNumberType | | | | | | _Complex float | BinaryFloatingPointType, ComplexNumberType | | | | |
| _Complex long double | BinaryFloatingPointType, ComplexNumberType | | | | | | _Complex long double | BinaryFloatingPointType, ComplexNumberType | | | | |
| _Complex std::float16_t | BinaryFloatingPointType, ComplexNumberType | | | | |
| _Decimal32 | Decimal32Type | | | | | | _Decimal32 | Decimal32Type | | | | |
| _Decimal64 | Decimal64Type | | | | | | _Decimal64 | Decimal64Type | | | | |
| _Decimal128 | Decimal128Type | | | | | | _Decimal128 | Decimal128Type | | | | |