From 8b082fb134d844804676e8a0f5ab08738952793c Mon Sep 17 00:00:00 2001 From: Thiemo Seufer Date: Tue, 20 Feb 2007 13:28:56 +0000 Subject: [ gas/ChangeLog ] * config/tc-mips.c (mips_set_options, mips_opts, file_ase_dspr2, ISA_SUPPORTS_DSPR2_ASE, MIPS_CPU_ASE_DSPR2): Add DSP R2 ASE support. (macro_build): Add case '2'. (macro): Expand M_BALIGN to nop, packrl.ph or balign. (validate_mips_insn): Add support for balign instruction. (mips_ip): Handle DSP R2 instructions. Support balign instruction. (OPTION_DSPR2, OPTION_NO_DSPR2, OPTION_COMPAT_ARCH_BASE, md_parse_option, mips_after_parse_args): Add -mdspr2 and -mno-dspr2 command line options. (s_mipsset): Add support for .set dspr2 and .set nodspr2 directives. (md_show_usage): Add -mdspr2 and -mno-dspr2 help output. * doc/c-mips.texi, doc/as.texinfo: Document -mdspr2, -mno-dspr2, .set dspr2, .set nodspr2. [ gas/testsuite/ChangeLog ] * gas/mips/mips32-dspr2.s, gas/mips/mips32-dspr2.d: New test for DSP R2. * gas/mips/mips.exp: Run new test. [ include/opcode/Changelog ] * mips.h (OP_SH_BP, OP_MASK_BP): Add support for balign instruction. (INSN_DSPR2): Add flag for DSP R2 instructions. (M_BALIGN): New macro. [ opcodes/ChangeLog ] * mips-dis.c (mips_arch_choices): Add DSP R2 support. (print_insn_args): Add support for balign instruction. * mips-opc.c (D33): New shortcut for DSP R2 instructions. (mips_builtin_opcodes): Add DSP R2 instructions. [ sim/mips/ChangeLog ] * Makefile.in (IGEN_INCLUDE): Add dsp2.igen. * configure.ac (mips*-sde-elf*, mipsisa32r2*-*-*, mipsisa64r2*-*-*): Add dsp2 to sim_igen_machine. * configure: Regenerate. * dsp.igen (do_ph_op): Add MUL support when op = 2. (do_ph_mulq): New function to support mulq_rs.ph and mulq_s.ph. (mulq_rs.ph): Use do_ph_mulq. (MFHI, MFLO, MTHI, MTLO): Move these instructions to mips.igen. * mips.igen: Add dsp2 model and include dsp2.igen. (MFHI, MFLO, MTHI, MTLO): Extend these instructions for for *mips32r2, *mips64r2, *dsp. (MADD, MADDU, MSUB, MSUBU, MULT, MULTU): Extend these instructions for *mips32r2, *mips64r2, *dsp2. * dsp2.igen: New file for MIPS DSP REV 2 ASE. [ sim/testsuite/sim/mips/ChangeLog ] * basic.exp: Run the dsp2 test. * utils-dsp.inc (dspckacc_astio, dspck_tsimm): New macro. * mips32-dsp2.s: New test. --- sim/mips/mips.igen | 199 +++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 187 insertions(+), 12 deletions(-) (limited to 'sim/mips/mips.igen') diff --git a/sim/mips/mips.igen b/sim/mips/mips.igen index 93f4f2d..9f175eb 100644 --- a/sim/mips/mips.igen +++ b/sim/mips/mips.igen @@ -72,6 +72,7 @@ :model:::mips3d:mips3d: // mips3d.igen :model:::mdmx:mdmx: // mdmx.igen :model:::dsp:dsp: // dsp.igen +:model:::dsp2:dsp2: // dsp2.igen :model:::smartmips:smartmips: // smartmips.igen // Vendor Extensions @@ -2430,9 +2431,7 @@ 011100,5.RS,5.RT,00000,00000,000000:SPECIAL2:32::MADD "madd r, r" *mips32: -*mips32r2: *mips64: -*mips64r2: *vr5500: { signed64 temp; @@ -2448,13 +2447,32 @@ } +011100,5.RS,5.RT,000,2.AC,00000,000000:SPECIAL2:32::MADD +"madd r, r":AC == 0 +"madd ac, r, r" +*mips32r2: +*mips64r2: +*dsp2: +{ + signed64 temp; + if (AC == 0) + check_mult_hilo (SD_, HIHISTORY, LOHISTORY); + if (NotWordValue (GPR[RS]) || NotWordValue (GPR[RT])) + Unpredictable (); + TRACE_ALU_INPUT2 (GPR[RS], GPR[RT]); + temp = (U8_4 (VL4_8 (DSPHI(AC)), VL4_8 (DSPLO(AC))) + + ((signed64) EXTEND32 (GPR[RT]) * (signed64) EXTEND32 (GPR[RS]))); + DSPLO(AC) = EXTEND32 (temp); + DSPHI(AC) = EXTEND32 (VH4_8 (temp)); + if (AC == 0) + TRACE_ALU_RESULT2 (HI, LO); +} + 011100,5.RS,5.RT,00000,00000,000001:SPECIAL2:32::MADDU "maddu r, r" *mips32: -*mips32r2: *mips64: -*mips64r2: *vr5500: { unsigned64 temp; @@ -2471,6 +2489,30 @@ } +011100,5.RS,5.RT,000,2.AC,00000,000001:SPECIAL2:32::MADDU +"maddu r, r":AC == 0 +"maddu ac, r, r" +*mips32r2: +*mips64r2: +*dsp2: +{ + unsigned64 temp; + if (AC == 0) + check_mult_hilo (SD_, HIHISTORY, LOHISTORY); + if (NotWordValue (GPR[RS]) || NotWordValue (GPR[RT])) + Unpredictable (); + TRACE_ALU_INPUT2 (GPR[RS], GPR[RT]); + temp = (U8_4 (VL4_8 (DSPHI(AC)), VL4_8 (DSPLO(AC))) + + ((unsigned64) VL4_8 (GPR[RS]) * (unsigned64) VL4_8 (GPR[RT]))); + if (AC == 0) + ACX += U8_4 (VL4_8 (HI), VL4_8 (LO)) < temp; /* SmartMIPS */ + DSPLO(AC) = EXTEND32 (temp); + DSPHI(AC) = EXTEND32 (VH4_8 (temp)); + if (AC == 0) + TRACE_ALU_RESULT2 (HI, LO); +} + + :function:::void:do_mfhi:int rd { check_mf_hilo (SD_, HIHISTORY, LOHISTORY); @@ -2494,6 +2536,19 @@ } +000000,000,2.AC,00000,5.RD,00000,010000:SPECIAL:32::MFHI +"mfhi r":AC == 0 +"mfhi r, ac" +*mips32r2: +*mips64r2: +*dsp: +{ + if (AC == 0) + do_mfhi (SD_, RD); + else + GPR[RD] = DSPHI(AC); +} + :function:::void:do_mflo:int rd { @@ -2518,6 +2573,19 @@ } +000000,000,2.AC,00000,5.RD,00000,010010:SPECIAL:32::MFLO +"mflo r":AC == 0 +"mflo r, ac" +*mips32r2: +*mips64r2: +*dsp: +{ + if (AC == 0) + do_mflo (SD_, RD); + else + GPR[RD] = DSPLO(AC); +} + 000000,5.RS,5.RT,5.RD,00000,001011:SPECIAL:32::MOVN "movn r, r, r" @@ -2560,9 +2628,7 @@ 011100,5.RS,5.RT,00000,00000,000100:SPECIAL2:32::MSUB "msub r, r" *mips32: -*mips32r2: *mips64: -*mips64r2: *vr5500: { signed64 temp; @@ -2578,13 +2644,32 @@ } +011100,5.RS,5.RT,000,2.AC,00000,000100:SPECIAL2:32::MSUB +"msub r, r":AC == 0 +"msub ac, r, r" +*mips32r2: +*mips64r2: +*dsp2: +{ + signed64 temp; + if (AC == 0) + check_mult_hilo (SD_, HIHISTORY, LOHISTORY); + if (NotWordValue (GPR[RS]) || NotWordValue (GPR[RT])) + Unpredictable (); + TRACE_ALU_INPUT2 (GPR[RS], GPR[RT]); + temp = (U8_4 (VL4_8 (DSPHI(AC)), VL4_8 (DSPLO(AC))) + - ((signed64) EXTEND32 (GPR[RT]) * (signed64) EXTEND32 (GPR[RS]))); + DSPLO(AC) = EXTEND32 (temp); + DSPHI(AC) = EXTEND32 (VH4_8 (temp)); + if (AC == 0) + TRACE_ALU_RESULT2 (HI, LO); +} + 011100,5.RS,5.RT,00000,00000,000101:SPECIAL2:32::MSUBU "msubu r, r" *mips32: -*mips32r2: *mips64: -*mips64r2: *vr5500: { unsigned64 temp; @@ -2600,6 +2685,27 @@ } +011100,5.RS,5.RT,000,2.AC,00000,000101:SPECIAL2:32::MSUBU +"msubu r, r":AC == 0 +"msubu ac, r, r" +*mips32r2: +*mips64r2: +*dsp2: +{ + unsigned64 temp; + if (AC == 0) + check_mult_hilo (SD_, HIHISTORY, LOHISTORY); + if (NotWordValue (GPR[RS]) || NotWordValue (GPR[RT])) + Unpredictable (); + TRACE_ALU_INPUT2 (GPR[RS], GPR[RT]); + temp = (U8_4 (VL4_8 (DSPHI(AC)), VL4_8 (DSPLO(AC))) + - ((unsigned64) VL4_8 (GPR[RS]) * (unsigned64) VL4_8 (GPR[RT]))); + DSPLO(AC) = EXTEND32 (temp); + DSPHI(AC) = EXTEND32 (VH4_8 (temp)); + if (AC == 0) + TRACE_ALU_RESULT2 (HI, LO); +} + 000000,5.RS,000000000000000,010001:SPECIAL:32::MTHI "mthi r" @@ -2617,6 +2723,18 @@ } +000000,5.RS,00000,000,2.AC,00000,010001:SPECIAL:32::MTHI +"mthi r":AC == 0 +"mthi r, ac" +*mips32r2: +*mips64r2: +*dsp: +{ + if (AC == 0) + check_mt_hilo (SD_, HIHISTORY); + DSPHI(AC) = GPR[RS]; +} + 000000,5.RS,000000000000000,010011:SPECIAL:32::MTLO "mtlo r" @@ -2634,6 +2752,18 @@ } +000000,5.RS,00000,000,2.AC,00000,010011:SPECIAL:32::MTLO +"mtlo r":AC == 0 +"mtlo r, ac" +*mips32r2: +*mips64r2: +*dsp: +{ + if (AC == 0) + check_mt_hilo (SD_, LOHISTORY); + DSPLO(AC) = GPR[RS]; +} + 011100,5.RS,5.RT,5.RD,00000,000010:SPECIAL2:32::MUL "mul r, r, r" @@ -2680,15 +2810,38 @@ *mipsIV: *mipsV: *mips32: -*mips32r2: *mips64: -*mips64r2: *vr4100: { do_mult (SD_, RS, RT, 0); } +000000,5.RS,5.RT,000,2.AC,00000,011000:SPECIAL:32::MULT +"mult r, r":AC == 0 +"mult ac, r, r" +*mips32r2: +*mips64r2: +*dsp2: +{ + signed64 prod; + if (AC == 0) + check_mult_hilo (SD_, HIHISTORY, LOHISTORY); + if (NotWordValue (GPR[RS]) || NotWordValue (GPR[RT])) + Unpredictable (); + TRACE_ALU_INPUT2 (GPR[RS], GPR[RT]); + prod = ((signed64)(signed32) GPR[RS]) + * ((signed64)(signed32) GPR[RT]); + DSPLO(AC) = EXTEND32 (VL4_8 (prod)); + DSPHI(AC) = EXTEND32 (VH4_8 (prod)); + if (AC == 0) + { + ACX = 0; /* SmartMIPS */ + TRACE_ALU_RESULT2 (HI, LO); + } +} + + 000000,5.RS,5.RT,5.RD,00000,011000:SPECIAL:32::MULT "mult r, r":RD == 0 "mult r, r, r" @@ -2723,14 +2876,35 @@ *mipsIV: *mipsV: *mips32: -*mips32r2: *mips64: -*mips64r2: *vr4100: { do_multu (SD_, RS, RT, 0); } + +000000,5.RS,5.RT,000,2.AC,00000,011001:SPECIAL:32::MULTU +"multu r, r":AC == 0 +"multu r, r" +*mips32r2: +*mips64r2: +*dsp2: +{ + unsigned64 prod; + if (AC == 0) + check_mult_hilo (SD_, HIHISTORY, LOHISTORY); + if (NotWordValue (GPR[RS]) || NotWordValue (GPR[RT])) + Unpredictable (); + TRACE_ALU_INPUT2 (GPR[RS], GPR[RT]); + prod = ((unsigned64)(unsigned32) GPR[RS]) + * ((unsigned64)(unsigned32) GPR[RT]); + DSPLO(AC) = EXTEND32 (VL4_8 (prod)); + DSPHI(AC) = EXTEND32 (VH4_8 (prod)); + if (AC == 0) + TRACE_ALU_RESULT2 (HI, LO); +} + + 000000,5.RS,5.RT,5.RD,00000,011001:SPECIAL:32::MULTU "multu r, r":RD == 0 "multu r, r, r" @@ -5694,5 +5868,6 @@ :include:::tx.igen :include:::vr.igen :include:::dsp.igen +:include:::dsp2.igen :include:::smartmips.igen -- cgit v1.1