Files
revive/crates/resolc/src/tests/data/solidity/large_div_rem.sol
T
kvpanch 6549a4f825 Strip minsize attribute from functions with large div/rem (#390)
That's a workaround to avoid LLVM backend crash while selecting
instruction for 256-bit integer division.
The workaround needs to be removed after we switch to newest inkwell
that has a fix in RISC-V backend

---------

Signed-off-by: kvp <mammal_windier8j@icloud.com>
2025-10-21 10:35:40 +02:00

42 lines
814 B
Solidity

// SPDX-License-Identifier: MIT
pragma solidity ^0.8;
contract LargeDivRem {
function rem_2(int n) public pure returns (int q) {
assembly {
q := smod(n, 2)
}
}
function div_2(int n) public pure returns (int q) {
assembly {
q := sdiv(n, 2)
}
}
function rem_7(int n) public pure returns (int q) {
assembly {
q := smod(n, 7)
}
}
function div_7(int n) public pure returns (int q) {
assembly {
q := sdiv(n, 2)
}
}
function rem_k(int n, int k) public pure returns (int q) {
assembly {
q := smod(n, k)
}
}
function div_k(int n, int k) public pure returns (int q) {
assembly {
q := sdiv(n, k)
}
}
}