1
- From 05d931244a575f3d03d8c7ff409d539e0cc6d154 Mon Sep 17 00:00:00 2001
1
+ From f41a659255180e29f57f48d6fe38a552f4dda0a2 Mon Sep 17 00:00:00 2001
2
2
From: Antoni Boucher <
[email protected] >
3
3
Date: Mon, 10 May 2021 19:43:02 -0400
4
4
Subject: [PATCH] Add support for sized integer types, including 128-bit
@@ -13,6 +13,7 @@ Subject: [PATCH] Add support for sized integer types, including 128-bit
13
13
GCC_JIT_TYPE_UINT32_T, GCC_JIT_TYPE_UINT64_T,
14
14
GCC_JIT_TYPE_UINT128_T, GCC_JIT_TYPE_INT8_T, GCC_JIT_TYPE_INT16_T,
15
15
GCC_JIT_TYPE_INT32_T, GCC_JIT_TYPE_INT64_T, GCC_JIT_TYPE_INT128_T.
16
+ * jit-builtins.c: Add support for BT_UINT128.
16
17
* jit-playback.c: Add support for the sized integer types.
17
18
* jit-recording.c: Add support for the sized integer types.
18
19
* libgccjit.h (GCC_JIT_TYPE_UINT8_T, GCC_JIT_TYPE_UINT16_T,
@@ -25,11 +26,12 @@ Subject: [PATCH] Add support for sized integer types, including 128-bit
25
26
* jit.dg/test-types.c: Add tests for sized integer types.
26
27
---
27
28
gcc/jit/docs/topics/types.rst | 10 +++
29
+ gcc/jit/jit-builtins.c | 1 +
28
30
gcc/jit/jit-playback.c | 21 ++++++
29
- gcc/jit/jit-recording.c | 73 ++++++++++++++++++++
31
+ gcc/jit/jit-recording.c | 77 + ++++++++++++++++++++
30
32
gcc/jit/libgccjit.h | 11 +++
31
33
gcc/testsuite/jit.dg/test-types.c | 111 ++++++++++++++++++++++++++++++
32
- 5 files changed, 226 insertions(+)
34
+ 6 files changed, 231 insertions(+)
33
35
34
36
diff --git a/gcc/jit/docs/topics/types.rst b/gcc/jit/docs/topics/types.rst
35
37
index 831f11b679a..68accacca45 100644
@@ -52,6 +54,18 @@ index 831f11b679a..68accacca45 100644
52
54
:c:data:`GCC_JIT_TYPE_FLOAT`
53
55
:c:data:`GCC_JIT_TYPE_DOUBLE`
54
56
:c:data:`GCC_JIT_TYPE_LONG_DOUBLE`
57
+ diff --git a/gcc/jit/jit-builtins.c b/gcc/jit/jit-builtins.c
58
+ index 1ea96f4e025..27f3eec3e54 100644
59
+ --- a/gcc/jit/jit-builtins.c
60
+ +++ b/gcc/jit/jit-builtins.c
61
+ @@ -483,6 +483,7 @@ builtins_manager::make_primitive_type (enum jit_builtin_type type_id)
62
+ case BT_UINT16: return m_ctxt->get_int_type (2, false);
63
+ case BT_UINT32: return m_ctxt->get_int_type (4, false);
64
+ case BT_UINT64: return m_ctxt->get_int_type (8, false);
65
+ + case BT_UINT128: return m_ctxt->get_int_type (16, false);
66
+ // case BT_WORD:
67
+ // case BT_UNWINDWORD:
68
+ case BT_FLOAT: return m_ctxt->get_type (GCC_JIT_TYPE_FLOAT);
55
69
diff --git a/gcc/jit/jit-playback.c b/gcc/jit/jit-playback.c
56
70
index c6136301243..40630aa1ab8 100644
57
71
--- a/gcc/jit/jit-playback.c
@@ -85,10 +99,21 @@ index c6136301243..40630aa1ab8 100644
85
99
return long_integer_type_node;
86
100
case GCC_JIT_TYPE_UNSIGNED_LONG:
87
101
diff --git a/gcc/jit/jit-recording.c b/gcc/jit/jit-recording.c
88
- index 117ff70114c..b67ae8bfb78 100644
102
+ index 117ff70114c..3848e5da138 100644
89
103
--- a/gcc/jit/jit-recording.c
90
104
+++ b/gcc/jit/jit-recording.c
91
- @@ -2247,6 +2247,18 @@ recording::memento_of_get_type::get_size ()
105
+ @@ -822,6 +822,10 @@ recording::context::get_int_type (int num_bytes, int is_signed)
106
+ return get_type (is_signed
107
+ ? GCC_JIT_TYPE_LONG_LONG
108
+ : GCC_JIT_TYPE_UNSIGNED_LONG_LONG);
109
+ + if (num_bits == 128)
110
+ + return get_type (is_signed
111
+ + ? GCC_JIT_TYPE_INT128_T
112
+ + : GCC_JIT_TYPE_UINT128_T);
113
+
114
+ /* Some other size, not corresponding to the C int types. */
115
+ /* To be written: support arbitrary other sizes, sharing by
116
+ @@ -2247,6 +2251,18 @@ recording::memento_of_get_type::get_size ()
92
117
case GCC_JIT_TYPE_UNSIGNED_LONG_LONG:
93
118
size = LONG_LONG_TYPE_SIZE;
94
119
break;
@@ -107,7 +132,7 @@ index 117ff70114c..b67ae8bfb78 100644
107
132
case GCC_JIT_TYPE_FLOAT:
108
133
size = FLOAT_TYPE_SIZE;
109
134
break;
110
- @@ -2295,6 +2307 ,16 @@ recording::memento_of_get_type::dereference ()
135
+ @@ -2295,6 +2311 ,16 @@ recording::memento_of_get_type::dereference ()
111
136
case GCC_JIT_TYPE_UNSIGNED_LONG:
112
137
case GCC_JIT_TYPE_LONG_LONG:
113
138
case GCC_JIT_TYPE_UNSIGNED_LONG_LONG:
@@ -124,7 +149,7 @@ index 117ff70114c..b67ae8bfb78 100644
124
149
case GCC_JIT_TYPE_FLOAT:
125
150
case GCC_JIT_TYPE_DOUBLE:
126
151
case GCC_JIT_TYPE_LONG_DOUBLE:
127
- @@ -2347,6 +2369 ,16 @@ recording::memento_of_get_type::is_int () const
152
+ @@ -2347,6 +2373 ,16 @@ recording::memento_of_get_type::is_int () const
128
153
case GCC_JIT_TYPE_UNSIGNED_LONG:
129
154
case GCC_JIT_TYPE_LONG_LONG:
130
155
case GCC_JIT_TYPE_UNSIGNED_LONG_LONG:
@@ -141,7 +166,7 @@ index 117ff70114c..b67ae8bfb78 100644
141
166
return true;
142
167
143
168
case GCC_JIT_TYPE_FLOAT:
144
- @@ -2400,6 +2432 ,16 @@ recording::memento_of_get_type::is_float () const
169
+ @@ -2400,6 +2436 ,16 @@ recording::memento_of_get_type::is_float () const
145
170
case GCC_JIT_TYPE_UNSIGNED_LONG:
146
171
case GCC_JIT_TYPE_LONG_LONG:
147
172
case GCC_JIT_TYPE_UNSIGNED_LONG_LONG:
@@ -158,7 +183,7 @@ index 117ff70114c..b67ae8bfb78 100644
158
183
return false;
159
184
160
185
case GCC_JIT_TYPE_FLOAT:
161
- @@ -2453,6 +2495 ,16 @@ recording::memento_of_get_type::is_bool () const
186
+ @@ -2453,6 +2499 ,16 @@ recording::memento_of_get_type::is_bool () const
162
187
case GCC_JIT_TYPE_UNSIGNED_LONG:
163
188
case GCC_JIT_TYPE_LONG_LONG:
164
189
case GCC_JIT_TYPE_UNSIGNED_LONG_LONG:
@@ -175,7 +200,7 @@ index 117ff70114c..b67ae8bfb78 100644
175
200
return false;
176
201
177
202
case GCC_JIT_TYPE_FLOAT:
178
- @@ -2511,6 +2563 ,17 @@ static const char * const get_type_strings[] = {
203
+ @@ -2511,6 +2567 ,17 @@ static const char * const get_type_strings[] = {
179
204
"long long", /* GCC_JIT_TYPE_LONG_LONG */
180
205
"unsigned long long", /* GCC_JIT_TYPE_UNSIGNED_LONG_LONG */
181
206
@@ -193,7 +218,7 @@ index 117ff70114c..b67ae8bfb78 100644
193
218
"float", /* GCC_JIT_TYPE_FLOAT */
194
219
"double", /* GCC_JIT_TYPE_DOUBLE */
195
220
"long double", /* GCC_JIT_TYPE_LONG_DOUBLE */
196
- @@ -2551,6 +2614 ,16 @@ static const char * const get_type_enum_strings[] = {
221
+ @@ -2551,6 +2618 ,16 @@ static const char * const get_type_enum_strings[] = {
197
222
"GCC_JIT_TYPE_UNSIGNED_LONG",
198
223
"GCC_JIT_TYPE_LONG_LONG",
199
224
"GCC_JIT_TYPE_UNSIGNED_LONG_LONG",
0 commit comments