Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct handling of NaN values in I[S/D]AMIN and I[S/D]AMAX to "return position of first NaN" #4191

Open
wants to merge 11 commits into
base: develop
Choose a base branch
from
Prev Previous commit
Next Next commit
Add NaN tests
  • Loading branch information
martin-frbg authored Aug 14, 2023
commit 43f5e4251b58124600e051ac451d10d367257c5f
156 changes: 155 additions & 1 deletion kernel/x86_64/iamax_sse.S
Original file line number Diff line number Diff line change
@@ -93,6 +93,10 @@
addq INCX, X
decq M
shufps $0, %xmm0, %xmm0
incq RET
comiss %xmm0, %xmm0
jp .L999
decq RET
#ifdef USE_ABS
andps %xmm15, %xmm0
#endif
@@ -254,6 +258,10 @@
decq M
addq $SIZE, X

incq RET
comiss %xmm1, %xmm1
jp .L998
decq RET
#ifdef USE_ABS
andps %xmm15, %xmm1
#endif
@@ -268,6 +276,14 @@

movss 0 * SIZE(X), %xmm1
movss 1 * SIZE(X), %xmm2
incq RET
comiss %xmm1, %xmm1
jp .L998
incq RET
comiss %xmm2, %xmm2
jp .L998
decq RET
decq RET

subq $2, M
addq $2 * SIZE, X
@@ -332,6 +348,31 @@
movss 5 * SIZE(X), %xmm6
movss 6 * SIZE(X), %xmm7
movss 7 * SIZE(X), %xmm8
incq RET
comiss %xmm1, %xmm1
jp .L998
incq RET
comiss %xmm2, %xmm2
jp .L998
incq RET
comiss %xmm3, %xmm3
jp .L998
incq RET
comiss %xmm4, %xmm4
jp .L998
incq RET
comiss %xmm5, %xmm5
jp .L998
incq RET
comiss %xmm6, %xmm6
jp .L998
incq RET
comiss %xmm7, %xmm7
jp .L998
incq RET
comiss %xmm8, %xmm8
jp .L998
subq $8, RET
#ifdef USE_ABS
andps %xmm15, %xmm1
andps %xmm15, %xmm2
@@ -378,6 +419,19 @@
movss 1 * SIZE(X), %xmm2
movss 2 * SIZE(X), %xmm3
movss 3 * SIZE(X), %xmm4
incq RET
comiss %xmm1, %xmm1
jp .L998
incq RET
comiss %xmm2, %xmm2
jp .L998
incq RET
comiss %xmm3, %xmm3
jp .L998
incq RET
comiss %xmm4, %xmm4
jp .L998
subq $4, RET
#ifdef USE_ABS
andps %xmm15, %xmm1
andps %xmm15, %xmm2
@@ -405,6 +459,13 @@

movss 0 * SIZE(X), %xmm1
movss 1 * SIZE(X), %xmm2
incq RET
comiss %xmm1, %xmm1
jp .L998
incq RET
comiss %xmm2, %xmm2
jp .L998
subq $2, RET
#ifdef USE_ABS
andps %xmm15, %xmm1
andps %xmm15, %xmm2
@@ -593,6 +654,31 @@
movss 5 * SIZE(X), %xmm6
movss 6 * SIZE(X), %xmm7
movss 7 * SIZE(X), %xmm8
incq RET
comiss %xmm1, %xmm1
jp .L998
incq RET
comiss %xmm2, %xmm2
jp .L998
incq RET
comiss %xmm3, %xmm3
jp .L998
incq RET
comiss %xmm4, %xmm4
jp .L998
incq RET
comiss %xmm5, %xmm5
jp .L998
incq RET
comiss %xmm6, %xmm6
jp .L998
incq RET
comiss %xmm7, %xmm7
jp .L998
incq RET
comiss %xmm8, %xmm8
jp .L998
subq $8, RET
#ifdef USE_ABS
andps %xmm15, %xmm1
andps %xmm15, %xmm2
@@ -639,6 +725,19 @@
movss 1 * SIZE(X), %xmm2
movss 2 * SIZE(X), %xmm3
movss 3 * SIZE(X), %xmm4
incq RET
comiss %xmm1, %xmm1
jp .L998
incq RET
comiss %xmm2, %xmm2
jp .L998
incq RET
comiss %xmm3, %xmm3
jp .L998
incq RET
comiss %xmm4, %xmm4
jp .L998
subq $4, RET
#ifdef USE_ABS
andps %xmm15, %xmm1
andps %xmm15, %xmm2
@@ -666,6 +765,13 @@

movss 0 * SIZE(X), %xmm1
movss 1 * SIZE(X), %xmm2
incq RET
comiss %xmm1, %xmm1
jp .L998
incq RET
comiss %xmm2, %xmm2
jp .L998
subq $2, RET
#ifdef USE_ABS
andps %xmm15, %xmm1
andps %xmm15, %xmm2
@@ -885,6 +991,31 @@
movss 0 * SIZE(X), %xmm2
subq INCX, X
movss 0 * SIZE(X), %xmm1
incq RET
comiss %xmm1, %xmm1
jp .L998
incq RET
comiss %xmm2, %xmm2
jp .L998
incq RET
comiss %xmm3, %xmm3
jp .L998
incq RET
comiss %xmm4, %xmm4
jp .L998
incq RET
comiss %xmm5, %xmm5
jp .L998
incq RET
comiss %xmm6, %xmm6
jp .L998
incq RET
comiss %xmm7, %xmm7
jp .L998
incq RET
comiss %xmm8, %xmm8
jp .L998
subq $8, RET
#ifdef USE_ABS
andps %xmm15, %xmm1
andps %xmm15, %xmm2
@@ -932,7 +1063,19 @@
addq INCX, X
movss 0 * SIZE(X), %xmm4
addq INCX, X

incq RET
comiss %xmm1, %xmm1
jp .L998
incq RET
comiss %xmm2, %xmm2
jp .L998
incq RET
comiss %xmm3, %xmm3
jp .L998
incq RET
comiss %xmm4, %xmm4
jp .L998
subq $4, RET
#ifdef USE_ABS
andps %xmm15, %xmm1
andps %xmm15, %xmm2
@@ -961,6 +1104,13 @@
addq INCX, X
movss 0 * SIZE(X), %xmm2
addq INCX, X
incq RET
comiss %xmm1, %xmm1
jp .L998
incq RET
comiss %xmm2, %xmm2
jp .L998
subq $2, RET
#ifdef USE_ABS
andps %xmm15, %xmm1
andps %xmm15, %xmm2
@@ -982,5 +1132,9 @@

ret

.L998:
// incq RET
jmp .L999

EPILOGUE