constants.uir 2.42 KB
Newer Older
Kunshan Wang's avatar
Kunshan Wang committed
1 2 3 4 5
.typedef @i1  = int<1>
.typedef @i8  = int<8>
.typedef @i16 = int<16>
.typedef @i32 = int<32>
.typedef @i64 = int<64>
6

Kunshan Wang's avatar
Kunshan Wang committed
7 8 9 10
.const @ci8     <@i8>  = 127
.const @ci16    <@i16> = 32767
.const @ci32    <@i32> = 2147483647
.const @ci64    <@i64> = 9223372036854775807
11

Kunshan Wang's avatar
Kunshan Wang committed
12
.const @ci64neg <@i64> = -42
13

Kunshan Wang's avatar
Kunshan Wang committed
14
.const @cio64   <@i64> = 0777
15

Kunshan Wang's avatar
Kunshan Wang committed
16 17 18
.const @cix64   <@i64> = 0x123456789abcdef0
.const @cixovf  <@i64> = 0xffffffffffffffff
.const @cixovf2 <@i64> = 0x8000000000000000
19

Kunshan Wang's avatar
Kunshan Wang committed
20 21
.typedef @float  = float
.typedef @double = double
22

Kunshan Wang's avatar
Kunshan Wang committed
23 24 25 26 27 28 29 30 31 32
.const @cf      <@float>    = 3.14f
.const @cfnan   <@float>    = nanf
.const @cfninf  <@float>    = -inff
.const @cfpinf  <@float>    = +inff
.const @cfbits  <@float>    = bitsf(0x12345678)
.const @cd      <@double>   = 6.28d
.const @cdnan   <@double>   = nand
.const @cdninf  <@double>   = -infd
.const @cdpinf  <@double>   = +infd
.const @cdbits  <@double>   = bitsd(0xfedcba9876543210)
33

Kunshan Wang's avatar
Kunshan Wang committed
34
.typedef @s1 = struct<@i64 @double>
Kunshan Wang's avatar
Kunshan Wang committed
35
.const @cs1 <@s1> = {@ci64 @cd}
36

Kunshan Wang's avatar
Kunshan Wang committed
37 38
.typedef @s2 = struct<@float @i64>
.const @cs2 <@s2> = {@cf @ci64}
39

Kunshan Wang's avatar
Kunshan Wang committed
40
.typedef @s3 = struct<@double @s2 @i32>
Kunshan Wang's avatar
Kunshan Wang committed
41 42 43
.const @cs3 <@s3> = {@cd @cs2 @ci32}

.typedef @void = void
44

Kunshan Wang's avatar
Kunshan Wang committed
45 46 47
.typedef @rv        = ref<@void>
.typedef @irv       = iref<@void>
.typedef @wrv       = weakref<@void>
Kunshan Wang's avatar
Kunshan Wang committed
48
.funcsig @sig0      = () -> ()
Kunshan Wang's avatar
Kunshan Wang committed
49 50 51
.typedef @func0     = funcref <@sig0>
.typedef @thread    = threadref
.typedef @stack     = stackref
52

Kunshan Wang's avatar
Kunshan Wang committed
53 54 55 56 57
.const @cr  <@rv>       = NULL
.const @cir <@irv>      = NULL
.const @cfu <@func0>    = NULL
.const @cth <@thread>   = NULL
.const @cst <@stack>    = NULL
Kunshan Wang's avatar
Kunshan Wang committed
58 59

.typedef @4xfloat   = vector <@float 4>
Kunshan Wang's avatar
Kunshan Wang committed
60
.typedef @4xi32     = vector <@i32 4>
Kunshan Wang's avatar
Kunshan Wang committed
61 62 63 64 65 66
.typedef @2xdouble  = vector <@double 2>

.const @F_1 <@float> = 1.0f
.const @F_2 <@float> = 2.0f
.const @F_3 <@float> = 3.0f
.const @F_4 <@float> = 4.0f
67 68 69 70
.const @I32_1 <@i32> = 1
.const @I32_2 <@i32> = 2
.const @I32_3 <@i32> = 3
.const @I32_4 <@i32> = 4
Kunshan Wang's avatar
Kunshan Wang committed
71 72 73
.const @D_1 <@float> = 1.0d
.const @D_2 <@float> = 2.0d

Kunshan Wang's avatar
Kunshan Wang committed
74 75 76
.const @cv4f <@4xfloat>  = {@F_1 @F_2 @F_3 @F_4}
.const @cv4i <@4xi32>    = {@I32_1 @I32_2 @I32_3 @I32_4}
.const @cv4d <@2xdouble> = {@D_1 @D_2}
Kunshan Wang's avatar
Kunshan Wang committed
77 78 79 80 81

.global @gi64 <@i64>
.funcdecl @fdummy <@sig0>

.typedef @ii64 = iref<@i64>
Kunshan Wang's avatar
Kunshan Wang committed
82
.typedef @sgf_t = struct<@ii64 @func0>
Kunshan Wang's avatar
Kunshan Wang committed
83 84

.const @sgf <@sgf_t> = {@gi64 @fdummy}
85

Kunshan Wang's avatar
Kunshan Wang committed
86 87
.typedef @i32_p = uptr<@i32>
.typedef @sig0_fp = ufuncptr<@sig0>
88 89 90

.const @I32P_PTR1   <@i32_p>   = 0x123456789abcdef0
.const @SIG0FP_PTR1 <@sig0_fp> = 0xfedcba9876543210
Kunshan Wang's avatar
Kunshan Wang committed
91 92 93

.typedef @i32_3_ary = array<@i32 3>
.const @ary1 <@i32_3_ary> = {@I32_1 @I32_2 @I32_3}