Commit c05854ec by Richard Sandiford Committed by Richard Sandiford

mips.exp: Rewrite.

gcc/testsuite/
	* gcc.target/mips/mips.exp: Rewrite.

	* gcc.target/mips/20020620-1.c: Use dg-options instead of
	dg-mips-options.  Remove target restrictions from dg-do.
	* gcc.target/mips/mips-ps-1.c: Likewise.
	* gcc.target/mips/mips-ps-2.c: Likewise.
	* gcc.target/mips/mips-ps-3.c: Likewise.
	* gcc.target/mips/mips-ps-4.c: Likewise.
	* gcc.target/mips/mips-ps-6.c: Likewise.

	* gcc.target/mips/asm-1.c: Use dg-options instead of dg-mips-options.
	* gcc.target/mips/branch-1.c: Likewise.
	* gcc.target/mips/clear-cache-2.c: Likewise.
	* gcc.target/mips/dse-1.c: Likewise.
	* gcc.target/mips/fix-r4000-1.c: Likewise.
	* gcc.target/mips/fix-r4000-2.c: Likewise.
	* gcc.target/mips/fix-r4000-3.c: Likewise.
	* gcc.target/mips/fix-r4000-4.c: Likewise.
	* gcc.target/mips/fix-r4000-5.c: Likewise.
	* gcc.target/mips/fix-r4000-6.c: Likewise.
	* gcc.target/mips/fix-r4000-7.c: Likewise.
	* gcc.target/mips/fix-r4000-8.c: Likewise.
	* gcc.target/mips/fix-r4000-9.c: Likewise.
	* gcc.target/mips/fix-r4000-10.c: Likewise.
	* gcc.target/mips/fix-r4000-11.c: Likewise.
	* gcc.target/mips/fix-r4000-12.c: Likewise.
	* gcc.target/mips/fix-vr4130-1.c: Likewise.
	* gcc.target/mips/fix-vr4130-2.c: Likewise.
	* gcc.target/mips/fix-vr4130-3.c: Likewise.
	* gcc.target/mips/fix-vr4130-4.c: Likewise.
	* gcc.target/mips/fpcmp-1.c: Likewise.
	* gcc.target/mips/fpcmp-2.c: Likewise.
	* gcc.target/mips/fpr-moves-1.c: Likewise.
	* gcc.target/mips/fpr-moves-2.c: Likewise.
	* gcc.target/mips/fpr-moves-3.c: Likewise.
	* gcc.target/mips/fpr-moves-4.c: Likewise.
	* gcc.target/mips/fpr-moves-5.c: Likewise.
	* gcc.target/mips/fpr-moves-6.c: Likewise.
	* gcc.target/mips/gcc-have-sync-compare-and-swap-2.c: Likewise.
	* gcc.target/mips/madd-1.c: Likewise.
	* gcc.target/mips/madd-2.c: Likewise.
	* gcc.target/mips/madd-5.c: Likewise.
	* gcc.target/mips/madd-6.c: Likewise.
	* gcc.target/mips/madd-7.c: Likewise.
	* gcc.target/mips/madd-8.c: Likewise.
	* gcc.target/mips/maddu-1.c: Likewise.
	* gcc.target/mips/maddu-2.c: Likewise.
	* gcc.target/mips/memcpy-1.c: Likewise.
	* gcc.target/mips/mips-sched-madd.c: Likewise.
	* gcc.target/mips/msub-1.c: Likewise.
	* gcc.target/mips/msub-2.c: Likewise.
	* gcc.target/mips/msub-5.c: Likewise.
	* gcc.target/mips/msub-6.c: Likewise.
	* gcc.target/mips/msub-7.c: Likewise.
	* gcc.target/mips/msub-8.c: Likewise.
	* gcc.target/mips/msubu-1.c: Likewise.
	* gcc.target/mips/msubu-2.c: Likewise.
	* gcc.target/mips/neg-abs-1.c: Likewise.
	* gcc.target/mips/neg-abs-2.c: Likewise.
	* gcc.target/mips/no-smartmips-lwxs.c: Likewise.
	* gcc.target/mips/no-smartmips-ror-1.c: Likewise.
	* gcc.target/mips/octeon-baddu-1.c: Likewise.
	* gcc.target/mips/octeon-bbit-2.c: Likewise.
	* gcc.target/mips/octeon-bbit-3.c: Likewise.
	* gcc.target/mips/octeon-cins-1.c: Likewise.
	* gcc.target/mips/octeon-cins-2.c: Likewise.
	* gcc.target/mips/octeon-dmul-1.c: Likewise.
	* gcc.target/mips/octeon-dmul-2.c: Likewise.
	* gcc.target/mips/octeon-exts-1.c: Likewise.
	* gcc.target/mips/octeon-exts-2.c: Likewise.
	* gcc.target/mips/octeon-exts-3.c: Likewise.
	* gcc.target/mips/octeon-exts-4.c: Likewise.
	* gcc.target/mips/octeon-exts-5.c: Likewise.
	* gcc.target/mips/octeon-pop-1.c: Likewise.
	* gcc.target/mips/octeon-seq-1.c: Likewise.
	* gcc.target/mips/octeon-seq-2.c: Likewise.
	* gcc.target/mips/octeon-seq-3.c: Likewise.
	* gcc.target/mips/octeon-seq-4.c: Likewise.
	* gcc.target/mips/pr26765.c: Likewise.
	* gcc.target/mips/pr33256.c: Likewise.
	* gcc.target/mips/pr33635-1.c: Likewise.
	* gcc.target/mips/pr33755.c: Likewise.
	* gcc.target/mips/pr34831.c: Likewise.
	* gcc.target/mips/pr35802.c: Likewise.
	* gcc.target/mips/pr37362.c: Likewise.
	* gcc.target/mips/r10k-cache-barrier-1.c: Likewise.
	* gcc.target/mips/r10k-cache-barrier-2.c: Likewise.
	* gcc.target/mips/r10k-cache-barrier-3.c: Likewise.
	* gcc.target/mips/r10k-cache-barrier-4.c: Likewise.
	* gcc.target/mips/r10k-cache-barrier-5.c: Likewise.
	* gcc.target/mips/r10k-cache-barrier-6.c: Likewise.
	* gcc.target/mips/r10k-cache-barrier-7.c: Likewise.
	* gcc.target/mips/r10k-cache-barrier-8.c: Likewise.
	* gcc.target/mips/r10k-cache-barrier-9.c: Likewise.
	* gcc.target/mips/r10k-cache-barrier-10.c: Likewise.
	* gcc.target/mips/r10k-cache-barrier-11.c: Likewise.
	* gcc.target/mips/r10k-cache-barrier-12.c: Likewise.
	* gcc.target/mips/r10k-cache-barrier-13.c: Likewise.
	* gcc.target/mips/r10k-cache-barrier-15.c: Likewise.
	* gcc.target/mips/r3900-mult.c: Likewise.
	* gcc.target/mips/rsqrt-4.c: Likewise.
	* gcc.target/mips/sb1-1.c: Likewise.
	* gcc.target/mips/scc-2.c: Likewise.
	* gcc.target/mips/scc-4.c: Likewise.
	* gcc.target/mips/sdata-1.c: Likewise.
	* gcc.target/mips/sdata-2.c: Likewise.
	* gcc.target/mips/sdata-3.c: Likewise.
	* gcc.target/mips/sdata-4.c: Likewise.
	* gcc.target/mips/smartmips-lwxs.c: Likewise.
	* gcc.target/mips/smartmips-ror-1.c: Likewise.
	* gcc.target/mips/smartmips-ror-2.c: Likewise.
	* gcc.target/mips/smartmips-ror-3.c: Likewise.
	* gcc.target/mips/smartmips-ror-4.c: Likewise.
	* gcc.target/mips/timode-1.c: Likewise.
	* gcc.target/mips/truncate-1.c: Likewise.
	* gcc.target/mips/truncate-2.c: Likewise.
	* gcc.target/mips/vr-mult-1.c: Likewise.
	* gcc.target/mips/vr-mult-2.c: Likewise.

	* gcc.target/mips/atomic-memory-2.c: Use dg-options instead of
	dg-mips-options.  Use isa>=2 instead of -mips32.

	* gcc.target/mips/branch-cost-1.c: Use dg-options instead of
	dg-mips-options.  Use isa>=4 instead of -mips64.
	* gcc.target/mips/branch-cost-2.c: Likewise.

	* gcc.target/mips/cache-1.c: Use dg-options instead of
	dg-mips-options.  Add isa>=3 and NOMIPS16 attributes.

	* gcc.target/mips/call-saved-1.c: Use dg-options instead of
	dg-mips-options.  Replace the mips16_attribute directives with
	a (-mips16) dg-option.  Use isa_rev=0 instead of -mips2.
	* gcc.target/mips/call-saved-2.c: Likewise.
	* gcc.target/mips/call-saved-3.c: Likewise.

	* gcc.target/mips/clear-cache-1.c: Use dg-options instead of
	dg-mips-options.  Use isa_rev>=2 instead of -mips32r2.
	* gcc.target/mips/ext_ins.c: Likewise.

	* gcc.target/mips/code-readable-1.c: Use dg-options instead of
	dg-mips-options.  Replace the mips16_attribute directives with
	a (-mips16) dg-option.  Use addressing=absolute too.
	* gcc.target/mips/code-readable-2.c: Likewise.
	* gcc.target/mips/code-readable-3.c: Likewise.

	* gcc.target/mips/dmult-1.c: Use dg-options instead of
	dg-mips-options.  Remove the mips16_attribute directives.
	* gcc.target/mips/gcc-have-sync-compare-and-swap-4.c: Likewise.

	* gcc.target/mips/dpaq_sa_l_w.c: Use dg-options instead of
	dg-mips-options.  Remove target restrictions from dg-do.
	Use -mgp32 instead of -mips32r2.
	* gcc.target/mips/dpsq_sa_l_w.c: Likewise.

	* gcc.target/mips/dsp-ctrl.c: Use dg-options instead of
	dg-mips-options.  Remove target restrictions from dg-do.
	Remove the !__mips_dsp code and add -mdsp -mgp32 to dg-options
	instead.  Add NOMIPS16 attributes.

	* gcc.target/mips/dspr2-MULT.c: Use dg-options instead of
	dg-mips-options.  Replace -march=mips32r2 with -mgp32.
	* gcc.target/mips/dspr2-MULTU.c: Likewise.

	* gcc.target/mips/ext-1.c: Use dg-options instead of
	dg-mips-options.  Use isa_rev>=2 instead of -mips64r2.

	* gcc.target/mips/fix-r10000-1.c: Use dg-options instead of
	dg-mips-options.  Remove -march=mips4.  
	* gcc.target/mips/fix-r10000-2.c: Likewise.
	* gcc.target/mips/fix-r10000-3.c: Likewise.
	* gcc.target/mips/fix-r10000-4.c: Likewise.
	* gcc.target/mips/fix-r10000-5.c: Likewise.
	* gcc.target/mips/fix-r10000-6.c: Likewise.
	* gcc.target/mips/fix-r10000-7.c: Likewise.
	* gcc.target/mips/fix-r10000-8.c: Likewise.
	* gcc.target/mips/fix-r10000-9.c: Likewise.
	* gcc.target/mips/fix-r10000-10.c: Likewise.
	* gcc.target/mips/fix-r10000-11.c: Likewise.
	* gcc.target/mips/fix-r10000-12.c: Likewise.
	* gcc.target/mips/fix-r10000-13.c: Likewise.
	* gcc.target/mips/fix-r10000-14.c: Likewise.
	* gcc.target/mips/fix-r10000-15.c: Likewise.

	* gcc.target/mips/fixed-scalar-type.c: Use dg-options instead
	of dg-mips-options.  Remove target restrictions from dg-do.
	Remove -march=mips32r2.
	* gcc.target/mips/fixed-vector-type.c: Likewise.
	* gcc.target/mips/mips32-dsp-run.c: Likewise.
	* gcc.target/mips/mips32-dspr2.c: Likewise.  Add NOMIPS16 attributes.

	* gcc.target/mips/fpr-moves-7.c: Use dg-options instead of
	dg-mips-options.  Replace the mips16_attribute directives with
	a (-mips16) dg-option.  Remove -msoft-float.
	* gcc.target/mips/fpr-moves-8.c: Likewise.
	* gcc.target/mips/int-moves-1.c: Likewise.
	* gcc.target/mips/int-moves-2.c: Likewise.

	* gcc.target/mips/gcc-have-sync-compare-and-swap-1.c: Use dg-options
	instead of dg-mips-options.  Use isa>=2 instead of -mips2.
	Add -mgp32.
	* gcc.target/mips/gcc-have-sync-compare-and-swap-3.c: Likewise.

	* gcc.target/mips/ins-1.c: Use dg-options instead of
	dg-mips-options.  Use "isa_rev>=2 -mgp32" instead of -march=mips32r2.

	* gcc.target/mips/loongson-muldiv-1.c: Use dg-options instead of
	dg-mips-options.  Use isa=loongson instead of -march=loongson2e.
	* gcc.target/mips/loongson-muldiv-2.c: Likewise.

	* gcc.target/mips/loongson-simd.c: Remove mips_loongson
	target requirement and use isa=loongson instead.  Add -mhard-float,
	-mno-mips16 and -flax-vector-conversions.

	* gcc.target/mips/lazy-binding-1.c: Use dg-options instead of
	dg-mips-options.  Remove target restrictions from dg-do.
	Add NOMIPS16 attributes.

	* gcc.target/mips/long-calls-pg.c: Use dg-options instead of
	dg-mips-options.  Remove -march=mips32 and -fno-pic.
	Add NOMIPS16 attributes.

	* gcc.target/mips/madd-3.c: Use dg-options instead of
	dg-mips-options.  Use isa_rev>=1 instead of -mips32.
	* gcc.target/mips/maddu-3.c: Likewise.
	* gcc.target/mips/msub-3.c: Likewise.
	* gcc.target/mips/msubu-3.c: Likewise.

	* gcc.target/mips/madd-4.c: Use dg-options instead of
	dg-mips-options.  Remove -mips32r2.
	* gcc.target/mips/maddu-4.c: Likewise.
	* gcc.target/mips/msub-4.c: Likewise.
	* gcc.target/mips/msubu-4.c: Likewise.

	* gcc.target/mips/mips-3d-1.c: Use dg-options instead of
	dg-mips-options.  Remove target restrictions from dg-do.
	Remove -mips64, -mhard-float and -mgp64.
	* gcc.target/mips/mips-3d-2.c: Likewise.
	* gcc.target/mips/mips-3d-3.c: Likewise.
	* gcc.target/mips/mips-3d-4.c: Likewise.
	* gcc.target/mips/mips-3d-5.c: Likewise.
	* gcc.target/mips/mips-3d-6.c: Likewise.
	* gcc.target/mips/mips-3d-7.c: Likewise.
	* gcc.target/mips/mips-3d-8.c: Likewise.
	* gcc.target/mips/mips-3d-9.c: Likewise.

	* gcc.target/mips/mips-ps-5.c: Use dg-options instead of
	dg-mips-options.  Remove -mips64.
	* gcc.target/mips/mips-ps-type.c: Likewise.

	* gcc.target/mips/mips-ps-7.c: Use dg-options instead of
	dg-mips-options.  Replace -mips32r2 with -mgp32.

	* gcc.target/mips/mips-ps-type-2.c: Use dg-options instead of
	dg-mips-options.  Use "isa_rev>=2 -mgp32" instead of -mips32r2.

	* gcc.target/mips/mips16-attributes.c: Use dg-options instead of
	dg-mips-options.  Replace the mips16_attribute directives with
	a (-mips16) dg-option.
	* gcc.target/mips/mips16-attributes-2.c: Likewise.
	* gcc.target/mips/r10k-cache-barrier-14.c: Likewise.
	* gcc.target/mips/scc-3.c: Likewise.

	* gcc.target/mips/mips16-attributes-3.c: Add { dg-options "(-mips16)" }.

	* gcc.target/mips/mips16e-extends.c: Use dg-options instead of
	dg-mips-options.  Replace the mips16_attribute directives with
	a (-mips16) dg-option.  Use isa_rev>=1 instead of -march=mips32.
	Add -mlong32.

	* gcc.target/mips/mips32-dsp.c: Use dg-options instead of
	dg-mips-options.  Replace -march=mips32 with -mgp32.

	* gcc.target/mips/mips32-dsp-type.c: Use dg-options instead of
	dg-mips-options.  Remove -march=mips32.

	* gcc.target/mips/mips32-dspr2-type.c: Use dg-options instead of
	dg-mips-options.  Remove -march=mips32r2.

	* gcc.target/mips/mips32r2-mxhc1.c: Use dg-options instead of
	dg-mips-options.  Add NOMIPS16 attributes.

	* gcc.target/mips/movcc-1.c: Use dg-options instead of
	dg-mips-options.  Use isa>=4 instead of -mips4.
	* gcc.target/mips/movcc-2.c: Likewise.
	* gcc.target/mips/movcc-3.c: Likewise.

	* gcc.target/mips/octeon-bbit-1.c: Use dg-options instead of
	dg-mips-options.  Declare foo as a NOMIPS16 function.
	Use foo instead of g.

	* gcc.target/mips/near-far-1.c: Use dg-options instead of
	dg-mips-options.  Replace the nonpic directives with an
	addressing=absolute option.
	* gcc.target/mips/near-far-2.c: Likewise.
	* gcc.target/mips/near-far-3.c: Likewise.
	* gcc.target/mips/near-far-4.c: Likewise.

	* gcc.target/mips/nmadd-1.c: Use dg-options instead of
	dg-mips-options.  Use isa=4 instead of -mips4.
	* gcc.target/mips/nmadd-2.c: Likewise.
	* gcc.target/mips/nmadd-3.c: Likewise.
	* gcc.target/mips/rsqrt-1.c: Likewise.
	* gcc.target/mips/rsqrt-2.c: Likewise.
	* gcc.target/mips/rsqrt-3.c: Likewise.

	* gcc.target/mips/save-restore-1.c: Use dg-options instead of
	dg-mips-options.  Replace the mips16_attribute directives with
	a (-mips16) dg-option.  Use isa_rev>=1 instead of -mips32r2.
	* gcc.target/mips/save-restore-2.c: Likewise.
	* gcc.target/mips/save-restore-3.c: Likewise.
	* gcc.target/mips/save-restore-4.c: Likewise.
	* gcc.target/mips/save-restore-5.c: Likewise.

	* gcc.target/mips/scc-1.c: Use dg-options instead of
	dg-mips-options.  Replace the mips16_attribute directives with
	a (-mips16) dg-option.  Use isa_rev>=1 instead of -mips32.

	* gcc.target/mips/timode-2.c: Remove target restrictions from dg-do.
	Use -mgp64.

