Revision 05f778c8 target-mips/op.c

b/target-mips/op.c
22 22

  
23 23
#include "config.h"
24 24
#include "exec.h"
25
#include "host-utils.h"
25 26

  
26 27
#ifndef CALL_FROM_TB0
27 28
#define CALL_FROM_TB0(func) func()
......
537 538

  
538 539
void op_clo (void)
539 540
{
540
    int n;
541

  
542
    if (T0 == ~((target_ulong)0)) {
543
        T0 = 32;
544
    } else {
545
        for (n = 0; n < 32; n++) {
546
            if (!(((int32_t)T0) & (1 << 31)))
547
                break;
548
            T0 <<= 1;
549
        }
550
        T0 = n;
551
    }
541
    T0 = clo32(T0);
552 542
    RETURN();
553 543
}
554 544

  
555 545
void op_clz (void)
556 546
{
557
    int n;
558

  
559
    if (T0 == 0) {
560
        T0 = 32;
561
    } else {
562
        for (n = 0; n < 32; n++) {
563
            if (T0 & (1 << 31))
564
                break;
565
            T0 <<= 1;
566
        }
567
        T0 = n;
568
    }
547
    T0 = clz32(T0);
569 548
    RETURN();
570 549
}
571 550

  
......
645 624
    RETURN();
646 625
}
647 626

  
627
void op_dclo (void)
628
{
629
    CALL_FROM_TB0(do_dclo);
630
    RETURN();
631
}
632

  
633
void op_dclz (void)
634
{
635
    CALL_FROM_TB0(do_dclz);
636
    RETURN();
637
}
638

  
648 639
#else /* TARGET_LONG_BITS > HOST_LONG_BITS */
649 640

  
650 641
void op_dsll (void)
......
735 726
       T0 = T1;
736 727
    RETURN();
737 728
}
738
#endif /* TARGET_LONG_BITS > HOST_LONG_BITS */
739 729

  
740 730
void op_dclo (void)
741 731
{
742
    int n;
743

  
744
    if (T0 == ~((target_ulong)0)) {
745
        T0 = 64;
746
    } else {
747
        for (n = 0; n < 64; n++) {
748
            if (!(T0 & (1ULL << 63)))
749
                break;
750
            T0 <<= 1;
751
        }
752
        T0 = n;
753
    }
732
    T0 = clo64(T0);
754 733
    RETURN();
755 734
}
756 735

  
757 736
void op_dclz (void)
758 737
{
759
    int n;
760

  
761
    if (T0 == 0) {
762
        T0 = 64;
763
    } else {
764
        for (n = 0; n < 64; n++) {
765
            if (T0 & (1ULL << 63))
766
                break;
767
            T0 <<= 1;
768
        }
769
        T0 = n;
770
    }
738
    T0 = clz64(T0);
771 739
    RETURN();
772 740
}
741
#endif /* TARGET_LONG_BITS > HOST_LONG_BITS */
773 742
#endif /* TARGET_MIPSN32 || TARGET_MIPS64 */
774 743

  
775 744
/* 64 bits arithmetic */

Also available in: Unified diff