Intel encodings for nearest/floor/ceil/trunc.

These floating point rounding operations all use the roundss/roundsd
instructions that are available in SSE 4.1.
This commit is contained in:
Jakob Stoklund Olesen
2017-09-25 14:57:01 -07:00
parent ac343ba92a
commit 6bec5f8507
8 changed files with 216 additions and 14 deletions

View File

@@ -35,10 +35,29 @@ ebb0(v0: f32):
return v1
}
; function %f32_ceil(f32) -> f32
; function %f32_floor(f32) -> f32
; function %f32_trunc(f32) -> f32
; function %f32_nearest (f32) -> f32
function %f32_ceil(f32) -> f32 {
ebb0(v0: f32):
v1 = ceil v0
return v1
}
function %f32_floor(f32) -> f32 {
ebb0(v0: f32):
v1 = floor v0
return v1
}
function %f32_trunc(f32) -> f32 {
ebb0(v0: f32):
v1 = trunc v0
return v1
}
function %f32_nearest (f32) -> f32 {
ebb0(v0: f32):
v1 = nearest v0
return v1
}
; Binary Operations

View File

@@ -32,10 +32,29 @@ ebb0(v0: f64):
return v1
}
; function %f64_ceil(f64) -> f64
; function %f64_floor(f64) -> f64
; function %f64_trunc(f64) -> f64
; function %f64_nearest (f64) -> f64
function %f64_ceil(f64) -> f64 {
ebb0(v0: f64):
v1 = ceil v0
return v1
}
function %f64_floor(f64) -> f64 {
ebb0(v0: f64):
v1 = floor v0
return v1
}
function %f64_trunc(f64) -> f64 {
ebb0(v0: f64):
v1 = trunc v0
return v1
}
function %f64_nearest (f64) -> f64 {
ebb0(v0: f64):
v1 = nearest v0
return v1
}
; Binary Operations