Changeset 96279 in vbox
- Timestamp:
- Aug 18, 2022 12:07:28 AM (2 years ago)
- Location:
- trunk/src/VBox/Runtime
- Files:
-
- 3 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/Makefile.kmk
r96271 r96279 1937 1937 common/math/log.asm \ 1938 1938 common/math/logf.asm \ 1939 common/math/log2.asm \ 1940 common/math/log2f.asm \ 1939 1941 common/math/llrint.asm \ 1940 1942 common/math/llrintf.asm \ … … 2008 2010 common/math/log.asm \ 2009 2011 common/math/logf.asm \ 2012 common/math/log2.asm \ 2013 common/math/log2f.asm \ 2010 2014 common/math/llrint.asm \ 2011 2015 common/math/llrintf.asm \ -
trunk/src/VBox/Runtime/common/math/log2f.asm
r96276 r96279 1 1 ; $Id$ 2 2 ;; @file 3 ; IPRT - No-CRT log2 - AMD64 & X86.3 ; IPRT - No-CRT log2f - AMD64 & X86. 4 4 ; 5 5 … … 36 36 37 37 ;; 38 ; Compute the log2 of rd38 ; Compute the log2f of rf 39 39 ; @returns st(0) / xmm0 40 ; @param r d[xSP + xCB*2] / xmm041 RT_NOCRT_BEGINPROC log2 40 ; @param rf [xSP + xCB*2] / xmm0 41 RT_NOCRT_BEGINPROC log2f 42 42 push xBP 43 43 SEH64_PUSH_xBP … … 52 52 ; 53 53 %ifdef RT_ARCH_AMD64 54 movs d[xBP - 10h], xmm055 fld qword [xBP - 10h]56 %else 57 fld qword [xBP + xCB*2]54 movss [xBP - 10h], xmm0 55 fld dword [xBP - 10h] 56 %else 57 fld dword [xBP + xCB*2] 58 58 %endif 59 59 … … 118 118 .return_val: 119 119 %ifdef RT_ARCH_AMD64 120 fstp qword [xBP - 10h]121 movs dxmm0, [xBP - 10h]120 fstp dword [xBP - 10h] 121 movss xmm0, [xBP - 10h] 122 122 %endif 123 123 .return: … … 153 153 ; Load NaN 154 154 %ifdef RT_ARCH_AMD64 155 movs d xmm0, [.s_r64NaN xWrtRIP]156 %else 157 fld qword [.s_r64NaN xWrtRIP]155 movss xmm0, [.s_r32NaN xWrtRIP] 156 %else 157 fld dword [.s_r32NaN xWrtRIP] 158 158 %endif 159 159 jmp .return … … 179 179 ; Load +Inf 180 180 %ifdef RT_ARCH_AMD64 181 movs d xmm0, [.s_r64MinusInf xWrtRIP]182 %else 183 fld qword [.s_r64MinusInf xWrtRIP]181 movss xmm0, [.s_r32MinusInf xWrtRIP] 182 %else 183 fld dword [.s_r32MinusInf xWrtRIP] 184 184 %endif 185 185 jmp .return … … 210 210 .s_r64AbsFyL2xP1InputMax: 211 211 dq 1.292 212 ;.s_r64AbsFyL2xP1Range: 213 ; dq 0.292 214 .s_r64MinusInf: 215 dq RTFLOAT64U_INF_MINUS 216 .s_r64NaN: 217 dq RTFLOAT64U_QNAN_MINUS 218 ENDPROC RT_NOCRT(log2) 219 212 .s_r32MinusInf: 213 dd RTFLOAT32U_INF_MINUS 214 .s_r32NaN: 215 dd RTFLOAT32U_QNAN_MINUS 216 ENDPROC RT_NOCRT(log2f) 217 -
trunk/src/VBox/Runtime/testcase/Makefile.kmk
r96268 r96279 672 672 ../common/math/log.asm \ 673 673 ../common/math/logf.asm \ 674 ../common/math/log2.asm \ 675 ../common/math/log2f.asm \ 674 676 ../common/math/lrint.asm \ 675 677 ../common/math/lrintf.asm \ -
trunk/src/VBox/Runtime/testcase/tstRTNoCrt-2.cpp
r96273 r96279 433 433 __LINE__, #a_Fn, #a_Args, g_szFloat[0], g_szFloat[1]); \ 434 434 } \ 435 } while (0) 436 437 438 439 #define CHECK_XCPT(a_InnerTestExpr, a_fXcptMask, a_fXcptExpect) do { \ 440 RT_NOCRT(feclearexcept(RT_NOCRT_FE_ALL_EXCEPT)); \ 441 a_InnerTestExpr; \ 442 int const fXcpt = RT_NOCRT(fetestexcept)(RT_NOCRT_FE_ALL_EXCEPT); \ 443 if ((fXcpt & (a_fXcptMask)) != (a_fXcptExpect)) \ 444 RTTestFailed(g_hTest, "line %u: %s -^-> %#x, expected %#x (%s)", \ 445 __LINE__, #a_InnerTestExpr, fXcpt, (a_fXcptExpect), #a_fXcptExpect); \ 446 RT_NOCRT(feclearexcept(RT_NOCRT_FE_ALL_EXCEPT)); \ 435 447 } while (0) 436 448 … … 2704 2716 CHECK_FLT_SAME(logf,(RTStrNanFloat("s", true))); 2705 2717 CHECK_FLT_SAME(logf,(RTStrNanFloat("s", false))); 2718 } 2719 2720 2721 void testLog2() 2722 { 2723 RTTestSub(g_hTest, "log2[f]"); 2724 2725 CHECK_DBL( RT_NOCRT(log2)(RTStrNanDouble(NULL, true)), RTStrNanDouble(NULL, true)); 2726 CHECK_DBL( RT_NOCRT(log2)(RTStrNanDouble("234", false)), RTStrNanDouble("234", false)); 2727 CHECK_DBL( RT_NOCRT(log2)(RTStrNanDouble("999s", false)), RTStrNanDouble("999s", false)); 2728 CHECK_DBL( RT_NOCRT(log2)(RTStrNanDouble("fffs", true)), RTStrNanDouble("fffs", true)); 2729 CHECK_XCPT(CHECK_DBL(RT_NOCRT(log2)( +0.0), -INFINITY), RT_NOCRT_FE_DIVBYZERO, RT_NOCRT_FE_DIVBYZERO); 2730 CHECK_XCPT(CHECK_DBL(RT_NOCRT(log2)( -0.0), -INFINITY), RT_NOCRT_FE_DIVBYZERO, RT_NOCRT_FE_DIVBYZERO); 2731 CHECK_XCPT(CHECK_DBL(RT_NOCRT(log2)(-123.0), RTStrNanDouble(NULL, false)), RT_NOCRT_FE_INVALID, RT_NOCRT_FE_INVALID); 2732 CHECK_DBL( RT_NOCRT(log2)( 1.0), +0.0); 2733 CHECK_DBL( RT_NOCRT(log2)( 2.0), +1.0); 2734 CHECK_DBL( RT_NOCRT(log2)( 1024.0), +10.0); 2735 CHECK_DBL( RT_NOCRT(log2)( 1099511627776.0), +40.0); /* _1T */ 2736 CHECK_DBL_SAME( log2,( 1.0)); 2737 CHECK_DBL_SAME( log2,( 2.0)); 2738 CHECK_DBL_SAME( log2,( 1024.0)); 2739 CHECK_DBL_SAME( log2,( 1099511627776.0)); /* _1T */ 2740 CHECK_DBL_SAME( log2,( 1.5)); 2741 CHECK_DBL_SAME( log2,( 1.234485e-5)); 2742 CHECK_DBL_SAME( log2,( 1.234485e+9)); 2743 CHECK_DBL_SAME( log2,( 1.234485e+253)); 2744 CHECK_DBL_SAME( log2,( +INFINITY)); 2745 CHECK_DBL_SAME( log2,( -INFINITY)); 2746 CHECK_DBL_SAME( log2,( +DBL_MAX)); 2747 CHECK_DBL_SAME( log2,( -DBL_MAX)); 2748 CHECK_DBL_SAME( log2,(RTStrNanDouble(NULL, true))); 2749 CHECK_DBL_SAME( log2,(RTStrNanDouble(NULL, false))); 2750 #if 0 /* UCRT doesn't preserve signalling NaN */ 2751 CHECK_DBL_SAME( log2,(RTStrNanDouble("s", true))); 2752 CHECK_DBL_SAME( log2,(RTStrNanDouble("s", false))); 2753 #endif 2754 2755 CHECK_FLT( RT_NOCRT(log2f)(RTStrNanFloat(NULL, true)), RTStrNanFloat(NULL, true)); 2756 CHECK_FLT( RT_NOCRT(log2f)(RTStrNanFloat("234", false)), RTStrNanFloat("234", false)); 2757 CHECK_FLT( RT_NOCRT(log2f)(RTStrNanFloat("999s", false)), RTStrNanFloat("999s", false)); 2758 CHECK_FLT( RT_NOCRT(log2f)(RTStrNanFloat("fffs", true)), RTStrNanFloat("fffs", true)); 2759 CHECK_XCPT(CHECK_FLT(RT_NOCRT(log2f)( +0.0f), -(float)INFINITY), RT_NOCRT_FE_DIVBYZERO, RT_NOCRT_FE_DIVBYZERO); 2760 CHECK_XCPT(CHECK_FLT(RT_NOCRT(log2f)( -0.0f), -(float)INFINITY), RT_NOCRT_FE_DIVBYZERO, RT_NOCRT_FE_DIVBYZERO); 2761 CHECK_XCPT(CHECK_FLT(RT_NOCRT(log2f)(-123.0f), RTStrNanFloat(NULL, false)), RT_NOCRT_FE_INVALID, RT_NOCRT_FE_INVALID); 2762 CHECK_FLT( RT_NOCRT(log2f)( 1.0f), +0.0f); 2763 CHECK_FLT( RT_NOCRT(log2f)( 2.0f), +1.0f); 2764 CHECK_FLT( RT_NOCRT(log2f)( 1024.0f), +10.0f); 2765 CHECK_FLT( RT_NOCRT(log2f)( 1099511627776.0f), +40.0f); /* _1T */ 2766 CHECK_FLT_SAME( log2f,( 1.0f)); 2767 CHECK_FLT_SAME( log2f,( 2.0f)); 2768 CHECK_FLT_SAME( log2f,( 1024.0f)); 2769 CHECK_FLT_SAME( log2f,( 1099511627776.0f)); /* _1T */ 2770 CHECK_FLT_SAME( log2f,( 1.5f)); 2771 CHECK_FLT_SAME( log2f,( 1.234485e-5f)); 2772 CHECK_FLT_SAME( log2f,( 1.234485e+9f)); 2773 CHECK_FLT_SAME( log2f,( 1.234485e+35f)); 2774 CHECK_FLT_SAME_RELAXED_NAN( log2f,( +(float)INFINITY)); /* UCRT returns +QNaN here, but log2 reutrn -QNaN. */ 2775 CHECK_FLT_SAME_RELAXED_NAN( log2f,( -(float)INFINITY)); /* ditto */ 2776 CHECK_FLT_SAME( log2f,( +FLT_MAX)); 2777 CHECK_FLT_SAME_RELAXED_NAN( log2f,( -FLT_MAX)); /* UCRT returns +QNaN here, but log2 reutrn -QNaN. */ 2778 CHECK_FLT_SAME( log2f,(RTStrNanFloat(NULL, true))); 2779 CHECK_FLT_SAME( log2f,(RTStrNanFloat(NULL, false))); 2780 #if 0 /* UCRT doesn't preserve signalling NaN */ 2781 CHECK_FLT_SAME( log2f,(RTStrNanDouble("s", true))); 2782 CHECK_FLT_SAME( log2f,(RTStrNanDouble("s", false))); 2783 #endif 2784 2706 2785 } 2707 2786 … … 3397 3476 testRemainder(); 3398 3477 testLog(); 3478 testLog2(); 3399 3479 testSqRt(); 3400 3480
Note:
See TracChangeset
for help on using the changeset viewer.