Commit f3f478a7efe9dc76325d0c774ca2e728d465bbe0
1 parent
ef28fd86
Fix signed/unsigned issues of immediate version of brcond (malc)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4588 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
48 additions
and
11 deletions
tcg/ppc/tcg-target.c
@@ -866,18 +866,55 @@ static void tcg_out_brcond(TCGContext *s, int cond, | @@ -866,18 +866,55 @@ static void tcg_out_brcond(TCGContext *s, int cond, | ||
866 | int imm; | 866 | int imm; |
867 | uint32_t op; | 867 | uint32_t op; |
868 | 868 | ||
869 | - imm = const_arg2 ? ((int16_t) arg2 == arg2) : 0; | ||
870 | switch (cond) { | 869 | switch (cond) { |
871 | - case TCG_COND_EQ: op = imm ? CMPLI : CMPL; break; | ||
872 | - case TCG_COND_NE: op = imm ? CMPLI : CMPL; break; | ||
873 | - case TCG_COND_LT: op = imm ? CMPI : CMP; break; | ||
874 | - case TCG_COND_GE: op = imm ? CMPI : CMP; break; | ||
875 | - case TCG_COND_LE: op = imm ? CMPI : CMP; break; | ||
876 | - case TCG_COND_GT: op = imm ? CMPI : CMP; break; | ||
877 | - case TCG_COND_LTU: op = imm ? CMPLI : CMPL; break; | ||
878 | - case TCG_COND_GEU: op = imm ? CMPLI : CMPL; break; | ||
879 | - case TCG_COND_LEU: op = imm ? CMPLI : CMPL; break; | ||
880 | - case TCG_COND_GTU: op = imm ? CMPLI : CMPL; break; | 870 | + case TCG_COND_EQ: |
871 | + case TCG_COND_NE: | ||
872 | + if (const_arg2) { | ||
873 | + if ((int16_t) arg2 == arg2) { | ||
874 | + op = CMPI; | ||
875 | + imm = 1; | ||
876 | + break; | ||
877 | + } | ||
878 | + else if ((uint16_t) arg2 == arg2) { | ||
879 | + op = CMPLI; | ||
880 | + imm = 1; | ||
881 | + break; | ||
882 | + } | ||
883 | + } | ||
884 | + op = CMPL; | ||
885 | + imm = 0; | ||
886 | + break; | ||
887 | + | ||
888 | + case TCG_COND_LT: | ||
889 | + case TCG_COND_GE: | ||
890 | + case TCG_COND_LE: | ||
891 | + case TCG_COND_GT: | ||
892 | + if (const_arg2) { | ||
893 | + if ((int16_t) arg2 == arg2) { | ||
894 | + op = CMPI; | ||
895 | + imm = 1; | ||
896 | + break; | ||
897 | + } | ||
898 | + } | ||
899 | + op = CMP; | ||
900 | + imm = 0; | ||
901 | + break; | ||
902 | + | ||
903 | + case TCG_COND_LTU: | ||
904 | + case TCG_COND_GEU: | ||
905 | + case TCG_COND_LEU: | ||
906 | + case TCG_COND_GTU: | ||
907 | + if (const_arg2) { | ||
908 | + if ((uint16_t) arg2 == arg2) { | ||
909 | + op = CMPLI; | ||
910 | + imm = 1; | ||
911 | + break; | ||
912 | + } | ||
913 | + } | ||
914 | + op = CMPL; | ||
915 | + imm = 0; | ||
916 | + break; | ||
917 | + | ||
881 | default: | 918 | default: |
882 | tcg_abort (); | 919 | tcg_abort (); |
883 | } | 920 | } |