On 64-bit targets i128 maps directly to __int128 but on targets that don't support it (seeming all <64-bit targets excluding wasm) that cannot be done. A C compiler would give you an error like __int128 is not supported on this target but we can't do that since LLVM's compiler-rt ABI requires 128-bit ints for functions like __divti3.
One option would be to make it match C23's _BitInt(128) but that is not always compatible with the 128-bit tu_int LLVM uses for compiler-rt.
Possible solutions are:
- forbid
i128 on targets that don't support __int128, add special c_tu_int type that matches compiler-rt's tu_int
- make
i128 match _BitInt(128) (and make 1-128 bit integers C ABI compatible) and move the compiler-rt call lowering to our own LLVM backend
- make
i128 always match compiler-rt's tu_int, do not support _BitInt
On 64-bit targets
i128maps directly to__int128but on targets that don't support it (seeming all <64-bit targets excluding wasm) that cannot be done. A C compiler would give you an error like__int128 is not supported on this targetbut we can't do that since LLVM's compiler-rt ABI requires 128-bit ints for functions like__divti3.One option would be to make it match C23's
_BitInt(128)but that is not always compatible with the 128-bittu_intLLVM uses for compiler-rt.Possible solutions are:
i128on targets that don't support__int128, add specialc_tu_inttype that matches compiler-rt'stu_inti128match_BitInt(128)(and make 1-128 bit integers C ABI compatible) and move the compiler-rt call lowering to our own LLVM backendi128always match compiler-rt'stu_int, do not support_BitInt