Changeset 60698 in vbox for trunk/src/VBox/Runtime/common
- Timestamp:
- Apr 25, 2016 10:02:31 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/math/bignum-amd64-x86.asm
r56290 r60698 26 26 27 27 28 ;********************************************************************************************************************************* 29 ;* Header Files * 30 ;********************************************************************************************************************************* 28 31 %define RT_ASM_WITH_SEH64 29 32 %include "iprt/asmdefs.mac" 30 33 %include "internal/bignum.mac" 34 35 36 ;********************************************************************************************************************************* 37 ;* Defined Constants And Macros * 38 ;********************************************************************************************************************************* 39 %ifdef RT_ARCH_AMD64 40 %macro sahf 0 41 %error "SAHF not supported on ancient AMD64" 42 %endmacro 43 %macro lahf 0 44 %error "LAHF not supported on ancient AMD64" 45 %endmacro 46 %endif 31 47 32 48 … … 67 83 xor r11d, r11d ; index register. 68 84 69 %if RTBIGNUM_ELEMENT_SIZE == 485 %if RTBIGNUM_ELEMENT_SIZE == 4 70 86 add cUsed, 1 ; cUsed = RT_ALIGN(cUsed, 2) / 2 71 87 shr cUsed, 1 72 %endif88 %endif 73 89 cmp cUsed, 8 ; Skip the big loop if small number. 74 90 jb .small_job … … 106 122 jnz .big_loop 107 123 124 %if 0 ; Ancient AMD CPUs does have lahf/sahf, thus the mess in the %else. 108 125 lahf ; Save CF 109 126 and cUsed, 7 ; Up to seven odd rounds. … … 111 128 sahf ; Restore CF. 112 129 jmp .small_loop ; Skip CF=1 (clc). 113 130 %else 131 jnc .no_carry 132 and cUsed, 7 ; Up to seven odd rounds. 133 jz .done 134 stc 135 jmp .small_loop ; Skip CF=1 (clc). 136 .no_carry: 137 and cUsed, 7 ; Up to seven odd rounds. 138 jz .done 139 %endif 114 140 .small_job: 115 141 clc … … 247 273 xor r11d, r11d ; index register. 248 274 249 %if RTBIGNUM_ELEMENT_SIZE == 4275 %if RTBIGNUM_ELEMENT_SIZE == 4 250 276 add cUsed, 1 ; cUsed = RT_ALIGN(cUsed, 2) / 2 251 277 shr cUsed, 1 252 %endif278 %endif 253 279 cmp cUsed, 8 ; Skip the big loop if small number. 254 280 jb .small_job … … 278 304 jnz .big_loop 279 305 306 %if 0 ; Ancient AMD CPUs does have lahf/sahf, thus the mess in the %else. 280 307 lahf ; Save CF 281 308 and cUsed, 7 ; Up to seven odd rounds. … … 283 310 sahf ; Restore CF. 284 311 jmp .small_loop ; Skip CF=1 (clc). 285 312 %else 313 jnc .no_carry 314 and cUsed, 7 ; Up to seven odd rounds. 315 jz .done 316 stc 317 jmp .small_loop ; Skip CF=1 (clc). 318 .no_carry: 319 and cUsed, 7 ; Up to seven odd rounds. 320 jz .done 321 %endif 286 322 .small_job: 287 323 clc … … 451 487 452 488 ; More to do? 453 lahf; save carry flag (uCarry no longer used on x86).489 pushf ; save carry flag (uCarry no longer used on x86). 454 490 %ifdef RT_ARCH_AMD64 455 491 mov cUsed, r11d … … 459 495 and cUsed, 7 460 496 jz .restore_cf_and_return ; Jump if we're good and done. 461 sahf ; Restore CF.497 popf ; Restore CF. 462 498 jmp .small_loop ; Deal with the odd rounds. 463 499 .restore_cf_and_return: 464 sahf500 popf 465 501 jmp .carry_to_eax 466 502
Note:
See TracChangeset
for help on using the changeset viewer.