multiply_and_divide.py (5081:2ccce8600a9d) | multiply_and_divide.py (5661:443e6f925027) |
---|---|
1# Copyright (c) 2007 The Hewlett-Packard Development Company 2# All rights reserved. 3# 4# Redistribution and use of this software in source and binary forms, 5# with or without modification, are permitted provided that the 6# following conditions are met: 7# 8# The software must be used only for Non-Commercial Use which means any --- 232 unchanged lines hidden (view full) --- 241 #second register 242 div2i t1, rax, 8, dataSize=1 243 div2 t1, rax, t1, dataSize=1 244 245 #Loop until we're out of bits to shift in 246divLoopTop: 247 div2 t1, rax, t1, dataSize=1 248 div2 t1, rax, t1, flags=(EZF,), dataSize=1 | 1# Copyright (c) 2007 The Hewlett-Packard Development Company 2# All rights reserved. 3# 4# Redistribution and use of this software in source and binary forms, 5# with or without modification, are permitted provided that the 6# following conditions are met: 7# 8# The software must be used only for Non-Commercial Use which means any --- 232 unchanged lines hidden (view full) --- 241 #second register 242 div2i t1, rax, 8, dataSize=1 243 div2 t1, rax, t1, dataSize=1 244 245 #Loop until we're out of bits to shift in 246divLoopTop: 247 div2 t1, rax, t1, dataSize=1 248 div2 t1, rax, t1, flags=(EZF,), dataSize=1 |
249 bri t0, label("divLoopTop"), flags=(nCEZF,) | 249 br label("divLoopTop"), flags=(nCEZF,) |
250 251 #Unload the answer 252 divq rax, dataSize=1 253 divr rsi, dataSize=1 254}; 255 256def macroop DIV_B_M 257{ --- 6 unchanged lines hidden (view full) --- 264 #second register 265 div2i t1, rax, 8, dataSize=1 266 div2 t1, rax, t1, dataSize=1 267 268 #Loop until we're out of bits to shift in 269divLoopTop: 270 div2 t1, rax, t1, dataSize=1 271 div2 t1, rax, t1, flags=(EZF,), dataSize=1 | 250 251 #Unload the answer 252 divq rax, dataSize=1 253 divr rsi, dataSize=1 254}; 255 256def macroop DIV_B_M 257{ --- 6 unchanged lines hidden (view full) --- 264 #second register 265 div2i t1, rax, 8, dataSize=1 266 div2 t1, rax, t1, dataSize=1 267 268 #Loop until we're out of bits to shift in 269divLoopTop: 270 div2 t1, rax, t1, dataSize=1 271 div2 t1, rax, t1, flags=(EZF,), dataSize=1 |
272 bri t0, label("divLoopTop"), flags=(nCEZF,) | 272 br label("divLoopTop"), flags=(nCEZF,) |
273 274 #Unload the answer 275 divq rax, dataSize=1 276 divr rsi, dataSize=1 277}; 278 279def macroop DIV_B_P 280{ --- 7 unchanged lines hidden (view full) --- 288 #second register 289 div2i t1, rax, 8, dataSize=1 290 div2 t1, rax, t1, dataSize=1 291 292 #Loop until we're out of bits to shift in 293divLoopTop: 294 div2 t1, rax, t1, dataSize=1 295 div2 t1, rax, t1, flags=(EZF,), dataSize=1 | 273 274 #Unload the answer 275 divq rax, dataSize=1 276 divr rsi, dataSize=1 277}; 278 279def macroop DIV_B_P 280{ --- 7 unchanged lines hidden (view full) --- 288 #second register 289 div2i t1, rax, 8, dataSize=1 290 div2 t1, rax, t1, dataSize=1 291 292 #Loop until we're out of bits to shift in 293divLoopTop: 294 div2 t1, rax, t1, dataSize=1 295 div2 t1, rax, t1, flags=(EZF,), dataSize=1 |
296 bri t0, label("divLoopTop"), flags=(nCEZF,) | 296 br label("divLoopTop"), flags=(nCEZF,) |
297 298 #Unload the answer 299 divq rax, dataSize=1 300 divr rsi, dataSize=1 301}; 302 303# 304# Unsigned division --- 11 unchanged lines hidden (view full) --- 316 317 #Loop until we're out of bits to shift in 318 #The amount of unrolling here could stand some tuning 319divLoopTop: 320 div2 t1, rax, t1 321 div2 t1, rax, t1 322 div2 t1, rax, t1 323 div2 t1, rax, t1, flags=(EZF,) | 297 298 #Unload the answer 299 divq rax, dataSize=1 300 divr rsi, dataSize=1 301}; 302 303# 304# Unsigned division --- 11 unchanged lines hidden (view full) --- 316 317 #Loop until we're out of bits to shift in 318 #The amount of unrolling here could stand some tuning 319divLoopTop: 320 div2 t1, rax, t1 321 div2 t1, rax, t1 322 div2 t1, rax, t1 323 div2 t1, rax, t1, flags=(EZF,) |
324 bri t0, label("divLoopTop"), flags=(nCEZF,) | 324 br label("divLoopTop"), flags=(nCEZF,) |
325 326 #Unload the answer 327 divq rax 328 divr rdx 329}; 330 331def macroop DIV_M 332{ --- 9 unchanged lines hidden (view full) --- 342 343 #Loop until we're out of bits to shift in 344 #The amount of unrolling here could stand some tuning 345divLoopTop: 346 div2 t1, rax, t1 347 div2 t1, rax, t1 348 div2 t1, rax, t1 349 div2 t1, rax, t1, flags=(EZF,) | 325 326 #Unload the answer 327 divq rax 328 divr rdx 329}; 330 331def macroop DIV_M 332{ --- 9 unchanged lines hidden (view full) --- 342 343 #Loop until we're out of bits to shift in 344 #The amount of unrolling here could stand some tuning 345divLoopTop: 346 div2 t1, rax, t1 347 div2 t1, rax, t1 348 div2 t1, rax, t1 349 div2 t1, rax, t1, flags=(EZF,) |
350 bri t0, label("divLoopTop"), flags=(nCEZF,) | 350 br label("divLoopTop"), flags=(nCEZF,) |
351 352 #Unload the answer 353 divq rax 354 divr rdx 355}; 356 357def macroop DIV_P 358{ --- 10 unchanged lines hidden (view full) --- 369 370 #Loop until we're out of bits to shift in 371 #The amount of unrolling here could stand some tuning 372divLoopTop: 373 div2 t1, rax, t1 374 div2 t1, rax, t1 375 div2 t1, rax, t1 376 div2 t1, rax, t1, flags=(EZF,) | 351 352 #Unload the answer 353 divq rax 354 divr rdx 355}; 356 357def macroop DIV_P 358{ --- 10 unchanged lines hidden (view full) --- 369 370 #Loop until we're out of bits to shift in 371 #The amount of unrolling here could stand some tuning 372divLoopTop: 373 div2 t1, rax, t1 374 div2 t1, rax, t1 375 div2 t1, rax, t1 376 div2 t1, rax, t1, flags=(EZF,) |
377 bri t0, label("divLoopTop"), flags=(nCEZF,) | 377 br label("divLoopTop"), flags=(nCEZF,) |
378 379 #Unload the answer 380 divq rax 381 divr rdx 382}; 383 384# 385# One byte version of signed division --- 31 unchanged lines hidden (view full) --- 417 #second register 418 div2i t4, t1, 8, dataSize=1 419 div2 t4, t1, t4, dataSize=1 420 421 #Loop until we're out of bits to shift in 422divLoopTop: 423 div2 t4, t1, t4, dataSize=1 424 div2 t4, t1, t4, flags=(EZF,), dataSize=1 | 378 379 #Unload the answer 380 divq rax 381 divr rdx 382}; 383 384# 385# One byte version of signed division --- 31 unchanged lines hidden (view full) --- 417 #second register 418 div2i t4, t1, 8, dataSize=1 419 div2 t4, t1, t4, dataSize=1 420 421 #Loop until we're out of bits to shift in 422divLoopTop: 423 div2 t4, t1, t4, dataSize=1 424 div2 t4, t1, t4, flags=(EZF,), dataSize=1 |
425 bri t0, label("divLoopTop"), flags=(nCEZF,) | 425 br label("divLoopTop"), flags=(nCEZF,) |
426 427 #Unload the answer 428 divq t5, dataSize=1 429 divr t6, dataSize=1 430 431 # Fix up signs. The sign of the dividend is still lying around in ECF. 432 # The sign of the remainder, ah, is the same as the dividend. The sign 433 # of the quotient is negated if the signs of the divisor and dividend --- 56 unchanged lines hidden (view full) --- 490 #second register 491 div2i t4, t1, 8, dataSize=1 492 div2 t4, t1, t4, dataSize=1 493 494 #Loop until we're out of bits to shift in 495divLoopTop: 496 div2 t4, t1, t4, dataSize=1 497 div2 t4, t1, t4, flags=(EZF,), dataSize=1 | 426 427 #Unload the answer 428 divq t5, dataSize=1 429 divr t6, dataSize=1 430 431 # Fix up signs. The sign of the dividend is still lying around in ECF. 432 # The sign of the remainder, ah, is the same as the dividend. The sign 433 # of the quotient is negated if the signs of the divisor and dividend --- 56 unchanged lines hidden (view full) --- 490 #second register 491 div2i t4, t1, 8, dataSize=1 492 div2 t4, t1, t4, dataSize=1 493 494 #Loop until we're out of bits to shift in 495divLoopTop: 496 div2 t4, t1, t4, dataSize=1 497 div2 t4, t1, t4, flags=(EZF,), dataSize=1 |
498 bri t0, label("divLoopTop"), flags=(nCEZF,) | 498 br label("divLoopTop"), flags=(nCEZF,) |
499 500 #Unload the answer 501 divq t5, dataSize=1 502 divr t6, dataSize=1 503 504 # Fix up signs. The sign of the dividend is still lying around in ECF. 505 # The sign of the remainder, ah, is the same as the dividend. The sign 506 # of the quotient is negated if the signs of the divisor and dividend --- 57 unchanged lines hidden (view full) --- 564 #second register 565 div2i t4, t1, 8, dataSize=1 566 div2 t4, t1, t4, dataSize=1 567 568 #Loop until we're out of bits to shift in 569divLoopTop: 570 div2 t4, t1, t4, dataSize=1 571 div2 t4, t1, t4, flags=(EZF,), dataSize=1 | 499 500 #Unload the answer 501 divq t5, dataSize=1 502 divr t6, dataSize=1 503 504 # Fix up signs. The sign of the dividend is still lying around in ECF. 505 # The sign of the remainder, ah, is the same as the dividend. The sign 506 # of the quotient is negated if the signs of the divisor and dividend --- 57 unchanged lines hidden (view full) --- 564 #second register 565 div2i t4, t1, 8, dataSize=1 566 div2 t4, t1, t4, dataSize=1 567 568 #Loop until we're out of bits to shift in 569divLoopTop: 570 div2 t4, t1, t4, dataSize=1 571 div2 t4, t1, t4, flags=(EZF,), dataSize=1 |
572 bri t0, label("divLoopTop"), flags=(nCEZF,) | 572 br label("divLoopTop"), flags=(nCEZF,) |
573 574 #Unload the answer 575 divq t5, dataSize=1 576 divr t6, dataSize=1 577 578 # Fix up signs. The sign of the dividend is still lying around in ECF. 579 # The sign of the remainder, ah, is the same as the dividend. The sign 580 # of the quotient is negated if the signs of the divisor and dividend --- 60 unchanged lines hidden (view full) --- 641 div2 t4, t1, t4 642 643 #Loop until we're out of bits to shift in 644divLoopTop: 645 div2 t4, t1, t4 646 div2 t4, t1, t4 647 div2 t4, t1, t4 648 div2 t4, t1, t4, flags=(EZF,) | 573 574 #Unload the answer 575 divq t5, dataSize=1 576 divr t6, dataSize=1 577 578 # Fix up signs. The sign of the dividend is still lying around in ECF. 579 # The sign of the remainder, ah, is the same as the dividend. The sign 580 # of the quotient is negated if the signs of the divisor and dividend --- 60 unchanged lines hidden (view full) --- 641 div2 t4, t1, t4 642 643 #Loop until we're out of bits to shift in 644divLoopTop: 645 div2 t4, t1, t4 646 div2 t4, t1, t4 647 div2 t4, t1, t4 648 div2 t4, t1, t4, flags=(EZF,) |
649 bri t0, label("divLoopTop"), flags=(nCEZF,) | 649 br label("divLoopTop"), flags=(nCEZF,) |
650 651 #Unload the answer 652 divq t5 653 divr t6 654 655 # Fix up signs. The sign of the dividend is still lying around in ECF. 656 # The sign of the remainder, ah, is the same as the dividend. The sign 657 # of the quotient is negated if the signs of the divisor and dividend --- 58 unchanged lines hidden (view full) --- 716 div2 t4, t1, t4 717 718 #Loop until we're out of bits to shift in 719divLoopTop: 720 div2 t4, t1, t4 721 div2 t4, t1, t4 722 div2 t4, t1, t4 723 div2 t4, t1, t4, flags=(EZF,) | 650 651 #Unload the answer 652 divq t5 653 divr t6 654 655 # Fix up signs. The sign of the dividend is still lying around in ECF. 656 # The sign of the remainder, ah, is the same as the dividend. The sign 657 # of the quotient is negated if the signs of the divisor and dividend --- 58 unchanged lines hidden (view full) --- 716 div2 t4, t1, t4 717 718 #Loop until we're out of bits to shift in 719divLoopTop: 720 div2 t4, t1, t4 721 div2 t4, t1, t4 722 div2 t4, t1, t4 723 div2 t4, t1, t4, flags=(EZF,) |
724 bri t0, label("divLoopTop"), flags=(nCEZF,) | 724 br label("divLoopTop"), flags=(nCEZF,) |
725 726 #Unload the answer 727 divq t5 728 divr t6 729 730 # Fix up signs. The sign of the dividend is still lying around in ECF. 731 # The sign of the remainder, ah, is the same as the dividend. The sign 732 # of the quotient is negated if the signs of the divisor and dividend --- 59 unchanged lines hidden (view full) --- 792 div2 t4, t1, t4 793 794 #Loop until we're out of bits to shift in 795divLoopTop: 796 div2 t4, t1, t4 797 div2 t4, t1, t4 798 div2 t4, t1, t4 799 div2 t4, t1, t4, flags=(EZF,) | 725 726 #Unload the answer 727 divq t5 728 divr t6 729 730 # Fix up signs. The sign of the dividend is still lying around in ECF. 731 # The sign of the remainder, ah, is the same as the dividend. The sign 732 # of the quotient is negated if the signs of the divisor and dividend --- 59 unchanged lines hidden (view full) --- 792 div2 t4, t1, t4 793 794 #Loop until we're out of bits to shift in 795divLoopTop: 796 div2 t4, t1, t4 797 div2 t4, t1, t4 798 div2 t4, t1, t4 799 div2 t4, t1, t4, flags=(EZF,) |
800 bri t0, label("divLoopTop"), flags=(nCEZF,) | 800 br label("divLoopTop"), flags=(nCEZF,) |
801 802 #Unload the answer 803 divq t5 804 divr t6 805 806 # Fix up signs. The sign of the dividend is still lying around in ECF. 807 # The sign of the remainder, ah, is the same as the dividend. The sign 808 # of the quotient is negated if the signs of the divisor and dividend --- 25 unchanged lines hidden --- | 801 802 #Unload the answer 803 divq t5 804 divr t6 805 806 # Fix up signs. The sign of the dividend is still lying around in ECF. 807 # The sign of the remainder, ah, is the same as the dividend. The sign 808 # of the quotient is negated if the signs of the divisor and dividend --- 25 unchanged lines hidden --- |