aboutsummaryrefslogtreecommitdiff
path: root/src/check_type.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2019-05-28 20:27:45 +0100
committergingerBill <bill@gingerbill.org>2019-05-28 20:27:45 +0100
commit3d2279fba0b322bd8d82bb43cb21f6f6f00515c5 (patch)
tree3b318dd18172a89f4c424b5fa610347c0851aa2b /src/check_type.cpp
parent2b080dbbc269f2cf9bf4bcc1b67d760c9c02d93f (diff)
Support 128-bit integers `i128` `u128`
Diffstat (limited to 'src/check_type.cpp')
-rw-r--r--src/check_type.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/check_type.cpp b/src/check_type.cpp
index 790cec789..15c621729 100644
--- a/src/check_type.cpp
+++ b/src/check_type.cpp
@@ -1848,6 +1848,13 @@ Type *type_to_abi_compat_param_type(gbAllocator a, Type *original_type) {
// NOTE(bill): Changing the passing parameter value type is to match C's ABI
// IMPORTANT TODO(bill): This only matches the ABI on MSVC at the moment
// SEE: https://msdn.microsoft.com/en-us/library/zthk2dkh.aspx
+
+ if (build_context.word_size == 8) {
+ if (is_type_integer_128bit(original_type)) {
+ return alloc_type_simd_vector(2, t_u64);
+ }
+ }
+
Type *bt = core_type(original_type);
switch (bt->kind) {
// Okay to pass by value (usually)
@@ -1954,6 +1961,12 @@ Type *type_to_abi_compat_result_type(gbAllocator a, Type *original_type) {
}
if (build_context.ODIN_OS == "windows") {
+ if (build_context.word_size == 8) {
+ if (is_type_integer_128bit(single_type)) {
+ return alloc_type_simd_vector(2, t_u64);
+ }
+ }
+
Type *bt = core_type(reduce_tuple_to_single_type(original_type));
// NOTE(bill): This is just reversed engineered from LLVM IR output
switch (bt->kind) {
@@ -1986,6 +1999,13 @@ Type *type_to_abi_compat_result_type(gbAllocator a, Type *original_type) {
// their architectures
}
+ if (is_type_integer_128bit(single_type)) {
+ if (build_context.word_size == 8) {
+ return original_type;
+ }
+ }
+
+
if (new_type != original_type) {
Type *tuple = alloc_type_tuple();
auto variables = array_make<Entity *>(a, 0, 1);
@@ -2012,6 +2032,12 @@ bool abi_compat_return_by_pointer(gbAllocator a, ProcCallingConvention cc, Type
if (build_context.ODIN_OS == "windows") {
+ if (build_context.word_size == 8) {
+ if (is_type_integer_128bit(single_type)) {
+ return false;
+ }
+ }
+
i64 size = 8*type_size_of(abi_return_type);
switch (size) {
case 0:
@@ -2023,7 +2049,14 @@ bool abi_compat_return_by_pointer(gbAllocator a, ProcCallingConvention cc, Type
default:
return true;
}
+ } else {
+ if (is_type_integer_128bit(single_type)) {
+ return build_context.word_size < 8;
+ }
}
+
+
+
return false;
}