Skip to content

Commit

Permalink
update intrinsics name (#652)
Browse files Browse the repository at this point in the history
* update intrinsics name

fix

fix

* format code

* update mbti

---------

Co-authored-by: Bao Zhiyuan <baozhiyuan@idea.edu.cn>
  • Loading branch information
Yoorkin and Bao Zhiyuan committed Jul 5, 2024
1 parent 8b5671b commit 3d6b4d3
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 31 deletions.
2 changes: 1 addition & 1 deletion builtin/builtin.mbti
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,6 @@ impl Int64 {
ctz(Int64) -> Int
debug_write(Int64, Buffer) -> Unit
default() -> Int64
extend_uint(UInt) -> Int64
land(Int64, Int64) -> Int64
lnot(Int64) -> Int64
lor(Int64, Int64) -> Int64
Expand Down Expand Up @@ -300,6 +299,7 @@ impl UInt {
}
impl UInt64 {
compare(UInt64, UInt64) -> Int
extend_uint(UInt) -> UInt64
op_add(UInt64, UInt64) -> UInt64
op_div(UInt64, UInt64) -> UInt64
op_equal(UInt64, UInt64) -> Bool
Expand Down
4 changes: 2 additions & 2 deletions builtin/int64.js.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -425,8 +425,8 @@ pub fn Int64::to_double(self : Int64) -> Double {
MyInt64::from_int64(self).to_double()
}

pub fn Int64::extend_uint(value : UInt) -> Int64 {
MyInt64::extend_i32_u(value.to_int()).to_int64()
pub fn UInt64::extend_uint(value : UInt) -> UInt64 {
MyInt64::extend_i32_u(value.to_int()).to_uint64()
}

pub fn Int64::reinterpret_as_double(self : Int64) -> Double {
Expand Down
8 changes: 4 additions & 4 deletions builtin/int64.wasm-gc.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,19 @@ pub fn Int64::to_int(self : Int64) -> Int = "%i64_to_i32"

pub fn Int64::to_double(self : Int64) -> Double = "%i64_to_f64"

pub fn Int64::extend_uint(val : UInt) -> Int64 = "%i32_to_i64_u"

pub fn Int64::reinterpret_as_double(self : Int64) -> Double = "%i64_to_f64_reinterpret"

pub fn UInt64::trunc_double(val : Double) -> UInt64 = "%f64_to_i64_u"
pub fn UInt64::trunc_double(val : Double) -> UInt64 = "%f64.to_u64"

pub fn UInt64::extend_uint(val : UInt) -> UInt64 = "%u32.to_u64"

pub fn Int::to_int64(self : Int) -> Int64 = "%i32_to_i64"

pub fn Double::to_int64(self : Double) -> Int64 = "%f64_to_i64"

pub fn Double::reinterpret_as_i64(self : Double) -> Int64 = "%f64_to_i64_reinterpret"

pub fn Double::convert_uint64(val : UInt64) -> Double = "%i64_to_f64_u"
pub fn Double::convert_uint64(val : UInt64) -> Double = "%u64.to_f64"

pub fn Int64::to_uint64(self : Int64) -> UInt64 = "%i64.to_u64_reinterpret"

Expand Down
8 changes: 4 additions & 4 deletions builtin/int64.wasm.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,19 @@ pub fn Int64::to_int(self : Int64) -> Int = "%i64_to_i32"

pub fn Int64::to_double(self : Int64) -> Double = "%i64_to_f64"

pub fn Int64::extend_uint(val : UInt) -> Int64 = "%i32_to_i64_u"

pub fn Int64::reinterpret_as_double(self : Int64) -> Double = "%i64_to_f64_reinterpret"

pub fn UInt64::trunc_double(val : Double) -> UInt64 = "%f64_to_i64_u"
pub fn UInt64::extend_uint(val : UInt) -> UInt64 = "%u32.to_u64"

pub fn UInt64::trunc_double(val : Double) -> UInt64 = "%f64.to_u64"

pub fn Int::to_int64(self : Int) -> Int64 = "%i32_to_i64"

pub fn Double::to_int64(self : Double) -> Int64 = "%f64_to_i64"

pub fn Double::reinterpret_as_i64(self : Double) -> Int64 = "%f64_to_i64_reinterpret"

pub fn Double::convert_uint64(val : UInt64) -> Double = "%i64_to_f64_u"
pub fn Double::convert_uint64(val : UInt64) -> Double = "%u64.to_f64"

pub fn Int64::to_uint64(self : Int64) -> UInt64 = "%i64.to_u64_reinterpret"

Expand Down
4 changes: 2 additions & 2 deletions builtin/intrinsics.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ pub fn Int::default() -> Int = "%i32_default"

pub fn Int::to_double(self : Int) -> Double = "%i32_to_f64"

pub fn UInt::trunc_double(val : Double) -> UInt = "%f64_to_i32_u"
pub fn UInt::trunc_double(val : Double) -> UInt = "%f64.to_u32"

pub fn Int::to_uint(self : Int) -> UInt = "%i32.to_u32_reinterpret"

Expand Down Expand Up @@ -113,7 +113,7 @@ pub fn Double::default() -> Double = "%f64_default"

pub fn Double::to_int(self : Double) -> Int = "%f64_to_i32"

pub fn Double::convert_uint(val : UInt) -> Double = "%i32_to_f64_u"
pub fn Double::convert_uint(val : UInt) -> Double = "%u32.to_f64"

// Char primitive ops

Expand Down
36 changes: 18 additions & 18 deletions double/ryu.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -54,31 +54,31 @@ fn umul128(a : Int64, b : Int64) -> (Int64, Int64) {
let aHi : Int = a.lsr(32).to_int()
let bLo : Int = b.to_int()
let bHi : Int = b.lsr(32).to_int()
let b00 : Int64 = Int64::extend_uint(aLo.to_uint()) * Int64::extend_uint(
bLo.to_uint(),
)
let b01 : Int64 = Int64::extend_uint(aLo.to_uint()) * Int64::extend_uint(
bHi.to_uint(),
)
let b10 : Int64 = Int64::extend_uint(aHi.to_uint()) * Int64::extend_uint(
bLo.to_uint(),
)
let b11 : Int64 = Int64::extend_uint(aHi.to_uint()) * Int64::extend_uint(
bHi.to_uint(),
)
let b00 : Int64 = (UInt64::extend_uint(aLo.to_uint()) * UInt64::extend_uint(
bLo.to_uint(),
)).to_int64()
let b01 : Int64 = (UInt64::extend_uint(aLo.to_uint()) * UInt64::extend_uint(
bHi.to_uint(),
)).to_int64()
let b10 : Int64 = (UInt64::extend_uint(aHi.to_uint()) * UInt64::extend_uint(
bLo.to_uint(),
)).to_int64()
let b11 : Int64 = (UInt64::extend_uint(aHi.to_uint()) * UInt64::extend_uint(
bHi.to_uint(),
)).to_int64()
let b00Lo : Int = b00.to_int()
let b00Hi : Int = b00.lsr(32).to_int()
let mid1 : Int64 = b10 + Int64::extend_uint(b00Hi.to_uint())
let mid1 : Int64 = b10 + UInt64::extend_uint(b00Hi.to_uint()).to_int64()
let mid1Lo : Int = mid1.to_int()
let mid1Hi : Int = mid1.lsr(32).to_int()
let mid2 : Int64 = b01 + Int64::extend_uint(mid1Lo.to_uint())
let mid2 : Int64 = b01 + UInt64::extend_uint(mid1Lo.to_uint()).to_int64()
let mid2Lo : Int = mid2.to_int()
let mid2Hi : Int = mid2.lsr(32).to_int()
let pHi : Int64 = b11 + Int64::extend_uint(mid1Hi.to_uint()) + Int64::extend_uint(
let pHi : Int64 = b11 + UInt64::extend_uint(mid1Hi.to_uint()).to_int64() + UInt64::extend_uint(
mid2Hi.to_uint(),
)
let pLo : Int64 = Int64::extend_uint(mid2Lo.to_uint()).lsl(32).lor(
Int64::extend_uint(b00Lo.to_uint()),
).to_int64()
let pLo : Int64 = UInt64::extend_uint(mid2Lo.to_uint()).to_int64().lsl(32).lor(
UInt64::extend_uint(b00Lo.to_uint()).to_int64(),
)
(pLo, pHi)
}
Expand Down

0 comments on commit 3d6b4d3

Please sign in to comment.