ZXFoundation™ 26h2
Loading...
Searching...
No Matches
builtins.cxxm File Reference

Compiler-RT builtins for freestanding — provides 128-bit integer runtime functions that clang emits for u128 arithmetic on s390x. More...

Include dependency graph for builtins.cxxm:

Data Structures

struct  detail::u128_pair

Functions

static auto detail::combine (u64 hi, u64 lo) noexcept -> u128
 Combine two u64 halves into a u128.
 declscope (C)
static auto detail::split (u128 v) noexcept -> u128_pair
 Split a u128 into high and low 64-bit halves.

Detailed Description

Compiler-RT builtins for freestanding — provides 128-bit integer runtime functions that clang emits for u128 arithmetic on s390x.

SPDX-License-Identifier: Apache-2.0

Function Documentation

◆ declscope()

declscope ( C )

128-bit logical shift left.

128-bit logical shift right.

128-bit arithmetic shift right.

Signed 128-bit division — __divti3.

clang emits this for i128 division. We compute the magnitude quotient via __udivti3 and apply the XOR-of-signs rule to the result. The INT128_MIN / -1 overflow is guarded (returns INT128_MIN) so the operation is total, matching the freestanding "no trap" expectation for this kernel runtime.

Signed 128-bit modulo — __modti3.

clang emits this for i128 remainder. The magnitude is computed via __umodti3 and the sign of the result follows the dividend (C truncated-toward-zero convention).

128-bit multiply (needed by some codegen paths).