_mm_ceil_ss
Microsoft Specific
Emits the Streaming SIMD Extensions 4 (SSE4) instruction roundss. This instruction rounds up a single precision floating point value.
__m128 _mm_ceil_ss(
__m128 a,
__m128 b
);
Parameters
[in] a
A 128-bit parameter that contains four 32-bit floating point values.[in] b
A 128-bit parameter that contains a 32-bit floating point value in the low doubleword.
Return value
r0 := CEIL(b0)
r1 := a1
r2 := a2
r3 := a3
Requirements
Intrinsic |
Architecture |
---|---|
_mm_ceil_ss |
x86, x64 |
Header file <smmintrin.h>
Remarks
The return value r and parameters a and b each consist of 128 bits. r0-r3, a0-a3, and b0-b3 are the sequentially ordered 32-bit components of these parameters, where r0, a0, and b0 denote the least significant 32 bits.
This function is implemented as a macro that invokes intrinsic _mm_round_ss with appropriate rounding control.
Before using this intrinsic, software must ensure that the processor supports the instruction.
Example
#include <stdio.h>
#include <smmintrin.h>
int main () {
__m128 a, b;
a.m128_f32[3] = 10.25;
a.m128_f32[2] = -6.5;
a.m128_f32[1] = 16;
a.m128_f32[0] = 0.125;
b.m128_f32[3] = 0;
b.m128_f32[2] = 0;
b.m128_f32[1] = 0;
b.m128_f32[0] = 625.5;
__m128 res = _mm_ceil_ss( a, b );
printf_s("Original a: %10f %10f %10f %10f\nOriginal b: %10f %10f %10f %10f\n",
a.m128_f32[3], a.m128_f32[2], a.m128_f32[1], a.m128_f32[0],
b.m128_f32[3], b.m128_f32[2], b.m128_f32[1], b.m128_f32[0]);
printf_s("Result res: %10f %10f %10f %10f\n",
res.m128_f32[3], res.m128_f32[2], res.m128_f32[1], res.m128_f32[0]);
return 0;
}
Original a: 10.250000 -6.500000 16.000000 0.125000
Original b: 0.000000 0.000000 0.000000 625.500000
Result res: 10.250000 -6.500000 16.000000 626.000000