float
SSE4.1 以前の SIMD を使用して床/天井を計算する高速な方法を提案できる人はいますか? float
32 ビット int で表現できない値がある場合など、すべてのコーナー ケースを正しく処理する必要があります。
現在、次のコードに似たものを使用しています (明確にするために asm に変換された C 組み込み関数を使用しています)。
;make many copies of the data
movaps xmm0, [float_value]
movaps xmm1, xmm0
movaps xmm2, xmm0
;check if the value is not too large in magnitude
andps xmm1, [exp_mask]
pcmpgtd xmm1, [max_exp]
;calculate the floor()
cvttps2dq xmm3, xmm2
psrld xmm2, 31
psubd xmm3, xmm2
cvtsq2ps xmm2, xmm3
;combine the results
andps xmm0, xmm1
andnps xmm1, xmm2
orps xmm0, xmm1
float 値が 32 ビット int に対して大きすぎないかどうかを確認するより効率的な方法はありますか?