[committed] mips16 attribute tweaks

Richard Sandiford rsandifo@nildram.co.uk
Sun Sep 23 10:57:00 GMT 2007


If a gcc.target/mips mips test requires a specific -march or non-mips16
-mips option, mips.exp skips the test for -mips16.  That's no longer
necessary: to get more test coverage, we should add "nomips16" attributes
to functions that must be non-MIPS16 and enable the test for -mips16 too.
The patch below does this.  I tried to be selective and only add nomips16
attributes to functions that really need them, such as when the test scans
the assembler output, or when the function in question uses a MIPS
built-in operation.  In particular, things like:

    /* Init from float */
    v2sf init (float a, float b)
    {
      return (v2sf) {a, b};
    }
    ...
    /* Add */ 
    v2sf add (v2sf a, v2sf b)
    {
      return a + b;
    }
    ...
    short _Fract non_sat_test1 (short _Fract a, short _Fract b)
    {
      return a + b;
    }

ought to work fine in MIPS16 mode too.

This of course showed up a few problems:

  - override_options rejects -mpaired-single -mhard-float -mips16
    because the code still uses TARGET_HARD_FLOAT instead of
    TARGET_HARD_FLOAT_ABI.  The patch fixes this and adds
    TARGET_HARD_FLOAT to all the TARGET_PAIRED_SINGLE_FLOAT
    instruction patterns; this brings the implementation in
    line with the TARGET_DOUBLE_FLOAT patterns and leaves a bare
    TARGET_PAIRED_SINGLE_FLOAT to test whether V2SF should be supported
    and whether the built-in functions should be registered.

  - The DSP built-in functions are not registered for -mips16.
    The patch fixes this by removing:

      /* Silently disable DSP extensions.  */
      target_flags &= ~MASK_DSP;
      target_flags &= ~MASK_DSPR2;

    and introducing ISA_HAS_DSP and ISA_HAS_DSPR2 instructions instead.
    (This is in line with things like ISA_HAS_LWXS, etc.)  As with
    TARGET_PAIRED_SINGLE_FLOAT, TARGET_DSP controls whether the DSP
    modes should be supported and wehther the built-in functions should
    be registered.

Allowing -mpaired-single -mhard-float -mips16 means that the vectorisation
tests must also check that the whole file is compiled nomips16.  I've added
a new check_effective_target_nomips16 procedure for that and updated the
vect.exp and fortran-torture.exp tests accordingly.

Tested on mipsisa64-elfoabi and applied.

Richard


gcc/
	* config/mips/mips.h (ISA_HAS_DSP, ISA_HAS_DSPR2): New macros.
	* config/mips/mips.c (mips_set_mips16_mode): Don't clear the DSP
	flags for MIPS16.
	(override_options): Check TARGET_HARD_FLOAT_ABI instead of
	TARGET_HARD_FLOAT when testing whether -mpaired-single is
	supported.
	(mips_conditional_register_usage): Check ISA_HAS_DSP instead of
	TARGET_DSP.
	* config/mips/constraints.md (ka): Check ISA_HAS_DSPR2 instead of
	TARGET_DSPR2.
	* config/mips/mips.md (ANYF): Require TARGET_HARD_FLOAT for V2SF.
	(mulv2sf3, movv2sf, movv2sf_hardfloat_64bit): Require
	TARGET_HARD_FLOAT.
	(<u>mulsidi3_32bit_internal, <u>msubsidi4, <u>maddsidi4): Check
	ISA_HAS_DSPR2 instead of TARGET_HAS_DSPR2.
	* config/mips/mips-dsp.md: Use ISA_HAS_DSP instead of TARGET_HAS_DSP
	throughout.
	* config/mips/mips-dspr2.md: Likewise ISA_HAS_DSPR2 and
	TARGET_HAS_DSPR2.
	* config/mips/mips-fixed.md: Use ISA_HAS_DSP and ISA_HAS_DSPR2
	instead of TARGET_HAS_DSP and TARGET_HAS_DSPR2.
	* config/mips/mips-ps-3d.md: Add TARGET_HARD_FLOAT to V2SF patterns.

