aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2011-10-31 04:05:49 -0400
committerDavid S. Miller <davem@davemloft.net>2011-10-31 04:05:49 -0400
commit2e8ecdc008a16b9a6c4b9628bb64d0d1c05f9f92 (patch)
treedda40d127f783e204e149bdbfe42000ce474a5d4
parenta52312b88c8103e965979a79a07f6b34af82ca4b (diff)
sparc64: Fix masking and shifting in VIS fpcmp emulation.
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--arch/sparc/kernel/visemul.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/arch/sparc/kernel/visemul.c b/arch/sparc/kernel/visemul.c
index 32b626c9d815..73370674ccff 100644
--- a/arch/sparc/kernel/visemul.c
+++ b/arch/sparc/kernel/visemul.c
@@ -713,17 +713,17 @@ static void pcmp(struct pt_regs *regs, unsigned int insn, unsigned int opf)
713 s16 b = (rs2 >> (i * 16)) & 0xffff; 713 s16 b = (rs2 >> (i * 16)) & 0xffff;
714 714
715 if (a > b) 715 if (a > b)
716 rd_val |= 1 << i; 716 rd_val |= 8 >> i;
717 } 717 }
718 break; 718 break;
719 719
720 case FCMPGT32_OPF: 720 case FCMPGT32_OPF:
721 for (i = 0; i < 2; i++) { 721 for (i = 0; i < 2; i++) {
722 s32 a = (rs1 >> (i * 32)) & 0xffff; 722 s32 a = (rs1 >> (i * 32)) & 0xffffffff;
723 s32 b = (rs2 >> (i * 32)) & 0xffff; 723 s32 b = (rs2 >> (i * 32)) & 0xffffffff;
724 724
725 if (a > b) 725 if (a > b)
726 rd_val |= 1 << i; 726 rd_val |= 2 >> i;
727 } 727 }
728 break; 728 break;
729 729
@@ -733,17 +733,17 @@ static void pcmp(struct pt_regs *regs, unsigned int insn, unsigned int opf)
733 s16 b = (rs2 >> (i * 16)) & 0xffff; 733 s16 b = (rs2 >> (i * 16)) & 0xffff;
734 734
735 if (a <= b) 735 if (a <= b)
736 rd_val |= 1 << i; 736 rd_val |= 8 >> i;
737 } 737 }
738 break; 738 break;
739 739
740 case FCMPLE32_OPF: 740 case FCMPLE32_OPF:
741 for (i = 0; i < 2; i++) { 741 for (i = 0; i < 2; i++) {
742 s32 a = (rs1 >> (i * 32)) & 0xffff; 742 s32 a = (rs1 >> (i * 32)) & 0xffffffff;
743 s32 b = (rs2 >> (i * 32)) & 0xffff; 743 s32 b = (rs2 >> (i * 32)) & 0xffffffff;
744 744
745 if (a <= b) 745 if (a <= b)
746 rd_val |= 1 << i; 746 rd_val |= 2 >> i;
747 } 747 }
748 break; 748 break;
749 749
@@ -753,17 +753,17 @@ static void pcmp(struct pt_regs *regs, unsigned int insn, unsigned int opf)
753 s16 b = (rs2 >> (i * 16)) & 0xffff; 753 s16 b = (rs2 >> (i * 16)) & 0xffff;
754 754
755 if (a != b) 755 if (a != b)
756 rd_val |= 1 << i; 756 rd_val |= 8 >> i;
757 } 757 }
758 break; 758 break;
759 759
760 case FCMPNE32_OPF: 760 case FCMPNE32_OPF:
761 for (i = 0; i < 2; i++) { 761 for (i = 0; i < 2; i++) {
762 s32 a = (rs1 >> (i * 32)) & 0xffff; 762 s32 a = (rs1 >> (i * 32)) & 0xffffffff;
763 s32 b = (rs2 >> (i * 32)) & 0xffff; 763 s32 b = (rs2 >> (i * 32)) & 0xffffffff;
764 764
765 if (a != b) 765 if (a != b)
766 rd_val |= 1 << i; 766 rd_val |= 2 >> i;
767 } 767 }
768 break; 768 break;
769 769
@@ -773,17 +773,17 @@ static void pcmp(struct pt_regs *regs, unsigned int insn, unsigned int opf)
773 s16 b = (rs2 >> (i * 16)) & 0xffff; 773 s16 b = (rs2 >> (i * 16)) & 0xffff;
774 774
775 if (a == b) 775 if (a == b)
776 rd_val |= 1 << i; 776 rd_val |= 8 >> i;
777 } 777 }
778 break; 778 break;
779 779
780 case FCMPEQ32_OPF: 780 case FCMPEQ32_OPF:
781 for (i = 0; i < 2; i++) { 781 for (i = 0; i < 2; i++) {
782 s32 a = (rs1 >> (i * 32)) & 0xffff; 782 s32 a = (rs1 >> (i * 32)) & 0xffffffff;
783 s32 b = (rs2 >> (i * 32)) & 0xffff; 783 s32 b = (rs2 >> (i * 32)) & 0xffffffff;
784 784
785 if (a == b) 785 if (a == b)
786 rd_val |= 1 << i; 786 rd_val |= 2 >> i;
787 } 787 }
788 break; 788 break;
789 } 789 }