mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2025-01-18 12:24:38 +08:00
06c441ccef
2022-02-01 Ali Lown <ali.lown@imgtec.com> Andrew Bennett <andrew.bennett@imgtec.com> Dragan Mladjenovic <dragan.mladjenovic@rt-rk.com> Faraz Shahbazker <fshahbazker@wavecomp.com> sim/common/ChangeLog: * sim-bits.h (EXTEND9, EXTEND18 ,EXTEND19, EXTEND21, EXTEND26): New macros. sim/mips/ChangeLog: * Makefile.in (IGEN_INCLUDE): Add mips3264r6.igen. * configure: Regenerate. * configure.ac: Support mipsisa32r6 and mipsisa64r6. (sim_engine_run): Pick simulator model from processor specified in e_flags. * cp1.c (value_fpr): Handle fmt_dc32. (fp_unary, fp_binary): Zero initialize locals. (update_fcsr, fp_classify, fp_rint, fp_r6_cmp, inner_fmac, fp_fmac, fp_min, fp_max, fp_mina, fp_maxa, fp_fmadd, fp_fmsub): New functions. (sim_fpu_class_mips_mapping): New. * cp1.h (fcsr_ABS2008_mask, fcsr_ABS2008_shift): New define. * interp.c (MIPSR6_P): New. (load_word): Allow unaligned memory access for MIPSR6. * micromips.igen (sc, scd): Adapt to new do_sc* helper signature. * mips.igen: Add *r6 models. (signal_if_cti, forbiddenslot32): New helpers. (delayslot32): Use signal_if_cti. (do_sc, do_scd); Add store_ll_bit parameter. (sc, scd): Adapt to previous change. (nal, beq, bal): New definitions for *r6. (sll): Split nop and ssnop cases into ... (nop, ssnop): New definitions. (loadstore_ea): Use the 32-bit compatibility adressing. (cache): Split logic into ... (do_cache): New helper. (check_fpu): Select IEEE 754-2008 mode for R6. (not_word_value, unpredictable, check_mt_hilo, check_mf_hilo, check_multi_hilo, check_div_hilo, check_u64, do_dmfc1b, add, li, addu, and, andi, bgez, bgtz, blez, bltz, bne, break, dadd, daddiu, daddu, dror, dror32, drorv, dsll, dsll32, dsllv, dsra, dsra32, dsrav, dsrl, dsrl32, dsub, dsubu, j, jal, jalr, jalr.hb, lb, lbu, ld, lh, lhu, lui, lw, lwu, nor, or, ori, ror, rorv, sb, sd, sh, sll, sllv, slt, slti, sltiu, sltu, sra, srav, srl, srlv, sub, subu, sw, sync, syscall, teq, tge, tgeu, tlt, tltu, tne, xor, xori, check_fmt_p, do_load_double, do_store_double, abs.FMT, add.FMT, ceil.l.FMT, ceil.w.FMT, cfc1, ctc1, cvt.d.FMT, cvt.l.FMT, cvt.w.FMT, div.FMT, dfmc1, dmtc1, floor.l.FMT, floor.w.FMT, ldc1, lwc1, mfc1, mov.FMT, mtc1, mul.FMT, recip.FMT, round.l.FMT, round.w.FMT, rsqrt.FMT, sdc1, sqrt.FMT, sub.FMT, swc1, trunc.l.FMT, trunc.w.FMT, bc0f, bc0fl, bc0t, bc0tl, dmfc0, dmtc0, eret, mfc0, mtc0, cop, tlbp, tlbr, tlbwi, tlbwr): Enable on *r6 models. * mips3264r2.igen (dext, dextm, dextu, di, dins, dinsm, dinsu, dsbh, dshd, ei, ext, mfhc1, mthc1, ins, seb, seh, synci, rdhwr, wsbh): Likewise. * mips3264r6.igen: New file. * sim-main.h (FP_formats): Add fmt_dc32. (FORBIDDEN_SLOT): New macros. (simFORBIDDENSLOT, FP_R6CMP_*, FP_R6CLASS_*): New defines. (fp_r6_cmp, fp_classify, fp_rint, fp_min, fp_max, fp_mina, fp_maxa, fp_fmadd, fp_fmsub): New declarations. (R6Compare, Classify, RoundToIntegralExact, Min, Max, MinA, MaxA, FusedMultiplyAdd, FusedMultiplySub): New macros. Wrapping previous declarations. sim/testsuite/mips/ChangeLog: * basic.exp: Add r6-*.s tests. (run_r6_removed_test): New function. (run_endian_tests): New function. * hilo-hazard-3.s: Skip for mips*r6. * r2-fpu.s: New test. * r6-64.s: New test. * r6-branch.s: New test. * r6-forbidden.s: New test. * r6-fpu.s: New test. * r6-llsc-dp.s: New test. * r6-llsc-wp.s: New test. * r6-removed.csv: New test. * r6-removed.s: New test. * r6.s: New test. * utils-r6.inc: New inc.
206 lines
3.6 KiB
PHP
206 lines
3.6 KiB
PHP
# MIPS simulator testsuite utility functions.
|
|
# Copyright (C) 2004-2022 Free Software Foundation, Inc.
|
|
# Contributed by Chris Demetriou of Broadcom Corporation.
|
|
#
|
|
# This file is part of the GNU simulators.
|
|
#
|
|
# This program is free software; you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
|
|
|
|
# $1, $4, $5, %6, are used as temps by the macros defined here.
|
|
|
|
.macro writemsg msg
|
|
la $5, 901f
|
|
li $6, 902f - 901f
|
|
.data
|
|
901: .ascii "\msg\n"
|
|
902:
|
|
.previous
|
|
.set push
|
|
.set noreorder
|
|
jal _dowrite
|
|
li $4, 0
|
|
.set pop
|
|
.endm
|
|
|
|
|
|
# The MIPS simulator uses "break 0x3ff" as the code to exit,
|
|
# with the return value in $4 (a0).
|
|
.macro exit rc
|
|
li $4, \rc
|
|
break 0x3ff
|
|
.endm
|
|
|
|
|
|
.macro setup
|
|
|
|
.global _start
|
|
.global __start
|
|
.ent _start
|
|
_start:
|
|
__start:
|
|
.set push
|
|
.set noreorder
|
|
j DIAG
|
|
nop
|
|
.set pop
|
|
.end _start
|
|
|
|
.global _fail
|
|
.ent _fail
|
|
_fail:
|
|
writemsg "fail"
|
|
exit 1
|
|
.end _fail
|
|
|
|
.global _pass
|
|
.ent _pass
|
|
_pass:
|
|
writemsg "pass"
|
|
exit 0
|
|
.end _pass
|
|
|
|
# The MIPS simulator can use multiple different monitor types,
|
|
# so we hard-code the simulator "write" reserved instruction opcode,
|
|
# rather than jumping to a vector that invokes it. The operation
|
|
# expects RA to point to the location at which to continue
|
|
# after writing.
|
|
.global _dowrite
|
|
.ent _dowrite
|
|
_dowrite:
|
|
# Write opcode (reserved instruction). See sim_monitor and its
|
|
# callers in sim/mips/interp.c.
|
|
.word 0x00000039 | ((8 << 1) << 6)
|
|
.end _dowrite
|
|
|
|
.endm # setup
|
|
|
|
|
|
.macro pass
|
|
.set push
|
|
.set noreorder
|
|
j _pass
|
|
nop
|
|
.set pop
|
|
.endm
|
|
|
|
|
|
.macro fail
|
|
.set push
|
|
.set noreorder
|
|
j _fail
|
|
nop
|
|
.set pop
|
|
.endm
|
|
|
|
|
|
.macro load32 reg, val
|
|
li \reg, \val
|
|
.endm
|
|
|
|
|
|
.macro load64 reg, val
|
|
dli \reg, \val
|
|
.endm
|
|
|
|
|
|
.macro loadaddr reg, addr
|
|
la \reg, \addr
|
|
.endm
|
|
|
|
|
|
.macro checkreg reg, expreg
|
|
.set push
|
|
.set noat
|
|
.set noreorder
|
|
beq \expreg, \reg, 901f
|
|
nop
|
|
fail
|
|
901:
|
|
.set pop
|
|
.endm
|
|
|
|
|
|
.macro check32 reg, val
|
|
.set push
|
|
.set noat
|
|
load32 $1, \val
|
|
checkreg \reg, $1
|
|
.set pop
|
|
.endm
|
|
|
|
|
|
.macro check64 reg, val
|
|
.set push
|
|
.set noat
|
|
load64 $1, \val
|
|
checkreg \reg, $1
|
|
.set pop
|
|
.endm
|
|
|
|
|
|
# Check hi-lo register pair against data stored at base+o1 and base+o2
|
|
# Clobbers $1 - $5
|
|
.macro checkpair lo, hi, base, w, o1, o2
|
|
move $2, \lo
|
|
move $3, \hi
|
|
.set noat
|
|
la $1, \base
|
|
l\w $4, \o1($1)
|
|
l\w $5, \o2($1)
|
|
.set at
|
|
checkreg $2, $4
|
|
checkreg $3, $5
|
|
.endm
|
|
|
|
.macro checkpair_le_d lo, hi, base
|
|
checkpair \lo, \hi, \base, w, 0, 4
|
|
.endm
|
|
|
|
.macro checkpair_be_d lo, hi, base
|
|
checkpair \lo, \hi, \base, w, 4, 0
|
|
.endm
|
|
|
|
.macro checkpair_le_q lo, hi, base
|
|
checkpair \lo, \hi, \base, d, 0, 8
|
|
.endm
|
|
|
|
.macro checkpair_be_q lo, hi, base
|
|
checkpair \lo, \hi, \base, d, 8, 0
|
|
.endm
|
|
|
|
# Endian-ness for comparison is determined by reading a word at ec
|
|
.macro checkpair_xendian lo, hi, base, ec, w
|
|
.set noat
|
|
lw $1, \ec
|
|
andi $1, $1, 0x1
|
|
# check endianess
|
|
beqz $1, 2f
|
|
.set at
|
|
1: # big endian
|
|
checkpair_be_\w \lo, \hi, \base
|
|
b 3f
|
|
2: # little endian
|
|
checkpair_le_\w \lo, \hi, \base
|
|
3:
|
|
.endm
|
|
|
|
.macro checkpair_qword lo, hi, base, oe
|
|
checkpair_xendian \lo, \hi, \base, \oe, q
|
|
.endm
|
|
|
|
.macro checkpair_dword lo, hi, base, oe
|
|
checkpair_xendian \lo, \hi, \base, \oe, d
|
|
.endm
|