• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revisión6065c6125174e6a392de83d2bbd1598350149732 (tree)
Tiempo2018-12-21 17:33:27
AutorYoshinori Sato <ysato@user...>
CommiterYoshinori Sato

Log Message

RXv3 support

Cambiar Resumen

Diferencia incremental

--- a/gas/config/rx-defs.h
+++ b/gas/config/rx-defs.h
@@ -39,7 +39,8 @@ enum rx_cpu_types
3939 RX610,
4040 RX200,
4141 RX100,
42- RXV2
42+ RXV2,
43+ RXV3
4344 };
4445
4546 extern int rx_pid_register;
@@ -57,6 +58,7 @@ extern void rx_op (expressionS, int, int);
5758 extern void rx_disp3 (expressionS, int);
5859 extern void rx_field5s (expressionS);
5960 extern void rx_field5s2 (expressionS);
61+extern void rx_bfield (expressionS, expressionS, expressionS);
6062 extern void rx_relax (int, int);
6163 extern void rx_linkrelax_dsp (int);
6264 extern void rx_linkrelax_imm (int);
@@ -64,6 +66,7 @@ extern void rx_linkrelax_branch (void);
6466 extern int rx_parse (void);
6567 extern int rx_wrap (void);
6668 extern void rx_note_string_insn_use (void);
69+extern void rx_post (char);
6770
6871 extern char * rx_lex_start;
6972 extern char * rx_lex_end;
--- a/gas/config/rx-parse.y
+++ b/gas/config/rx-parse.y
@@ -33,6 +33,7 @@ static int rx_lex (void);
3333 #define BSIZE 0
3434 #define WSIZE 1
3535 #define LSIZE 2
36+#define DSIZE 3
3637
3738 /* .sb .sw .l .uw */
3839 static int sizemap[] = { BSIZE, WSIZE, LSIZE, WSIZE };
@@ -90,6 +91,8 @@ static int sizemap[] = { BSIZE, WSIZE, LSIZE, WSIZE };
9091 #define PC2(v) rx_op (v, 2, RXREL_PCREL)
9192 #define PC3(v) rx_op (v, 3, RXREL_PCREL)
9293
94+#define POST(v) rx_post (v)
95+
9396 #define IMM_(v,pos,size) F (immediate (v, RXREL_SIGNED, pos, size), pos, 2); \
9497 if (v.X_op != O_constant && v.X_op != O_big) rx_linkrelax_imm (pos)
9598 #define IMM(v,pos) IMM_ (v, pos, 32)
@@ -116,6 +119,7 @@ static int displacement (expressionS, int);
116119 static void rtsd_immediate (expressionS);
117120 static void rx_range (expressionS, int, int);
118121 static void rx_check_v2 (void);
122+static void rx_check_v3 (void);
119123
120124 static int need_flag = 0;
121125 static int rx_in_brackets = 0;
@@ -137,36 +141,37 @@ static int sub_op2;
137141 expressionS exp;
138142 }
139143
140-%type <regno> REG FLAG CREG BCND BMCND SCCND ACC
144+%type <regno> REG FLAG CREG BCND BMCND SCCND ACC DREG DREGH DREGL DCREG DCMP
141145 %type <regno> flag bwl bw memex
142146 %type <exp> EXPR disp
143147
144-%token REG FLAG CREG ACC
148+%token REG FLAG CREG ACC DREG DREGH DREGL DCREG
145149
146150 %token EXPR UNKNOWN_OPCODE IS_OPCODE
147151
148-%token DOT_S DOT_B DOT_W DOT_L DOT_A DOT_UB DOT_UW
152+%token DOT_S DOT_B DOT_W DOT_L DOT_A DOT_UB DOT_UW DOT_D
149153
150154 %token ABS ADC ADD AND_
151-%token BCLR BCND BMCND BNOT BRA BRK BSET BSR BTST
155+%token BCLR BCND BFMOV BFMOVZ BMCND BNOT BRA BRK BSET BSR BTST
152156 %token CLRPSW CMP
153-%token DBT DIV DIVU
157+%token DABS DADD DBT DCMP DDIV DIV DIVU DMOV DMUL DNEG
158+%token DPOPM DPUSHM DROUND DSQRT DSUB DTOF DTOI DTOU
154159 %token EDIV EDIVU EMACA EMSBA EMUL EMULA EMULU
155-%token FADD FCMP FDIV FMUL FREIT FSUB FSQRT FTOI FTOU
156-%token INT ITOF
160+%token FADD FCMP FDIV FMUL FREIT FSUB FSQRT FTOD FTOI FTOU
161+%token INT ITOD ITOF
157162 %token JMP JSR
158163 %token MACHI MACLH MACLO MAX MIN MOV MOVCO MOVLI MOVU MSBHI MSBLH MSBLO MUL
159-%token MULHI MULLH MULLO MULU MVFACHI MVFACGU MVFACMI MVFACLO MVFC MVTACGU
160-%token MVTACHI MVTACLO MVTC MVTIPL
164+%token MULHI MULLH MULLO MULU MVFACHI MVFACGU MVFACMI MVFACLO MVFC MVFDC
165+%token MVFDR MVTACGU MVTACHI MVTACLO MVTC MVTDC MVTIPL
161166 %token NEG NOP NOT
162167 %token OR
163168 %token POP POPC POPM PUSH PUSHA PUSHC PUSHM
164169 %token RACL RACW RDACL RDACW REIT REVL REVW RMPA ROLC RORC ROTL ROTR ROUND
165-%token RTE RTFI RTS RTSD
166-%token SAT SATR SBB SCCND SCMPU SETPSW SHAR SHLL SHLR SMOVB SMOVF
170+%token RSTR RTE RTFI RTS RTSD
171+%token SAT SATR SAVE SBB SCCND SCMPU SETPSW SHAR SHLL SHLR SMOVB SMOVF
167172 %token SMOVU SSTR STNZ STOP STZ SUB SUNTIL SWHILE
168173 %token TST
169-%token UTOF
174+%token UTOD UTOF
170175 %token WAIT
171176 %token XCHG XOR
172177
@@ -630,7 +635,7 @@ statement :
630635 | DIV { sub_op = 8; } op_dp20_rim
631636 | DIVU { sub_op = 9; } op_dp20_rim
632637 | TST { sub_op = 12; } op_dp20_rim
633- | XOR { sub_op = 13; } op_dp20_rim
638+ | XOR { sub_op = 13; } op_xor
634639 | NOT { sub_op = 14; sub_op2 = 0; } op_dp20_rr
635640 | STZ { sub_op = 14; sub_op2 = 0; } op_dp20_ri
636641 | STNZ { sub_op = 15; sub_op2 = 1; } op_dp20_ri
@@ -738,17 +743,17 @@ statement :
738743 | MVFACLO { sub_op = 1; } mvfa_op
739744 | RACW '#' EXPR
740745 { id24 (2, 0x18, 0x00);
741- if (rx_uintop ($3, 4) && $3.X_add_number == 1)
746+ if (rx_uintop ($3, 4) && exp_val($3) == 1)
742747 ;
743- else if (rx_uintop ($3, 4) && $3.X_add_number == 2)
748+ else if (rx_uintop ($3, 4) && exp_val($3) == 2)
744749 F (1, 19, 1);
745750 else
746751 as_bad (_("RACW expects #1 or #2"));}
747752 | RACW '#' EXPR ',' ACC
748753 { rx_check_v2 (); id24 (2, 0x18, 0x00); F ($5, 16, 1);
749- if (rx_uintop ($3, 4) && $3.X_add_number == 1)
754+ if (rx_uintop ($3, 4) && exp_val($3) == 1)
750755 ;
751- else if (rx_uintop ($3, 4) && $3.X_add_number == 2)
756+ else if (rx_uintop ($3, 4) && exp_val($3) == 2)
752757 F (1, 19, 1);
753758 else
754759 as_bad (_("RACW expects #1 or #2"));}
@@ -903,6 +908,99 @@ statement :
903908 as_bad (_("RDACW expects #1 or #2"));}
904909
905910 /* ---------------------------------------------------------------------- */
911+ | BFMOV { rx_check_v3(); sub_op = 1; } op_bfield
912+ | BFMOVZ { rx_check_v3(); sub_op = 0; } op_bfield
913+
914+/* ---------------------------------------------------------------------- */
915+ | RSTR { rx_check_v3(); sub_op = 0; } op_save_rstr
916+ | SAVE { rx_check_v3(); sub_op = 1; } op_save_rstr
917+
918+/* ---------------------------------------------------------------------- */
919+ | DABS { rx_check_v3(); sub_op = 0x0c; sub_op2 = 0x01; } double2_op
920+ | DNEG { rx_check_v3(); sub_op = 0x0c; sub_op2 = 0x02; } double2_op
921+ | DROUND { rx_check_v3(); sub_op = 0x0d; sub_op2 = 0x0d; } double2_op
922+ | DSQRT { rx_check_v3(); sub_op = 0x0d; sub_op2 = 0x00; } double2_op
923+ | DTOF { rx_check_v3(); sub_op = 0x0d; sub_op2 = 0x0c; } double2_op
924+ | DTOI { rx_check_v3(); sub_op = 0x0d; sub_op2 = 0x08;} double2_op
925+ | DTOU { rx_check_v3(); sub_op = 0x0d; sub_op2 = 0x09; } double2_op
926+ | DADD { rx_check_v3(); sub_op = 0x00; } double3_op
927+ | DDIV { rx_check_v3(); sub_op = 0x05; } double3_op
928+ | DMUL { rx_check_v3(); sub_op = 0x02; } double3_op
929+ | DSUB { rx_check_v3(); sub_op = 0x01; } double3_op
930+ | DCMP DREG ',' DREG { rx_check_v3();
931+ B4(0x76, 0x90, 0x08, 0x00); F($1, 24, 4); F($2, 28, 4); F($4, 16, 4); }
932+ | DMOV DOT_D REG ',' DREGH
933+ { rx_check_v3();
934+ B4(0xfd, 0x77, 0x80, 0x03); F($3, 20, 4); F($5, 24, 4); }
935+ | DMOV DOT_L REG ',' DREGH
936+ { rx_check_v3();
937+ B4(0xfd, 0x77, 0x80, 0x02); F($3, 20, 4); F($5, 24, 4); }
938+ | DMOV DOT_L REG ',' DREGL
939+ { rx_check_v3();
940+ B4(0xfd, 0x77, 0x80, 0x00); F($3, 20, 4); F($5, 24, 4); }
941+ | DMOV DOT_L DREGH ',' REG
942+ { rx_check_v3();
943+ B4(0xfd, 0x75, 0x80, 0x02); F($3, 24, 4); F($5, 20, 4); }
944+ | DMOV DOT_L DREGL ',' REG
945+ { rx_check_v3();
946+ B4(0xfd, 0x75, 0x80, 0x00); F($3, 24, 4); F($5, 20, 4); }
947+ | DMOV DOT_D DREG ',' DREG
948+ { rx_check_v3();
949+ B4(0x76, 0x90, 0x0c, 0x00); F($3, 16, 4); F($5, 24, 4); }
950+ | DMOV DOT_D DREG ',' '[' REG ']'
951+ { rx_check_v3();
952+ B4(0xfc, 0x78, 0x08, 0x00); F($6, 16, 4); F($3, 24, 4); }
953+ | DMOV DOT_D DREG ',' disp '[' REG ']'
954+ { rx_check_v3();
955+ B3(0xfc, 0x78, 0x08); F($7, 16, 4); DSP($5, 14, DSIZE);
956+ POST($3 << 4); }
957+ | DMOV DOT_D '[' REG ']' ',' DREG
958+ { rx_check_v3();
959+ B4(0xfc, 0xc8, 0x08, 0x00); F($4, 16, 4); F($7, 24, 4); }
960+ | DMOV DOT_D disp '[' REG ']' ',' DREG
961+ { rx_check_v3();
962+ B3(0xfc, 0xc8, 0x08); F($5, 16, 4); DSP($3, 14, DSIZE);
963+ POST($8 << 4); }
964+ | DMOV DOT_D '#' EXPR ',' DREGH
965+ { rx_check_v3();
966+ B3(0xf9, 0x03, 0x03); F($6, 16, 4); IMM($4, -1); }
967+ | DMOV DOT_L '#' EXPR ',' DREGH
968+ { rx_check_v3();
969+ B3(0xf9, 0x03, 0x02); F($6, 16, 4); IMM($4, -1); }
970+ | DMOV DOT_L '#' EXPR ',' DREGL
971+ { rx_check_v3();
972+ B3(0xf9, 0x03, 0x00); F($6, 16, 4); IMM($4, -1); }
973+ | DPOPM DOT_D DREG '-' DREG
974+ { rx_check_v3();
975+ B3(0x75, 0xb8, 0x00); F($3, 16, 4); F($5 - $3, 20, 4); }
976+ | DPOPM DOT_L DCREG '-' DCREG
977+ { rx_check_v3();
978+ B3(0x75, 0xa8, 0x00); F($3, 16, 4); F($5 - $3, 20, 4); }
979+ | DPUSHM DOT_D DREG '-' DREG
980+ { rx_check_v3();
981+ B3(0x75, 0xb0, 0x00); F($3, 16, 4); F($5 - $3, 20, 4); }
982+ | DPUSHM DOT_L DCREG '-' DCREG
983+ { rx_check_v3();
984+ B3(0x75, 0xa0, 0x00); F($3, 16, 4); F($5 - $3, 20, 4); }
985+ | MVFDC DCREG ',' REG
986+ { rx_check_v3();
987+ B4(0xfd, 0x75, 0x80, 0x04); F($2, 24, 4); F($4, 20, 4); }
988+ | MVFDR
989+ { rx_check_v3(); B3(0x75, 0x90, 0x1b); }
990+ | MVTDC REG ',' DCREG
991+ { rx_check_v3();
992+ B4(0xfd, 0x77, 0x80, 0x04); F($2, 24, 4); F($4, 20, 4); }
993+ | FTOD REG ',' DREG
994+ { rx_check_v3();
995+ B4(0xfd, 0x77, 0x80, 0x0a); F($2, 24, 4); F($4, 20, 4); }
996+ | ITOD REG ',' DREG
997+ { rx_check_v3();
998+ B4(0xfd, 0x77, 0x80, 0x09); F($2, 24, 4); F($4, 20, 4); }
999+ | UTOD REG ',' DREG
1000+ { rx_check_v3();
1001+ B4(0xfd, 0x77, 0x80, 0x0d); F($2, 24, 4); F($4, 20, 4); }
1002+
1003+/* ---------------------------------------------------------------------- */
9061004
9071005 ;
9081006
@@ -1048,6 +1146,34 @@ mvfa_op
10481146 as_bad (_("IMM expects #0 to #2"));}
10491147 ;
10501148
1149+op_xor
1150+ : op_dp20_rim
1151+ | REG ',' REG ',' REG
1152+ { rx_check_v3(); B3(0xff,0x60,0x00), F ($5, 12, 4), F ($1, 16, 4), F ($3, 20, 4); }
1153+ ;
1154+
1155+op_bfield
1156+ : { rx_check_v3(); }
1157+ '#' EXPR ',' '#' EXPR ',' '#' EXPR ',' REG ',' REG
1158+ { B3(0xfc, 0x5a + (sub_op << 2), 0); F($11, 16, 4); F($13, 20, 4);
1159+ rx_bfield($3, $6, $9);}
1160+ ;
1161+
1162+op_save_rstr
1163+ : '#' EXPR
1164+ { B3(0xfd,0x76,0xe0 + (sub_op << 4)); UO1($2); }
1165+ | REG
1166+ { B4(0xfd,0x76,0xc0 + (sub_op << 4), 0x00); F($1, 20, 4); }
1167+ ;
1168+
1169+double2_op
1170+ : DREG ',' DREG
1171+ { B4(0x76, 0x90, sub_op, sub_op2); F($1, 16, 4); F($3, 24, 4);}
1172+
1173+double3_op
1174+ : DREG ',' DREG ',' DREG
1175+ { B4(0x76, 0x90, sub_op, 0x00); F($1, 28, 4); F($3, 16,4); F($5, 24, 4);}
1176+
10511177 /* ====================================================================== */
10521178
10531179 disp : { $$ = zero_expr (); }
@@ -1135,6 +1261,66 @@ token_table[] =
11351261 { "bbpsw", CREG, 24 },
11361262 { "bbpc", CREG, 25 },
11371263
1264+ { "dr0", DREG, 0 },
1265+ { "dr1", DREG, 1 },
1266+ { "dr2", DREG, 2 },
1267+ { "dr3", DREG, 3 },
1268+ { "dr4", DREG, 4 },
1269+ { "dr5", DREG, 5 },
1270+ { "dr6", DREG, 6 },
1271+ { "dr7", DREG, 7 },
1272+ { "dr8", DREG, 8 },
1273+ { "dr9", DREG, 9 },
1274+ { "dr10", DREG, 10 },
1275+ { "dr11", DREG, 11 },
1276+ { "dr12", DREG, 12 },
1277+ { "dr13", DREG, 13 },
1278+ { "dr14", DREG, 14 },
1279+ { "dr15", DREG, 15 },
1280+
1281+ { "drh0", DREGH, 0 },
1282+ { "drh1", DREGH, 1 },
1283+ { "drh2", DREGH, 2 },
1284+ { "drh3", DREGH, 3 },
1285+ { "drh4", DREGH, 4 },
1286+ { "drh5", DREGH, 5 },
1287+ { "drh6", DREGH, 6 },
1288+ { "drh7", DREGH, 7 },
1289+ { "drh8", DREGH, 8 },
1290+ { "drh9", DREGH, 9 },
1291+ { "drh10", DREGH, 10 },
1292+ { "drh11", DREGH, 11 },
1293+ { "drh12", DREGH, 12 },
1294+ { "drh13", DREGH, 13 },
1295+ { "drh14", DREGH, 14 },
1296+ { "drh15", DREGH, 15 },
1297+
1298+ { "drl0", DREGL, 0 },
1299+ { "drl1", DREGL, 1 },
1300+ { "drl2", DREGL, 2 },
1301+ { "drl3", DREGL, 3 },
1302+ { "drl4", DREGL, 4 },
1303+ { "drl5", DREGL, 5 },
1304+ { "drl6", DREGL, 6 },
1305+ { "drl7", DREGL, 7 },
1306+ { "drl8", DREGL, 8 },
1307+ { "drl9", DREGL, 9 },
1308+ { "drl10", DREGL, 10 },
1309+ { "drl11", DREGL, 11 },
1310+ { "drl12", DREGL, 12 },
1311+ { "drl13", DREGL, 13 },
1312+ { "drl14", DREGL, 14 },
1313+ { "drl15", DREGL, 15 },
1314+
1315+ { "DPSW", DCREG, 0 },
1316+ { "DCMR", DCREG, 1 },
1317+ { "DCENT", DCREG, 2 },
1318+ { "DEPC", DCREG, 3 },
1319+ { "DCR0", DCREG, 0 },
1320+ { "DCR1", DCREG, 1 },
1321+ { "DCR2", DCREG, 2 },
1322+ { "DCR3", DCREG, 3 },
1323+
11381324 { ".s", DOT_S, 0 },
11391325 { ".b", DOT_B, 0 },
11401326 { ".w", DOT_W, 0 },
@@ -1142,6 +1328,7 @@ token_table[] =
11421328 { ".a", DOT_A , 0},
11431329 { ".ub", DOT_UB, 0 },
11441330 { ".uw", DOT_UW , 0},
1331+ { ".d", DOT_D , 0},
11451332
11461333 { "c", FLAG, 0 },
11471334 { "z", FLAG, 1 },
@@ -1160,6 +1347,8 @@ token_table[] =
11601347 { "and", AND_, IS_OPCODE },
11611348 OPC(BCLR),
11621349 OPC(BCND),
1350+ OPC(BFMOV),
1351+ OPC(BFMOVZ),
11631352 OPC(BMCND),
11641353 OPC(BNOT),
11651354 OPC(BRA),
@@ -1169,9 +1358,23 @@ token_table[] =
11691358 OPC(BTST),
11701359 OPC(CLRPSW),
11711360 OPC(CMP),
1361+ OPC(DABS),
1362+ OPC(DADD),
11721363 OPC(DBT),
1364+ OPC(DDIV),
11731365 OPC(DIV),
11741366 OPC(DIVU),
1367+ OPC(DMOV),
1368+ OPC(DMUL),
1369+ OPC(DNEG),
1370+ OPC(DPOPM),
1371+ OPC(DPUSHM),
1372+ OPC(DROUND),
1373+ OPC(DSQRT),
1374+ OPC(DSUB),
1375+ OPC(DTOF),
1376+ OPC(DTOI),
1377+ OPC(DTOU),
11751378 OPC(EDIV),
11761379 OPC(EDIVU),
11771380 OPC(EMACA),
@@ -1185,10 +1388,12 @@ token_table[] =
11851388 OPC(FMUL),
11861389 OPC(FREIT),
11871390 OPC(FSQRT),
1391+ OPC(FTOD),
11881392 OPC(FTOU),
11891393 OPC(FSUB),
11901394 OPC(FTOI),
11911395 OPC(INT),
1396+ OPC(ITOD),
11921397 OPC(ITOF),
11931398 OPC(JMP),
11941399 OPC(JSR),
@@ -1197,6 +1402,9 @@ token_table[] =
11971402 OPC(MVFACMI),
11981403 OPC(MVFACLO),
11991404 OPC(MVFC),
1405+ OPC(MVFDC),
1406+ OPC(MVFDR),
1407+ OPC(MVTDC),
12001408 OPC(MVTACGU),
12011409 OPC(MVTACHI),
12021410 OPC(MVTACLO),
@@ -1243,12 +1451,14 @@ token_table[] =
12431451 OPC(ROTL),
12441452 OPC(ROTR),
12451453 OPC(ROUND),
1454+ OPC(RSTR),
12461455 OPC(RTE),
12471456 OPC(RTFI),
12481457 OPC(RTS),
12491458 OPC(RTSD),
12501459 OPC(SAT),
12511460 OPC(SATR),
1461+ OPC(SAVE),
12521462 OPC(SBB),
12531463 OPC(SCCND),
12541464 OPC(SCMPU),
@@ -1267,6 +1477,7 @@ token_table[] =
12671477 OPC(SUNTIL),
12681478 OPC(SWHILE),
12691479 OPC(TST),
1480+ OPC(UTOD),
12701481 OPC(UTOF),
12711482 OPC(WAIT),
12721483 OPC(XCHG),
@@ -1289,12 +1500,13 @@ condition_opcode_table[] =
12891500
12901501 #define NUM_CONDITION_OPCODES (sizeof (condition_opcode_table) / sizeof (condition_opcode_table[0]))
12911502
1292-static struct
1503+struct condition_symbol
12931504 {
12941505 const char * string;
12951506 int val;
1296-}
1297-condition_table[] =
1507+};
1508+
1509+static struct condition_symbol condition_table[] =
12981510 {
12991511 { "z", 0 },
13001512 { "eq", 0 },
@@ -1314,11 +1526,20 @@ condition_table[] =
13141526 { "n", 7 },
13151527 { "lt", 9 },
13161528 { "le", 11 },
1317- { "no", 13 }
1529+ { "no", 13 },
13181530 /* never = 15 */
13191531 };
13201532
1533+static struct condition_symbol double_condition_table[] =
1534+{
1535+ { "un", 1 },
1536+ { "eq", 2 },
1537+ { "lt", 4 },
1538+ { "le", 6 },
1539+};
1540+
13211541 #define NUM_CONDITIONS (sizeof (condition_table) / sizeof (condition_table[0]))
1542+#define NUM_DOUBLE_CONDITIONS (sizeof (double_condition_table) / sizeof (double_condition_table[0]))
13221543
13231544 void
13241545 rx_lex_init (char * beginning, char * ending)
@@ -1333,7 +1554,7 @@ rx_lex_init (char * beginning, char * ending)
13331554 }
13341555
13351556 static int
1336-check_condition (const char * base)
1557+check_condition (const char * base, struct condition_symbol *t, unsigned int num)
13371558 {
13381559 char * cp;
13391560 unsigned int i;
@@ -1343,11 +1564,11 @@ check_condition (const char * base)
13431564 if (memcmp (rx_lex_start, base, strlen (base)))
13441565 return 0;
13451566 cp = rx_lex_start + strlen (base);
1346- for (i = 0; i < NUM_CONDITIONS; i ++)
1567+ for (i = 0; i < num; i ++)
13471568 {
1348- if (strcasecmp (cp, condition_table[i].string) == 0)
1569+ if (strcasecmp (cp, t[i].string) == 0)
13491570 {
1350- rx_lval.regno = condition_table[i].val;
1571+ rx_lval.regno = t[i].val;
13511572 return 1;
13521573 }
13531574 }
@@ -1408,14 +1629,25 @@ rx_lex (void)
14081629 }
14091630
14101631 if (rx_last_token == 0)
1411- for (ci = 0; ci < NUM_CONDITION_OPCODES; ci ++)
1412- if (check_condition (condition_opcode_table[ci].string))
1632+ {
1633+ for (ci = 0; ci < NUM_CONDITION_OPCODES; ci ++)
1634+ if (check_condition (condition_opcode_table[ci].string,
1635+ condition_table, NUM_CONDITIONS))
1636+ {
1637+ *e = save;
1638+ rx_lex_start = e;
1639+ rx_last_token = condition_opcode_table[ci].token;
1640+ return condition_opcode_table[ci].token;
1641+ }
1642+ if (check_condition ("dcmp", double_condition_table,
1643+ NUM_DOUBLE_CONDITIONS))
14131644 {
14141645 *e = save;
14151646 rx_lex_start = e;
1416- rx_last_token = condition_opcode_table[ci].token;
1417- return condition_opcode_table[ci].token;
1647+ rx_last_token = DCMP;
1648+ return DCMP;
14181649 }
1650+ }
14191651
14201652 for (i = 0; i < NUM_TOKENS; i++)
14211653 if (strcasecmp (rx_lex_start, token_table[i].string) == 0
@@ -1446,7 +1678,7 @@ rx_lex (void)
14461678 rx_in_brackets = 0;
14471679
14481680 if (rx_in_brackets
1449- || rx_last_token == REG
1681+ || rx_last_token == REG || rx_last_token == DREG || rx_last_token == DCREG
14501682 || strchr ("[],#", *rx_lex_start))
14511683 {
14521684 rx_last_token = *rx_lex_start;
@@ -1679,7 +1911,7 @@ immediate (expressionS exp, int type, int pos, int bits)
16791911 rx_op (exp, 4, type);
16801912 return 0;
16811913 }
1682- else if (type == RXREL_SIGNED)
1914+ else if (type == RXREL_SIGNED && pos >= 0)
16831915 {
16841916 /* This is a symbolic immediate, we will relax it later. */
16851917 rx_relax (RX_RELAX_IMM, pos);
@@ -1754,6 +1986,11 @@ displacement (expressionS exp, int msize)
17541986 rx_error (_("long displacement not long-aligned"));
17551987 vshift = 2;
17561988 break;
1989+ case DSIZE:
1990+ if (val & 7)
1991+ rx_error (_("double displacement not double-aligned"));
1992+ vshift = 3;
1993+ break;
17571994 default:
17581995 as_bad (_("displacement with unknown size (internal bug?)\n"));
17591996 break;
@@ -1828,3 +2065,10 @@ rx_check_v2 (void)
18282065 if (rx_cpu < RXV2)
18292066 rx_error (_("target CPU type does not support v2 instructions"));
18302067 }
2068+
2069+static void
2070+rx_check_v3 (void)
2071+{
2072+ if (rx_cpu < RXV3)
2073+ rx_error (_("target CPU type does not support v3 instructions"));
2074+}
--- a/gas/config/tc-rx.c
+++ b/gas/config/tc-rx.c
@@ -44,7 +44,11 @@ const char FLT_CHARS[] = "dD";
4444 /* ELF flags to set in the output file header. */
4545 static int elf_flags = E_FLAG_RX_ABI;
4646
47+#ifndef TE_LINUX
4748 bfd_boolean rx_use_conventional_section_names = FALSE;
49+#else
50+bfd_boolean rx_use_conventional_section_names = TRUE;
51+#endif
4852 static bfd_boolean rx_use_small_data_limit = FALSE;
4953
5054 static bfd_boolean rx_pid_mode = FALSE;
@@ -108,15 +112,17 @@ struct cpu_type
108112 {
109113 const char *cpu_name;
110114 enum rx_cpu_types type;
115+ int flag;
111116 };
112117
113118 struct cpu_type cpu_type_list[] =
114119 {
115- {"rx100",RX100},
116- {"rx200",RX200},
117- {"rx600",RX600},
118- {"rx610",RX610},
119- {"rxv2",RXV2}
120+ {"rx100", RX100, 0},
121+ {"rx200", RX200, 0},
122+ {"rx600", RX600, 0},
123+ {"rx610", RX610, 0},
124+ {"rxv2", RXV2, E_FLAG_RX_V2},
125+ {"rxv3", RXV3, E_FLAG_RX_V3},
120126 };
121127
122128 int
@@ -181,8 +187,7 @@ md_parse_option (int c ATTRIBUTE_UNUSED, const char * arg ATTRIBUTE_UNUSED)
181187 if (strcasecmp (arg, cpu_type_list[i].cpu_name) == 0)
182188 {
183189 rx_cpu = cpu_type_list[i].type;
184- if (rx_cpu == RXV2)
185- elf_flags |= E_FLAG_RX_V2;
190+ elf_flags |= cpu_type_list[i].flag;
186191 return 1;
187192 }
188193 }
@@ -212,7 +217,7 @@ md_show_usage (FILE * stream)
212217 fprintf (stream, _(" --mrelax\n"));
213218 fprintf (stream, _(" --mpid\n"));
214219 fprintf (stream, _(" --mint-register=<value>\n"));
215- fprintf (stream, _(" --mcpu=<rx100|rx200|rx600|rx610|rxv2>\n"));
220+ fprintf (stream, _(" --mcpu=<rx100|rx200|rx600|rx610|rxv2|rxv3>\n"));
216221 fprintf (stream, _(" --mno-allow-string-insns"));
217222 }
218223
@@ -723,6 +728,8 @@ typedef struct rx_bytesT
723728 fixS * fixP;
724729 } fixups[2];
725730 int n_fixups;
731+ char post[1];
732+ int n_post;
726733 struct
727734 {
728735 char type;
@@ -947,6 +954,20 @@ rx_field5s2 (expressionS exp)
947954 rx_bytes.base[1] |= (val ) & 0x0f;
948955 }
949956
957+void
958+rx_bfield(expressionS s, expressionS d, expressionS w)
959+{
960+ int slsb = s.X_add_number;
961+ int dlsb = d.X_add_number;
962+ int width = w.X_add_number;
963+ unsigned int imm =
964+ (((dlsb + width) & 0x1f) << 10 | (dlsb << 5) |
965+ ((dlsb - slsb) & 0x1f));
966+ rx_bytes.ops[0] = imm & 0xff;
967+ rx_bytes.ops[1] = (imm >> 8);
968+ rx_bytes.n_ops = 2;
969+}
970+
950971 #define OP(x) rx_bytes.ops[rx_bytes.n_ops++] = (x)
951972
952973 #define F_PRECISION 2
@@ -1008,6 +1029,11 @@ rx_op (expressionS exp, int nbytes, int type)
10081029 }
10091030 }
10101031
1032+void rx_post(char byte)
1033+{
1034+ rx_bytes.post[rx_bytes.n_post++] = byte;
1035+}
1036+
10111037 int
10121038 rx_wrap (void)
10131039 {
@@ -1133,21 +1159,22 @@ md_assemble (char * str)
11331159 0 /* offset */,
11341160 0 /* opcode */);
11351161 frag_then->fr_opcode = bytes;
1136- frag_then->fr_fix += rx_bytes.n_base + rx_bytes.n_ops;
1137- frag_then->fr_subtype = rx_bytes.n_base + rx_bytes.n_ops;
1162+ frag_then->fr_fix += rx_bytes.n_base + rx_bytes.n_ops + rx_bytes.n_post;
1163+ frag_then->fr_subtype = rx_bytes.n_base + rx_bytes.n_ops + rx_bytes.n_post;
11381164 }
11391165 else
11401166 {
1141- bytes = frag_more (rx_bytes.n_base + rx_bytes.n_ops);
1167+ bytes = frag_more (rx_bytes.n_base + rx_bytes.n_ops + rx_bytes.n_post);
11421168 frag_then = frag_now;
11431169 if (fetchalign_bytes)
1144- fetchalign_bytes->n_ops = rx_bytes.n_base + rx_bytes.n_ops;
1170+ fetchalign_bytes->n_ops = rx_bytes.n_base + rx_bytes.n_ops + rx_bytes.n_post;
11451171 }
11461172
11471173 fetchalign_bytes = NULL;
11481174
11491175 APPEND (base, n_base);
11501176 APPEND (ops, n_ops);
1177+ APPEND (post, n_post);
11511178
11521179 if (rx_bytes.link_relax && rx_bytes.n_fixups)
11531180 {
@@ -1196,7 +1223,6 @@ md_assemble (char * str)
11961223 if (frag_then->tc_frag_data)
11971224 frag_then->tc_frag_data->fixups[i].fixP = f;
11981225 }
1199-
12001226 dwarf2_emit_insn (idx);
12011227 }
12021228
--- a/include/elf/rx.h
+++ b/include/elf/rx.h
@@ -111,7 +111,7 @@ START_RELOC_NUMBERS (elf_rx_reloc_type)
111111 END_RELOC_NUMBERS (R_RX_max)
112112
113113 #define EF_RX_CPU_RX 0x00000079 /* FIXME: this collides with the E_FLAG_RX_... values below. */
114-#define EF_RX_CPU_MASK 0x0000007F /* specific cpu bits. */
114+#define EF_RX_CPU_MASK 0x000003FF /* specific cpu bits. */
115115 #define EF_RX_ALL_FLAGS (EF_RX_CPU_MASK)
116116
117117 /* Values for the e_flags field in the ELF header. */
@@ -124,6 +124,7 @@ END_RELOC_NUMBERS (R_RX_max)
124124 #define E_FLAG_RX_SINSNS_NO 0 /* Bit-5 if this binary must not be linked with a string instruction using binary. */
125125 #define E_FLAG_RX_SINSNS_MASK (3 << 6) /* Mask of bits used to determine string instruction use. */
126126 #define E_FLAG_RX_V2 (1 << 8) /* RX v2 instructions */
127+#define E_FLAG_RX_V3 (1 << 9) /* RX v3 instructions */
127128
128129 /* These define the addend field of R_RX_RH_RELAX relocations. */
129130 #define RX_RELAXA_IMM6 0x00000010 /* Imm8/16/24/32 at bit offset 6. */