mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-28 00:02:28 +00:00
parent
32e289b1d8
commit
9367253b4d
15 changed files with 390 additions and 124 deletions
|
@ -17,31 +17,40 @@
|
|||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/macros.internal.h"
|
||||
.source __FILE__
|
||||
|
||||
// Returns largest integral not greater than 𝑥.
|
||||
//
|
||||
// @param 𝑥 is float scalar in low quarter of %xmm0
|
||||
// @return float scalar in low quarter of %xmm0
|
||||
floorf: .leafprologue
|
||||
.profilable
|
||||
movss .LC8(%rip),%xmm1
|
||||
andps %xmm0,%xmm1
|
||||
movss .LC7(%rip),%xmm2
|
||||
comiss %xmm1,%xmm2
|
||||
movss 4f(%rip),%xmm3
|
||||
movss 2f(%rip),%xmm4
|
||||
movaps %xmm0,%xmm2
|
||||
movaps %xmm0,%xmm1
|
||||
andps %xmm3,%xmm2
|
||||
ucomiss %xmm2,%xmm4
|
||||
jbe 1f
|
||||
cvttss2si %xmm0,%eax
|
||||
pxor %xmm1,%xmm1
|
||||
movss .LC3(%rip),%xmm2
|
||||
cvtsi2ss %eax,%xmm1
|
||||
movaps %xmm1,%xmm3
|
||||
cmpnless %xmm0,%xmm3
|
||||
movaps %xmm3,%xmm0
|
||||
andps %xmm2,%xmm0
|
||||
subss %xmm0,%xmm1
|
||||
movaps %xmm1,%xmm0
|
||||
cvttss2sil %xmm0,%eax
|
||||
pxor %xmm2,%xmm2
|
||||
movss 3f(%rip),%xmm4
|
||||
andnps %xmm1,%xmm3
|
||||
cvtsi2ssl %eax,%xmm2
|
||||
movaps %xmm2,%xmm5
|
||||
cmpnless %xmm0,%xmm5
|
||||
movaps %xmm5,%xmm0
|
||||
andps %xmm4,%xmm0
|
||||
subss %xmm0,%xmm2
|
||||
movaps %xmm2,%xmm0
|
||||
orps %xmm3,%xmm0
|
||||
1: .leafepilogue
|
||||
.endfn floorf,globl
|
||||
|
||||
.rodata.cst4
|
||||
.LC3: .float 1.0
|
||||
.LC7: .long 0x4b000000
|
||||
|
||||
2: .long 0x4b000000
|
||||
3: .long 0x3f800000
|
||||
.rodata.cst16
|
||||
.LC8: .long 2147483647,0,0,0
|
||||
4: .long 0x7fffffff
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue