aboutsummaryrefslogtreecommitdiff
path: root/sim/mips/gencode.c
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>1997-09-01 09:47:03 +0000
committerAndrew Cagney <cagney@redhat.com>1997-09-01 09:47:03 +0000
commit52352d38d6218b8c7dcc2b59e88820f702c89fd1 (patch)
treead38de9df23e2d51d7defc9efa12e05a547ac86d /sim/mips/gencode.c
parent0ffba68fdc03f68c2cf78cb16ac87464cacf8fde (diff)
downloadgdb-52352d38d6218b8c7dcc2b59e88820f702c89fd1.zip
gdb-52352d38d6218b8c7dcc2b59e88820f702c89fd1.tar.gz
gdb-52352d38d6218b8c7dcc2b59e88820f702c89fd1.tar.bz2
Test/fix pabsh, pabsw, psrlvw.
Diffstat (limited to 'sim/mips/gencode.c')
-rw-r--r--sim/mips/gencode.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/sim/mips/gencode.c b/sim/mips/gencode.c
index 6ef01bf..4c6937d 100644
--- a/sim/mips/gencode.c
+++ b/sim/mips/gencode.c
@@ -3580,8 +3580,8 @@ build_instruction (doisa, features, mips16, insn)
break;
case PSRLVW:
- printf("GPR_UD(destreg,0) = RT_UW(0) >> (RS_UB(0) & 0x1F);\n");
- printf("GPR_UD(destreg,1) = RT_UW(2) >> (RS_UB(8) & 0x1F);\n");
+ printf("GPR_UD(destreg,0) = SIGNEXTEND ( RT_UW(0) >> (RS_UB(0) & 0x1F), 31);\n");
+ printf("GPR_UD(destreg,1) = SIGNEXTEND ( RT_UW(2) >> (RS_UB(8) & 0x1F), 31);\n");
break;
case PSRAVW:
@@ -3658,14 +3658,18 @@ build_instruction (doisa, features, mips16, insn)
{
char* name = name_for_data_len( insn );
char* letter = letter_for_data_len( insn );
+ char* min = min_for_data_len( insn );
+ char* max = max_for_data_len( insn );
printf("int i;\n");
printf("for(i=0;i<%sS_IN_MMI_REGS;i++)\n", name );
printf(" {\n");
- printf(" if (RT_S%s(i) < 0)\n", letter );
- printf(" GPR_S%s(destreg,i) = -RT_S%s(i);\n", letter, letter );
- printf(" else\n");
+ printf(" if (RT_S%s(i) >= 0)\n", letter );
printf(" GPR_S%s(destreg,i) = RT_S%s(i);\n", letter, letter );
+ printf(" else if (RT_S%s(i) == %s)\n", letter, min );
+ printf(" GPR_S%s(destreg,i) = %s;\n", letter, max );
+ printf(" else\n");
+ printf(" GPR_S%s(destreg,i) = -RT_S%s(i);\n", letter, letter );
printf(" }\n");
break;
}