From-SVN: r142875
parent 816bc01b
2008-12-21 Richard Sandiford <rdsandiford@googlemail.com> 2008-12-21 Richard Sandiford <rdsandiford@googlemail.com>
* gcc.target/mips/mips.exp: Rewrite.
* gcc.target/mips/20020620-1.c: Use dg-options instead of
dg-mips-options. Remove target restrictions from dg-do.
* gcc.target/mips/mips-ps-1.c: Likewise.
* gcc.target/mips/mips-ps-2.c: Likewise.
* gcc.target/mips/mips-ps-3.c: Likewise.
* gcc.target/mips/mips-ps-4.c: Likewise.
* gcc.target/mips/mips-ps-6.c: Likewise.
* gcc.target/mips/asm-1.c: Use dg-options instead of dg-mips-options.
* gcc.target/mips/branch-1.c: Likewise.
* gcc.target/mips/clear-cache-2.c: Likewise.
* gcc.target/mips/dse-1.c: Likewise.
* gcc.target/mips/fix-r4000-1.c: Likewise.
* gcc.target/mips/fix-r4000-2.c: Likewise.
* gcc.target/mips/fix-r4000-3.c: Likewise.
* gcc.target/mips/fix-r4000-4.c: Likewise.
* gcc.target/mips/fix-r4000-5.c: Likewise.
* gcc.target/mips/fix-r4000-6.c: Likewise.
* gcc.target/mips/fix-r4000-7.c: Likewise.
* gcc.target/mips/fix-r4000-8.c: Likewise.
* gcc.target/mips/fix-r4000-9.c: Likewise.
* gcc.target/mips/fix-r4000-10.c: Likewise.
* gcc.target/mips/fix-r4000-11.c: Likewise.
* gcc.target/mips/fix-r4000-12.c: Likewise.
* gcc.target/mips/fix-vr4130-1.c: Likewise.
* gcc.target/mips/fix-vr4130-2.c: Likewise.
* gcc.target/mips/fix-vr4130-3.c: Likewise.
* gcc.target/mips/fix-vr4130-4.c: Likewise.
* gcc.target/mips/fpcmp-1.c: Likewise.
* gcc.target/mips/fpcmp-2.c: Likewise.
* gcc.target/mips/fpr-moves-1.c: Likewise.
* gcc.target/mips/fpr-moves-2.c: Likewise.
* gcc.target/mips/fpr-moves-3.c: Likewise.
* gcc.target/mips/fpr-moves-4.c: Likewise.
* gcc.target/mips/fpr-moves-5.c: Likewise.
* gcc.target/mips/fpr-moves-6.c: Likewise.
* gcc.target/mips/gcc-have-sync-compare-and-swap-2.c: Likewise.
* gcc.target/mips/madd-1.c: Likewise.
* gcc.target/mips/madd-2.c: Likewise.
* gcc.target/mips/madd-5.c: Likewise.
* gcc.target/mips/madd-6.c: Likewise.
* gcc.target/mips/madd-7.c: Likewise.
* gcc.target/mips/madd-8.c: Likewise.
* gcc.target/mips/maddu-1.c: Likewise.
* gcc.target/mips/maddu-2.c: Likewise.
* gcc.target/mips/memcpy-1.c: Likewise.
* gcc.target/mips/mips-sched-madd.c: Likewise.
* gcc.target/mips/msub-1.c: Likewise.
* gcc.target/mips/msub-2.c: Likewise.
* gcc.target/mips/msub-5.c: Likewise.
* gcc.target/mips/msub-6.c: Likewise.
* gcc.target/mips/msub-7.c: Likewise.
* gcc.target/mips/msub-8.c: Likewise.
* gcc.target/mips/msubu-1.c: Likewise.
* gcc.target/mips/msubu-2.c: Likewise.
* gcc.target/mips/neg-abs-1.c: Likewise.
* gcc.target/mips/neg-abs-2.c: Likewise.
* gcc.target/mips/no-smartmips-lwxs.c: Likewise.
* gcc.target/mips/no-smartmips-ror-1.c: Likewise.
* gcc.target/mips/octeon-baddu-1.c: Likewise.
* gcc.target/mips/octeon-bbit-2.c: Likewise.
* gcc.target/mips/octeon-bbit-3.c: Likewise.
* gcc.target/mips/octeon-cins-1.c: Likewise.
* gcc.target/mips/octeon-cins-2.c: Likewise.
* gcc.target/mips/octeon-dmul-1.c: Likewise.
* gcc.target/mips/octeon-dmul-2.c: Likewise.
* gcc.target/mips/octeon-exts-1.c: Likewise.
* gcc.target/mips/octeon-exts-2.c: Likewise.
* gcc.target/mips/octeon-exts-3.c: Likewise.
* gcc.target/mips/octeon-exts-4.c: Likewise.
* gcc.target/mips/octeon-exts-5.c: Likewise.
* gcc.target/mips/octeon-pop-1.c: Likewise.
* gcc.target/mips/octeon-seq-1.c: Likewise.
* gcc.target/mips/octeon-seq-2.c: Likewise.
* gcc.target/mips/octeon-seq-3.c: Likewise.
* gcc.target/mips/octeon-seq-4.c: Likewise.
* gcc.target/mips/pr26765.c: Likewise.
* gcc.target/mips/pr33256.c: Likewise.
* gcc.target/mips/pr33635-1.c: Likewise.
* gcc.target/mips/pr33755.c: Likewise.
* gcc.target/mips/pr34831.c: Likewise.
* gcc.target/mips/pr35802.c: Likewise.
* gcc.target/mips/pr37362.c: Likewise.
* gcc.target/mips/r10k-cache-barrier-1.c: Likewise.
* gcc.target/mips/r10k-cache-barrier-2.c: Likewise.
* gcc.target/mips/r10k-cache-barrier-3.c: Likewise.
* gcc.target/mips/r10k-cache-barrier-4.c: Likewise.
* gcc.target/mips/r10k-cache-barrier-5.c: Likewise.
* gcc.target/mips/r10k-cache-barrier-6.c: Likewise.
* gcc.target/mips/r10k-cache-barrier-7.c: Likewise.
* gcc.target/mips/r10k-cache-barrier-8.c: Likewise.
* gcc.target/mips/r10k-cache-barrier-9.c: Likewise.
* gcc.target/mips/r10k-cache-barrier-10.c: Likewise.
* gcc.target/mips/r10k-cache-barrier-11.c: Likewise.
* gcc.target/mips/r10k-cache-barrier-12.c: Likewise.
* gcc.target/mips/r10k-cache-barrier-13.c: Likewise.
* gcc.target/mips/r10k-cache-barrier-15.c: Likewise.
* gcc.target/mips/r3900-mult.c: Likewise.
* gcc.target/mips/rsqrt-4.c: Likewise.
* gcc.target/mips/sb1-1.c: Likewise.
* gcc.target/mips/scc-2.c: Likewise.
* gcc.target/mips/scc-4.c: Likewise.
* gcc.target/mips/sdata-1.c: Likewise.
* gcc.target/mips/sdata-2.c: Likewise.
* gcc.target/mips/sdata-3.c: Likewise.
* gcc.target/mips/sdata-4.c: Likewise.
* gcc.target/mips/smartmips-lwxs.c: Likewise.
* gcc.target/mips/smartmips-ror-1.c: Likewise.
* gcc.target/mips/smartmips-ror-2.c: Likewise.
* gcc.target/mips/smartmips-ror-3.c: Likewise.
* gcc.target/mips/smartmips-ror-4.c: Likewise.
* gcc.target/mips/timode-1.c: Likewise.
* gcc.target/mips/truncate-1.c: Likewise.
* gcc.target/mips/truncate-2.c: Likewise.
* gcc.target/mips/vr-mult-1.c: Likewise.
* gcc.target/mips/vr-mult-2.c: Likewise.
* gcc.target/mips/atomic-memory-2.c: Use dg-options instead of
dg-mips-options. Use isa>=2 instead of -mips32.
* gcc.target/mips/branch-cost-1.c: Use dg-options instead of
dg-mips-options. Use isa>=4 instead of -mips64.
* gcc.target/mips/branch-cost-2.c: Likewise.
* gcc.target/mips/cache-1.c: Use dg-options instead of
dg-mips-options. Add isa>=3 and NOMIPS16 attributes.
* gcc.target/mips/call-saved-1.c: Use dg-options instead of
dg-mips-options. Replace the mips16_attribute directives with
a (-mips16) dg-option. Use isa_rev=0 instead of -mips2.
* gcc.target/mips/call-saved-2.c: Likewise.
* gcc.target/mips/call-saved-3.c: Likewise.
* gcc.target/mips/clear-cache-1.c: Use dg-options instead of
dg-mips-options. Use isa_rev>=2 instead of -mips32r2.
* gcc.target/mips/ext_ins.c: Likewise.
* gcc.target/mips/code-readable-1.c: Use dg-options instead of
dg-mips-options. Replace the mips16_attribute directives with
a (-mips16) dg-option. Use addressing=absolute too.
* gcc.target/mips/code-readable-2.c: Likewise.
* gcc.target/mips/code-readable-3.c: Likewise.
* gcc.target/mips/dmult-1.c: Use dg-options instead of
dg-mips-options. Remove the mips16_attribute directives.
* gcc.target/mips/gcc-have-sync-compare-and-swap-4.c: Likewise.
* gcc.target/mips/dpaq_sa_l_w.c: Use dg-options instead of
dg-mips-options. Remove target restrictions from dg-do.
Use -mgp32 instead of -mips32r2.
* gcc.target/mips/dpsq_sa_l_w.c: Likewise.
* gcc.target/mips/dsp-ctrl.c: Use dg-options instead of
dg-mips-options. Remove target restrictions from dg-do.
Remove the !__mips_dsp code and add -mdsp -mgp32 to dg-options
instead. Add NOMIPS16 attributes.
* gcc.target/mips/dspr2-MULT.c: Use dg-options instead of
dg-mips-options. Replace -march=mips32r2 with -mgp32.
* gcc.target/mips/dspr2-MULTU.c: Likewise.
* gcc.target/mips/ext-1.c: Use dg-options instead of
dg-mips-options. Use isa_rev>=2 instead of -mips64r2.
* gcc.target/mips/fix-r10000-1.c: Use dg-options instead of
dg-mips-options. Remove -march=mips4.
* gcc.target/mips/fix-r10000-2.c: Likewise.
* gcc.target/mips/fix-r10000-3.c: Likewise.
* gcc.target/mips/fix-r10000-4.c: Likewise.
* gcc.target/mips/fix-r10000-5.c: Likewise.
* gcc.target/mips/fix-r10000-6.c: Likewise.
* gcc.target/mips/fix-r10000-7.c: Likewise.
* gcc.target/mips/fix-r10000-8.c: Likewise.
* gcc.target/mips/fix-r10000-9.c: Likewise.
* gcc.target/mips/fix-r10000-10.c: Likewise.
* gcc.target/mips/fix-r10000-11.c: Likewise.
* gcc.target/mips/fix-r10000-12.c: Likewise.
* gcc.target/mips/fix-r10000-13.c: Likewise.
* gcc.target/mips/fix-r10000-14.c: Likewise.
* gcc.target/mips/fix-r10000-15.c: Likewise.
* gcc.target/mips/fixed-scalar-type.c: Use dg-options instead
of dg-mips-options. Remove target restrictions from dg-do.
Remove -march=mips32r2.
* gcc.target/mips/fixed-vector-type.c: Likewise.
* gcc.target/mips/mips32-dsp-run.c: Likewise.
* gcc.target/mips/mips32-dspr2.c: Likewise. Add NOMIPS16 attributes.
* gcc.target/mips/fpr-moves-7.c: Use dg-options instead of
dg-mips-options. Replace the mips16_attribute directives with
a (-mips16) dg-option. Remove -msoft-float.
* gcc.target/mips/fpr-moves-8.c: Likewise.
* gcc.target/mips/int-moves-1.c: Likewise.
* gcc.target/mips/int-moves-2.c: Likewise.
* gcc.target/mips/gcc-have-sync-compare-and-swap-1.c: Use dg-options
instead of dg-mips-options. Use isa>=2 instead of -mips2.
Add -mgp32.
* gcc.target/mips/gcc-have-sync-compare-and-swap-3.c: Likewise.
* gcc.target/mips/ins-1.c: Use dg-options instead of
dg-mips-options. Use "isa_rev>=2 -mgp32" instead of -march=mips32r2.
* gcc.target/mips/loongson-muldiv-1.c: Use dg-options instead of
dg-mips-options. Use isa=loongson instead of -march=loongson2e.
* gcc.target/mips/loongson-muldiv-2.c: Likewise.
* gcc.target/mips/loongson-simd.c: Remove mips_loongson
target requirement and use isa=loongson instead. Add -mhard-float,
-mno-mips16 and -flax-vector-conversions.
* gcc.target/mips/lazy-binding-1.c: Use dg-options instead of
dg-mips-options. Remove target restrictions from dg-do.
Add NOMIPS16 attributes.
* gcc.target/mips/long-calls-pg.c: Use dg-options instead of
dg-mips-options. Remove -march=mips32 and -fno-pic.
Add NOMIPS16 attributes.
* gcc.target/mips/madd-3.c: Use dg-options instead of
dg-mips-options. Use isa_rev>=1 instead of -mips32.
* gcc.target/mips/maddu-3.c: Likewise.
* gcc.target/mips/msub-3.c: Likewise.
* gcc.target/mips/msubu-3.c: Likewise.
* gcc.target/mips/madd-4.c: Use dg-options instead of
dg-mips-options. Remove -mips32r2.
* gcc.target/mips/maddu-4.c: Likewise.
* gcc.target/mips/msub-4.c: Likewise.
* gcc.target/mips/msubu-4.c: Likewise.
* gcc.target/mips/mips-3d-1.c: Use dg-options instead of
dg-mips-options. Remove target restrictions from dg-do.
Remove -mips64, -mhard-float and -mgp64.
* gcc.target/mips/mips-3d-2.c: Likewise.
* gcc.target/mips/mips-3d-3.c: Likewise.
* gcc.target/mips/mips-3d-4.c: Likewise.
* gcc.target/mips/mips-3d-5.c: Likewise.
* gcc.target/mips/mips-3d-6.c: Likewise.
* gcc.target/mips/mips-3d-7.c: Likewise.
* gcc.target/mips/mips-3d-8.c: Likewise.
* gcc.target/mips/mips-3d-9.c: Likewise.
* gcc.target/mips/mips-ps-5.c: Use dg-options instead of
dg-mips-options. Remove -mips64.
* gcc.target/mips/mips-ps-type.c: Likewise.
* gcc.target/mips/mips-ps-7.c: Use dg-options instead of
dg-mips-options. Replace -mips32r2 with -mgp32.
* gcc.target/mips/mips-ps-type-2.c: Use dg-options instead of
dg-mips-options. Use "isa_rev>=2 -mgp32" instead of -mips32r2.
* gcc.target/mips/mips16-attributes.c: Use dg-options instead of
dg-mips-options. Replace the mips16_attribute directives with
a (-mips16) dg-option.
* gcc.target/mips/mips16-attributes-2.c: Likewise.
* gcc.target/mips/r10k-cache-barrier-14.c: Likewise.
* gcc.target/mips/scc-3.c: Likewise.
* gcc.target/mips/mips16-attributes-3.c: Add { dg-options "(-mips16)" }.
* gcc.target/mips/mips16e-extends.c: Use dg-options instead of
dg-mips-options. Replace the mips16_attribute directives with
a (-mips16) dg-option. Use isa_rev>=1 instead of -march=mips32.
Add -mlong32.
* gcc.target/mips/mips32-dsp.c: Use dg-options instead of
dg-mips-options. Replace -march=mips32 with -mgp32.
* gcc.target/mips/mips32-dsp-type.c: Use dg-options instead of
dg-mips-options. Remove -march=mips32.
* gcc.target/mips/mips32-dspr2-type.c: Use dg-options instead of
dg-mips-options. Remove -march=mips32r2.
* gcc.target/mips/mips32r2-mxhc1.c: Use dg-options instead of
dg-mips-options. Add NOMIPS16 attributes.
* gcc.target/mips/movcc-1.c: Use dg-options instead of
dg-mips-options. Use isa>=4 instead of -mips4.
* gcc.target/mips/movcc-2.c: Likewise.
* gcc.target/mips/movcc-3.c: Likewise.
* gcc.target/mips/octeon-bbit-1.c: Use dg-options instead of
dg-mips-options. Declare foo as a NOMIPS16 function.
Use foo instead of g.
* gcc.target/mips/near-far-1.c: Use dg-options instead of
dg-mips-options. Replace the nonpic directives with an
addressing=absolute option.
* gcc.target/mips/near-far-2.c: Likewise.
* gcc.target/mips/near-far-3.c: Likewise.
* gcc.target/mips/near-far-4.c: Likewise.
* gcc.target/mips/nmadd-1.c: Use dg-options instead of
dg-mips-options. Use isa=4 instead of -mips4.
* gcc.target/mips/nmadd-2.c: Likewise.
* gcc.target/mips/nmadd-3.c: Likewise.
* gcc.target/mips/rsqrt-1.c: Likewise.
* gcc.target/mips/rsqrt-2.c: Likewise.
* gcc.target/mips/rsqrt-3.c: Likewise.
* gcc.target/mips/save-restore-1.c: Use dg-options instead of
dg-mips-options. Replace the mips16_attribute directives with
a (-mips16) dg-option. Use isa_rev>=1 instead of -mips32r2.
* gcc.target/mips/save-restore-2.c: Likewise.
* gcc.target/mips/save-restore-3.c: Likewise.
* gcc.target/mips/save-restore-4.c: Likewise.
* gcc.target/mips/save-restore-5.c: Likewise.
* gcc.target/mips/scc-1.c: Use dg-options instead of
dg-mips-options. Replace the mips16_attribute directives with
a (-mips16) dg-option. Use isa_rev>=1 instead of -mips32.
* gcc.target/mips/timode-2.c: Remove target restrictions from dg-do.
Use -mgp64.
2008-12-21 Richard Sandiford <rdsandiford@googlemail.com>
PR target/35899 PR target/35899
* gcc.target/mips/smartmips-lwxs.c: Add -mlong32. * gcc.target/mips/smartmips-lwxs.c: Add -mlong32.
......
/* { dg-do compile { target mips64*-*-* mipsisa64*-*-* } } */ /* { dg-do compile } */
/* { dg-mips-options "-O2 -mlong64" } */ /* { dg-options "-O2 -mlong64" } */
int foo (int *x, int i) int foo (int *x, int i)
{ {
return x[i] + i; return x[i] + i;
......
/* PR target/17565. GCC used to put the asm into the delay slot /* PR target/17565. GCC used to put the asm into the delay slot
of the call. */ of the call. */
/* { dg-do assemble } */ /* { dg-do assemble } */
/* { dg-mips-options "-O" } */ /* { dg-options "-O" } */
NOMIPS16 int foo (int n) NOMIPS16 int foo (int n)
{ {
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O2 -mips32 -mabi=32" } */ /* { dg-options "-O2 isa>=2 -mabi=32" } */
/* { dg-final { scan-assembler "addiu" } } */ /* { dg-final { scan-assembler "addiu" } } */
/* { dg-final { scan-assembler-not "subu" } } */ /* { dg-final { scan-assembler-not "subu" } } */
......
/* We should implement these "if" statements using an "andi" instruction /* We should implement these "if" statements using an "andi" instruction
followed by a branch on zero. */ followed by a branch on zero. */
/* { dg-mips-options "-O2" } */ /* { dg-options "-O2" } */
void bar (void); void bar (void);
NOMIPS16 void f1 (int x) { if (x & 4) bar (); } NOMIPS16 void f1 (int x) { if (x & 4) bar (); }
......
/* { dg-mips-options "-mbranch-cost=1 -mips64 -O2" } */ /* { dg-options "-mbranch-cost=1 isa>=4 -O2" } */
NOMIPS16 int NOMIPS16 int
foo (int x, int y, int z, int k) foo (int x, int y, int z, int k)
{ {
......
/* { dg-mips-options "-mbranch-cost=10 -mips64 -O2" } */ /* { dg-options "-mbranch-cost=10 isa>=4 -O2" } */
NOMIPS16 int NOMIPS16 int
foo (int x, int y, int z, int k) foo (int x, int y, int z, int k)
{ {
......
/* { dg-mips-options "-O2" } */ /* { dg-options "-O2 isa>=3" } */
void NOMIPS16 void
f1 (int *area) f1 (int *area)
{ {
__builtin_mips_cache (20, area); __builtin_mips_cache (20, area);
} }
void NOMIPS16 void
f2 (const short *area) f2 (const short *area)
{ {
__builtin_mips_cache (24, area + 10); __builtin_mips_cache (24, area + 10);
} }
void NOMIPS16 void
f3 (volatile unsigned int *area, int offset) f3 (volatile unsigned int *area, int offset)
{ {
__builtin_mips_cache (0, area + offset); __builtin_mips_cache (0, area + offset);
} }
void NOMIPS16 void
f4 (const volatile unsigned char *area) f4 (const volatile unsigned char *area)
{ {
__builtin_mips_cache (4, area - 80); __builtin_mips_cache (4, area - 80);
......
/* Check that we save all call-saved GPRs in a MIPS16 __builtin_eh_return /* Check that we save all call-saved GPRs in a MIPS16 __builtin_eh_return
function. */ function. */
/* { dg-do compile { target mips16_attribute } } */ /* { dg-options "(-mips16) isa_rev=0" } */
/* { dg-mips-options "-mips2" } */
/* { dg-add-options mips16_attribute } */
void bar (void); void bar (void);
......
/* Check that we save non-MIPS16 GPRs if they are explicitly clobbered. */ /* Check that we save non-MIPS16 GPRs if they are explicitly clobbered. */
/* { dg-do compile { target mips16_attribute } } */ /* { dg-options "(-mips16) isa_rev=0 -O2" } */
/* { dg-mips-options "-mips2 -O2" } */
/* { dg-add-options mips16_attribute } */
MIPS16 void MIPS16 void
foo (void) foo (void)
......
/* Check that we save all call-saved GPRs in a MIPS16 __builtin_setjmp /* Check that we save all call-saved GPRs in a MIPS16 __builtin_setjmp
function. */ function. */
/* { dg-do compile { target mips16_attribute } } */ /* { dg-options "(-mips16) isa_rev=0 -O2" } */
/* { dg-mips-options "-mips2 -O2" } */
/* { dg-add-options mips16_attribute } */
void bar (void); void bar (void);
extern int buf[]; extern int buf[];
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O2 -mips32r2" } */ /* { dg-options "-O2 isa_rev>=2" } */
/* { dg-final { scan-assembler "synci" } } */ /* { dg-final { scan-assembler "synci" } } */
/* { dg-final { scan-assembler "jr.hb" } } */ /* { dg-final { scan-assembler "jr.hb" } } */
/* { dg-final { scan-assembler-not "_flush_cache" } } */ /* { dg-final { scan-assembler-not "_flush_cache" } } */
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O2 -mips32" } */ /* { dg-options "-O2 -mips32" } */
/* { dg-final { scan-assembler-not "synci" } } */ /* { dg-final { scan-assembler-not "synci" } } */
/* { dg-final { scan-assembler-not "jr.hb" } } */ /* { dg-final { scan-assembler-not "jr.hb" } } */
/* { dg-final { scan-assembler "_flush_cache" } } */ /* { dg-final { scan-assembler "_flush_cache" } } */
......
/* { dg-do compile { target mips16_attribute } } */ /* { dg-options "(-mips16) -mcode-readable=yes -mgp32 addressing=absolute" } */
/* { dg-mips-options "-mcode-readable=yes -mgp32" } */
/* { dg-add-options mips16_attribute } */
MIPS16 int MIPS16 int
foo (int i) foo (int i)
......
/* { dg-do compile { target mips16_attribute } } */ /* { dg-options "(-mips16) -mcode-readable=pcrel -mgp32 addressing=absolute" } */
/* { dg-mips-options "-mcode-readable=pcrel -mgp32" } */
/* { dg-add-options mips16_attribute } */
MIPS16 int MIPS16 int
foo (int i) foo (int i)
......
/* { dg-do compile { target mips16_attribute } } */ /* { dg-options "(-mips16) -mcode-readable=no -mgp32 addressing=absolute" } */
/* { dg-mips-options "-mcode-readable=no -mgp32" } */
/* { dg-add-options mips16_attribute } */
MIPS16 int MIPS16 int
foo (int i) foo (int i)
......
/* { dg-do compile { target mips16_attribute } } */ /* { dg-options "-mips64 -mgp64" } */
/* { dg-mips-options "-mips64 -mgp64" } */
/* { dg-add-options mips16_attribute } */
/* { dg-final { scan-assembler "\tdmult\t" } } */ /* { dg-final { scan-assembler "\tdmult\t" } } */
/* { dg-final { scan-assembler "\tmflo\t" } } */ /* { dg-final { scan-assembler "\tmflo\t" } } */
/* { dg-final { scan-assembler-not "\tdmul\t" } } */ /* { dg-final { scan-assembler-not "\tdmul\t" } } */
......
/* { dg-do compile { target {fixed_point} } } */ /* { dg-do compile } */
/* { dg-mips-options "-O2 -mips32r2 -mdsp" } */ /* { dg-options "-O2 -mgp32 -mdsp" } */
/* { dg-final { scan-assembler-times "\tdpaq_sa.l.w\t\\\$ac" 3 } } */ /* { dg-final { scan-assembler-times "\tdpaq_sa.l.w\t\\\$ac" 3 } } */
NOMIPS16 _Sat long long _Fract NOMIPS16 _Sat long long _Fract
......
/* { dg-do compile { target {fixed_point} } } */ /* { dg-do compile } */
/* { dg-mips-options "-O2 -mips32r2 -mdsp" } */ /* { dg-options "-O2 -mgp32 -mdsp" } */
/* { dg-final { scan-assembler-times "\tdpsq_sa.l.w\t\\\$ac" 2 } } */ /* { dg-final { scan-assembler-times "\tdpsq_sa.l.w\t\\\$ac" 2 } } */
NOMIPS16 _Sat long long _Fract NOMIPS16 _Sat long long _Fract
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-mgp64 -O" } */ /* { dg-options "-mgp64 -O" } */
#define TEST(ID, TYPE1, TYPE2) \ #define TEST(ID, TYPE1, TYPE2) \
union u##ID { \ union u##ID { \
......
/* { dg-do run { target mips*-*-* } } */ /* { dg-do run } */
/* { dg-options "-O2" } */ /* { dg-options "-O2 -mdsp -mgp32" } */
extern void abort (void); extern void abort (void);
extern void exit (int); extern void exit (int);
#if __mips_dsp
void __attribute__ ((noinline)) NOMIPS16 void __attribute__ ((noinline))
test1 (int i) test1 (int i)
{ {
__builtin_mips_wrdsp (i, 63); __builtin_mips_wrdsp (i, 63);
} }
void __attribute__ ((noinline)) NOMIPS16 void __attribute__ ((noinline))
test2 () test2 ()
{ {
long long a = 0; long long a = 0;
__builtin_mips_extpdp (a, 3); __builtin_mips_extpdp (a, 3);
} }
void __attribute__ ((noinline)) NOMIPS16 void __attribute__ ((noinline))
test3 (int i) test3 (int i)
{ {
long long a = 0; long long a = 0;
__builtin_mips_extpdp (a, i); __builtin_mips_extpdp (a, i);
} }
void __attribute__ ((noinline)) NOMIPS16 void __attribute__ ((noinline))
test4 () test4 ()
{ {
long long a = 0; long long a = 0;
...@@ -33,7 +32,7 @@ test4 () ...@@ -33,7 +32,7 @@ test4 ()
__builtin_mips_mthlip (a, i); __builtin_mips_mthlip (a, i);
} }
int NOMIPS16 int
main () main ()
{ {
int cntl; int cntl;
...@@ -68,13 +67,3 @@ main () ...@@ -68,13 +67,3 @@ main ()
exit (0); exit (0);
} }
#else
int
main ()
{
exit (0);
}
#endif
/* Test MIPS32 DSP REV 2 MULT instruction */ /* Test MIPS32 DSP REV 2 MULT instruction */
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-march=mips32r2 -mdspr2 -O2 -ffixed-hi -ffixed-lo" } */ /* { dg-options "-mgp32 -mdspr2 -O2 -ffixed-hi -ffixed-lo" } */
/* { dg-final { scan-assembler "\tmult\t" } } */ /* { dg-final { scan-assembler "\tmult\t" } } */
/* { dg-final { scan-assembler "ac1" } } */ /* { dg-final { scan-assembler "ac1" } } */
......
/* Test MIPS32 DSP REV 2 MULTU instruction */ /* Test MIPS32 DSP REV 2 MULTU instruction */
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-march=mips32r2 -mdspr2 -O2 -ffixed-hi -ffixed-lo" } */ /* { dg-options "-mgp32 -mdspr2 -O2 -ffixed-hi -ffixed-lo" } */
/* { dg-final { scan-assembler "\tmultu\t" } } */ /* { dg-final { scan-assembler "\tmultu\t" } } */
/* { dg-final { scan-assembler "ac1" } } */ /* { dg-final { scan-assembler "ac1" } } */
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O -mips64r2 -mgp64" } */ /* { dg-options "-O isa_rev>=2 -mgp64" } */
/* { dg-final { scan-assembler "\tdext\t" } } */ /* { dg-final { scan-assembler "\tdext\t" } } */
/* { dg-final { scan-assembler-not "and" } } */ /* { dg-final { scan-assembler-not "and" } } */
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-march=mips32r2" } */ /* { dg-options "isa_rev>=2" } */
/* { dg-final { scan-assembler "ext" } } */ /* { dg-final { scan-assembler "ext" } } */
/* { dg-final { scan-assembler "ins" } } */ /* { dg-final { scan-assembler "ins" } } */
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O2 -march=mips4 -mfix-r10000" } */ /* { dg-options "-O2 -mfix-r10000" } */
/* { dg-final { scan-assembler-times "\tbeql\t" 3 } } */ /* { dg-final { scan-assembler-times "\tbeql\t" 3 } } */
NOMIPS16 int NOMIPS16 int
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O2 -march=mips4 -mfix-r10000" } */ /* { dg-options "-O2 -mfix-r10000" } */
/* { dg-final { scan-assembler-times "\tbeql\t" 3 } } */ /* { dg-final { scan-assembler-times "\tbeql\t" 3 } } */
NOMIPS16 int NOMIPS16 int
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O2 -march=mips4 -mfix-r10000" } */ /* { dg-options "-O2 -mfix-r10000" } */
/* { dg-final { scan-assembler-times "\tbeql\t" 3 } } */ /* { dg-final { scan-assembler-times "\tbeql\t" 3 } } */
NOMIPS16 int NOMIPS16 int
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O2 -march=mips4 -mfix-r10000" } */ /* { dg-options "-O2 -mfix-r10000" } */
/* { dg-final { scan-assembler-times "\tbeql\t" 3 } } */ /* { dg-final { scan-assembler-times "\tbeql\t" 3 } } */
/* { dg-message "note: '__sync_nand_and_fetch' changed semantics in GCC 4.4" "" { target *-*-* } 0 } */ /* { dg-message "note: '__sync_nand_and_fetch' changed semantics in GCC 4.4" "" { target *-*-* } 0 } */
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O2 -march=mips4 -mfix-r10000" } */ /* { dg-options "-O2 -mfix-r10000" } */
/* { dg-final { scan-assembler-times "\tbeql\t" 3 } } */ /* { dg-final { scan-assembler-times "\tbeql\t" 3 } } */
NOMIPS16 int NOMIPS16 int
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O2 -march=mips4 -mfix-r10000" } */ /* { dg-options "-O2 -mfix-r10000" } */
/* { dg-final { scan-assembler-times "\tbeql\t" 3 } } */ /* { dg-final { scan-assembler-times "\tbeql\t" 3 } } */
NOMIPS16 int NOMIPS16 int
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O2 -march=mips4 -mfix-r10000" } */ /* { dg-options "-O2 -mfix-r10000" } */
/* { dg-final { scan-assembler-times "\tbeql\t" 3 } } */ /* { dg-final { scan-assembler-times "\tbeql\t" 3 } } */
NOMIPS16 int NOMIPS16 int
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O2 -march=mips4 -mfix-r10000" } */ /* { dg-options "-O2 -mfix-r10000" } */
/* { dg-final { scan-assembler-times "\tbeql\t" 3 } } */ /* { dg-final { scan-assembler-times "\tbeql\t" 3 } } */
NOMIPS16 int NOMIPS16 int
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O2 -march=mips4 -mfix-r10000" } */ /* { dg-options "-O2 -mfix-r10000" } */
/* { dg-final { scan-assembler-times "\tbeql\t" 3 } } */ /* { dg-final { scan-assembler-times "\tbeql\t" 3 } } */
NOMIPS16 int NOMIPS16 int
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O2 -march=mips4 -mfix-r10000" } */ /* { dg-options "-O2 -mfix-r10000" } */
/* { dg-final { scan-assembler-times "\tbeql\t" 3 } } */ /* { dg-final { scan-assembler-times "\tbeql\t" 3 } } */
NOMIPS16 int NOMIPS16 int
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O2 -march=mips4 -mfix-r10000" } */ /* { dg-options "-O2 -mfix-r10000" } */
/* { dg-final { scan-assembler-times "\tbeql\t" 3 } } */ /* { dg-final { scan-assembler-times "\tbeql\t" 3 } } */
NOMIPS16 int NOMIPS16 int
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O2 -march=mips4 -mfix-r10000" } */ /* { dg-options "-O2 -mfix-r10000" } */
/* { dg-final { scan-assembler-times "\tbeql\t" 3 } } */ /* { dg-final { scan-assembler-times "\tbeql\t" 3 } } */
/* { dg-message "note: '__sync_fetch_and_nand' changed semantics in GCC 4.4" "" { target *-*-* } 0 } */ /* { dg-message "note: '__sync_fetch_and_nand' changed semantics in GCC 4.4" "" { target *-*-* } 0 } */
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O2 -march=mips4 -mfix-r10000" } */ /* { dg-options "-O2 -mfix-r10000" } */
/* { dg-final { scan-assembler-times "\tbeql\t" 3 } } */ /* { dg-final { scan-assembler-times "\tbeql\t" 3 } } */
NOMIPS16 int NOMIPS16 int
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O2 -march=mips4 -mfix-r10000" } */ /* { dg-options "-O2 -mfix-r10000" } */
/* { dg-final { scan-assembler-times "\tbeql\t" 3 } } */ /* { dg-final { scan-assembler-times "\tbeql\t" 3 } } */
NOMIPS16 int NOMIPS16 int
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O2 -march=mips4 -mfix-r10000" } */ /* { dg-options "-O2 -mfix-r10000" } */
/* { dg-final { scan-assembler-times "\tbeql\t" 3 } } */ /* { dg-final { scan-assembler-times "\tbeql\t" 3 } } */
NOMIPS16 int NOMIPS16 int
......
/* { dg-mips-options "-march=r4000 -mfix-r4000 -O2 -dp" } */ /* { dg-options "-march=r4000 -mfix-r4000 -O2 -dp" } */
typedef int int32_t; typedef int int32_t;
typedef int uint32_t; typedef int uint32_t;
int32_t foo (int32_t x, int32_t y) { return x * y; } int32_t foo (int32_t x, int32_t y) { return x * y; }
......
/* ??? At the moment, lower-subreg.c decomposes the copy of the multiplication /* ??? At the moment, lower-subreg.c decomposes the copy of the multiplication
result to $2, which prevents the register allocators from storing the result to $2, which prevents the register allocators from storing the
multiplication result in $2. */ multiplication result in $2. */
/* { dg-mips-options "-mips3 -mfix-r4000 -mgp64 -O2 -fno-split-wide-types -dp -EL" } */ /* { dg-options "-mips3 -mfix-r4000 -mgp64 -O2 -fno-split-wide-types -dp -EL" } */
typedef unsigned long long uint64_t; typedef unsigned long long uint64_t;
typedef unsigned int uint128_t __attribute__((mode(TI))); typedef unsigned int uint128_t __attribute__((mode(TI)));
uint128_t foo (uint64_t x, uint64_t y) { return (uint128_t) x * y; } uint128_t foo (uint64_t x, uint64_t y) { return (uint128_t) x * y; }
......
/* { dg-mips-options "-march=r4000 -mfix-r4000 -mgp64 -O2 -dp" } */ /* { dg-options "-march=r4000 -mfix-r4000 -mgp64 -O2 -dp" } */
typedef long long int64_t; typedef long long int64_t;
int64_t foo (int64_t x) { return x / 11993; } int64_t foo (int64_t x) { return x / 11993; }
/* { dg-final { scan-assembler "[concat {\tdmult\t\$4,\$[0-9]+[^\n]+smuldi3_highpart[^\n]+\n\tmfhi\t\$[0-9]+\n}]" } } */ /* { dg-final { scan-assembler "[concat {\tdmult\t\$4,\$[0-9]+[^\n]+smuldi3_highpart[^\n]+\n\tmfhi\t\$[0-9]+\n}]" } } */
/* { dg-mips-options "-march=r4000 -mfix-r4000 -mgp64 -O2 -dp" } */ /* { dg-options "-march=r4000 -mfix-r4000 -mgp64 -O2 -dp" } */
typedef unsigned long long uint64_t; typedef unsigned long long uint64_t;
uint64_t foo (uint64_t x) { return x / 11993; } uint64_t foo (uint64_t x) { return x / 11993; }
/* { dg-final { scan-assembler "[concat {\tdmultu\t\$4,\$[0-9]+[^\n]+umuldi3_highpart[^\n]+\n\tmfhi\t\$[0-9]+\n}]" } } */ /* { dg-final { scan-assembler "[concat {\tdmultu\t\$4,\$[0-9]+[^\n]+umuldi3_highpart[^\n]+\n\tmfhi\t\$[0-9]+\n}]" } } */
/* { dg-mips-options "-mips1 -mfix-r4000 -O2 -dp -EB" } */ /* { dg-options "-mips1 -mfix-r4000 -O2 -dp -EB" } */
typedef int int32_t; typedef int int32_t;
typedef long long int64_t; typedef long long int64_t;
int32_t foo (int32_t x, int32_t y) { return ((int64_t) x * y) >> 32; } int32_t foo (int32_t x, int32_t y) { return ((int64_t) x * y) >> 32; }
......
/* { dg-mips-options "-mips1 -mfix-r4000 -O2 -dp -EB" } */ /* { dg-options "-mips1 -mfix-r4000 -O2 -dp -EB" } */
typedef unsigned int uint32_t; typedef unsigned int uint32_t;
typedef unsigned long long uint64_t; typedef unsigned long long uint64_t;
uint32_t foo (uint32_t x, uint32_t y) { return ((uint64_t) x * y) >> 32; } uint32_t foo (uint32_t x, uint32_t y) { return ((uint64_t) x * y) >> 32; }
......
/* ??? At the moment, lower-subreg.c decomposes the copy of the multiplication /* ??? At the moment, lower-subreg.c decomposes the copy of the multiplication
result to $2, which prevents the register allocators from storing the result to $2, which prevents the register allocators from storing the
multiplication result in $2. */ multiplication result in $2. */
/* { dg-mips-options "-mips1 -mfix-r4000 -O2 -fno-split-wide-types -dp -EL" } */ /* { dg-options "-mips1 -mfix-r4000 -O2 -fno-split-wide-types -dp -EL" } */
typedef int int32_t; typedef int int32_t;
typedef long long int64_t; typedef long long int64_t;
int64_t foo (int32_t x, int32_t y) { return (int64_t) x * y; } int64_t foo (int32_t x, int32_t y) { return (int64_t) x * y; }
......
/* ??? At the moment, lower-subreg.c decomposes the copy of the multiplication /* ??? At the moment, lower-subreg.c decomposes the copy of the multiplication
result to $2, which prevents the register allocators from storing the result to $2, which prevents the register allocators from storing the
multiplication result in $2. */ multiplication result in $2. */
/* { dg-mips-options "-mips1 -mfix-r4000 -O2 -fno-split-wide-types -dp -EL" } */ /* { dg-options "-mips1 -mfix-r4000 -O2 -fno-split-wide-types -dp -EL" } */
typedef unsigned int uint32_t; typedef unsigned int uint32_t;
typedef unsigned long long uint64_t; typedef unsigned long long uint64_t;
uint64_t foo (uint32_t x, uint32_t y) { return (uint64_t) x * y; } uint64_t foo (uint32_t x, uint32_t y) { return (uint64_t) x * y; }
......
/* { dg-mips-options "-march=r4000 -mfix-r4000 -mgp64 -O2 -dp" } */ /* { dg-options "-march=r4000 -mfix-r4000 -mgp64 -O2 -dp" } */
typedef long long int64_t; typedef long long int64_t;
typedef unsigned long long uint64_t; typedef unsigned long long uint64_t;
int64_t foo (int64_t x, int64_t y) { return x * y; } int64_t foo (int64_t x, int64_t y) { return x * y; }
......
/* { dg-mips-options "-march=r4000 -mfix-r4000 -O2 -mgp64 -dp -EB" } */ /* { dg-options "-march=r4000 -mfix-r4000 -O2 -mgp64 -dp -EB" } */
typedef long long int64_t; typedef long long int64_t;
typedef int int128_t __attribute__((mode(TI))); typedef int int128_t __attribute__((mode(TI)));
int64_t foo (int64_t x, int64_t y) { return ((int128_t) x * y) >> 64; } int64_t foo (int64_t x, int64_t y) { return ((int128_t) x * y) >> 64; }
......
/* { dg-mips-options "-march=r4000 -mfix-r4000 -O2 -mgp64 -dp -EB" } */ /* { dg-options "-march=r4000 -mfix-r4000 -O2 -mgp64 -dp -EB" } */
typedef unsigned long long uint64_t; typedef unsigned long long uint64_t;
typedef unsigned int uint128_t __attribute__((mode(TI))); typedef unsigned int uint128_t __attribute__((mode(TI)));
uint64_t foo (uint64_t x, uint64_t y) { return ((uint128_t) x * y) >> 64; } uint64_t foo (uint64_t x, uint64_t y) { return ((uint128_t) x * y) >> 64; }
......
/* ??? At the moment, lower-subreg.c decomposes the copy of the multiplication /* ??? At the moment, lower-subreg.c decomposes the copy of the multiplication
result to $2, which prevents the register allocators from storing the result to $2, which prevents the register allocators from storing the
multiplication result in $2. */ multiplication result in $2. */
/* { dg-mips-options "-mips3 -mfix-r4000 -mgp64 -O2 -fno-split-wide-types -dp -EL" } */ /* { dg-options "-mips3 -mfix-r4000 -mgp64 -O2 -fno-split-wide-types -dp -EL" } */
typedef long long int64_t; typedef long long int64_t;
typedef int int128_t __attribute__((mode(TI))); typedef int int128_t __attribute__((mode(TI)));
int128_t foo (int64_t x, int64_t y) { return (int128_t) x * y; } int128_t foo (int64_t x, int64_t y) { return (int128_t) x * y; }
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-march=vr4130 -mfix-vr4130" } */ /* { dg-options "-march=vr4130 -mfix-vr4130" } */
NOMIPS16 unsigned int NOMIPS16 unsigned int
foo (unsigned int x, unsigned int y) foo (unsigned int x, unsigned int y)
{ {
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-march=vr4130 -mfix-vr4130" } */ /* { dg-options "-march=vr4130 -mfix-vr4130" } */
NOMIPS16 int foo (void) { int r; asm ("# foo" : "=l" (r)); return r; } NOMIPS16 int foo (void) { int r; asm ("# foo" : "=l" (r)); return r; }
/* { dg-final { scan-assembler "\tmacc\t" } } */ /* { dg-final { scan-assembler "\tmacc\t" } } */
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-march=vr4130 -mgp64 -mfix-vr4130" } */ /* { dg-options "-march=vr4130 -mgp64 -mfix-vr4130" } */
NOMIPS16 unsigned long long NOMIPS16 unsigned long long
foo (unsigned long long x, unsigned long long y) foo (unsigned long long x, unsigned long long y)
{ {
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-march=vr4130 -mgp64 -mfix-vr4130" } */ /* { dg-options "-march=vr4130 -mgp64 -mfix-vr4130" } */
NOMIPS16 long long NOMIPS16 long long
foo (void) foo (void)
{ {
......
/* Test scalar fixed-point instructions */ /* Test scalar fixed-point instructions */
/* { dg-do compile { target {fixed_point} } } */ /* { dg-do compile } */
/* { dg-mips-options "-march=mips32r2 -mdspr2 -O2" } */ /* { dg-options "-mdspr2 -O2" } */
/* { dg-final { scan-assembler-times "\taddu\t" 10 } } */ /* { dg-final { scan-assembler-times "\taddu\t" 10 } } */
/* { dg-final { scan-assembler-times "\tsubu\t" 10 } } */ /* { dg-final { scan-assembler-times "\tsubu\t" 10 } } */
/* { dg-final { scan-assembler "\taddu_s.qb\t" } } */ /* { dg-final { scan-assembler "\taddu_s.qb\t" } } */
......
/* Test vector fixed-point instructions */ /* Test vector fixed-point instructions */
/* { dg-do compile { target {fixed_point} } } */ /* { dg-do compile } */
/* { dg-mips-options "-march=mips32r2 -mdspr2 -O2" } */ /* { dg-options "-mdspr2 -O2" } */
/* { dg-final { scan-assembler-times "\taddq_s.ph\t" 2 } } */ /* { dg-final { scan-assembler-times "\taddq_s.ph\t" 2 } } */
/* { dg-final { scan-assembler-times "\tsubq_s.ph\t" 2 } } */ /* { dg-final { scan-assembler-times "\tsubq_s.ph\t" 2 } } */
/* { dg-final { scan-assembler-times "\taddu_s.qb\t" 1 } } */ /* { dg-final { scan-assembler-times "\taddu_s.qb\t" 1 } } */
......
/* We used to use c.lt.fmt instead of c.ule.fmt here. */ /* We used to use c.lt.fmt instead of c.ule.fmt here. */
/* { dg-mips-options "-mhard-float -O2" } */ /* { dg-options "-mhard-float -O2" } */
NOMIPS16 int f1 (float x, float y) { return __builtin_isless (x, y); } NOMIPS16 int f1 (float x, float y) { return __builtin_isless (x, y); }
NOMIPS16 int f2 (double x, double y) { return __builtin_isless (x, y); } NOMIPS16 int f2 (double x, double y) { return __builtin_isless (x, y); }
/* { dg-final { scan-assembler "c\\.ule\\.s" } } */ /* { dg-final { scan-assembler "c\\.ule\\.s" } } */
......
/* We used to use c.le.fmt instead of c.ult.fmt here. */ /* We used to use c.le.fmt instead of c.ult.fmt here. */
/* { dg-mips-options "-mhard-float -O2" } */ /* { dg-options "-mhard-float -O2" } */
NOMIPS16 int f1 (float x, float y) { return __builtin_islessequal (x, y); } NOMIPS16 int f1 (float x, float y) { return __builtin_islessequal (x, y); }
NOMIPS16 int f2 (double x, double y) { return __builtin_islessequal (x, y); } NOMIPS16 int f2 (double x, double y) { return __builtin_islessequal (x, y); }
/* { dg-final { scan-assembler "c\\.ult\\.s" } } */ /* { dg-final { scan-assembler "c\\.ult\\.s" } } */
......
/* { dg-mips-options "-mabi=32 -mhard-float -mips1 -O2 -EL" } */ /* { dg-options "-mabi=32 -mhard-float -mips1 -O2 -EL" } */
NOMIPS16 void NOMIPS16 void
foo (double d, double *x) foo (double d, double *x)
......
/* { dg-mips-options "-mabi=32 -mhard-float -mips1 -O2 -EB" } */ /* { dg-options "-mabi=32 -mhard-float -mips1 -O2 -EB" } */
NOMIPS16 void NOMIPS16 void
foo (double d, double *x) foo (double d, double *x)
......
/* { dg-mips-options "-mabi=32 -mfp64 -O2 -EL" } */ /* { dg-options "-mabi=32 -mfp64 -O2 -EL" } */
NOMIPS16 double NOMIPS16 double
foo (double d) foo (double d)
......
/* { dg-mips-options "-mabi=32 -mfp64 -O2 -EB" } */ /* { dg-options "-mabi=32 -mfp64 -O2 -EB" } */
NOMIPS16 double NOMIPS16 double
foo (double d) foo (double d)
......
/* { dg-mips-options "-mabi=64 -mhard-float -O2 -EL" } */ /* { dg-options "-mabi=64 -mhard-float -O2 -EL" } */
NOMIPS16 void NOMIPS16 void
foo (long double d, long double *x) foo (long double d, long double *x)
......
/* { dg-mips-options "-mabi=64 -mhard-float -O2 -EB" } */ /* { dg-options "-mabi=64 -mhard-float -O2 -EB" } */
NOMIPS16 void NOMIPS16 void
foo (long double d, long double *x) foo (long double d, long double *x)
......
/* { dg-do compile { target mips16_attribute } } */ /* { dg-options "(-mips16) -mabi=64 -O2 -EL" } */
/* { dg-mips-options "-mabi=64 -msoft-float -O2 -EL" } */
/* { dg-add-options mips16_attribute } */
extern long double g[16]; extern long double g[16];
extern unsigned char gstuff[0x10000]; extern unsigned char gstuff[0x10000];
......
/* { dg-do compile { target mips16_attribute } } */ /* { dg-options "(-mips16) -mabi=64 -O2 -EB" } */
/* { dg-mips-options "-mabi=64 -msoft-float -O2 -EB" } */
/* { dg-add-options mips16_attribute } */
extern long double g[16]; extern long double g[16];
extern unsigned char gstuff[0x10000]; extern unsigned char gstuff[0x10000];
......
/* { dg-do preprocess } */ /* { dg-do preprocess } */
/* { dg-mips-options "-mips2" } */ /* { dg-options "isa>=2 -mgp32" } */
#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 #ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1
#error nonono #error nonono
......
/* { dg-do preprocess } */ /* { dg-do preprocess } */
/* { dg-mips-options "-mgp64" } */ /* { dg-options "-mgp64" } */
#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 #ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1
#error nonono #error nonono
......
/* { dg-do preprocess { target mips16_attribute } } */ /* { dg-options "isa>=2 -mgp32 -mips16" } */
/* { dg-mips-options "-mips2 -mips16" } */
/* { dg-add-options mips16_attribute } */
#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 #ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1
#error nonono #error nonono
......
/* { dg-do preprocess { target mips16_attribute } } */ /* { dg-options "-mgp64 -mips16" } */
/* { dg-mips-options "-mgp64 -mips16" } */
/* { dg-add-options mips16_attribute } */
#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 #ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1
#error nonono #error nonono
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O -march=mips32r2" } */ /* { dg-options "-O isa_rev>=2 -mgp32" } */
/* { dg-final { scan-assembler "\tins\t" } } */ /* { dg-final { scan-assembler "\tins\t" } } */
struct struct
......
/* { dg-do compile { target mips16_attribute } } */ /* { dg-options "(-mips16) -mgp64 -O2 -EL" } */
/* { dg-mips-options "-mgp64 -msoft-float -O2 -EL" } */
/* { dg-add-options mips16_attribute } */
typedef unsigned uint128_t __attribute__((mode(TI))); typedef unsigned uint128_t __attribute__((mode(TI)));
......
/* { dg-do compile { target mips16_attribute } } */ /* { dg-options "(-mips16) -mgp64 -O2 -EB" } */
/* { dg-mips-options "-mgp64 -msoft-float -O2 -EB" } */
/* { dg-add-options mips16_attribute } */
typedef unsigned uint128_t __attribute__((mode(TI))); typedef unsigned uint128_t __attribute__((mode(TI)));
......
/* { dg-do compile { target nomips16 } } */ /* { dg-do compile } */
/* { dg-mips-options "-mabicalls -mshared -mexplicit-relocs -O2 -fno-delayed-branch" } */ /* { dg-options "-mabicalls -mshared -mexplicit-relocs -O2 -fno-delayed-branch" } */
void bar (void); void bar (void);
void NOMIPS16 void
foo (int n) foo (int n)
{ {
while (n--) while (n--)
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O2 -mabi=32 -march=mips32 -fno-pic -pg -mno-abicalls -mlong-calls" } */ /* { dg-options "-O2 -mabi=32 -pg -mno-abicalls -mlong-calls" } */
/* { dg-final { scan-assembler-not "\tjal\t_mcount" } } */ /* { dg-final { scan-assembler-not "\tjal\t_mcount" } } */
void NOMIPS16 void
foo (void) foo (void)
{ {
} }
/* { dg-mips-options "-O2 -march=loongson2e" } */ /* { dg-options "-O2 isa=loongson" } */
typedef int st; typedef int st;
typedef unsigned int ut; typedef unsigned int ut;
......
/* { dg-mips-options "-O2 -march=loongson2e -mgp64" } */ /* { dg-options "-O2 isa=loongson -mgp64" } */
typedef long long st; typedef long long st;
typedef unsigned long long ut; typedef unsigned long long ut;
......
...@@ -19,7 +19,10 @@ along with GCC; see the file COPYING3. If not see ...@@ -19,7 +19,10 @@ along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */ <http://www.gnu.org/licenses/>. */
/* { dg-do run } */ /* { dg-do run } */
/* { dg-require-effective-target mips_loongson } */ /* loongson.h does not handle or check for MIPS16ness. There doesn't
seem any good reason for it to, given that the Loongson processors
do not support MIPS16. */
/* { dg-options "isa=loongson -mhard-float -mno-mips16 -flax-vector-conversions" } */
#include "loongson.h" #include "loongson.h"
#include <stdio.h> #include <stdio.h>
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O2 -march=vr4130 -mgp32" } */ /* { dg-options "-O2 -march=vr4130 -mgp32" } */
/* { dg-final { scan-assembler-times "\tmacc\t\\\$1," 3 } } */ /* { dg-final { scan-assembler-times "\tmacc\t\\\$1," 3 } } */
NOMIPS16 long long NOMIPS16 long long
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O2 -march=vr5500 -mgp32" } */ /* { dg-options "-O2 -march=vr5500 -mgp32" } */
/* { dg-final { scan-assembler-times "\tmadd\t" 3 } } */ /* { dg-final { scan-assembler-times "\tmadd\t" 3 } } */
NOMIPS16 long long NOMIPS16 long long
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O2 -mips32 -mgp32" } */ /* { dg-options "-O2 isa_rev>=1 -mgp32" } */
/* { dg-final { scan-assembler-times "\tmadd\t" 3 } } */ /* { dg-final { scan-assembler-times "\tmadd\t" 3 } } */
NOMIPS16 long long NOMIPS16 long long
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O2 -mips32r2 -mdspr2 -mgp32" } */ /* { dg-options "-O2 -mdspr2 -mgp32" } */
/* { dg-final { scan-assembler-times "\tmadd\t\\\$ac" 3 } } */ /* { dg-final { scan-assembler-times "\tmadd\t\\\$ac" 3 } } */
NOMIPS16 long long NOMIPS16 long long
......
/* { dg-mips-options "-O2 -march=5kc" } */ /* { dg-options "-O2 -march=5kc" } */
/* { dg-final { scan-assembler-times "\tmadd\t" 4 } } */ /* { dg-final { scan-assembler-times "\tmadd\t" 4 } } */
/* { dg-final { scan-assembler-not "\tmtlo\t" } } */ /* { dg-final { scan-assembler-not "\tmtlo\t" } } */
/* { dg-final { scan-assembler-times "\tmflo\t" 3 } } */ /* { dg-final { scan-assembler-times "\tmflo\t" 3 } } */
......
/* { dg-mips-options "-O2 -march=5kc" } */ /* { dg-options "-O2 -march=5kc" } */
/* { dg-final { scan-assembler-not "\tmadd\t" } } */ /* { dg-final { scan-assembler-not "\tmadd\t" } } */
/* { dg-final { scan-assembler "\tmul\t" } } */ /* { dg-final { scan-assembler "\tmul\t" } } */
/* { dg-final { scan-assembler "\taddu\t" } } */ /* { dg-final { scan-assembler "\taddu\t" } } */
......
/* -mlong32 added because of PR target/38598. */ /* -mlong32 added because of PR target/38598. */
/* { dg-mips-options "-O2 -march=5kc -mlong32" } */ /* { dg-options "-O2 -march=5kc -mlong32" } */
/* { dg-final { scan-assembler-not "\tmul\t" } } */ /* { dg-final { scan-assembler-not "\tmul\t" } } */
/* { dg-final { scan-assembler "\tmadd\t" } } */ /* { dg-final { scan-assembler "\tmadd\t" } } */
......
/* { dg-mips-options "-O2 -march=5kc" } */ /* { dg-options "-O2 -march=5kc" } */
/* { dg-final { scan-assembler "\tmul\t" } } */ /* { dg-final { scan-assembler "\tmul\t" } } */
/* { dg-final { scan-assembler-not "\tmadd\t" } } */ /* { dg-final { scan-assembler-not "\tmadd\t" } } */
/* { dg-final { scan-assembler-not "\tmtlo\t" } } */ /* { dg-final { scan-assembler-not "\tmtlo\t" } } */
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O2 -march=vr4130 -mgp32" } */ /* { dg-options "-O2 -march=vr4130 -mgp32" } */
/* { dg-final { scan-assembler-times "\tmaccu\t\\\$1," 3 } } */ /* { dg-final { scan-assembler-times "\tmaccu\t\\\$1," 3 } } */
typedef unsigned int ui; typedef unsigned int ui;
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O2 -march=vr5500 -mgp32" } */ /* { dg-options "-O2 -march=vr5500 -mgp32" } */
/* { dg-final { scan-assembler-times "\tmaddu\t" 3 } } */ /* { dg-final { scan-assembler-times "\tmaddu\t" 3 } } */
typedef unsigned int ui; typedef unsigned int ui;
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O2 -mips32 -mgp32" } */ /* { dg-options "-O2 isa_rev>=1 -mgp32" } */
/* { dg-final { scan-assembler-times "\tmaddu\t" 3 } } */ /* { dg-final { scan-assembler-times "\tmaddu\t" 3 } } */
typedef unsigned int ui; typedef unsigned int ui;
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O2 -mips32r2 -mdspr2 -mgp32" } */ /* { dg-options "-O2 -mdspr2 -mgp32" } */
/* { dg-final { scan-assembler-times "\tmaddu\t\\\$ac" 3 } } */ /* { dg-final { scan-assembler-times "\tmaddu\t\\\$ac" 3 } } */
typedef unsigned int ui; typedef unsigned int ui;
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O2" } */ /* { dg-options "-O2" } */
/* { dg-final { scan-assembler-not "\tlbu\t" } } */ /* { dg-final { scan-assembler-not "\tlbu\t" } } */
#include <string.h> #include <string.h>
......
/* { dg-do run { target mipsisa64*-*-* } } */ /* { dg-do run } */
/* { dg-mips-options "-mips64 -O2 -mips3d -mhard-float -mgp64" } */ /* { dg-options "-O2 -mips3d" } */
/* Test MIPS-3D builtin functions */ /* Test MIPS-3D builtin functions */
#include <stdlib.h> #include <stdlib.h>
......
/* { dg-do run { target mipsisa64*-*-* } } */ /* { dg-do run } */
/* { dg-mips-options "-mips64 -O2 -mips3d -mhard-float -mgp64" } */ /* { dg-options "-O2 -mips3d" } */
/* Test MIPS-3D branch-if-any-two builtin functions */ /* Test MIPS-3D branch-if-any-two builtin functions */
#include <stdlib.h> #include <stdlib.h>
......
/* { dg-do run { target mipsisa64*-*-* } } */ /* { dg-do run } */
/* { dg-mips-options "-mips64 -O2 -mips3d -mhard-float -mgp64" } */ /* { dg-options "-O2 -mips3d" } */
/* Test MIPS-3D absolute compare builtin functions */ /* Test MIPS-3D absolute compare builtin functions */
#include <stdlib.h> #include <stdlib.h>
......
/* { dg-do run { target mipsisa64*-*-* } } */ /* { dg-do run } */
/* { dg-mips-options "-mips64 -O2 -mips3d -mhard-float -mgp64" } */ /* { dg-options "-O2 -mips3d" } */
/* Test MIPS-3D branch-if-any-four builtin functions */ /* Test MIPS-3D branch-if-any-four builtin functions */
#include <stdlib.h> #include <stdlib.h>
......
/* { dg-do run { target mipsisa64*-*-* } } */ /* { dg-do run } */
/* { dg-mips-options "-mips64 -O2 -mips3d -mhard-float -mgp64" } */ /* { dg-options "-O2 -mips3d" } */
/* Test MIPS-3D absolute-compare & branch-if-any-four builtin functions */ /* Test MIPS-3D absolute-compare & branch-if-any-four builtin functions */
#include <stdlib.h> #include <stdlib.h>
......
/* { dg-do run { target mipsisa64*-*-* } } */ /* { dg-do run } */
/* { dg-mips-options "-mips64 -O2 -mips3d -mhard-float -mgp64" } */ /* { dg-options "-O2 -mips3d" } */
/* Test MIPS-3D absolute compare (floats) builtin functions */ /* Test MIPS-3D absolute compare (floats) builtin functions */
#include <stdlib.h> #include <stdlib.h>
......
/* { dg-do run { target mipsisa64*-*-* } } */ /* { dg-do run } */
/* { dg-mips-options "-mips64 -O2 -mips3d -mhard-float -mgp64" } */ /* { dg-options "-O2 -mips3d" } */
/* Test MIPS-3D absolute compare (doubles) builtin functions */ /* Test MIPS-3D absolute compare (doubles) builtin functions */
#include <stdlib.h> #include <stdlib.h>
......
/* { dg-do run { target mipsisa64*-*-* } } */ /* { dg-do run } */
/* { dg-mips-options "-mips64 -O2 -mips3d -mhard-float -mgp64" } */ /* { dg-options "-O2 -mips3d" } */
/* Test MIPS-3D absolute compare and conditional move builtin functions */ /* Test MIPS-3D absolute compare and conditional move builtin functions */
#include <stdlib.h> #include <stdlib.h>
......
/* { dg-do run { target mipsisa64*-*-* } } */ /* { dg-do run } */
/* { dg-mips-options "-mips64 -O2 -mips3d -mhard-float -mgp64" } */ /* { dg-options "-O2 -mips3d" } */
/* Matrix Multiplications */ /* Matrix Multiplications */
#include <stdlib.h> #include <stdlib.h>
......
/* { dg-do run { target mpaired_single } } */ /* { dg-do run } */
/* { dg-mips-options "-O2 -mpaired-single" } */ /* { dg-options "-O2 -mpaired-single" } */
/* Test v2sf calculations */ /* Test v2sf calculations */
#include <stdlib.h> #include <stdlib.h>
......
/* { dg-do run { target mpaired_single } } */ /* { dg-do run } */
/* { dg-mips-options "-O2 -mpaired-single" } */ /* { dg-options "-O2 -mpaired-single" } */
/* Test MIPS paired-single builtin functions */ /* Test MIPS paired-single builtin functions */
#include <stdlib.h> #include <stdlib.h>
......
/* { dg-do run { target mpaired_single } } */ /* { dg-do run } */
/* { dg-mips-options "-O2 -mpaired-single" } */ /* { dg-options "-O2 -mpaired-single" } */
/* Test MIPS paired-single conditional move */ /* Test MIPS paired-single conditional move */
#include <stdlib.h> #include <stdlib.h>
......
/* { dg-do run { target mpaired_single } } */ /* { dg-do run } */
/* { dg-mips-options "-O2 -mpaired-single" } */ /* { dg-options "-O2 -mpaired-single" } */
/* Test MIPS paired-single comparisons */ /* Test MIPS paired-single comparisons */
#include <stdlib.h> #include <stdlib.h>
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-mips64 -O2 -mpaired-single -mgp64 -ftree-vectorize" } */ /* { dg-options "-O2 -mpaired-single -mgp64 -ftree-vectorize" } */
extern float a[], b[], c[]; extern float a[], b[], c[];
......
/* mips-ps-2.c with an extra -ffinite-math-only option. This option /* mips-ps-2.c with an extra -ffinite-math-only option. This option
changes the way that abs.ps is handled. */ changes the way that abs.ps is handled. */
/* { dg-do run { target mpaired_single } } */ /* { dg-do run } */
/* { dg-mips-options "-O2 -mpaired-single -ffinite-math-only" } */ /* { dg-options "-O2 -mpaired-single -ffinite-math-only" } */
/* Test MIPS paired-single builtin functions */ /* Test MIPS paired-single builtin functions */
#include <stdlib.h> #include <stdlib.h>
......
/* mips-ps-5.c with -mips32r2 instead of -mips64. */ /* mips-ps-5.c with -mgp32 instead of -mgp64. */
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-mips32r2 -O2 -mpaired-single -ftree-vectorize" } */ /* { dg-options "-mgp32 -O2 -mpaired-single -ftree-vectorize" } */
extern float a[], b[], c[]; extern float a[], b[], c[];
......
/* Test v2sf calculations. The nmadd and nmsub patterns need /* Test v2sf calculations. The nmadd and nmsub patterns need
-ffinite-math-only. */ -ffinite-math-only. */
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-mips32r2 -O2 -mpaired-single -ffinite-math-only" } */ /* { dg-options "isa_rev>=2 -mgp32 -O2 -mpaired-single -ffinite-math-only" } */
/* { dg-final { scan-assembler "cvt.ps.s" } } */ /* { dg-final { scan-assembler "cvt.ps.s" } } */
/* { dg-final { scan-assembler "mov.ps" } } */ /* { dg-final { scan-assembler "mov.ps" } } */
/* { dg-final { scan-assembler "ldc1" } } */ /* { dg-final { scan-assembler "ldc1" } } */
......
/* Test v2sf calculations. The nmadd and nmsub patterns need /* Test v2sf calculations. The nmadd and nmsub patterns need
-ffinite-math-only. */ -ffinite-math-only. */
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-mips64 -O2 -mpaired-single -mgp64 -ffinite-math-only" } */ /* { dg-options "-O2 -mpaired-single -mgp64 -ffinite-math-only" } */
/* { dg-final { scan-assembler "cvt.ps.s" } } */ /* { dg-final { scan-assembler "cvt.ps.s" } } */
/* { dg-final { scan-assembler "mov.ps" } } */ /* { dg-final { scan-assembler "mov.ps" } } */
/* { dg-final { scan-assembler "ldc1" } } */ /* { dg-final { scan-assembler "ldc1" } } */
......
/* Test for case where another independent multiply insn may interfere /* Test for case where another independent multiply insn may interfere
with a macc chain. */ with a macc chain. */
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-Os -march=24kf" } */ /* { dg-options "-Os -march=24kf" } */
NOMIPS16 int foo (int a, int b, int c, int d, int e, int f, int g) NOMIPS16 int foo (int a, int b, int c, int d, int e, int f, int g)
{ {
......
# Copyright (C) 1997, 2007 Free Software Foundation, Inc. # Copyright (C) 1997, 2007, 2008 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
...@@ -14,7 +14,165 @@ ...@@ -14,7 +14,165 @@
# along with GCC; see the file COPYING3. If not see # along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>. # <http://www.gnu.org/licenses/>.
# GCC testsuite that uses the `dg.exp' driver. # A MIPS version of the GCC dg.exp driver.
#
# There are many MIPS features that we want to test, and many of those
# features are specific to certain architectures, certain ABIs and so on.
# There are therefore many cases in which we want to test something that
# is incompatible with the user's chosen test options.
#
# In most dg testsuites, the options added by dg-options have a lower
# priority than the options chosen by the user. For example, if a test
# specifies:
#
# { dg-options "-mips1" }
#
# and the user passes the following option to runtest:
#
# --target_board unix/-mips3
#
# the test would be compiled as MIPS III rather than MIPS I. If the
# test really wouldn't work with -mips3, normal practice would be to
# have something like:
#
# { dg-do compile { target can_force_mips1 } }
#
# so that the test is skipped when an option like -mips3 is passed.
#
# Sticking to the same approach here would cause us to skip many tests,
# even though the toolchain can generate the required code. For example,
# there are 6 MIPS ABIs, plus variants. Some configurations support
# more than one ABI, so it is natural to use something like:
#
# --target_board unix{-mabi=n32,-mabi=32,-mabi=64}
#
# when testing them. But these -mabi=* options would normally prevent any
# EABI and o64 tests from running.
#
# This testsuite therefore defines a local version of dg-options that
# overrides any user options that are incompatible with the test options.
# It tries to keep the other user options intact.
#
#
# Most of the tests in this testsuite are scan-assembler tests, but
# sometimes we need a link test instead. In these cases, we must not
# try to link code with options that are incompatible with the current
# multilib, because xgcc is passed -L and -B options that are specific
# to that multilib.
#
# Normal GCC practice would be to skip incompatible link tests as
# unsupported, but in this particular case, it seems better to downgrade
# them to an assemble test instead. At least that way we get some
# test-for-ICE and code-sanity coverage.
#
# The same problem applies to run tests. If a test requires runtime
# support for a particular feature, and if the current target does not
# provide that support, normal practice would be to skip the test.
# But in this case it seems better to downgrade it to a link test instead.
# (We might then have to downgrade it to an assembler test according to
# the constraints just mentioned.)
#
# The local dg-options therefore checks whether the new options are
# link-compatiable with the user's options. If not, it automatically
# downgrades link tests to assemble tests. It does the same for run
# tests, but in addition, it downgrades run tests to link tests if the
# target does not provide runtime support for a required feature or ASE.
#
#
# Another problem is that many of the options we want to test require
# certain other features. For example, -mips3d requires both 64-bit
# FPRs and a MIPS32 or MIPS64 target; -mfix-r10000 requires branch-
# likely instructions; and so on. We could handle this by specifying
# a set of options that are guaranteed to give us what we want, such as:
#
# dg-options "-mips3d -mpaired-single -mhard-float -mgp64 -mfp64 -mabi=n32 -march=mips64 -mips64"
#
# With the new dg-options semantics, this would override any troublesome
# user options like -mips3, -march=vr4100, -mfp32, -mgp32, -msoft-float,
# -mno-paired-single and so on. But there are three major problems with
# this:
#
# - It is easy to forget options.
#
# - If a new option is added, all tests that are incompatible with that
# option must be updated.
#
# - We want to be able to test MIPS-3D with things like -march=mips32,
# -march=mips64r2, -march=sb1, and so on.
#
# The local version of dg-options therefore works out the requirements
# of each test option. As with the test options themselves, the local
# dg-options overrides any user options that incompatible with these
# requirements, but it keeps the other user options the same.
#
# For example, if the user passes -mips3, a MIPS-3D test will choose
# a different architecture like -mips64 instead. But if the user
# passes -march=sb1, MIPS-3D tests will be run with that option.
#
#
# Sometimes it is useful to say "I want an environment that is compatible
# with option X, but I don't want to pass option X itself". The main example
# of this is -mips16: we want to be able to test __attribute__((mips16))
# without requiring the test itself to be compiled as -mips16. The local
# version of dg-options lets you do this by putting X in parentheses.
# For example:
#
# { dg-options "(-mips16)" }
#
# selects a MIPS16-compatible target without passing -mips16 itself.
#
# It is also useful to say "any architecture within this ISA range is fine".
# This can be done using special pseudo-options of the form:
#
# PROP=VALUE PROP<=VALUE PROP>=VALUE
#
# where PROP can be:
#
# isa:
# the value of the __mips macro.
#
# isa_rev:
# the value of the __mips_isa_rev macro, or 0 if it isn't defined.
#
# For example, "isa_rev>=1" selects a MIPS32 or MIPS64 processor,
# "isa=4" selects a MIPS IV processor, and so on. There are also
# the following special pseudo-options:
#
# isa=loongson:
# select a Loongson processor
#
# addressing=absolute
# force absolute addresses to be used
#
#
# In summary:
#
# (1) Try to avoid { target ... } requirements wherever possible.
# Specify the requirements as dg-options instead.
#
# (2) Don't worry about the consequences of (1) for link and run tests.
# If the test uses { dg-do link } or { dg-do run }, and its
# dg-options are incompatible with the current target, the
# testsuite will downgrade them where necessary.
#
# (3) Try to use the bare minimum of options and leave dg-options
# to work out the dependencies. For example, if you want
# a MIPS-3D test, you should generally just specify -mips3d.
# Don't specify an architecture option like -mips64 unless
# the test really doesn't work with -mips32r2, -mips64r2,
# -march=sb1, etc.
#
# (4) If you want something compatible with a particular option,
# but don't want to pass the option itself, wrap that option
# in parentheses. In particular, pass '(-mips16)' if you
# want to use "mips16" attributes.
#
# (5) When testing a feature of a generic ISA (as opposed to a
# processor-specific extension), try to use the "isa" and
# "isa_rev" pseudo-options instead of specific architecture
# options. For example, if the feature is present on revision 2
# processors and above, try to use "isa_rev>=2" instead of
# "-mips32r2" or "-mips64r2".
# Exit immediately if this isn't a MIPS target. # Exit immediately if this isn't a MIPS target.
if ![istarget mips*-*-*] { if ![istarget mips*-*-*] {
...@@ -24,361 +182,945 @@ if ![istarget mips*-*-*] { ...@@ -24,361 +182,945 @@ if ![istarget mips*-*-*] {
# Load support procs. # Load support procs.
load_lib gcc-dg.exp load_lib gcc-dg.exp
# Find out which target is selected by the default compiler flags. # A list of GROUP REGEXP pairs. Each GROUP represents a logical group of
# Also remember which aspects of the target are forced on the command # options from which only option should be chosen. REGEXP matches all the
# line (as opposed to being overridable defaults). # options in that group; it is implicitly wrapped in "^(...)$".
# set mips_option_groups {
# $mips_isa: the ISA level specified by __mips abi "-mabi=.*"
# $mips_isa_rev: the ISA revision specified by __mips_isa_rev addressing "addressing=.*"
# $mips_arch: the architecture specified by _MIPS_ARCH arch "-mips([1-5]|32.*|64.*)|-march=.*|isa(|_rev)(=|<=|>=).*"
# $mips_mips16: true if MIPS16 output is selected dump_pattern "-dp"
# $mips_gp: the number of bytes in a general register endianness "-E(L|B)|-me(l|b)"
# $mips_fp: the number of bytes in a floating-point register float "-m(hard|soft)-float"
# $mips_float: "hard" or "soft" fp "-mfp(32|64)"
# $mips_abi: the ABI specified by _MIPS_SIM gp "-mgp(32|64)"
# long "-mlong(32|64)"
# $mips_forced_isa: true if the command line uses -march=* or -mips* mips16 "-mips16|-mno-mips16"
# $mips_forced_abi: true if the command line uses -mabi=* mips3d "-mips3d|-mno-mips3d"
# $mips_forced_regs: true if the command line uses -mgp* or -mfp* optimization "-O(|[0-3s])"
# $mips_forced_float: true if the command line uses -mhard/soft-float pic "-f(no-|)(pic|PIC)"
# $mips_forced_be true if the command line uses -EB or -meb profiling "-pg"
# $mips_forced_le true if the command line uses -EL or -mel small-data "-G[0-9]+"
# $mips_forced_gp true if the command line forces a particular GP mode warnings "-w"
# $mips_forced_no_abicalls }
# true if the command line contains -mno-abicalls
# $mips_forced_no_shared # Add -mfoo/-mno-foo options to mips_option_groups.
# true if the command line contains -mno-shared foreach option {
# $mips_forced_no_er true if the command line contains -mno-explicit-relocs abicalls
proc setup_mips_tests {} { branch-likely
global mips_isa dsp
global mips_isa_rev dspr2
global mips_arch explicit-relocs
global mips_mips16 extern-sdata
global mips_gp fix-r4000
global mips_fp fix-r10000
global mips_float fix-vr4130
global mips_abi gpopt
local-sdata
global mips_forced_isa long-calls
global mips_forced_abi paired-single
global mips_forced_float plt
global mips_forced_be shared
global mips_forced_le smartmips
global mips_forced_gp sym32
global mips_forced_no_abicalls } {
global mips_forced_no_shared lappend mips_option_groups $option "-m(no-|)$option"
global mips_forced_no_er }
global mips_forced_regs
# Add -mfoo= options to mips_option_groups.
global compiler_flags foreach option {
branch-cost
code-readable
r10k-cache-barrier
} {
lappend mips_option_groups $option "-m$option=.*"
}
# Add -ffoo/-fno-foo options to mips_option_groups.
foreach option {
delayed-branch
fast-math
finite-math-only
fixed-hi
fixed-lo
lax-vector-conversions
split-wide-types
tree-vectorize
} {
lappend mips_option_groups $option "-f(no-|)$option"
}
# A list of option groups that have an impact on the ABI.
set mips_abi_groups {
abi
abicalls
arch
endianness
float
fp
gp
gpopt
long
pic
small-data
}
# mips_option_tests(OPTION) is some assembly code that will run to completion
# on a target that supports OPTION.
set mips_option_tests(-mips16) {
move $2,$31
jal 1f
b 2f
.align 2
.set mips16
1:
jr $31
.set nomips16
.align 2
2:
move $31,$2
}
set mips_option_tests(-mpaired-single) {
.set mips64
lui $2,0x3f80
mtc1 $2,$f0
cvt.ps.s $f2,$f0,$f0
}
set mips_option_tests(-mips3d) {
.set mips64
.set mips3d
lui $2,0x3f80
mtc1 $2,$f0
cvt.ps.s $f2,$f0,$f0
mulr.ps $f2,$f2,$f2
rsqrt1.s $f2,$f0
mul.s $f4,$f2,$f0
rsqrt2.s $f4,$f4,$f2
madd.s $f4,$f2,$f2,$f4
}
set mips_option_tests(-mdsp) {
.set mips64r2
.set dsp
addsc $2,$2,$2
}
set mips_option_tests(-mdspr2) {
.set mips64r2
.set dspr2
prepend $2,$3,11
}
# Canonicalize command-line option OPTION.
proc mips_canonicalize_option { option } {
regsub {^-mips([1-5]|32*|64*)$} $option {-march=mips\1} option
regsub {^-mel$} $option {-EL} option
regsub {^-meb$} $option {-EB} option
regsub {^-O$} $option {-O1} option
# MIPS doesn't use -fpic and -fPIC to distinguish between code models.
regsub {^-f(no-|)PIC} $option {-f\1pic} option
return $option
}
# Return true if OPTION1 and OPTION2 represent the same command-line option.
proc mips_same_option_p { option1 option2 } {
return [string equal \
[mips_canonicalize_option $option1] \
[mips_canonicalize_option $option2]]
}
# Preprocess CODE using target_compile options OPTIONS. Return the
# compiler output.
proc mips_preprocess { options code } {
global tool global tool
set src dummy[pid].c set src dummy[pid].c
set f [open $src "w"] set f [open $src "w"]
puts $f { puts $f $code
close $f
set output [${tool}_target_compile $src "" preprocess $options]
file delete $src
return $output
}
# Set the target board's command-line options to NEW_OPTIONS, storing the
# old values in UPVAR.
proc mips_push_test_options { upvar new_options } {
upvar $upvar var
global board_info
array unset var
set var(name) board_info([target_info name],multilib_flags)
if { [info exists $var(name)] } {
set var(old_options) [set $var(name)]
set $var(name) [join $new_options " "]
}
}
# Undo the effects of [mips_push_test_options UPVAR ...]
proc mips_pop_test_options { upvar } {
upvar $upvar var
global board_info
if { [info exists var(old_options)] } {
set $var(name) $var(old_options)
}
}
# Return property PROP for architecture option ARCH (which belongs to
# the "arch" group in mips_option_groups). See the comment at the
# top of the file for the valid property names.
#
# Cache the results in mips_arch_info (which can be reused between test
# variants).
proc mips_arch_info { arch prop } {
global mips_arch_info
global board_info
set arch [mips_canonicalize_option $arch]
if { ![info exists mips_arch_info($arch,$prop)] } {
mips_push_test_options saved_options {}
set output [mips_preprocess [list "additional_flags=$arch -mabi=32"] {
int isa = __mips; int isa = __mips;
#ifdef __mips_isa_rev #ifdef __mips_isa_rev
int isa_rev = __mips_isa_rev; int isa_rev = __mips_isa_rev;
#else #else
int isa_rev = 1; int isa_rev = 0;
#endif #endif
const char *arch = _MIPS_ARCH; }]
#ifdef __mips16 foreach lhs { isa isa_rev } {
int mips16 = 1; regsub ".*$lhs = (\[^;\]*).*" $output {\1} rhs
verbose -log "Architecture $arch has $lhs $rhs"
set mips_arch_info($arch,$lhs) $rhs
}
mips_pop_test_options saved_options
}
return $mips_arch_info($arch,$prop)
}
# Return the option group associated with OPTION, or "" if none.
proc mips_option_maybe_group { option } {
global mips_option_groups
foreach { group regexp } $mips_option_groups {
if { [regexp -- "^($regexp)\$" $option] } {
return $group
}
}
return ""
}
# Return the option group associated with OPTION. Raise an error if
# there is none.
proc mips_option_group { option } {
set group [mips_option_maybe_group $option]
if { [string equal $group ""] } {
error "Unrecognised option: $option"
}
return $group
}
# Return the option for option group GROUP, or "" if no option in that
# group has been chosen. UPSTATUS describes the option status.
proc mips_option { upstatus group } {
upvar $upstatus status
return $status(option,$group)
}
# If the default options for this test run include an option in group GROUP,
# return that option, otherwise return "".
proc mips_original_option { group } {
global mips_base_options
return [mips_option mips_base_options $group]
}
# Return true if the test described up UPSTATUS requires a specific
# option in group GROUP.
proc mips_test_option_p { upstatus group } {
upvar $upstatus status
return $status(test_option_p,$group)
}
# If the test described by UPSTATUS requires a particular option in group
# GROUP, return that option, otherwise return "".
proc mips_test_option { upstatus group } {
upvar $upstatus status
if { [mips_test_option_p status $group] } {
return [mips_option status $group]
} else {
return ""
}
}
# Return true if the options described by UPSTATUS include OPTION.
proc mips_have_option_p { upstatus option } {
upvar $upstatus status
return [mips_same_option_p \
[mips_option status [mips_option_group $option]] \
$option]
}
# Return true if the test described by UPSTATUS requires option OPTION.
proc mips_have_test_option_p { upstatus option } {
upvar $upstatus status
set group [mips_option_group $option]
return [mips_same_option_p [mips_test_option status $group] $option]
}
# If the test described by UPSTATUS does not specify an option in
# OPTION's group, act as though it had specified OPTION.
#
# The first optional argument indicates whether the option should be
# treated as though it were wrapped in parentheses; see the comment at
# the top of the file for details about this convention. The default is 0.
proc mips_make_test_option { upstatus option args } {
upvar $upstatus status
set group [mips_option_group $option]
if { ![mips_test_option_p status $group] } {
set status(option,$group) $option
set status(test_option_p,$group) 1
if { [llength $args] == 0 || ![lindex $args 0] } {
set status(explicit_p,$group) 1
}
}
}
# If the test described by UPSTATUS requires option FROM, assume that
# it implicitly requires option TO.
proc mips_option_dependency { upstatus from to } {
upvar $upstatus status
if { [mips_have_test_option_p status $from] } {
mips_make_test_option status $to
}
}
# Return true if the given arch-group option specifies a 32-bit ISA.
proc mips_32bit_arch_p { option } {
set isa [mips_arch_info $option isa]
return [expr { $isa < 3 || $isa == 32 }]
}
# Return true if the given arch-group option specifies a 64-bit ISA.
proc mips_64bit_arch_p { option } {
return [expr { ![mips_32bit_arch_p $option] }]
}
# Return true if the given abi-group option implicitly requires -mgp32.
proc mips_32bit_abi_p { option } {
switch -glob -- $option {
-mabi=32 {
return 1
}
}
return 0
}
# Return true if the given abi-group option implicitly requires -mgp64.
proc mips_64bit_abi_p { option } {
switch -glob -- $option {
-mabi=o64 -
-mabi=n32 -
-mabi=64 {
return 1
}
}
return 0
}
# Check whether the current target supports all the options that the
# current test requires. Return "" if so, otherwise return one of
# the incompatible options. UPSTATUS describes the option status.
proc mips_first_unsupported_option { upstatus } {
global mips_option_tests
upvar $upstatus status
foreach { option code } [array get mips_option_tests] {
if { [mips_have_test_option_p status $option] } {
regsub -all "\n" $code "\\n\\\n" asm
# Use check_runtime from target-supports.exp, which caches
# the result for us.
if { ![check_runtime mips_option_$option [subst {
__attribute__((nomips16)) int
main (void)
{
asm (".set push\
$asm\
.set pop");
return 0;
}
}]] } {
return $option
}
}
}
return ""
}
# Initialize this testsuite for a new test variant.
proc mips-dg-init {} {
# Invariant information.
global mips_option_groups
# Internally-generated information about this run.
global mips_base_options
global mips_extra_options
# Override dg-options with our mips-dg-options routine.
rename dg-options mips-old-dg-options
rename mips-dg-options dg-options
# Start with a fresh option status.
array unset mips_base_options
foreach { group regexp } $mips_option_groups {
set mips_base_options(option,$group) ""
set mips_base_options(explicit_p,$group) 0
set mips_base_options(test_option_p,$group) 0
}
# Use preprocessor macros to work out as many implicit options as we can.
set output [mips_preprocess "" {
const char *options[] = {
#if !defined _MIPS_SIM
"-mabi=eabi",
#elif _MIPS_SIM==_ABIO32
"-mabi=32",
#elif _MIPS_SIM==_ABIO64
"-mabi=o64",
#elif _MIPS_SIM==_ABIN32
"-mabi=n32",
#else
"-mabi=64",
#endif #endif
#ifdef __mips64
int gp = 64; "-march=" _MIPS_ARCH,
#ifdef _MIPSEB
"-EB",
#else #else
int gp = 32; "-EL",
#endif #endif
int fp = __mips_fpr;
#ifdef __mips_hard_float #ifdef __mips_hard_float
const char *float = "hard"; "-mhard-float",
#else #else
const char *float = "soft"; "-msoft-float",
#endif #endif
#if !defined _MIPS_SIM
const char *abi = "eabi"; #if __mips_fpr == 64
#elif _MIPS_SIM==_ABIO32 "-mfp64",
const char *abi = "32"; #else
#elif _MIPS_SIM==_ABIO64 "-mfp32",
const char *abi = "o64"; #endif
#elif _MIPS_SIM==_ABIN32
const char *abi = "n32"; #ifdef __mips64
"-mgp64",
#else #else
const char *abi = "64"; "-mgp32",
#endif #endif
#if _MIPS_SZLONG == 64
"-mlong64",
#else
"-mlong32",
#endif
#ifdef __mips16
"-mips16",
#else
"-mno-mips16",
#endif
#ifdef __mips3d
"-mips3d",
#else
"-mno-mips3d",
#endif
#ifdef __mips_paired_single_float
"-mpaired-single",
#else
"-mno-paired-single",
#endif
#if __mips_abicalls
"-mabicalls",
#else
"-mno-abicalls",
#endif
#if __mips_dsp_rev >= 2
"-mdspr2",
#else
"-mno-dspr2",
#endif
#if __mips_dsp_rev >= 1
"-mdsp",
#else
"-mno-dsp",
#endif
#ifndef __PIC__
"addressing=absolute",
#endif
#ifdef __mips_smartmips
"-msmartmips",
#else
"-mno-smartmips",
#endif
0
};
}]
foreach line [split $output "\r\n"] {
# Poor man's string concatenation.
regsub -all {" "} $line "" line
if { [regexp {"(.*)",} $line dummy option] } {
set group [mips_option_group $option]
set mips_base_options(option,$group) $option
}
} }
close $f
set output [${tool}_target_compile $src "" preprocess ""]
file delete $src
regexp {isa = ([^;]*)} $output dummy mips_isa # Process the target's multilib options, saving any unrecognized
regexp {isa_rev = ([^;]*)} $output dummy mips_isa_rev # ones in mips_extra_options.
regexp {arch = "([^"]*)} $output dummy mips_arch set mips_extra_options {}
set mips_mips16 [regexp {mips16 = 1} $output] foreach option [split [board_info target multilib_flags]] {
regexp {gp = ([^;]*)} $output dummy mips_gp set group [mips_option_maybe_group $option]
regexp {fp = ([^;]*)} $output dummy mips_fp if { ![string equal $group ""] } {
regexp {float = "([^"]*)} $output dummy mips_float set mips_base_options(option,$group) $option
regexp {abi = "([^"]*)} $output dummy mips_abi set mips_base_options(explicit_p,$group) 1
} else {
set mips_forced_isa [regexp -- {(-mips[1-5][[:>:]]|-mips32*|-mips64*|-march)} $compiler_flags] lappend mips_extra_options $option
set mips_forced_abi [regexp -- {-mabi} $compiler_flags] }
set mips_forced_regs [regexp -- {(-mgp|-mfp)} $compiler_flags] }
set mips_forced_float [regexp -- {-m(hard|soft)-float} $compiler_flags] }
set mips_forced_be [regexp -- {-(EB|meb)[[:>:]]} $compiler_flags]
set mips_forced_le [regexp -- {-(EL|mel)[[:>:]]} $compiler_flags] # Finish a test run started by mips-dg-init.
set mips_forced_gp [regexp -- {-(G|m(|no-)((extern|local)-sdata|gpopt)|mabicalls|mrtp)} $compiler_flags] proc mips-dg-finish {} {
set mips_forced_no_abicalls [regexp -- {-mno-abicalls} $compiler_flags] rename dg-options mips-dg-options
set mips_forced_no_shared [regexp -- {-mno-shared} $compiler_flags] rename mips-old-dg-options dg-options
set mips_forced_no_er [regexp -- {-mno-explicit-relocs} $compiler_flags] }
if {$mips_forced_regs && $mips_gp == 32 && $mips_fp == 64} { # Override dg-options so that we can do some MIPS-specific processing.
set mips_forced_abi 1 # All options used in this testsuite must appear in mips_option_groups.
set mips_forced_isa 1 #
} # Test options override multilib options. Certain test options can
} # also imply other test options, which also override multilib options.
# These dependencies are ordered as follows:
# Like dg-options, but treats certain MIPS-specific options specially: #
# # START END
# -mgp32 # | |
# -march=mips32* # -mips16 -mno-mips16
# Force 32-bit code. Skip the test if the multilib flags force # | |
# a 64-bit ABI. # -mips3d -mno-mips3d
# # | |
# -mgp64 # -mpaired-single -mno-paired-single
# Force 64-bit code. Also force a 64-bit target architecture # | |
# if the other flags don't do so. Skip the test if the multilib # -mfp64 -mfp32
# flags force a 32-bit ABI or a 32-bit architecture. # | |
# # -mhard-float -msoft-float
# -mfp64 # | |
# Force the use of 64-bit floating-point registers, even on a # -mno-sym32 -msym32
# 32-bit target. Also force -mhard-float and an architecture that # | |
# supports such a combination, unless these things are already # -fpic -fno-pic
# specified by other parts of the given flags. # | |
# # -mshared -mno-shared
# -mabi=* # | |
# Force a particular ABI. Skip the test if the multilib flags # -mno-plt -mplt
# force a specific ABI or a different register size. If testing # | |
# MIPS16 multilibs, try to force -msoft-float for ABIs other than # addressing=unknown addressing=absolute
# o32 and o64, and skip the test if this is not possible. # | |
# # -mabicalls -mno-abicalls
# -march=* # | |
# -mips* # -G0 <other value>
# Select the target architecture. Skip the test if the multilib # | |
# flags force a different architecture. # <other value> -mr10k-cache-barrier=none
# # | |
# -msoft-float # -mfix-r10000 -mno-fix-r10000
# -mhard-float # | |
# Select the given floating-point mode. Skip the test if the # -mbranch-likely -mno-branch-likely
# multilib flags force a different selection. # | |
# # -msmartmips -mno-smartmips
# -EB # | |
# -EL # -mno-gpopt -mgpopt
# Select the given endianness. Skip the test if the multilib flags # | |
# force the opposite endianness. # -mexplicit-relocs -mno-explicit-relocs
# # | |
# -G* # +-- gp, abi & arch ---------+
# -m(no-)extern-sdata #
# -m(no-)local-sdata # For these purposes, the "gp", "abi" & "arch" option groups are treated
# -m(no-)gpopt # as a single node.
# Select the small-data mode, and -mno-abcialls. Skip the test if proc mips-dg-options { args } {
# the multilib flags already contain such an option, or specify # dg.exp variables.
# something that might be incompatible with them.
#
# -mabicalls
# -mshared
# Select the form of SVR4 PIC. Skip the test if the multilib flags
# conflict with the required setting.
#
# -mexplicit-relocs
# Select explicit relocations. Skip the test if the multilib flags
# force -mno-explicit-relocs.
#
# -mpaired-single
# Select paired-single instructions. Also behave as for -mfp64.
proc dg-mips-options {args} {
upvar dg-extra-tool-flags extra_tool_flags upvar dg-extra-tool-flags extra_tool_flags
upvar dg-do-what do_what upvar dg-do-what do_what
global mips_isa # Invariant information.
global mips_isa_rev global mips_option_groups
global mips_arch global mips_abi_groups
global mips_mips16
global mips_gp # Information about this run.
global mips_fp global mips_base_options
global mips_float
global mips_abi # Start out with the default option state.
array set options [array get mips_base_options]
global mips_forced_isa
global mips_forced_abi # Record the options that this test explicitly needs.
global mips_forced_regs foreach option [lindex $args 1] {
global mips_forced_float set all_but_p [regexp {^\((.*)\)$} $option dummy option]
global mips_forced_be set group [mips_option_group $option]
global mips_forced_le if { [mips_test_option_p options $group] } {
global mips_forced_gp set old [mips_option options $group]
global mips_forced_no_abicalls error "Inconsistent $group option: $old vs. $option"
global mips_forced_no_shared
global mips_forced_no_er
set flags [lindex $args 1]
set matches 1
# Add implied flags.
foreach flag $flags {
if {[string match -mpaired-single $flag]
&& [lsearch $flags -mfp*] < 0} {
append flags " -mfp64"
} elseif {[regexp -- {^-mabi=(.*)} $flag dummy abi]
&& $mips_mips16
&& $abi != "32"
&& $abi != "o64"} {
if {[lsearch $flags -mhard-float] >= 0} {
set matches 0
} else { } else {
append flags " -msoft-float" mips_make_test_option options $option $all_but_p
} }
} elseif {[regexp -- {^-mr10k-cache-barrier=(load|store)} $flag] }
&& $mips_isa < 3
&& [lsearch -regexp $flags {^(-mips|-march)}] < 0} { # Handle dependencies between options on the left of the
append flags " -mips3" # dependency diagram.
} mips_option_dependency options "-mips3d" "-mpaired-single"
} mips_option_dependency options "-mpaired-single" "-mfp64"
foreach flag $flags { mips_option_dependency options "-mfp64" "-mhard-float"
if {[string match -mfp* $flag] mips_option_dependency options "-fpic" "-mshared"
&& [lsearch -regexp $flags {^-m(hard|soft)-float$}] < 0} { mips_option_dependency options "-mshared" "-mno-plt"
append flags " -mhard-float" mips_option_dependency options "-mno-plt" "addressing=unknown"
} mips_option_dependency options "-mabicalls" "-G0"
} mips_option_dependency options "-mno-gpopt" "-mexplicit-relocs"
# Handle options that force a particular register size. Add # Work out information about the current ABI.
# architecture and ABI options if necessary. set abi_test_option_p [mips_test_option_p options abi]
set mips_new_gp $mips_gp set abi [mips_option options abi]
set mips_new_fp $mips_fp set eabi_p [mips_same_option_p $abi "-mabi=eabi"]
foreach flag $flags {
switch -glob -- $flag { # If the test forces a particular ABI, set the register size
-msmartmips - # accordingly.
-mips[12] - if { $abi_test_option_p } {
-mips32* - if { [mips_32bit_abi_p $abi] } {
-march=mips32* - mips_make_test_option options "-mgp32"
-march=r3900 - } elseif { [mips_64bit_abi_p $abi] } {
-march=24k* - mips_make_test_option options "-mgp64"
-mabi=32 - }
-mgp32 { }
set mips_new_gp 32
} # Interpret the special "isa" and "isa_rev" options. If we have
-mabi=64 - # a choice of a 32-bit or a 64-bit architecture, prefer to keep
-mabi=o64 - # the -mgp setting the same.
-mabi=n32 - set spec [mips_option options arch]
-mgp64 { if { [regexp {^[^-]} $spec] } {
set mips_new_gp 64 set arch [mips_option mips_base_options arch]
if { [string equal $spec "isa=loongson"] } {
if { ![regexp {^-march=loongson} $arch] } {
set arch "-march=loongson2f"
}
} else {
if { ![regexp {^(isa(?:|_rev))(=|<=|>=)([0-9]+)$} $spec \
dummy prop relation value] } {
error "Unrecognized isa specification: $isa_spec"
}
set current [mips_arch_info $arch $prop]
if { ($current < $value && ![string equal $relation "<="])
|| ($current > $value && ![string equal $relation ">="])
|| ([mips_have_test_option_p options "-mgp64"]
&& [mips_32bit_arch_p $arch]) } {
# The current setting is out of range; it cannot
# possibly be used. Find a replacement that can.
if { [string equal $prop "isa"] } {
set arch "-mips$value"
} elseif { $value == 0 } {
set arch "-mips4"
} else {
if { [mips_have_option_p options "-mgp32"] } {
set arch "-mips32"
} else {
set arch "-mips64"
}
if { $value > 1 } {
append arch "r$value"
}
} }
-mfp64 {
set mips_new_fp 64
} }
} }
set options(option,arch) $arch
} }
if {$mips_new_gp != $mips_gp || $mips_new_fp != $mips_fp} { # Work out information about the current architecture.
if {$mips_forced_regs} { set arch_test_option_p [mips_test_option_p options arch]
set matches 0 set arch [mips_option options arch]
set isa [mips_arch_info $arch isa]
set isa_rev [mips_arch_info $arch isa_rev]
# If the test forces a 32-bit architecture, force -mgp32.
# Force the current -mgp setting otherwise; if we don't,
# some configurations would make a 64-bit architecture
# imply -mgp64.
if { $arch_test_option_p } {
if { [mips_32bit_arch_p $arch] } {
mips_make_test_option options "-mgp32"
} else {
mips_make_test_option options [mips_option options gp]
}
} }
# Select an appropriate ABI.
if {[lsearch $flags "-mabi=*"] < 0} { # We've now fixed the GP register size. Make it easily available.
if {$mips_new_gp == 32} { set gp_size [expr { [mips_have_option_p options "-mgp32"] ? 32 : 64 }]
append flags " -mabi=32"
# Handle dependencies between the pre-arch options and the arch option.
# This should mirror the arch and post-arch code below.
if { !$arch_test_option_p } {
# We need a revision 2 or better ISA for:
#
# - the combination of -mgp32 -mfp64
# - the DSP ASE
if { $isa_rev < 2
&& (($gp_size == 32 && [mips_have_test_option_p options "-mfp64"])
|| [mips_have_test_option_p options "-mdsp"]
|| [mips_have_test_option_p options "-mdspr2"]) } {
if { $gp_size == 32 } {
mips_make_test_option options "-mips32r2"
} else { } else {
append flags " -mabi=o64" mips_make_test_option options "-mips64r2"
} }
# We need a MIPS32 or MIPS64 ISA for:
#
# - paired-single instructions(*)
#
# (*) Note that we don't support MIPS V at the moment.
} elseif { $isa_rev < 1
&& [mips_have_test_option_p options "-mpaired-single"] } {
if { $gp_size == 32 } {
mips_make_test_option options "-mips32"
} else {
mips_make_test_option options "-mips64"
} }
# And an appropriate architecture. # We need MIPS III or higher for:
if {[lsearch -regexp $flags {^(-mips|-march)}] < 0} { #
if {$mips_new_gp == 64 && $mips_gp == 32} { # - the "cache" instruction
append flags " -mips3" } elseif { $isa < 3
} elseif {$mips_new_gp == 32 && $mips_new_fp == 64} { && ([mips_have_test_option_p options \
append flags " -mips32r2" "-mr10k-cache-barrier=load-store"]
|| [mips_have_test_option_p options \
"-mr10k-cache-barrier=store"]) } {
mips_make_test_option options "-mips3"
# We need MIPS II or higher for:
#
# - branch-likely instructions(*)
#
# (*) needed by both -mbranch-likely and -mfix-r10000
} elseif { $isa < 2
&& ([mips_have_test_option_p options "-mbranch-likely"]
|| [mips_have_test_option_p options "-mfix-r10000"]) } {
mips_make_test_option options "-mips2"
# Check whether we need to switch from a 32-bit processor to the
# "nearest" 64-bit processor.
} elseif { $gp_size == 64 && [mips_32bit_arch_p $arch] } {
if { $isa_rev == 0 } {
mips_make_test_option options "-mips3"
} elseif { $isa_rev == 1 } {
mips_make_test_option options "-mips64"
} else {
mips_make_test_option options "-mips64r$isa_rev"
} }
} }
unset arch
unset isa
unset isa_rev
} }
foreach flag $flags { # Set an appropriate ABI, handling dependencies between the pre-abi
if {[string match -mabicalls $flag]} { # options and the abi options. This should mirror the abi and post-abi
# EABI has no SVR4-style PIC mode, so try to force another ABI. # code below.
if {$mips_abi == "eabi" && [lsearch $flags "-mabi=*"] < 0} { if { !$abi_test_option_p } {
if {$mips_new_gp == 32} { if { ($eabi_p
append flags " -mabi=32" && ([mips_have_option_p options "-mabicalls"]
|| ($gp_size == 32
&& [mips_have_option_p options "-mfp64"]))) } {
# EABI doesn't support -mabicalls.
# EABI doesn't support the combination -mgp32 -mfp64.
set force_abi 1
} elseif { [mips_have_option_p options "-mips16"]
&& ![mips_same_option_p $abi "-mabi=32"]
&& ![mips_same_option_p $abi "-mabi=o64"]
&& (![mips_have_option_p options "addressing=absolute"]
|| [mips_have_option_p options "-mhard-float"]) } {
# -mips16 -mhard-float requires o32 or o64.
# -mips16 PIC requires o32 or o64.
set force_abi 1
} else { } else {
append flags " -mabi=n32" set force_abi 0
} }
if { $gp_size == 32 } {
if { $force_abi || [mips_64bit_abi_p $abi] } {
mips_make_test_option options "-mabi=32"
}
} else {
if { $force_abi || [mips_32bit_abi_p $abi] } {
# All configurations should have an assembler that
# supports o64, since it requires the same BFD target
# vector as o32. In contrast, many assembler
# configurations do not have n32 or n64 support.
mips_make_test_option options "-mabi=o64"
} }
# Turn off small data, if on by default.
append flags " -G0"
} }
unset abi
unset eabi_p
} }
# Handle the other options. # Handle dependencies between the abi options and the post-abi options.
foreach flag $flags { # This should mirror the abi and pre-abi code above.
if {[regexp -- {^-mabi=(.*)} $flag dummy abi]} { if { $abi_test_option_p } {
if {$abi != $mips_abi && $mips_forced_abi} { if { $eabi_p } {
set matches 0 mips_make_test_option options "-mno-abicalls"
if { $gp_size == 32 } {
mips_make_test_option options "-mfp32"
} }
} elseif {[regexp -- {^-mips(.*)} $flag dummy isa]
|| [regexp -- {^-march=mips(.*)} $flag dummy isa]} {
if {![regexp {(.*)r(.*)} $isa dummy isa isa_rev]} {
set isa_rev 1
} }
if {($isa != $mips_isa || $isa_rev != $mips_isa_rev) if { [mips_have_option_p options "-mips16"]
&& $mips_forced_isa} { && ![mips_same_option_p $abi "-mabi=32"]
set matches 0 && ![mips_same_option_p $abi "-mabi=o64"]
&& (![mips_have_option_p options "addressing=absolute"]
|| [mips_have_option_p options "-mhard-float"]) } {
if { [mips_test_option_p options mips16] } {
mips_make_test_option options "addressing=absolute"
mips_make_test_option options "-msoft-float"
} else {
mips_make_test_option options "-mno-mips16"
} }
} elseif {[regexp -- {^-march=(.*)} $flag dummy arch]} {
if {$arch != $mips_arch && $mips_forced_isa} {
set matches 0
} }
} elseif {[regexp -- {^-m(hard|soft)-float} $flag dummy float]} { unset abi
if {$mips_float != $float && $mips_forced_float} { unset eabi_p
set matches 0
} }
} elseif {[regexp -- {^-(EB|meb)$} $flag]} {
if {$mips_forced_le} { # Handle dependencies between the arch option and the post-arch options.
set matches 0 # This should mirror the arch and pre-arch code above.
if { $arch_test_option_p } {
if { $isa < 2 } {
mips_make_test_option options "-mno-branch-likely"
mips_make_test_option options "-mno-fix-r10000"
} }
} elseif {[regexp -- {^-(EL|mel)$} $flag]} { if { $isa < 3 } {
if {$mips_forced_be} { mips_make_test_option options "-mr10k-cache-barrier=none"
set matches 0
} }
} elseif {[regexp -- {^-(G|m(|no-)((extern|local)-sdata|gpopt))} $flag]} { if { $isa_rev < 1 } {
if {$flag != "-G0"} { mips_make_test_option options "-mno-paired-single"
append flags " -mno-abicalls"
} }
if {$mips_forced_gp} { if { $isa_rev < 2 } {
set matches 0 if { $gp_size == 32 } {
mips_make_test_option options "-mfp32"
} }
} elseif {[regexp -- {^-mabicalls$} $flag]} { mips_make_test_option options "-mno-dsp"
if {$mips_forced_no_abicalls} { mips_make_test_option options "-mno-dspr2"
set matches 0
} }
} elseif {[regexp -- {^-mshared$} $flag]} { unset arch
if {$mips_forced_no_shared} { unset isa
set matches 0 unset isa_rev
} }
} elseif {[regexp -- {^-mexplicit-relocs$} $flag]} {
if {$mips_forced_no_er} { # Handle dependencies between options on the right of the diagram.
set matches 0 mips_option_dependency options "-mno-explicit-relocs" "-mgpopt"
switch -- [mips_test_option options small-data] {
"" -
-G0 {}
default {
mips_make_test_option options "-mno-abicalls"
} }
} }
if { [mips_have_option_p options "-mabicalls"] } {
mips_option_dependency options "addressing=absolute" "-mplt"
}
mips_option_dependency options "-mplt" "-msym32"
mips_option_dependency options "-mplt" "-mno-shared"
mips_option_dependency options "-mno-shared" "-fno-pic"
mips_option_dependency options "-mfp32" "-mno-paired-single"
mips_option_dependency options "-msoft-float" "-mno-paired-single"
mips_option_dependency options "-mno-paired-single" "-mno-mips3d"
# If the test requires an unsupported option, change run tests
# to link tests.
switch -- [lindex $do_what 0] {
run {
set option [mips_first_unsupported_option options]
if { ![string equal $option ""] } {
set do_what [lreplace $do_what 0 0 link]
verbose -log "Downgraded to a 'link' test due to unsupported option '$option'"
}
} }
if {$matches} { }
append extra_tool_flags " " $flags
} else { # If the test has overridden a option that changes the ABI,
set do_what [list [lindex $do_what 0] "N" "P"] # downgrade a link or execution test to an assembler test.
foreach group $mips_abi_groups {
set old_option [mips_original_option $group]
set new_option [mips_option options $group]
if { ![mips_same_option_p $old_option $new_option] } {
switch -- [lindex $do_what 0] {
link -
run {
set do_what [lreplace $do_what 0 0 assemble]
verbose -log "Downgraded to an 'assemble' test due to incompatible $group option ($old_option changed to $new_option)"
}
}
break
}
}
# Add all options to the dg variable.
set options(explicit_p,addressing) 0
foreach { group regexp } $mips_option_groups {
if { $options(explicit_p,$group) } {
append extra_tool_flags " " $options(option,$group)
}
}
# If the test is MIPS16-compatible, provide a counterpart to the
# NOMIPS16 convenience macro.
if { [mips_have_test_option_p options "-mips16"] } {
append extra_tool_flags " -DMIPS16=__attribute__((mips16))"
}
# Use our version of gcc-dg-test for this test.
if { ![string equal [info procs "mips-gcc-dg-test"] ""] } {
rename gcc-dg-test mips-old-gcc-dg-test
rename mips-gcc-dg-test gcc-dg-test
} }
} }
setup_mips_tests # A version of gcc-dg-test that is used by dg-options tests.
proc mips-gcc-dg-test { prog do_what extra_tool_flags } {
global board_info
global mips_extra_options
# Override the user's chosen test options with the combined test/user
# version.
mips_push_test_options saved_options $mips_extra_options
set result [gcc-dg-test-1 gcc_target_compile $prog \
$do_what $extra_tool_flags]
mips_pop_test_options saved_options
# Restore the usual gcc-dg-test.
rename gcc-dg-test mips-gcc-dg-test
rename mips-old-gcc-dg-test gcc-dg-test
return $result
}
dg-init dg-init
# MIPS16 is defined in add_options_for_mips16_attribute. mips-dg-init
# MIPS16 is defined by "-mips16" or "(-mips16)" in dg-options.
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] "" \ dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] "" \
"-DNOMIPS16=__attribute__((nomips16))" "-DNOMIPS16=__attribute__((nomips16))"
mips-dg-finish
dg-finish dg-finish
/* { dg-do compile { target mips16_attribute } } */
/* { dg-skip-if "" { *-*-* } { "-mflip-mips16" } { "" } } */ /* { dg-skip-if "" { *-*-* } { "-mflip-mips16" } { "" } } */
/* { dg-add-options mips16_attribute } */ /* { dg-options "(-mips16)" } */
void f1 (void); void f1 (void);
void __attribute__((mips16)) f1 (void) {} /* { dg-error "conflicting" } */ void __attribute__((mips16)) f1 (void) {} /* { dg-error "conflicting" } */
......
/* { dg-options "(-mips16)" } */
/* We should be able to assign mips16 and nomips16 functions to a pointer. */ /* We should be able to assign mips16 and nomips16 functions to a pointer. */
void __attribute__((mips16)) f1 (void); void __attribute__((mips16)) f1 (void);
void (*ptr1) (void) = f1; void (*ptr1) (void) = f1;
......
/* Verify that mips16 and nomips16 attributes work, checking all combinations /* Verify that mips16 and nomips16 attributes work, checking all combinations
of calling a nomips16/mips16/default function from a nomips16/mips16/default of calling a nomips16/mips16/default function from a nomips16/mips16/default
function. */ function. */
/* { dg-do run { target { mipsisa*-*-elf* && mips16_attribute } } } */ /* { dg-do run } */
/* { dg-add-options mips16_attribute } */ /* { dg-options "(-mips16)" } */
#include <stdlib.h> #include <stdlib.h>
......
/* { dg-do compile { target mips16_attribute } } */ /* -mlong32 added because of PR target/38595. */
/* { dg-mips-options "-Os -march=mips32" } */ /* { dg-options "(-mips16) -Os isa_rev>=1 -mlong32" } */
/* { dg-add-options mips16_attribute } */
MIPS16 short cksum16 (unsigned long n) MIPS16 short cksum16 (unsigned long n)
{ {
......
/* Test MIPS32 DSP instructions */ /* Test MIPS32 DSP instructions */
/* { dg-do run { target mipsisa32r2*-*-* } } */ /* { dg-do run } */
/* { dg-mips-options "-march=mips32r2 -mdsp -O2" } */ /* { dg-options "-mdsp -O2" } */
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
......
/* Test MIPS32 DSP instructions */ /* Test MIPS32 DSP instructions */
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-march=mips32 -mdsp" } */ /* { dg-options "-mdsp" } */
/* { dg-final { scan-assembler "addq.ph" } } */ /* { dg-final { scan-assembler "addq.ph" } } */
/* { dg-final { scan-assembler "addu.qb" } } */ /* { dg-final { scan-assembler "addu.qb" } } */
/* { dg-final { scan-assembler "subq.ph" } } */ /* { dg-final { scan-assembler "subq.ph" } } */
......
/* Test MIPS32 DSP instructions */ /* Test MIPS32 DSP instructions */
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-march=mips32 -mdsp" } */ /* { dg-options "-mgp32 -mdsp" } */
/* { dg-final { scan-assembler "addq.ph" } } */ /* { dg-final { scan-assembler "addq.ph" } } */
/* { dg-final { scan-assembler "addq_s.ph" } } */ /* { dg-final { scan-assembler "addq_s.ph" } } */
/* { dg-final { scan-assembler "addq_s.w" } } */ /* { dg-final { scan-assembler "addq_s.w" } } */
......
/* Test MIPS32 DSP REV 2 instructions */ /* Test MIPS32 DSP REV 2 instructions */
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-march=mips32r2 -mdspr2" } */ /* { dg-options "-mdspr2" } */
/* { dg-final { scan-assembler "\tmul.ph\t" } } */ /* { dg-final { scan-assembler "\tmul.ph\t" } } */
typedef short v2hi __attribute__ ((vector_size(4))); typedef short v2hi __attribute__ ((vector_size(4)));
......
/* Test MIPS32 DSP REV 2 instructions */ /* Test MIPS32 DSP REV 2 instructions */
/* { dg-do run { target mipsisa32r2*-*-* } } */ /* { dg-do run } */
/* { dg-mips-options "-march=mips32r2 -mdspr2 -O2" } */ /* { dg-options "-mdspr2 -O2" } */
typedef signed char v4q7 __attribute__ ((vector_size(4))); typedef signed char v4q7 __attribute__ ((vector_size(4)));
typedef signed char v4i8 __attribute__ ((vector_size(4))); typedef signed char v4i8 __attribute__ ((vector_size(4)));
...@@ -13,7 +13,7 @@ typedef long long a64; ...@@ -13,7 +13,7 @@ typedef long long a64;
void abort (void); void abort (void);
void test_MIPS_DSPR2 (void); NOMIPS16 void test_MIPS_DSPR2 (void);
int little_endian; int little_endian;
...@@ -28,7 +28,7 @@ int main () ...@@ -28,7 +28,7 @@ int main ()
return 0; return 0;
} }
void test_MIPS_DSPR2 () NOMIPS16 void test_MIPS_DSPR2 ()
{ {
v4q7 v4q7_a,v4q7_b,v4q7_c,v4q7_r,v4q7_s; v4q7 v4q7_a,v4q7_b,v4q7_c,v4q7_r,v4q7_s;
v4i8 v4i8_a,v4i8_b,v4i8_c,v4i8_r,v4i8_s; v4i8 v4i8_a,v4i8_b,v4i8_c,v4i8_r,v4i8_s;
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O -mabi=32 -mfp64" } */ /* { dg-options "-O -mabi=32 -mfp64" } */
/* { dg-final { scan-assembler "mthc1" } } */ /* { dg-final { scan-assembler "mthc1" } } */
/* { dg-final { scan-assembler "mfhc1" } } */ /* { dg-final { scan-assembler "mfhc1" } } */
double func1 (long long a) NOMIPS16 double func1 (long long a)
{ {
return a; return a;
} }
long long func2 (double b) NOMIPS16 long long func2 (double b)
{ {
return b; return b;
} }
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O2 -mips4" } */ /* { dg-options "-O2 isa>=4" } */
/* { dg-final { scan-assembler "movz" } } */ /* { dg-final { scan-assembler "movz" } } */
/* { dg-final { scan-assembler "movn" } } */ /* { dg-final { scan-assembler "movn" } } */
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O2 -mips4" } */ /* { dg-options "-O2 isa>=4" } */
/* { dg-final { scan-assembler "movz" } } */ /* { dg-final { scan-assembler "movz" } } */
/* { dg-final { scan-assembler "movn" } } */ /* { dg-final { scan-assembler "movn" } } */
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O2 -mips4 -mhard-float" } */ /* { dg-options "-O2 isa>=4 -mhard-float" } */
/* { dg-final { scan-assembler "movt" } } */ /* { dg-final { scan-assembler "movt" } } */
/* { dg-final { scan-assembler "movf" } } */ /* { dg-final { scan-assembler "movf" } } */
/* { dg-final { scan-assembler "movz.s" } } */ /* { dg-final { scan-assembler "movz.s" } } */
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O2 -march=vr5400 -mgp32" } */ /* { dg-options "-O2 -march=vr5400 -mgp32" } */
/* { dg-final { scan-assembler-times "\tmsac\t\\\$0," 2 } } */ /* { dg-final { scan-assembler-times "\tmsac\t\\\$0," 2 } } */
NOMIPS16 long long NOMIPS16 long long
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O2 -march=vr5500 -mgp32" } */ /* { dg-options "-O2 -march=vr5500 -mgp32" } */
/* { dg-final { scan-assembler-times "\tmsub\t" 2 } } */ /* { dg-final { scan-assembler-times "\tmsub\t" 2 } } */
NOMIPS16 long long NOMIPS16 long long
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O2 -mips32 -mgp32" } */ /* { dg-options "-O2 isa_rev>=1 -mgp32" } */
/* { dg-final { scan-assembler-times "\tmsub\t" 2 } } */ /* { dg-final { scan-assembler-times "\tmsub\t" 2 } } */
NOMIPS16 long long NOMIPS16 long long
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O2 -mips32r2 -mdspr2 -mgp32" } */ /* { dg-options "-O2 -mdspr2 -mgp32" } */
/* { dg-final { scan-assembler-times "\tmsub\t\\\$ac" 2 } } */ /* { dg-final { scan-assembler-times "\tmsub\t\\\$ac" 2 } } */
NOMIPS16 long long NOMIPS16 long long
......
/* { dg-mips-options "-O2 -march=5kc" } */ /* { dg-options "-O2 -march=5kc" } */
/* { dg-final { scan-assembler-times "\tmsub\t" 4 } } */ /* { dg-final { scan-assembler-times "\tmsub\t" 4 } } */
/* { dg-final { scan-assembler-not "\tmtlo\t" } } */ /* { dg-final { scan-assembler-not "\tmtlo\t" } } */
/* { dg-final { scan-assembler-times "\tmflo\t" 3 } } */ /* { dg-final { scan-assembler-times "\tmflo\t" 3 } } */
......
/* { dg-mips-options "-O2 -march=5kc" } */ /* { dg-options "-O2 -march=5kc" } */
/* { dg-final { scan-assembler-not "\tmsub\t" } } */ /* { dg-final { scan-assembler-not "\tmsub\t" } } */
/* { dg-final { scan-assembler "\tmul\t" } } */ /* { dg-final { scan-assembler "\tmul\t" } } */
/* { dg-final { scan-assembler "\tsubu\t" } } */ /* { dg-final { scan-assembler "\tsubu\t" } } */
......
/* -mlong32 added because of PR target/38598. */ /* -mlong32 added because of PR target/38598. */
/* { dg-mips-options "-O2 -march=5kc -mlong32" } */ /* { dg-options "-O2 -march=5kc -mlong32" } */
/* { dg-final { scan-assembler-not "\tmul\t" } } */ /* { dg-final { scan-assembler-not "\tmul\t" } } */
/* { dg-final { scan-assembler "\tmsub\t" } } */ /* { dg-final { scan-assembler "\tmsub\t" } } */
......
/* { dg-mips-options "-O2 -march=5kc" } */ /* { dg-options "-O2 -march=5kc" } */
/* { dg-final { scan-assembler "\tmul\t" } } */ /* { dg-final { scan-assembler "\tmul\t" } } */
/* { dg-final { scan-assembler-not "\tmsub\t" } } */ /* { dg-final { scan-assembler-not "\tmsub\t" } } */
/* { dg-final { scan-assembler-not "\tmtlo\t" } } */ /* { dg-final { scan-assembler-not "\tmtlo\t" } } */
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O2 -march=vr5400 -mgp32" } */ /* { dg-options "-O2 -march=vr5400 -mgp32" } */
/* { dg-final { scan-assembler-times "\tmsacu\t\\\$0," 2 } } */ /* { dg-final { scan-assembler-times "\tmsacu\t\\\$0," 2 } } */
typedef unsigned int ui; typedef unsigned int ui;
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O2 -march=vr5500 -mgp32" } */ /* { dg-options "-O2 -march=vr5500 -mgp32" } */
/* { dg-final { scan-assembler-times "\tmsubu\t" 2 } } */ /* { dg-final { scan-assembler-times "\tmsubu\t" 2 } } */
typedef unsigned int ui; typedef unsigned int ui;
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O2 -mips32 -mgp32" } */ /* { dg-options "-O2 isa_rev>=1 -mgp32" } */
/* { dg-final { scan-assembler-times "\tmsubu\t" 2 } } */ /* { dg-final { scan-assembler-times "\tmsubu\t" 2 } } */
typedef unsigned int ui; typedef unsigned int ui;
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O2 -mips32r2 -mdspr2 -mgp32" } */ /* { dg-options "-O2 -mdspr2 -mgp32" } */
/* { dg-final { scan-assembler-times "\tmsubu\t\\\$ac" 2 } } */ /* { dg-final { scan-assembler-times "\tmsubu\t\\\$ac" 2 } } */
typedef unsigned int ui; typedef unsigned int ui;
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-mlong-calls" } */ /* { dg-options "-mlong-calls addressing=absolute" } */
/* { dg-require-effective-target nonpic } */
extern int long_call_func () __attribute__((long_call)); extern int long_call_func () __attribute__((long_call));
extern int far_func () __attribute__((far)); extern int far_func () __attribute__((far));
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-mno-long-calls" } */ /* { dg-options "-mno-long-calls addressing=absolute" } */
/* { dg-require-effective-target nonpic } */
extern int long_call_func () __attribute__((long_call)); extern int long_call_func () __attribute__((long_call));
extern int far_func () __attribute__((far)); extern int far_func () __attribute__((far));
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-mlong-calls -O2" } */ /* { dg-options "-mlong-calls addressing=absolute -O2" } */
/* { dg-require-effective-target nonpic } */
NOMIPS16 extern int long_call_func () __attribute__((long_call)); NOMIPS16 extern int long_call_func () __attribute__((long_call));
NOMIPS16 extern int far_func () __attribute__((far)); NOMIPS16 extern int far_func () __attribute__((far));
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-mno-long-calls -O2" } */ /* { dg-options "-mno-long-calls addressing=absolute -O2" } */
/* { dg-require-effective-target nonpic } */
NOMIPS16 extern int long_call_func () __attribute__((long_call)); NOMIPS16 extern int long_call_func () __attribute__((long_call));
NOMIPS16 extern int far_func () __attribute__((far)); NOMIPS16 extern int far_func () __attribute__((far));
......
/* Make sure that we use abs.fmt and neg.fmt when the signs of NaNs don't /* Make sure that we use abs.fmt and neg.fmt when the signs of NaNs don't
matter. */ matter. */
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O2 -mhard-float -ffinite-math-only" } */ /* { dg-options "-O2 -mhard-float -ffinite-math-only" } */
/* { dg-final { scan-assembler "neg.s" } } */ /* { dg-final { scan-assembler "neg.s" } } */
/* { dg-final { scan-assembler "neg.d" } } */ /* { dg-final { scan-assembler "neg.d" } } */
/* { dg-final { scan-assembler "abs.s" } } */ /* { dg-final { scan-assembler "abs.s" } } */
......
/* Make sure that we avoid abs.fmt and neg.fmt when the signs of NaNs /* Make sure that we avoid abs.fmt and neg.fmt when the signs of NaNs
matter. */ matter. */
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O2 -mhard-float -fno-finite-math-only" } */ /* { dg-options "-O2 -mhard-float -fno-finite-math-only" } */
/* { dg-final { scan-assembler-not "neg.s" } } */ /* { dg-final { scan-assembler-not "neg.s" } } */
/* { dg-final { scan-assembler-not "neg.d" } } */ /* { dg-final { scan-assembler-not "neg.d" } } */
/* { dg-final { scan-assembler-not "abs.s" } } */ /* { dg-final { scan-assembler-not "abs.s" } } */
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O2 -ffast-math -mips4 -mhard-float" } */ /* { dg-options "-O2 -ffast-math isa=4 -mhard-float" } */
/* { dg-final { scan-assembler "nmadd.s" } } */ /* { dg-final { scan-assembler "nmadd.s" } } */
/* { dg-final { scan-assembler "nmadd.d" } } */ /* { dg-final { scan-assembler "nmadd.d" } } */
/* { dg-final { scan-assembler "nmsub.s" } } */ /* { dg-final { scan-assembler "nmsub.s" } } */
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O2 -fno-fast-math -ffinite-math-only -mips4 -mhard-float" } */ /* { dg-options "-O2 -fno-fast-math -ffinite-math-only isa=4 -mhard-float" } */
/* { dg-final { scan-assembler "nmadd.s" } } */ /* { dg-final { scan-assembler "nmadd.s" } } */
/* { dg-final { scan-assembler "nmadd.d" } } */ /* { dg-final { scan-assembler "nmadd.d" } } */
/* { dg-final { scan-assembler "nmsub.s" } } */ /* { dg-final { scan-assembler "nmsub.s" } } */
......
/* The same code as nmadd-2.c, but compiled with -fno-finite-math-only. /* The same code as nmadd-2.c, but compiled with -fno-finite-math-only.
We can't use nmadd and nmsub in that case. */ We can't use nmadd and nmsub in that case. */
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O2 -fno-fast-math -fno-finite-math-only -mips4 -mhard-float" } */ /* { dg-options "-O2 -fno-fast-math -fno-finite-math-only isa=4 -mhard-float" } */
/* { dg-final { scan-assembler-not "nmadd.s" } } */ /* { dg-final { scan-assembler-not "nmadd.s" } } */
/* { dg-final { scan-assembler-not "nmadd.d" } } */ /* { dg-final { scan-assembler-not "nmadd.d" } } */
/* { dg-final { scan-assembler-not "nmsub.s" } } */ /* { dg-final { scan-assembler-not "nmsub.s" } } */
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O -mno-smartmips" } */ /* { dg-options "-O -mno-smartmips" } */
NOMIPS16 int scaled_indexed_word_load (int a[], int b) NOMIPS16 int scaled_indexed_word_load (int a[], int b)
{ {
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O -mno-smartmips -march=mips32" } */ /* { dg-options "-O -mno-smartmips -march=mips32" } */
NOMIPS16 int rotate_left (unsigned a, unsigned s) NOMIPS16 int rotate_left (unsigned a, unsigned s)
{ {
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O -march=octeon" } */ /* { dg-options "-O -march=octeon" } */
/* { dg-final { scan-assembler-times "\tbaddu\t" 4 } } */ /* { dg-final { scan-assembler-times "\tbaddu\t" 4 } } */
/* { dg-final { scan-assembler-not "\tandi\t" } } */ /* { dg-final { scan-assembler-not "\tandi\t" } } */
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O2 -march=octeon" } */ /* { dg-options "-O2 -march=octeon" } */
/* { dg-final { scan-assembler-times "\tbbit1\t" 4 } } */ /* { dg-final { scan-assembler-times "\tbbit1\t" 4 } } */
/* { dg-final { scan-assembler-times "\tbbit0\t" 2 } } */ /* { dg-final { scan-assembler-times "\tbbit0\t" 2 } } */
/* { dg-final { scan-assembler-not "andi\t" } } */ /* { dg-final { scan-assembler-not "andi\t" } } */
NOMIPS16 void foo (void);
NOMIPS16 void NOMIPS16 void
f1 (long long i) f1 (long long i)
{ {
...@@ -51,5 +53,5 @@ NOMIPS16 void ...@@ -51,5 +53,5 @@ NOMIPS16 void
f6 () f6 ()
{ {
if (!test_bit(0, &r)) if (!test_bit(0, &r))
g (); foo ();
} }
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O2 -march=octeon -mbranch-likely" } */ /* { dg-options "-O2 -march=octeon -mbranch-likely" } */
/* { dg-final { scan-assembler "\tbbit\[01\]\t" } } */ /* { dg-final { scan-assembler "\tbbit\[01\]\t" } } */
/* { dg-final { scan-assembler-not "\tbbit\[01\]l\t" } } */ /* { dg-final { scan-assembler-not "\tbbit\[01\]l\t" } } */
/* { dg-final { scan-assembler "\tbnel\t" } } */ /* { dg-final { scan-assembler "\tbnel\t" } } */
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
which does not get recognized as a valid bbit pattern. The which does not get recognized as a valid bbit pattern. The
middle-end should be able to simplify this further. */ middle-end should be able to simplify this further. */
/* { dg-mips-options "-O2 -march=octeon -meb" } */ /* { dg-options "-O2 -march=octeon -meb" } */
/* { dg-final { scan-assembler-times "\tbbit\[01\]\t|\tbgez\t" 2 } } */ /* { dg-final { scan-assembler-times "\tbbit\[01\]\t|\tbgez\t" 2 } } */
/* { dg-final { scan-assembler-not "ext\t" } } */ /* { dg-final { scan-assembler-not "ext\t" } } */
......
/* { dg-do compile } */ /* { dg-do compile } */
/* The tests also work with -mgp32. For long long tests, only one of /* The tests also work with -mgp32. For long long tests, only one of
the 32-bit parts is used. */ the 32-bit parts is used. */
/* { dg-mips-options "-O -march=octeon" } */ /* { dg-options "-O -march=octeon" } */
/* { dg-final { scan-assembler-times "\tcins\t" 3 } } */ /* { dg-final { scan-assembler-times "\tcins\t" 3 } } */
/* { dg-final { scan-assembler-not "\tandi\t|sll\t" } } */ /* { dg-final { scan-assembler-not "\tandi\t|sll\t" } } */
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O -march=octeon -mgp64" } */ /* { dg-options "-O -march=octeon -mgp64" } */
/* { dg-final { scan-assembler-not "\tcins\t" } } */ /* { dg-final { scan-assembler-not "\tcins\t" } } */
NOMIPS16 unsigned NOMIPS16 unsigned
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-march=octeon -mgp64" } */ /* { dg-options "-march=octeon -mgp64" } */
/* { dg-final { scan-assembler "\tdmul\t" } } */ /* { dg-final { scan-assembler "\tdmul\t" } } */
/* { dg-final { scan-assembler-not "\tdmult\t" } } */ /* { dg-final { scan-assembler-not "\tdmult\t" } } */
/* { dg-final { scan-assembler-not "\tmflo\t" } } */ /* { dg-final { scan-assembler-not "\tmflo\t" } } */
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-march=octeon -mgp64" } */ /* { dg-options "-march=octeon -mgp64" } */
/* { dg-final { scan-assembler-not "\tdmul" } } */ /* { dg-final { scan-assembler-not "\tdmul" } } */
NOMIPS16 long long NOMIPS16 long long
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-march=octeon" } */ /* { dg-options "-march=octeon" } */
/* { dg-final { scan-assembler "\texts\t" } } */ /* { dg-final { scan-assembler "\texts\t" } } */
struct foo struct foo
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O -march=octeon -meb" } */ /* { dg-options "-O -march=octeon -meb" } */
/* { dg-final { scan-assembler-times "\texts\t" 4 } } */ /* { dg-final { scan-assembler-times "\texts\t" 4 } } */
struct bar struct bar
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O -march=octeon -mgp64" } */ /* { dg-options "-O -march=octeon -mgp64" } */
/* { dg-final { scan-assembler-times "\texts\t" 3 } } */ /* { dg-final { scan-assembler-times "\texts\t" 3 } } */
struct foo struct foo
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O -march=octeon -mgp64" } */ /* { dg-options "-O -march=octeon -mgp64" } */
/* { dg-final { scan-assembler-not "\tsll\t\[^\n\]*,0" } } */ /* { dg-final { scan-assembler-not "\tsll\t\[^\n\]*,0" } } */
/* { dg-final { scan-assembler-times "\texts\t" 6 } } */ /* { dg-final { scan-assembler-times "\texts\t" 6 } } */
......
/* -mel version of octeon-exts-2.c. */ /* -mel version of octeon-exts-2.c. */
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O -march=octeon -mel" } */ /* { dg-options "-O -march=octeon -mel" } */
/* { dg-final { scan-assembler-times "\texts\t" 4 } } */ /* { dg-final { scan-assembler-times "\texts\t" 4 } } */
struct bar struct bar
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O -march=octeon -mgp64" } */ /* { dg-options "-O -march=octeon -mgp64" } */
/* { dg-final { scan-assembler "\tpop\t" } } */ /* { dg-final { scan-assembler "\tpop\t" } } */
/* { dg-final { scan-assembler "\tdpop\t" } } */ /* { dg-final { scan-assembler "\tdpop\t" } } */
......
/* Check if we expand seq and sne. */ /* Check if we expand seq and sne. */
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-march=octeon" } */ /* { dg-options "-march=octeon" } */
/* { dg-final { scan-assembler-times "\tseq\t|\tseqi\t" 4 } } */ /* { dg-final { scan-assembler-times "\tseq\t|\tseqi\t" 4 } } */
/* { dg-final { scan-assembler-times "\tsne\t|\tsnei\t" 4 } } */ /* { dg-final { scan-assembler-times "\tsne\t|\tsnei\t" 4 } } */
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-march=octeon -mgp64" } */ /* { dg-options "-march=octeon -mgp64" } */
/* { dg-final { scan-assembler-times "\tseq\t|\tseqi\t" 3 } } */ /* { dg-final { scan-assembler-times "\tseq\t|\tseqi\t" 3 } } */
/* { dg-final { scan-assembler-times "\tsne\t|\tsnei\t" 3 } } */ /* { dg-final { scan-assembler-times "\tsne\t|\tsnei\t" 3 } } */
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O -march=octeon -mgp64" } */ /* { dg-options "-O -march=octeon -mgp64" } */
/* { dg-final { scan-assembler-not "and\t\|andi\t\|ext\t\|sll\t\|srl\t" } } */ /* { dg-final { scan-assembler-not "and\t\|andi\t\|ext\t\|sll\t\|srl\t" } } */
/* { dg-final { scan-assembler-times "\tseqi\t\|\tsnei\t" 4 } } */ /* { dg-final { scan-assembler-times "\tseqi\t\|\tsnei\t" 4 } } */
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O2 -march=octeon" } */ /* { dg-options "-O2 -march=octeon" } */
/* { dg-final { scan-assembler-not "xor" } } */ /* { dg-final { scan-assembler-not "xor" } } */
unsigned unsigned
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
This testcase used to trigger an unrecognizable insn. */ This testcase used to trigger an unrecognizable insn. */
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O2 -w" } */ /* { dg-options "-O2 -w" } */
__thread int *a = 0; __thread int *a = 0;
......
/* GCC used to report an ICE for this test because we generated a LO_SUM /* GCC used to report an ICE for this test because we generated a LO_SUM
for an illegitimate constant. */ for an illegitimate constant. */
/* { dg-mips-options "-mabi=64 -msym32 -O2 -EB -mno-abicalls" } */ /* { dg-options "-mabi=64 -msym32 -O2 -EB -mno-abicalls" } */
extern unsigned long a[]; extern unsigned long a[];
int b (int); int b (int);
......
/* { dg-mips-options "-mabi=64 -O2" } */ /* { dg-options "-mabi=64 -O2" } */
NOMIPS16 long double __powitf2 (long double x, int m) NOMIPS16 long double __powitf2 (long double x, int m)
{ {
......
/* { dg-do link } */ /* { dg-do link } */
/* { dg-mips-options "-O2" } */ /* { dg-options "-O2" } */
volatile int gv; volatile int gv;
const char *ptrs[2]; const char *ptrs[2];
......
/* { dg-mips-options "-ffast-math -mips64 -mgp32" } */ /* { dg-options "-ffast-math -mips64 -mgp32" } */
double double
foo (void) foo (void)
......
/* { dg-mips-options "-O2 -march=74kc -mgp32" } */ /* { dg-options "-O2 -march=74kc -mgp32" } */
__thread int x __attribute__((tls_model("initial-exec"))); __thread int x __attribute__((tls_model("initial-exec")));
__thread int y __attribute__((tls_model("initial-exec"))); __thread int y __attribute__((tls_model("initial-exec")));
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-march=mips64r2 -mabi=n32" } */ /* { dg-options "-march=mips64r2 -mabi=n32" } */
typedef float TFtype __attribute__((mode(TF))); typedef float TFtype __attribute__((mode(TF)));
......
/* { dg-mips-options "-O2 -mabi=64 -mr10k-cache-barrier=store" } */ /* { dg-options "-O2 -mabi=64 -mr10k-cache-barrier=store" } */
/* Test that stores to uncached addresses do not get unnecessary /* Test that stores to uncached addresses do not get unnecessary
cache barriers. */ cache barriers. */
......
/* { dg-mips-options "-O2 -mr10k-cache-barrier=store -mips4 -mbranch-likely -mno-abicalls" } */ /* { dg-options "-O2 -mr10k-cache-barrier=store -mips4 -mbranch-likely -mno-abicalls" } */
int bar (int); int bar (int);
/* Test that code after a branch-likely does not get an unnecessary /* Test that code after a branch-likely does not get an unnecessary
......
/* { dg-mips-options "-O2 -mr10k-cache-barrier=store -mno-abicalls" } */ /* { dg-options "-O2 -mr10k-cache-barrier=store -mno-abicalls" } */
/* Test that loads are not unnecessarily protected. */ /* Test that loads are not unnecessarily protected. */
......
/* { dg-mips-options "-O2 -mr10k-cache-barrier=load-store -mno-abicalls" } */ /* { dg-options "-O2 -mr10k-cache-barrier=load-store -mno-abicalls" } */
/* Test that loads are correctly protected. */ /* Test that loads are correctly protected. */
......
/* { dg-mips-options "-O2 -mr10k-cache-barrier=store" } */ /* { dg-options "-O2 -mr10k-cache-barrier=store" } */
/* Test that indirect calls are protected. */ /* Test that indirect calls are protected. */
......
/* { dg-do compile { target mips16_attribute } } */ /* { dg-options "(-mips16) -O2 -mr10k-cache-barrier=store" } */
/* { dg-mips-options "-O2 -mr10k-cache-barrier=store" } */
/* { dg-add-options mips16_attribute } */
/* Test that indirect calls are protected. */ /* Test that indirect calls are protected. */
......
/* { dg-mips-options "-O2 -mr10k-cache-barrier=store -mips2" } */ /* { dg-options "-O2 -mr10k-cache-barrier=store -mips2" } */
/* { dg-error "requires.*cache.*instruction" "" { target *-*-* } 0 } */ /* { dg-error "requires.*cache.*instruction" "" { target *-*-* } 0 } */
/* { dg-mips-options "-O2 -mabi=64 -mr10k-cache-barrier=store" } */ /* { dg-options "-O2 -mabi=64 -mr10k-cache-barrier=store" } */
/* Test that stores to constant cached addresses are protected /* Test that stores to constant cached addresses are protected
by cache barriers. */ by cache barriers. */
......
/* { dg-mips-options "-O2 -mr10k-cache-barrier=store -mno-abicalls" } */ /* { dg-options "-O2 -mr10k-cache-barrier=store -mno-abicalls" } */
/* Test that in-range stores to the frame are not protected by /* Test that in-range stores to the frame are not protected by
cache barriers. */ cache barriers. */
......
/* { dg-mips-options "-O2 -mr10k-cache-barrier=store -mno-abicalls" } */ /* { dg-options "-O2 -mr10k-cache-barrier=store -mno-abicalls" } */
void bar (int *x); void bar (int *x);
......
/* { dg-mips-options "-O2 -mr10k-cache-barrier=store -mno-abicalls -mabi=64" } */ /* { dg-options "-O2 -mr10k-cache-barrier=store -mno-abicalls -mabi=64" } */
/* Test that in-range stores to static objects do not get an unnecessary /* Test that in-range stores to static objects do not get an unnecessary
cache barrier. */ cache barrier. */
......
/* { dg-mips-options "-O2 -mr10k-cache-barrier=store -mabi=64" } */ /* { dg-options "-O2 -mr10k-cache-barrier=store -mabi=64" } */
int x[4]; int x[4];
void bar (void); void bar (void);
......
/* { dg-mips-options "-O2 -mr10k-cache-barrier=store -mno-abicalls" } */ /* { dg-options "-O2 -mr10k-cache-barrier=store -mno-abicalls" } */
void bar1 (void); void bar1 (void);
void bar2 (void); void bar2 (void);
......
/* { dg-mips-options "-O2 -mr10k-cache-barrier=store -G8" } */ /* { dg-options "-O2 -mr10k-cache-barrier=store -G8" } */
/* Test that in-range stores to components of static objects /* Test that in-range stores to components of static objects
do not get an unnecessary cache barrier. */ do not get an unnecessary cache barrier. */
......
/* { dg-mips-options "-O2 -mr10k-cache-barrier=store -G8" } */ /* { dg-options "-O2 -mr10k-cache-barrier=store -G8" } */
/* Test that out-of-range stores to components of static objects /* Test that out-of-range stores to components of static objects
are protected by a cache barrier. */ are protected by a cache barrier. */
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-march=r3900" } */ /* { dg-options "-march=r3900" } */
/* { dg-final { scan-assembler "\tmult\t\[^\n\]*,\[^\n\]*," } } */ /* { dg-final { scan-assembler "\tmult\t\[^\n\]*,\[^\n\]*," } } */
NOMIPS16 int NOMIPS16 int
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O2 -ffast-math -mips4 -mhard-float -mgp64" } */ /* { dg-options "-O2 -ffast-math isa=4 -mhard-float -mgp64" } */
/* { dg-final { scan-assembler "rsqrt.d" } } */ /* { dg-final { scan-assembler "rsqrt.d" } } */
/* { dg-final { scan-assembler "rsqrt.s" } } */ /* { dg-final { scan-assembler "rsqrt.s" } } */
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O2 -ffast-math -mips4 -mhard-float -mgp64" } */ /* { dg-options "-O2 -ffast-math isa=4 -mhard-float -mgp64" } */
/* { dg-final { scan-assembler "rsqrt.d" } } */ /* { dg-final { scan-assembler "rsqrt.d" } } */
/* { dg-final { scan-assembler "rsqrt.s" } } */ /* { dg-final { scan-assembler "rsqrt.s" } } */
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O2 -mips4 -mhard-float" } */ /* { dg-options "-O2 isa=4 -mhard-float" } */
/* { dg-final { scan-assembler-not "rsqrt.d" } } */ /* { dg-final { scan-assembler-not "rsqrt.d" } } */
/* { dg-final { scan-assembler-not "rsqrt.s" } } */ /* { dg-final { scan-assembler-not "rsqrt.s" } } */
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O2 -ffast-math -mips64 -mhard-float -mgp32" } */ /* { dg-options "-O2 -ffast-math -mips64 -mhard-float -mgp32" } */
/* { dg-final { scan-assembler-not "\trsqrt.d\t" } } */ /* { dg-final { scan-assembler-not "\trsqrt.d\t" } } */
/* { dg-final { scan-assembler-times "\trsqrt.s\t" 2 } } */ /* { dg-final { scan-assembler-times "\trsqrt.s\t" 2 } } */
......
/* Check that we can use the save instruction to save varargs. */ /* Check that we can use the save instruction to save varargs. */
/* { dg-do compile { target mips16_attribute } } */ /* { dg-options "(-mips16) isa_rev>=1 -mabi=32 -O2" } */
/* { dg-mips-options "-mips32r2 -mabi=32 -O2" } */
/* { dg-add-options mips16_attribute } */
#include <stdarg.h> #include <stdarg.h>
......
/* Check that we can use the save instruction to save spilled arguments. */ /* Check that we can use the save instruction to save spilled arguments. */
/* { dg-do compile { target mips16_attribute } } */ /* { dg-options "(-mips16) isa_rev>=1 -mabi=32 -O2" } */
/* { dg-mips-options "-mips32r2 -mabi=32 -O2" } */
/* { dg-add-options mips16_attribute } */
MIPS16 void MIPS16 void
foo (int *a, int b, int c) foo (int *a, int b, int c)
......
/* Check that we can use the save instruction to save spilled arguments /* Check that we can use the save instruction to save spilled arguments
when the argument save area is out of range of a direct load or store. */ when the argument save area is out of range of a direct load or store. */
/* { dg-do compile { target mips16_attribute } } */ /* { dg-options "(-mips16) isa_rev>=1 -mabi=32 -O2" } */
/* { dg-mips-options "-mips32r2 -mabi=32 -O2" } */
/* { dg-add-options mips16_attribute } */
void bar (int *); void bar (int *);
......
/* Check that we can use the save instruction to save $16, $17 and $31. */ /* Check that we can use the save instruction to save $16, $17 and $31. */
/* { dg-do compile { target mips16_attribute } } */ /* { dg-options "(-mips16) isa_rev>=1 -mabi=32 -O2" } */
/* { dg-mips-options "-mips32r2 -mabi=32 -O2" } */
/* { dg-add-options mips16_attribute } */
void bar (void); void bar (void);
......
/* Check that we don't try to save the same register twice. */ /* Check that we don't try to save the same register twice. */
/* { dg-do assemble { target mips16_attribute } } */ /* { dg-options "(-mips16) isa_rev>=1 -mgp32 -O2" } */
/* { dg-mips-options "-mips32r2 -mgp32 -O2" } */
/* { dg-add-options mips16_attribute } */
int bar (int, int, int, int); int bar (int, int, int, int);
void frob (void); void frob (void);
......
/* Test SB-1 v2sf extensions. */ /* Test SB-1 v2sf extensions. */
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-march=sb1 -O2 -mpaired-single -mgp64 -ffast-math" } */ /* { dg-options "-march=sb1 -O2 -mpaired-single -mgp64 -ffast-math" } */
/* { dg-final { scan-assembler "div.ps" } } */ /* { dg-final { scan-assembler "div.ps" } } */
/* { dg-final { scan-assembler "recip.ps" } } */ /* { dg-final { scan-assembler "recip.ps" } } */
/* { dg-final { scan-assembler "sqrt.ps" } } */ /* { dg-final { scan-assembler "sqrt.ps" } } */
......
/* { dg-do compile { target mips16_attribute } } */ /* { dg-options "(-mips16) -O isa_rev>=1" } */
/* { dg-mips-options "-O -mips32" } */
/* { dg-add-options mips16_attribute } */
/* { dg-final { scan-assembler-times {slt \$2,\$5,\$4} 1 } } */ /* { dg-final { scan-assembler-times {slt \$2,\$5,\$4} 1 } } */
/* { dg-final { scan-assembler-times {sltu \$2,\$5,\$4} 1 } } */ /* { dg-final { scan-assembler-times {sltu \$2,\$5,\$4} 1 } } */
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O -mgp64" } */ /* { dg-options "-O -mgp64" } */
/* { dg-final { scan-assembler-not "and\t\|andi\t\|ext\t\|sll\t\|srl\t" } } */ /* { dg-final { scan-assembler-not "and\t\|andi\t\|ext\t\|sll\t\|srl\t" } } */
/* { dg-final { scan-assembler-times "slt\t\|slti?u\t" 12 } } */ /* { dg-final { scan-assembler-times "slt\t\|slti?u\t" 12 } } */
......
/* { dg-do compile { target mips16_attribute } } */ /* { dg-options "(-mips16) -O -mabi=o64" } */
/* { dg-mips-options "-O -mabi=o64" } */
/* { dg-add-options mips16_attribute } */
/* { dg-final { scan-assembler-not "and\t\|andi\t\|ext\t\|sll\t\|srl\t" } } */ /* { dg-final { scan-assembler-not "and\t\|andi\t\|ext\t\|sll\t\|srl\t" } } */
/* { dg-final { scan-assembler-times "slt\t\|slti?u\t" 8 } } */ /* { dg-final { scan-assembler-times "slt\t\|slti?u\t" 8 } } */
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O -mabi=o64" } */ /* { dg-options "-O -mabi=o64" } */
/* { dg-final { scan-assembler "slt\t" } } */ /* { dg-final { scan-assembler "slt\t" } } */
/* { dg-final { scan-assembler "sltu\t\|xor\t\|xori\t" } } */ /* { dg-final { scan-assembler "sltu\t\|xor\t\|xori\t" } } */
......
/* { dg-mips-options "-G4 -mexplicit-relocs" } */ /* { dg-options "-G4 -mexplicit-relocs" } */
/* { dg-final { scan-assembler "%gp_?rel\\(l4a\\)" } } */ /* { dg-final { scan-assembler "%gp_?rel\\(l4a\\)" } } */
/* { dg-final { scan-assembler "%gp_?rel\\(l4b\\)" } } */ /* { dg-final { scan-assembler "%gp_?rel\\(l4b\\)" } } */
......
/* { dg-mips-options "-G4 -mexplicit-relocs -mno-local-sdata" } */ /* { dg-options "-G4 -mexplicit-relocs -mno-local-sdata" } */
/* { dg-final { scan-assembler-not "%gp_?rel\\(l4a\\)" } } */ /* { dg-final { scan-assembler-not "%gp_?rel\\(l4a\\)" } } */
/* { dg-final { scan-assembler-not "%gp_?rel\\(l4b\\)" } } */ /* { dg-final { scan-assembler-not "%gp_?rel\\(l4b\\)" } } */
......
/* { dg-mips-options "-G4 -mexplicit-relocs -mno-extern-sdata" } */ /* { dg-options "-G4 -mexplicit-relocs -mno-extern-sdata" } */
/* { dg-final { scan-assembler "%gp_?rel\\(l4a\\)" } } */ /* { dg-final { scan-assembler "%gp_?rel\\(l4a\\)" } } */
/* { dg-final { scan-assembler "%gp_?rel\\(l4b\\)" } } */ /* { dg-final { scan-assembler "%gp_?rel\\(l4b\\)" } } */
......
/* { dg-mips-options "-G4 -mexplicit-relocs -mno-gpopt" } */ /* { dg-options "-G4 -mexplicit-relocs -mno-gpopt" } */
/* { dg-final { scan-assembler-not "%gp_?rel" } } */ /* { dg-final { scan-assembler-not "%gp_?rel" } } */
/* { dg-final { scan-assembler-not "\\\$gp" } } */ /* { dg-final { scan-assembler-not "\\\$gp" } } */
......
/* { dg-do compile } */ /* { dg-do compile } */
/* -mlong32 added because of PR target/38599. */ /* -mlong32 added because of PR target/38599. */
/* { dg-mips-options "-O -msmartmips -mlong32" } */ /* { dg-options "-O -msmartmips -mlong32" } */
NOMIPS16 int scaled_indexed_word_load (int a[], int b) NOMIPS16 int scaled_indexed_word_load (int a[], int b)
{ {
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O -msmartmips" } */ /* { dg-options "-O -msmartmips" } */
NOMIPS16 int rotate_left (unsigned a, unsigned s) NOMIPS16 int rotate_left (unsigned a, unsigned s)
{ {
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O -msmartmips" } */ /* { dg-options "-O -msmartmips" } */
NOMIPS16 int rotate_right (unsigned a, unsigned s) NOMIPS16 int rotate_right (unsigned a, unsigned s)
{ {
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O -msmartmips" } */ /* { dg-options "-O -msmartmips" } */
#define S 13 #define S 13
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O -msmartmips" } */ /* { dg-options "-O -msmartmips" } */
#define S 13 #define S 13
......
/* { dg-mips-options "-mgp64" } */ /* { dg-options "-mgp64" } */
typedef int int128_t __attribute__((mode(TI))); typedef int int128_t __attribute__((mode(TI)));
typedef unsigned int uint128_t __attribute__((mode(TI))); typedef unsigned int uint128_t __attribute__((mode(TI)));
......
/* { dg-do run { target mips64 } } */ /* { dg-do run } */
/* { dg-options "-mgp64" } */
typedef int int128_t __attribute__((mode(TI))); typedef int int128_t __attribute__((mode(TI)));
typedef unsigned int uint128_t __attribute__((mode(TI))); typedef unsigned int uint128_t __attribute__((mode(TI)));
......
/* { dg-mips-options "-O -mgp64" } */ /* { dg-options "-O -mgp64" } */
#define TEST(ID, TYPE, SHIFT) \ #define TEST(ID, TYPE, SHIFT) \
int __attribute__((nomips16)) \ int __attribute__((nomips16)) \
......
/* { dg-mips-options "-O -mgp64" } */ /* { dg-options "-O -mgp64" } */
#define TEST(ID, TYPE, SHIFT) \ #define TEST(ID, TYPE, SHIFT) \
int NOMIPS16 \ int NOMIPS16 \
......
/* Make sure that mul/addu is preferred over mtlo/macc and that mul/subu /* Make sure that mul/addu is preferred over mtlo/macc and that mul/subu
is preferred over mtlo/msac. */ is preferred over mtlo/msac. */
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O2 -march=vr5400" } */ /* { dg-options "-O2 -march=vr5400" } */
NOMIPS16 int f1 (int a, int b, int c) { return a + b * c; } NOMIPS16 int f1 (int a, int b, int c) { return a + b * c; }
NOMIPS16 int f2 (int a, int b, int c) { return a - b * c; } NOMIPS16 int f2 (int a, int b, int c) { return a - b * c; }
/* { dg-final { scan-assembler "\tmul\t.*\tmul\t" } } */ /* { dg-final { scan-assembler "\tmul\t.*\tmul\t" } } */
/* Make sure that mul/addu is preferred over mtlo/macc and that mul/subu /* Make sure that mul/addu is preferred over mtlo/macc and that mul/subu
is preferred over mtlo/msac. */ is preferred over mtlo/msac. */
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-mips-options "-O2 -march=vr5500" } */ /* { dg-options "-O2 -march=vr5500" } */
NOMIPS16 int f1 (int a, int b, int c) { return a + b * c; } NOMIPS16 int f1 (int a, int b, int c) { return a + b * c; }
NOMIPS16 int f2 (int a, int b, int c) { return a - b * c; } NOMIPS16 int f2 (int a, int b, int c) { return a - b * c; }
/* { dg-final { scan-assembler "\tmul\t.*\tmul\t" } } */ /* { dg-final { scan-assembler "\tmul\t.*\tmul\t" } } */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment