mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add ctz and popcnt to WasmDialect
This commit is contained in:
parent
c90d3a3558
commit
87557896ed
@ -1,5 +1,8 @@
|
||||
### 0.6.12 (unreleased)
|
||||
|
||||
Language Features:
|
||||
* Wasm backend: Add ``i32.ctz``, ``i64.ctz``, ``i32.popcnt``, and ``i64.popcnt``.
|
||||
|
||||
Compiler Features:
|
||||
* Code Generator: Evaluate ``keccak256`` of string literals at compile-time.
|
||||
|
||||
|
@ -38,13 +38,18 @@ WasmDialect::WasmDialect()
|
||||
"add",
|
||||
"sub",
|
||||
"mul",
|
||||
// TODO: div_s
|
||||
"div_u",
|
||||
// TODO: rem_s
|
||||
"rem_u",
|
||||
"and",
|
||||
"or",
|
||||
"xor",
|
||||
"shl",
|
||||
// TODO: shr_s
|
||||
"shr_u",
|
||||
// TODO: rotl
|
||||
// TODO: rotr
|
||||
})
|
||||
addFunction(t.str() + "." + name, {t, t}, {t});
|
||||
|
||||
@ -52,9 +57,13 @@ WasmDialect::WasmDialect()
|
||||
for (auto const& name: {
|
||||
"eq",
|
||||
"ne",
|
||||
// TODO: lt_s
|
||||
"lt_u",
|
||||
// TODO: gt_s
|
||||
"gt_u",
|
||||
// TODO: le_s
|
||||
"le_u",
|
||||
// TODO: ge_s
|
||||
"ge_u"
|
||||
})
|
||||
addFunction(t.str() + "." + name, {t, t}, {i32});
|
||||
@ -62,8 +71,13 @@ WasmDialect::WasmDialect()
|
||||
addFunction("i32.eqz", {i32}, {i32});
|
||||
addFunction("i64.eqz", {i64}, {i32});
|
||||
|
||||
addFunction("i32.clz", {i32}, {i32});
|
||||
addFunction("i64.clz", {i64}, {i64});
|
||||
for (auto t: types)
|
||||
for (auto const& name: {
|
||||
"clz",
|
||||
"ctz",
|
||||
"popcnt",
|
||||
})
|
||||
addFunction(t.str() + "." + name, {t}, {t});
|
||||
|
||||
addFunction("i32.wrap_i64", {i64}, {i32});
|
||||
|
||||
@ -73,6 +87,7 @@ WasmDialect::WasmDialect()
|
||||
m_functions["i32.store"_yulstring].sideEffects.invalidatesStorage = false;
|
||||
addFunction("i64.store", {i32, i64}, {}, false);
|
||||
m_functions["i64.store"_yulstring].sideEffects.invalidatesStorage = false;
|
||||
// TODO: add i32.store16, i64.store8, i64.store16, i64.store32
|
||||
|
||||
addFunction("i32.store8", {i32, i32}, {}, false);
|
||||
m_functions["i32.store8"_yulstring].sideEffects.invalidatesStorage = false;
|
||||
@ -89,6 +104,7 @@ WasmDialect::WasmDialect()
|
||||
m_functions["i64.load"_yulstring].sideEffects.invalidatesMemory = false;
|
||||
m_functions["i64.load"_yulstring].sideEffects.sideEffectFree = true;
|
||||
m_functions["i64.load"_yulstring].sideEffects.sideEffectFreeIfNoMSize = true;
|
||||
// TODO: add i32.load8, i32.load16, i64.load8, i64.load16, i64.load32
|
||||
|
||||
// Drop is actually overloaded for all types, but Yul does not support that.
|
||||
// Because of that, we introduce "i32.drop" and "i64.drop".
|
||||
|
Loading…
Reference in New Issue
Block a user