gcc/testsuite/
	* lib/target-supports.exp (check_effective_target_nomips16): New
	procedure.
	* lib/fortran-torture.exp: Check nomips16 as well as mpaired_single
	for mipsisa64*-*-*.
	* gcc.dg/vect/vect.exp: Likewise.
	* g++.dg/vect/vect.exp: Likewise.
	* gcc.target/mips/mips.exp (setup_mips_tests): Don't set mips_mips16.
	(dg-mips-options): Don't skip -march* and -mips* tests for -mips16.
	* gcc.target/mips/branch-cost-1.c (foo): Add NOMIPS16.
	* gcc.target/mips/branch-cost-2.c (foo): Likewise.
	* gcc.target/mips/clear-cache-1.c (f): Likewise.
	* gcc.target/mips/dpaq_sa_l_w.c (f1, f2, f3): Likewise.
	* gcc.target/mips/dpsq_sa_l_w.c (f1, f2, f3): Likewise.
	* gcc.target/mips/fix-vr4130-1.c (foo): Likewise.
	* gcc.target/mips/fix-vr4130-2.c (foo): Likewise.
	* gcc.target/mips/fix-vr4130-3.c (foo): Likewise.
	* gcc.target/mips/fix-vr4130-4.c (foo): Likewise.
	* gcc.target/mips/fixed-scalar-type.c (test1, test2, test3, test4)
	(test5, test6, test7, test8, test9, test10, test11, test12, test13)
	(test14, test15, test16, test17, test18): Likewise.
	* gcc.target/mips/fixed-vector-type.c (test1, test2, test3, test4)
	(test5, test6, test7, test8, test9, test10, test11, test12, test13)
	(test14, test15, test16, test17, test18, test19, test20, test21)
	(test22): Likewise.
	* gcc.target/mips/madd-1.c (f1, f2, f3): Likewise.
	* gcc.target/mips/madd-2.c (f1, f2, f3): Likewise.
	* gcc.target/mips/madd-4.c (f1, f2, f3): Likewise.
	* gcc.target/mips/maddu-1.c (f1, f2, f3): Likewise.
	* gcc.target/mips/maddu-2.c (f1, f2, f3): Likewise.
	* gcc.target/mips/maddu-4.c (f1, f2, f3): Likewise.
	* gcc.target/mips/mips-3d-1.c (main): Likewise.
	* gcc.target/mips/mips-3d-2.c (main, test0, test1, test2, test3)
	(test4, test5, test6, test7, test8, test9, test10, test11, test12)
	(test13, test14, test15, test16, test17, test18, test19, test20)
	(test21, test22, test23, test24, test25, test26, test27, test28)
	(test29, test30, test31): Likewise.
	* gcc.target/mips/mips-3d-3.c (main, test0, test1, test2, test3)
	(test4, test5, test6, test7, test8, test9, test10, test11, test12)
	(test13, test14, test15, test16, test17, test18, test19, test20)
	(test21, test22, test23, test24, test25, test26, test27, test28)
	(test29, test30, test31, test32, test33, test34, test35, test36)
	(test37, test38, test39, test40, test41, test42, test43, test44)
	(test45, test46, test47, test48, test49, test50, test51, test52)
	(test53, test54, test55, test56, test57, test58, test59, test60)
	(test61, test62, test63): Likewise.
	* gcc.target/mips/mips-3d-4.c (main, test0, test1, test2, test3)
	(test4, test5, test6, test7, test8, test9, test10, test11, test12)
	(test13, test14, test15, test16, test17, test18, test19, test20)
	(test21, test22, test23, test24, test25, test26, test27, test28)
	(test29, test30, test31): Likewise.
	* gcc.target/mips/mips-3d-5.c (main, test0, test1, test2, test3)
	(test4, test5, test6, test7, test8, test9, test10, test11, test12)
	(test13, test14, test15, test16, test17, test18, test19, test20)
	(test21, test22, test23, test24, test25, test26, test27, test28)
	(test29, test30, test31): Likewise.
	* gcc.target/mips/mips-3d-6.c (main, test0, test1, test2, test3)
	(test4, test5, test6, test7, test8, test9, test10, test11, test12)
	(test13, test14, test15): Likewise.
	* gcc.target/mips/mips-3d-7.c (main, test0, test1, test2, test3)
	(test4, test5, test6, test7, test8, test9, test10, test11, test12)
	(test13, test14, test15): Likewise.
	* gcc.target/mips/mips-3d-8.c (main, test0, test1, test2, test3)
	(test4, test5, test6, test7, test8, test9, test10, test11, test12)
	(test13, test14, test15, test16, test17, test18, test19, test20)
	(test21, test22, test23, test24, test25, test26, test27, test28)
	(test29, test30, test31): Likewise.
	* gcc.target/mips/mips-3d-9.c (matrix_multiply2, matrix_multiply3)
	(matrix_multiply4: Likewise.
	* gcc.target/mips/mips-ps-1.c (main): Likewise.
	* gcc.target/mips/mips-ps-2.c (main): Likewise.
	* gcc.target/mips/mips-ps-3.c (main): Likewise.
	* gcc.target/mips/mips-ps-4.c (main, test0, test1, test2, test3)
	(test4, test5, test6, test7, test8, test9, test10, test11, test12)
	(test13, test14, test15, test16, test17, test18, test19, test20)
	(test21, test22, test23, test24, test25, test26, test27, test28)
	(test29, test30, test31): Likewise.
	* gcc.target/mips/mips-ps-5.c (main, test0, test1, test2, test3)
	(test4, test5, test6, test7, test8, test9, test10, test11, test12)
	(test13, test14, test15, test16, test17, test18, test19, test20)
	(test21, test22, test23, test24, test25, test26, test27, test28)
	(test29, test30, test31): Likewise.
	* gcc.target/mips/mips-ps-5.c (main): Likewise.
	* gcc.target/mips/mips-ps-6.c (main): Likewise.
	* gcc.target/mips/mips-ps-type.c (init, move, load, store, add, sub)
	(neg, mul, madd, msub, nmadd, nmsub, cond_move1, cond_move2): Likewise.
	* gcc.target/mips/mips32-dsp-type.c (add_v2hi,add_v4qi, sub_v2hi)
	(sub_v4qi): Likewise.
	* gcc.target/mips/mips32-dsp.c (test_MIPS_DSP, add_v2q15, add_v4i8)
	(sub_v2q15, sub_v4i8, test_MIPS_DSP): Likewise.
	* gcc.target/mips/movcc-1.c (sub1, sub2): Likewise.
	* gcc.target/mips/movcc-2.c (sub4, sub5): Likewise.
	* gcc.target/mips/movcc-3.c (sub3, sub6, sub7, sub8, sub9, suba)
	(subb, subc): Likewise.
	* gcc.target/mips/msub-1.c (f1, f2): Likewise.
	* gcc.target/mips/msub-2.c (f1, f2): Likewise.
	* gcc.target/mips/msub-4.c (f1, f2): Likewise.
	* gcc.target/mips/msubu-1.c (f1, f2): Likewise.
	* gcc.target/mips/msubu-2.c (f1, f2): Likewise.
	* gcc.target/mips/msubu-4.c (f1, f2): Likewise.
	* gcc.target/mips/nmadd-1.c (sub1, sub2, sub3, sub4): Likewise.
	* gcc.target/mips/nmadd-2.c (sub1, sub2, sub3, sub4): Likewise.
	* gcc.target/mips/rsqrt-1.c (foo, bar): Likewise.
	* gcc.target/mips/rsqrt-2.c (foo, bar): Likewise.
	* gcc.target/mips/sb1-1.c (divide, recip, squareroot, rsqrt): Likewise.
	* gcc.target/mips/vr-mult-1.c (f1, f2): Likewise.
	* gcc.target/mips/vr-mult-2.c (f1, f2): Likewise.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff.gz
Type: application/octet-stream
Size: 18041 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20070923/8a74bdd2/attachment.obj>


More information about the Gcc-patches mailing list