Commit 82bb2eae by Oleg Endo

sh.exp (check_effective_target_sh4a, [...]): New effective target checks.

gcc/testsuite/
	* gcc.target/sh/sh.exp (check_effective_target_sh4a,
	check_effective_target_big_endian, check_effective_target_little_endian,
	check_effective_target_any_fpu, check_effective_target_double_fpu,
	check_effective_target_use_single_only_fpu,
	check_effective_target_default_single_fpu,
	check_effective_target_no_fpu, check_effective_target_has_xf_regs,
	check_effective_target_has_fsca, check_effective_target_has_fsrra,
	check_effective_target_has_fpchg, check_effective_target_has_dyn_shift,
	check_effective_target_fmovd_enabled,
	check_effective_target_has_privileged, check_effective_target_has_pref,
	check_effective_target_banked_r0r7_isr,
	check_effective_target_stack_save_isr): New effective target checks.
	* gcc.target/sh/pr51244-16.c: Merge into pr51244-15.c.
	* gcc.target/sh/pr51244-20-sh2a.c: Merge into pr51244-20.c.
	* gcc.target/sh/pr51244-3.c: Merge into pr51244-2.c
	* gcc.target/sh/pr54089-5.c: Merge into pr54089-4.c.
	* gcc.target/sh/20080410-1.c: Use new effective target checks.
	* gcc.target/sh/attr-isr-nosave_low_regs.c: Likewise.
	* gcc.target/sh/attr-isr.c: Likewise.
	* gcc.target/sh/fpul-usage-1.c: Likewise.
	* gcc.target/sh/hiconst.c: Likewise.
	* gcc.target/sh/mfmovd.c: Likewise.
	* gcc.target/sh/pr21255-3.c: Likewise.
	* gcc.target/sh/pr33135-1.c: Likewise.
	* gcc.target/sh/pr33135-2.c: Likewise.
	* gcc.target/sh/pr33135-3.c: Likewise.
	* gcc.target/sh/pr33135-4.c: Likewise.
	* gcc.target/sh/pr39423-2.c: Likewise.
	* gcc.target/sh/pr49880-4.c: Likewise.
	* gcc.target/sh/pr49880-5.c: Likewise.
	* gcc.target/sh/pr50749-sf-postinc-1.c: Likewise.
	* gcc.target/sh/pr50749-sf-postinc-2.c: Likewise.
	* gcc.target/sh/pr50749-sf-postinc-3.c: Likewise.
	* gcc.target/sh/pr50749-sf-postinc-4.c: Likewise.
	* gcc.target/sh/pr50749-sf-predec-1.c: Likewise.
	* gcc.target/sh/pr50749-sf-predec-2.c: Likewise.
	* gcc.target/sh/pr50749-sf-predec-3.c: Likewise.
	* gcc.target/sh/pr50749-sf-predec-4.c: Likewise.
	* gcc.target/sh/pr50751-2.c: Likewise.
	* gcc.target/sh/pr50751-3.c: Likewise.
	* gcc.target/sh/pr50751-5.c: Likewise.
	* gcc.target/sh/pr50751-6.c: Likewise.
	* gcc.target/sh/pr50751-8.c: Likewise.
	* gcc.target/sh/pr51244-15.c: Likewise.
	* gcc.target/sh/pr51244-2.c: Likewise.
	* gcc.target/sh/pr51244-20.c: Likewise.
	* gcc.target/sh/pr51244-6.c: Likewise.
	* gcc.target/sh/pr52483-4.c: Likewise.
	* gcc.target/sh/pr53511-1.c: Likewise.
	* gcc.target/sh/pr53512-1.c: Likewise.
	* gcc.target/sh/pr53512-2.c: Likewise.
	* gcc.target/sh/pr53512-3.c: Likewise.
	* gcc.target/sh/pr53512-4.c: Likewise.
	* gcc.target/sh/pr53513-1.c: Likewise.
	* gcc.target/sh/pr54089-2.c: Likewise.
	* gcc.target/sh/pr54089-3.c: Likewise.
	* gcc.target/sh/pr54089-4.c: Likewise.
	* gcc.target/sh/pr54602-2.c: Likewise.
	* gcc.target/sh/pr54602-3.c: Likewise.
	* gcc.target/sh/pr54602-4.c: Likewise.
	* gcc.target/sh/pr54680.c: Likewise.
	* gcc.target/sh/pr55303-1.c: Likewise.
	* gcc.target/sh/pr55303-2.c: Likewise.
	* gcc.target/sh/pr55303-3.c: Likewise.
	* gcc.target/sh/pr56547-1.c: Likewise.
	* gcc.target/sh/pr56547-2.c: Likewise.
	* gcc.target/sh/pr61195.c: Likewise.
	* gcc.target/sh/pr61996.c: Likewise.
	* gcc.target/sh/pr6526.c: Likewise.
	* gcc.target/sh/pragma-isr-nosave_low_regs.c: Likewise.
	* gcc.target/sh/pragma-isr-trapa2.c: Likewise.
	* gcc.target/sh/prefetch.c: Likewise.
	* gcc.target/sh/rte-delay-slot.c: Likewise.
	* gcc.target/sh/sh2a-band.c: Likewise.
	* gcc.target/sh/sh2a-bclr.c: Likewise.
	* gcc.target/sh/sh2a-bclrmem.c: Likewise.
	* gcc.target/sh/sh2a-bld.c: Likewise.
	* gcc.target/sh/sh2a-bor.c: Likewise.
	* gcc.target/sh/sh2a-bset.c: Likewise.
	* gcc.target/sh/sh2a-bsetmem.c: Likewise.
	* gcc.target/sh/sh2a-bxor.c: Likewise.
	* gcc.target/sh/sh2a-jsrn.c: Likewise.
	* gcc.target/sh/sh2a-movi20s.c: Likewise.
	* gcc.target/sh/sh2a-movrt.c: Likewise.
	* gcc.target/sh/sh2a-resbank.c: Likewise.
	* gcc.target/sh/sh2a-rtsn.c: Likewise.
	* gcc.target/sh/sh2a-tbr-jump.c: Likewise.
	* gcc.target/sh/sh4a-bitmovua.c: Likewise.
	* gcc.target/sh/sh4a-cosf.c: Likewise.
	* gcc.target/sh/sh4a-fsrra.c: Likewise.
	* gcc.target/sh/sh4a-memmovua.c: Likewise.
	* gcc.target/sh/sh4a-sincosf.c: Likewise.
	* gcc.target/sh/sh4a-sinf.c: Likewise.

From-SVN: r227944
parent 7c3e7056
2015-09-20 Oleg Endo <olegendo@gcc.gnu.org>
* gcc.target/sh/sh.exp (check_effective_target_sh4a,
check_effective_target_big_endian, check_effective_target_little_endian,
check_effective_target_any_fpu, check_effective_target_double_fpu,
check_effective_target_use_single_only_fpu,
check_effective_target_default_single_fpu,
check_effective_target_no_fpu, check_effective_target_has_xf_regs,
check_effective_target_has_fsca, check_effective_target_has_fsrra,
check_effective_target_has_fpchg, check_effective_target_has_dyn_shift,
check_effective_target_fmovd_enabled,
check_effective_target_has_privileged, check_effective_target_has_pref,
check_effective_target_banked_r0r7_isr,
check_effective_target_stack_save_isr): New effective target checks.
* gcc.target/sh/pr51244-16.c: Merge into pr51244-15.c.
* gcc.target/sh/pr51244-20-sh2a.c: Merge into pr51244-20.c.
* gcc.target/sh/pr51244-3.c: Merge into pr51244-2.c
* gcc.target/sh/pr54089-5.c: Merge into pr54089-4.c.
* gcc.target/sh/20080410-1.c: Use new effective target checks.
* gcc.target/sh/attr-isr-nosave_low_regs.c: Likewise.
* gcc.target/sh/attr-isr.c: Likewise.
* gcc.target/sh/fpul-usage-1.c: Likewise.
* gcc.target/sh/hiconst.c: Likewise.
* gcc.target/sh/mfmovd.c: Likewise.
* gcc.target/sh/pr21255-3.c: Likewise.
* gcc.target/sh/pr33135-1.c: Likewise.
* gcc.target/sh/pr33135-2.c: Likewise.
* gcc.target/sh/pr33135-3.c: Likewise.
* gcc.target/sh/pr33135-4.c: Likewise.
* gcc.target/sh/pr39423-2.c: Likewise.
* gcc.target/sh/pr49880-4.c: Likewise.
* gcc.target/sh/pr49880-5.c: Likewise.
* gcc.target/sh/pr50749-sf-postinc-1.c: Likewise.
* gcc.target/sh/pr50749-sf-postinc-2.c: Likewise.
* gcc.target/sh/pr50749-sf-postinc-3.c: Likewise.
* gcc.target/sh/pr50749-sf-postinc-4.c: Likewise.
* gcc.target/sh/pr50749-sf-predec-1.c: Likewise.
* gcc.target/sh/pr50749-sf-predec-2.c: Likewise.
* gcc.target/sh/pr50749-sf-predec-3.c: Likewise.
* gcc.target/sh/pr50749-sf-predec-4.c: Likewise.
* gcc.target/sh/pr50751-2.c: Likewise.
* gcc.target/sh/pr50751-3.c: Likewise.
* gcc.target/sh/pr50751-5.c: Likewise.
* gcc.target/sh/pr50751-6.c: Likewise.
* gcc.target/sh/pr50751-8.c: Likewise.
* gcc.target/sh/pr51244-15.c: Likewise.
* gcc.target/sh/pr51244-2.c: Likewise.
* gcc.target/sh/pr51244-20.c: Likewise.
* gcc.target/sh/pr51244-6.c: Likewise.
* gcc.target/sh/pr52483-4.c: Likewise.
* gcc.target/sh/pr53511-1.c: Likewise.
* gcc.target/sh/pr53512-1.c: Likewise.
* gcc.target/sh/pr53512-2.c: Likewise.
* gcc.target/sh/pr53512-3.c: Likewise.
* gcc.target/sh/pr53512-4.c: Likewise.
* gcc.target/sh/pr53513-1.c: Likewise.
* gcc.target/sh/pr54089-2.c: Likewise.
* gcc.target/sh/pr54089-3.c: Likewise.
* gcc.target/sh/pr54089-4.c: Likewise.
* gcc.target/sh/pr54602-2.c: Likewise.
* gcc.target/sh/pr54602-3.c: Likewise.
* gcc.target/sh/pr54602-4.c: Likewise.
* gcc.target/sh/pr54680.c: Likewise.
* gcc.target/sh/pr55303-1.c: Likewise.
* gcc.target/sh/pr55303-2.c: Likewise.
* gcc.target/sh/pr55303-3.c: Likewise.
* gcc.target/sh/pr56547-1.c: Likewise.
* gcc.target/sh/pr56547-2.c: Likewise.
* gcc.target/sh/pr61195.c: Likewise.
* gcc.target/sh/pr61996.c: Likewise.
* gcc.target/sh/pr6526.c: Likewise.
* gcc.target/sh/pragma-isr-nosave_low_regs.c: Likewise.
* gcc.target/sh/pragma-isr-trapa2.c: Likewise.
* gcc.target/sh/prefetch.c: Likewise.
* gcc.target/sh/rte-delay-slot.c: Likewise.
* gcc.target/sh/sh2a-band.c: Likewise.
* gcc.target/sh/sh2a-bclr.c: Likewise.
* gcc.target/sh/sh2a-bclrmem.c: Likewise.
* gcc.target/sh/sh2a-bld.c: Likewise.
* gcc.target/sh/sh2a-bor.c: Likewise.
* gcc.target/sh/sh2a-bset.c: Likewise.
* gcc.target/sh/sh2a-bsetmem.c: Likewise.
* gcc.target/sh/sh2a-bxor.c: Likewise.
* gcc.target/sh/sh2a-jsrn.c: Likewise.
* gcc.target/sh/sh2a-movi20s.c: Likewise.
* gcc.target/sh/sh2a-movrt.c: Likewise.
* gcc.target/sh/sh2a-resbank.c: Likewise.
* gcc.target/sh/sh2a-rtsn.c: Likewise.
* gcc.target/sh/sh2a-tbr-jump.c: Likewise.
* gcc.target/sh/sh4a-bitmovua.c: Likewise.
* gcc.target/sh/sh4a-cosf.c: Likewise.
* gcc.target/sh/sh4a-fsrra.c: Likewise.
* gcc.target/sh/sh4a-memmovua.c: Likewise.
* gcc.target/sh/sh4a-sincosf.c: Likewise.
* gcc.target/sh/sh4a-sinf.c: Likewise.
2015-09-20 Jeff Law <law@redhat.com> 2015-09-20 Jeff Law <law@redhat.com>
PR tree-optimization/47679 PR tree-optimization/47679
* g++.dg/warn/Wuninitialized-6.C: New test. * g++.dg/warn/Wuninitialized-6.C: New test.
2015-09-18 Ville Voutilainen <ville.voutilainen@gmail.com> 2015-09-18 Ville Voutilainen <ville.voutilainen@gmail.com>
......
/* { dg-do compile } */ /* { dg-do compile { target { little_endian } } } */
/* { dg-options "-O0" } */ /* { dg-options "-O0" } */
/* { dg-skip-if "" { "sh*-*-*" } "-mb" "" } */
/* { dg-final { scan-assembler-not "add\tr0,r0" } } */ /* { dg-final { scan-assembler-not "add\tr0,r0" } } */
/* This test checks chain reloads conflicts. If they don't /* This test checks chain reloads conflicts. If they don't
......
...@@ -3,8 +3,7 @@ ...@@ -3,8 +3,7 @@
(On SH3* and SH4* r0..r7 are banked) (On SH3* and SH4* r0..r7 are banked)
Call-saved registers r8..r13 also don't need to be restored. Call-saved registers r8..r13 also don't need to be restored.
To test that we look for register push insns such as 'mov.l r0,@-r15'. */ To test that we look for register push insns such as 'mov.l r0,@-r15'. */
/* { dg-do compile { target { { "sh*-*-*" } && nonpic } } } */ /* { dg-do compile { target { { banked_r0r7_isr } && nonpic } } } */
/* { dg-skip-if "" { "sh*-*-*" } { "-m1*" "-m2*" "-m5*" } { "" } } */
/* { dg-options "-O" } */ /* { dg-options "-O" } */
/* { dg-final { scan-assembler-times "rte" 1 } } */ /* { dg-final { scan-assembler-times "rte" 1 } } */
/* { dg-final { scan-assembler-not "mov.l\tr\[0-9\],@-r15" } } */ /* { dg-final { scan-assembler-not "mov.l\tr\[0-9\],@-r15" } } */
......
/* The call will clobber r0..r7, which will need not be saved/restored, but /* The call will clobber r0..r7, which will need not be saved/restored, but
not the call-saved registers r8..r14. Check this by counting the register not the call-saved registers r8..r14. Check this by counting the register
push insns. */ push insns. */
/* { dg-do compile { target { { { sh-*-* sh[1234ble]*-*-* } && { ! sh2a*-*-* } } && nonpic } } } */ /* { dg-do compile { target { { ! sh2a } && nonpic } } } */
/* { dg-skip-if "" { "sh*-*-*" } { "-m2a*" } { "" } } */
/* { dg-options "-O" } */ /* { dg-options "-O" } */
/* { dg-final { scan-assembler-times "rte" 1} } */ /* { dg-final { scan-assembler-times "rte" 1} } */
/* { dg-final { scan-assembler-times "mov.l\tr\[0-7\],@-r15" 8 } } */ /* { dg-final { scan-assembler-times "mov.l\tr\[0-7\],@-r15" 8 } } */
......
/* Check that the FPUL register is used when reading a float as an int and /* Check that the FPUL register is used when reading a float as an int and
vice versa, as opposed to pushing and popping the values over the stack. */ vice versa, as opposed to pushing and popping the values over the stack. */
/* { dg-do compile } */ /* { dg-do compile { target { any_fpu } } } */
/* { dg-options "-O1" } */ /* { dg-options "-O1" } */
/* { dg-skip-if "" { "sh*-*-*" } { "-m1" "-m2" "-m4al" "*nofpu" "-m4-340*" "-m4-400*" "-m4-500*" "-m5*" } { "" } } */
/* { dg-final { scan-assembler "fpul" } } */ /* { dg-final { scan-assembler "fpul" } } */
/* { dg-final { scan-assembler-not "r15" } } */ /* { dg-final { scan-assembler-not "r15" } } */
......
/* { dg-do compile { target "sh*-*-*" } } */ /* { dg-do compile } */
/* { dg-options "-O1" } */ /* { dg-options "-O1" } */
char a; char a;
......
/* Verify that we generate fmov.d instructions to move doubles when -mfmovd /* Verify that we generate fmov.d instructions to move doubles when -mfmovd
option is enabled. */ option is enabled. */
/* { dg-do compile } */ /* { dg-do compile { target { double_fpu } } } */
/* { dg-require-effective-target hard_float } */
/* { dg-options "-mfmovd" } */ /* { dg-options "-mfmovd" } */
/* { dg-skip-if "" { *-*-* } { "*-single-only" } { "" } } */
/* { dg-final { scan-assembler "fmov.d" } } */ /* { dg-final { scan-assembler "fmov.d" } } */
extern double g; extern double g;
......
/* { dg-do compile } */ /* { dg-do compile { target { double_fpu } } } */
/* { dg-options "-O2 -fomit-frame-pointer" } */ /* { dg-options "-O2 -fomit-frame-pointer" } */
/* { dg-skip-if "" { "sh*-*-*" } { "-m2e" "-m3e" "*single-only" } { "" } } */
/* { dg-final { scan-assembler "mov #?0,r.*; mov #?20,r" } } */ /* { dg-final { scan-assembler "mov #?0,r.*; mov #?20,r" } } */
/* { dg-final { scan-assembler "mov #?1077149696,r.*; mov #?0,r" } } */ /* { dg-final { scan-assembler "mov #?1077149696,r.*; mov #?0,r" } } */
double double
......
/* Check that fcmp/eq and fcmp/gt instructions are generated by default /* Check that fcmp/eq and fcmp/gt instructions are generated by default
(implicit -mieee). */ (implicit -mieee). */
/* { dg-do compile } */ /* { dg-do compile { target { any_fpu } } } */
/* { dg-options "-O1" } */ /* { dg-options "-O1" } */
/* { dg-skip-if "" { "sh*-*-*" } { "-m1" "-m2" "-m3" "-m4al" "*nofpu" "-m4-340*" "-m4-400*" "-m4-500*" "-m5*" } { "" } } */
/* { dg-final { scan-assembler-times "fcmp/eq" 4 } } */ /* { dg-final { scan-assembler-times "fcmp/eq" 4 } } */
/* { dg-final { scan-assembler-times "fcmp/gt" 4 } } */ /* { dg-final { scan-assembler-times "fcmp/gt" 4 } } */
...@@ -29,4 +28,3 @@ test_03 (double a, double b) ...@@ -29,4 +28,3 @@ test_03 (double a, double b)
{ {
return a >= b; return a >= b;
} }
/* Check that only the fcmp/gt instruction is generated when specifying /* Check that only the fcmp/gt instruction is generated when specifying
-ffinite-math-only (implicit -mno-ieee). */ -ffinite-math-only (implicit -mno-ieee). */
/* { dg-do compile } */ /* { dg-do compile { target { any_fpu } } } */
/* { dg-options "-O1 -ffinite-math-only" } */ /* { dg-options "-O1 -ffinite-math-only" } */
/* { dg-skip-if "" { "sh*-*-*" } { "-m1" "-m2" "-m3" "-m4al" "*nofpu" "-m4-340*" "-m4-400*" "-m4-500*" "-m5*" } { "" } } */
/* { dg-final { scan-assembler-not "fcmp/eq" } } */ /* { dg-final { scan-assembler-not "fcmp/eq" } } */
/* { dg-final { scan-assembler-times "fcmp/gt" 4 } } */ /* { dg-final { scan-assembler-times "fcmp/gt" 4 } } */
......
/* Check that fcmp/eq and fcmp/gt instructions are generated when specifying /* Check that fcmp/eq and fcmp/gt instructions are generated when specifying
-ffinite-math-only and -mieee. */ -ffinite-math-only and -mieee. */
/* { dg-do compile } */ /* { dg-do compile { target { any_fpu } } } */
/* { dg-options "-O1 -ffinite-math-only -mieee" } */ /* { dg-options "-O1 -ffinite-math-only -mieee" } */
/* { dg-skip-if "" { "sh*-*-*" } { "-m1" "-m2" "-m3" "-m4al" "*nofpu" "-m4-340*" "-m4-400*" "-m4-500*" "-m5*" } { "" } } */
/* { dg-final { scan-assembler-times "fcmp/eq" 4 } } */ /* { dg-final { scan-assembler-times "fcmp/eq" 4 } } */
/* { dg-final { scan-assembler-times "fcmp/gt" 4 } } */ /* { dg-final { scan-assembler-times "fcmp/gt" 4 } } */
...@@ -29,4 +28,3 @@ test_03 (double a, double b) ...@@ -29,4 +28,3 @@ test_03 (double a, double b)
{ {
return a >= b; return a >= b;
} }
/* Check that only the fcmp/gt instruction is generated when specifying /* Check that only the fcmp/gt instruction is generated when specifying
-fno-finite-math-only and -mno-ieee. */ -fno-finite-math-only and -mno-ieee. */
/* { dg-do compile } */ /* { dg-do compile { target { any_fpu } } } */
/* { dg-options "-O1 -fno-finite-math-only -mno-ieee" } */ /* { dg-options "-O1 -fno-finite-math-only -mno-ieee" } */
/* { dg-skip-if "" { "sh*-*-*" } { "-m1" "-m2" "-m3" "-m4al" "*nofpu" "-m4-340*" "-m4-400*" "-m4-500*" "-m5*" } { "" } } */
/* { dg-final { scan-assembler-not "fcmp/eq" } } */ /* { dg-final { scan-assembler-not "fcmp/eq" } } */
/* { dg-final { scan-assembler-times "fcmp/gt" 4 } } */ /* { dg-final { scan-assembler-times "fcmp/gt" 4 } } */
...@@ -29,4 +28,3 @@ test_03 (double a, double b) ...@@ -29,4 +28,3 @@ test_03 (double a, double b)
{ {
return a >= b; return a >= b;
} }
/* Check that displacement addressing is used for indexed addresses with a /* Check that displacement addressing is used for indexed addresses with a
small offset, instead of re-calculating the index and that the movu.w small offset, instead of re-calculating the index and that the movu.w
instruction is used on SH2A. */ instruction is used on SH2A. */
/* { dg-do compile } */ /* { dg-do compile { target { sh2a } } } */
/* { dg-options "-O2" } */ /* { dg-options "-O2" } */
/* { dg-skip-if "" { "sh*-*-*" } { "*" } { "-m2a*" } } */
/* { dg-final { scan-assembler-not "add\t#1" } } */ /* { dg-final { scan-assembler-not "add\t#1" } } */
/* { dg-final { scan-assembler "movu.w" } } */ /* { dg-final { scan-assembler "movu.w" } } */
......
/* Check that the option -mdiv=call-fp does not produce calls to the /* Check that the option -mdiv=call-fp does not produce calls to the
library function that uses FPU to implement integer division if FPU insns library function that uses FPU to implement integer division if FPU insns
are not supported or are disabled. */ are not supported or are disabled. */
/* { dg-do compile } */ /* { dg-do compile { target { no_fpu } } } */
/* { dg-options "-mdiv=call-fp" } */ /* { dg-options "-mdiv=call-fp" } */
/* { dg-skip-if "" { "sh*-*-*" } { "*"} { "-m1" "-m2" "-m3" "-m4al" "*nofpu" "-m4-340*" "-m4-400*" "-m4-500*" } } */
/* { dg-final { scan-assembler-not "sdivsi3_i4\n|udivsi3_i4\n" } } */ /* { dg-final { scan-assembler-not "sdivsi3_i4\n|udivsi3_i4\n" } } */
int int
......
/* Check that the option -mdiv=call-fp results in the corresponding library /* Check that the option -mdiv=call-fp results in the corresponding library
function calls on targets that have a double precision FPU. */ function calls on targets that have a double precision FPU. */
/* { dg-do compile } */ /* { dg-do compile { target { double_fpu || use_single_only_fpu } } } */
/* { dg-options "-mdiv=call-fp" } */ /* { dg-options "-mdiv=call-fp" } */
/* { dg-skip-if "" { "sh*-*-*" } { "*"} { "-m2a" "-m4" "-m4a" "*single-only" } } */
/* { dg-final { scan-assembler "sdivsi3_i4\n" } } */ /* { dg-final { scan-assembler "sdivsi3_i4\n" } } */
/* { dg-final { scan-assembler "udivsi3_i4\n" } } */ /* { dg-final { scan-assembler "udivsi3_i4\n" } } */
......
/* PR target/50749: Verify that post-increment addressing is generated. */ /* PR target/50749: Verify that post-increment addressing is generated. */
/* { dg-do compile } */ /* { dg-do compile { target { any_fpu } } } */
/* { dg-options "-O2" } */ /* { dg-options "-O2" } */
/* { dg-skip-if "" { "sh*-*-*" } { "-m1" "-m2" "-m3" "-m4al" "*nofpu" "-m4-340*" "-m4-400*" "-m4-500*" "-m5*" } { "" } } */
/* { dg-final { scan-assembler-times "fmov.s\t@r\[0-9]\+\\+,fr\[0-9]\+" 1 } } */ /* { dg-final { scan-assembler-times "fmov.s\t@r\[0-9]\+\\+,fr\[0-9]\+" 1 } } */
float* float*
...@@ -12,4 +11,3 @@ test_func_00 (float* p, float* x) ...@@ -12,4 +11,3 @@ test_func_00 (float* p, float* x)
*x = r; *x = r;
return p; return p;
} }
/* PR target/50749: Verify that subsequent post-increment addressings /* PR target/50749: Verify that subsequent post-increment addressings
are generated. */ are generated. */
/* { dg-do compile } */ /* { dg-do compile { target { any_fpu } } } */
/* { dg-options "-O2" } */ /* { dg-options "-O2" } */
/* { dg-skip-if "" { "sh*-*-*" } { "-m1" "-m2*" "-m4al" "*nofpu" "-m4-340*" "-m4-400*" "-m4-500*" "-m5*" } { "" } } */
/* { dg-final { scan-assembler-times "fmov.s\t@r\[0-9]\+\\+,fr\[0-9]\+" 5 { xfail *-*-*} } } */ /* { dg-final { scan-assembler-times "fmov.s\t@r\[0-9]\+\\+,fr\[0-9]\+" 5 { xfail *-*-*} } } */
float* float*
......
/* PR target/50749: Verify that post-increment addressing is generated /* PR target/50749: Verify that post-increment addressing is generated
inside a loop. */ inside a loop. */
/* { dg-do compile } */ /* { dg-do compile { target { any_fpu } } } */
/* { dg-options "-O2" } */ /* { dg-options "-O2" } */
/* { dg-skip-if "" { "sh*-*-*" } { "-m1" "-m2" "-m3" "-m4al" "*nofpu" "-m4-340*" "-m4-400*" "-m4-500*" "-m5*" } { "" } } */
/* { dg-final { scan-assembler-times "fmov.s\t@r\[0-9]\+\\+,fr\[0-9]\+" 1 } } */ /* { dg-final { scan-assembler-times "fmov.s\t@r\[0-9]\+\\+,fr\[0-9]\+" 1 } } */
float float
......
/* PR target/50749: Verify that post-increment addressing is generated /* PR target/50749: Verify that post-increment addressing is generated
inside a loop. */ inside a loop. */
/* { dg-do compile } */ /* { dg-do compile { target { any_fpu } } } */
/* { dg-options "-O2" } */ /* { dg-options "-O2" } */
/* { dg-skip-if "" { "sh*-*-*" } { "-m1" "-m2*" "-m4al" "*nofpu" "-m4-340*" "-m4-400*" "-m4-500*" "-m5*" } { "" } } */
/* { dg-final { scan-assembler-times "fmov.s\t@r\[0-9]\+\\+,fr\[0-9]\+" 3 { xfail *-*-*} } } */ /* { dg-final { scan-assembler-times "fmov.s\t@r\[0-9]\+\\+,fr\[0-9]\+" 3 { xfail *-*-*} } } */
float float
......
/* PR target/50749: Verify that pre-decrement addressing is generated. */ /* PR target/50749: Verify that pre-decrement addressing is generated. */
/* { dg-do compile } */ /* { dg-do compile { target { any_fpu } } } */
/* { dg-options "-O2" } */ /* { dg-options "-O2" } */
/* { dg-skip-if "" { "sh*-*-*" } { "-m1" "-m2" "-m3" "-m4al" "*nofpu" "-m4-340*" "-m4-400*" "-m4-500*" "-m5*" } { "" } } */
/* { dg-final { scan-assembler-times "fmov.s\tfr\[0-9]\+,@-r\[0-9]\+" 1 } } */ /* { dg-final { scan-assembler-times "fmov.s\tfr\[0-9]\+,@-r\[0-9]\+" 1 } } */
float* float*
......
/* PR target/50749: Verify that subsequent pre-decrement addressings /* PR target/50749: Verify that subsequent pre-decrement addressings
are generated. */ are generated. */
/* { dg-do compile } */ /* { dg-do compile { target { any_fpu } } } */
/* { dg-options "-O2" } */ /* { dg-options "-O2" } */
/* { dg-skip-if "" { "sh*-*-*" } { "-m1" "-m2*" "-m4al" "*nofpu" "-m4-340*" "-m4-400*" "-m4-500*" "-m5*" } { "" } } */
/* { dg-final { scan-assembler-times "fmov.s\tfr\[0-9]\+,@-r\[0-9]\+" 5 { xfail *-*-*} } } */ /* { dg-final { scan-assembler-times "fmov.s\tfr\[0-9]\+,@-r\[0-9]\+" 5 { xfail *-*-*} } } */
float* float*
......
/* PR target/50749: Verify that pre-decrement addressing is generated /* PR target/50749: Verify that pre-decrement addressing is generated
inside a loop. */ inside a loop. */
/* { dg-do compile } */ /* { dg-do compile { target { any_fpu } } } */
/* { dg-options "-O2" } */ /* { dg-options "-O2" } */
/* { dg-skip-if "" { "sh*-*-*" } { "-m1" "-m2" "-m3" "-m4al" "*nofpu" "-m4-340*" "-m4-400*" "-m4-500*" "-m5*" } { "" } } */
/* { dg-final { scan-assembler-times "fmov.s\tfr\[0-9]\+,@-r\[0-9]\+" 1 } } */ /* { dg-final { scan-assembler-times "fmov.s\tfr\[0-9]\+,@-r\[0-9]\+" 1 } } */
float* float*
......
/* PR target/50749: Verify that pre-decrement addressing is generated /* PR target/50749: Verify that pre-decrement addressing is generated
inside a loop. */ inside a loop. */
/* { dg-do compile } */ /* { dg-do compile { target { any_fpu } } } */
/* { dg-options "-O2" } */ /* { dg-options "-O2" } */
/* { dg-skip-if "" { "sh*-*-*" } { "-m1" "-m2*" "-m4al" "*nofpu" "-m4-340*" "-m4-400*" "-m4-500*" "-m5*" } { "" } } */
/* { dg-final { scan-assembler-times "fmov.s\tfr\[0-9]\+,@-r\[0-9]\+" 3 { xfail *-*-*} } } */ /* { dg-final { scan-assembler-times "fmov.s\tfr\[0-9]\+,@-r\[0-9]\+" 3 { xfail *-*-*} } } */
float* float*
......
...@@ -2,9 +2,8 @@ ...@@ -2,9 +2,8 @@
base address is adjusted only once. On SH2A this test is skipped because base address is adjusted only once. On SH2A this test is skipped because
there is a 4 byte mov.b insn that can handle larger displacements. Thus there is a 4 byte mov.b insn that can handle larger displacements. Thus
on SH2A the base address will not be adjusted in this case. */ on SH2A the base address will not be adjusted in this case. */
/* { dg-do compile } */ /* { dg-do compile { target { ! sh2a } } } */
/* { dg-options "-O1" } */ /* { dg-options "-O1" } */
/* { dg-skip-if "" { "sh*-*-*" } { "-m5*" "-m2a*" } { "" } } */
/* { dg-final { scan-assembler-times "add" 2 } } */ /* { dg-final { scan-assembler-times "add" 2 } } */
void void
......
/* Check that on SH2A the 4 byte mov.b displacement insn is generated to /* Check that on SH2A the 4 byte mov.b displacement insn is generated to
handle larger displacements. If it is generated correctly, there should handle larger displacements. If it is generated correctly, there should
be no base address adjustments outside the mov.b insns. */ be no base address adjustments outside the mov.b insns. */
/* { dg-do compile } */ /* { dg-do compile { target { sh2a } } } */
/* { dg-options "-O1" } */ /* { dg-options "-O1" } */
/* { dg-skip-if "" { "sh*-*-*" } { "*" } { "-m2a*" } } */
/* { dg-final { scan-assembler-not "add|sub" } } */ /* { dg-final { scan-assembler-not "add|sub" } } */
void void
......
...@@ -2,9 +2,8 @@ ...@@ -2,9 +2,8 @@
base address is adjusted only once. On SH2A this test is skipped because base address is adjusted only once. On SH2A this test is skipped because
there is a 4 byte mov.w insn that can handle larger displacements. Thus there is a 4 byte mov.w insn that can handle larger displacements. Thus
on SH2A the base address will not be adjusted in this case. */ on SH2A the base address will not be adjusted in this case. */
/* { dg-do compile } */ /* { dg-do compile { target { ! sh2a } } } */
/* { dg-options "-O1" } */ /* { dg-options "-O1" } */
/* { dg-skip-if "" { "sh*-*-*" } { "-m5*" "-m2a*" } { "" } } */
/* { dg-final { scan-assembler-times "add" 2 } } */ /* { dg-final { scan-assembler-times "add" 2 } } */
void void
......
/* Check that on SH2A the 4 byte mov.w displacement insn is generated to /* Check that on SH2A the 4 byte mov.w displacement insn is generated to
handle larger displacements. If it is generated correctly, there should handle larger displacements. If it is generated correctly, there should
be no base address adjustments outside the mov.w insns. */ be no base address adjustments outside the mov.w insns. */
/* { dg-do compile } */ /* { dg-do compile { target { sh2a } } } */
/* { dg-options "-O1" } */ /* { dg-options "-O1" } */
/* { dg-skip-if "" { "sh*-*-*" } { "*" } { "-m2a*" } } */
/* { dg-final { scan-assembler-not "add|sub" } } */ /* { dg-final { scan-assembler-not "add|sub" } } */
void void
......
/* Check that on SH2A the 4 byte movu.b and movu.w displacement insns are /* Check that on SH2A the 4 byte movu.b and movu.w displacement insns are
generated. This has to be checked with -O2 because some of the patterns generated. This has to be checked with -O2 because some of the patterns
rely on peepholes. */ rely on peepholes. */
/* { dg-do compile } */ /* { dg-do compile { target { sh2a } } } */
/* { dg-options "-O2" } */ /* { dg-options "-O2" } */
/* { dg-skip-if "" { "sh*-*-*" } { "*" } { "-m2a*" } } */
/* { dg-final { scan-assembler-times "movu.b" 4 } } */ /* { dg-final { scan-assembler-times "movu.b" 4 } } */
/* { dg-final { scan-assembler-times "movu.w" 3 } } */ /* { dg-final { scan-assembler-times "movu.w" 3 } } */
......
/* Check that the redundant test removal code in the *cbranch_t split works /* Check that the redundant test removal code in the *cbranch_t split works
as expected on non-SH2A targets. Because on SH2A the movrt instruction as expected. */
is used, this test is re-used and checked differently in pr51244-16.c. */
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O2" } */ /* { dg-options "-O2" } */
/* { dg-skip-if "" { "sh*-*-*" } { "-m5*" "-m2a*" } { "" } } */
/* { dg-final { scan-assembler-times "tst" 6 } } */
/* { dg-final { scan-assembler-times "movt" 6 } } */
/* { dg-final { scan-assembler-times "xor" 3 } } */
/* { dg-final { scan-assembler-not "extu|exts|negc" } } */ /* { dg-final { scan-assembler-not "extu|exts|negc" } } */
/* { dg-final { scan-assembler-times "tst" 6 } } */
/* { dg-final { scan-assembler-times "movt" 6 { target { ! sh2a } } } } */
/* { dg-final { scan-assembler-times "xor" 3 { target { ! sh2a } } } } */
/* { dg-final { scan-assembler-times "movt" 3 { target { sh2a } } } } */
/* { dg-final { scan-assembler-times "movrt" 3 { target { sh2a } } } } */
typedef char bool; typedef char bool;
......
/* Check that the redundant test removal code in the *cbranch_t split works
as expected on SH2A targets. */
/* { dg-do compile } */
/* { dg-options "-O2" } */
/* { dg-skip-if "" { "sh*-*-*" } { "*" } { "-m2a*" } } */
/* { dg-final { scan-assembler-times "tst" 6 } } */
/* { dg-final { scan-assembler-times "movt" 3 } } */
/* { dg-final { scan-assembler-times "movrt" 3 } } */
/* { dg-final { scan-assembler-not "extu|exts|negc" } } */
#include "pr51244-15.c"
/* Check that when taking the complement of the T bit using the negc /* Check that when taking the complement of the T bit using the negc
instruction pattern, the constant -1 is loaded only once. instruction pattern, the constant -1 is loaded only once on non-SH2A and
On SH2A this test is skipped because the movrt instruction is used that the movrt insn is generated on SH2A.
to get the complement of the T bit. */
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O1 -mbranch-cost=2" } */ /* { dg-options "-O1 -mbranch-cost=2" } */
/* { dg-skip-if "" { "sh*-*-*" } { "-m5*" "-m2a*" } { "" } } */
/* { dg-final { scan-assembler-times "mov\t#-1" 1 } } */ /* { dg-final { scan-assembler-times "mov\t#-1" 1 { target { ! sh2a } } } } */
/* { dg-final { scan-assembler-times "movrt" 4 { target { sh2a } } } } */
void void
testfunc_00 (int* a, int* b, int c, int d) testfunc_00 (int* a, int* b, int c, int d)
......
/* Check that the SH specific sh_treg_combine RTL optimization pass works as
expected. */
/* { dg-do compile } */
/* { dg-options "-O2" } */
/* { dg-skip-if "" { "sh*-*-*" } { "*" } { "-m2a*" } } */
/* { dg-final { scan-assembler-times "tst" 6 } } */
/* { dg-final { scan-assembler-not "movt" } } */
/* { dg-final { scan-assembler-times "nott" 2 } } */
/* { dg-final { scan-assembler-times "cmp/eq" 2 } } */
/* { dg-final { scan-assembler-times "cmp/hi" 4 } } */
/* { dg-final { scan-assembler-times "cmp/gt" 2 } } */
/* { dg-final { scan-assembler-not "not\t" } } */
#include "pr51244-20.c"
/* Check that the SH specific sh_treg_combine RTL optimization pass works as /* Check that the SH specific sh_treg_combine RTL optimization pass works as
expected. On SH2A the expected insns are slightly different, see expected. */
pr51244-20-sh2a.c. */
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O2" } */ /* { dg-options "-O2" } */
/* { dg-skip-if "" { "sh*-*-*" } { "-m5*" "-m2a*" } { "" } } */
/* { dg-final { scan-assembler-times "tst" 7 } } */ /* { dg-final { scan-assembler-not "not\t" } } */
/* { dg-final { scan-assembler-times "movt" 2 } } */
/* { dg-final { scan-assembler-times "cmp/eq" 2 } } */ /* { dg-final { scan-assembler-times "cmp/eq" 2 } } */
/* { dg-final { scan-assembler-times "cmp/hi" 4 } } */ /* { dg-final { scan-assembler-times "cmp/hi" 4 } } */
/* { dg-final { scan-assembler-times "cmp/gt" 2 } } */ /* { dg-final { scan-assembler-times "cmp/gt" 2 } } */
/* { dg-final { scan-assembler-not "not\t" } } */
/* { dg-final { scan-assembler-times "tst" 7 { target { ! sh2a } } } } */
/* { dg-final { scan-assembler-times "movt" 2 { target { ! sh2a } } } } */
/* { dg-final { scan-assembler-times "tst" 6 { target { sh2a } } } } */
/* { dg-final { scan-assembler-not "movt" { target { sh2a } } } } */
/* { dg-final { scan-assembler-times "nott" 2 { target { sh2a } } } } */
/* non-SH2A: 2x tst, 1x movt, 2x cmp/eq, 1x cmp/hi /* non-SH2A: 2x tst, 1x movt, 2x cmp/eq, 1x cmp/hi
......
/* Check that when taking the complement of the T bit on SH2A,
the movrt instruction is being generated. */
/* { dg-do compile } */
/* { dg-options "-O1 -mbranch-cost=2" } */
/* { dg-skip-if "" { "sh*-*-*" } { "*" } { "-m2a*" } } */
/* { dg-final { scan-assembler-times "movrt" 4 } } */
void
testfunc_00 (int* a, int* b, int c, int d)
{
b[0] = a[0] != c;
b[1] = a[1] != d;
b[2] = a[2] != c;
b[3] = a[3] != d;
}
/* Check that no unnecessary sign or zero extension insn is generated after /* Check that no unnecessary sign or zero extension insn is generated after
a negc or movrt insn that stores the inverted T bit in a reg. */ a negc or movrt insn that stores the inverted T bit in a reg. */
/* { dg-do compile } */ /* { dg-do compile { target { any_fpu } } } */
/* { dg-options "-O1" } */ /* { dg-options "-O1" } */
/* { dg-skip-if "" { "sh*-*-*" } { "-m1" "-m2" "-m3" "-m4al" "*nofpu" "-m4-340*" "-m4-400*" "-m4-500*" "-m5*" } { "" } } */
/* { dg-final { scan-assembler-not "extu|exts" } } */ /* { dg-final { scan-assembler-not "extu|exts" } } */
float float
......
/* Check that loads/stores from/to volatile floating point mems utilize /* Check that loads/stores from/to volatile floating point mems utilize
indexed addressing modes. */ indexed addressing modes. */
/* { dg-do compile } */ /* { dg-do compile { target { any_fpu } } } */
/* { dg-options "-O1" } */ /* { dg-options "-O1" } */
/* { dg-skip-if "" { "sh*-*-*" } { "-m1" "-m2" "-m3" "-m4al" "*nofpu" "-m4-340*" "-m4-400*" "-m4-500*" "-m5*" } { "" } } */
/* { dg-final { scan-assembler-times "@\\(r0," 2 } } */ /* { dg-final { scan-assembler-times "@\\(r0," 2 } } */
float float
......
/* Verify that the fmac insn is used for the standard fmaf function. */ /* Verify that the fmac insn is used for the standard fmaf function. */
/* { dg-do compile } */ /* { dg-do compile { target { any_fpu } } } */
/* { dg-options "-O1" } */ /* { dg-options "-O1" } */
/* { dg-skip-if "" { "sh*-*-*" } { "-m1" "-m2" "-m3" "-m4al" "*nofpu" "-m4-340*" "-m4-400*" "-m4-500*" "-m5*" } { "" } } */
/* { dg-final { scan-assembler "fmac" } } */ /* { dg-final { scan-assembler "fmac" } } */
#include <math.h> #include <math.h>
......
/* Verify that the fsca insn is used when specifying -mfsca and /* Verify that the fsca insn is used when specifying -mfsca and
-funsafe-math-optimizations. */ -funsafe-math-optimizations. */
/* { dg-do compile } */ /* { dg-do compile { target { has_fsca } } } */
/* { dg-options "-O1 -mfsca -funsafe-math-optimizations" } */ /* { dg-options "-O1 -mfsca -funsafe-math-optimizations" } */
/* { dg-skip-if "" { "sh*-*-*" } { "-m1" "-m2*" "-m3*" "-m4al" "*nofpu" "-m4-340*" "-m4-400*" "-m4-500*" "-m5*" } { "" } } */
/* { dg-final { scan-assembler-times "fsca" 3 } } */ /* { dg-final { scan-assembler-times "fsca" 3 } } */
#include <math.h> #include <math.h>
......
/* Verify that the fsca insn is not used when specifying -mno-fsca and /* Verify that the fsca insn is not used when specifying -mno-fsca and
-funsafe-math-optimizations. */ -funsafe-math-optimizations. */
/* { dg-do compile } */ /* { dg-do compile { target { has_fsca } } } */
/* { dg-options "-O1 -mno-fsca -funsafe-math-optimizations" } */ /* { dg-options "-O1 -mno-fsca -funsafe-math-optimizations" } */
/* { dg-skip-if "" { "sh*-*-*" } { "-m1" "-m2*" "-m4al" "*nofpu" "-m4-340*" "-m4-400*" "-m4-500*" "-m5*" } { "" } } */
/* { dg-final { scan-assembler-not "fsca" } } */ /* { dg-final { scan-assembler-not "fsca" } } */
#include <math.h> #include <math.h>
......
/* Verify that the fsrra insn is used when specifying -mfsrra and /* Verify that the fsrra insn is used when specifying -mfsrra and
-funsafe-math-optimizations and -ffinite-math-only. */ -funsafe-math-optimizations and -ffinite-math-only. */
/* { dg-do compile } */ /* { dg-do compile { target { has_fsrra } } } */
/* { dg-options "-O1 -mfsrra -funsafe-math-optimizations -ffinite-math-only" } */ /* { dg-options "-O1 -mfsrra -funsafe-math-optimizations -ffinite-math-only" } */
/* { dg-skip-if "" { "sh*-*-*" } { "-m1" "-m2*" "-m3*" "-m4al" "*nofpu" "-m4-340*" "-m4-400*" "-m4-500*" "-m5*" } { "" } } */
/* { dg-final { scan-assembler "fsrra" } } */ /* { dg-final { scan-assembler "fsrra" } } */
#include <math.h> #include <math.h>
......
/* Verify that the fsrra insn is not used when specifying -mno-fsrra and /* Verify that the fsrra insn is not used when specifying -mno-fsrra and
-funsafe-math-optimizations and -ffinite-math-only. */ -funsafe-math-optimizations and -ffinite-math-only. */
/* { dg-do compile } */ /* { dg-do compile { target { has_fsrra } } } */
/* { dg-options "-O1 -mno-fsrra -funsafe-math-optimizations -ffinite-math-only" } */ /* { dg-options "-O1 -mno-fsrra -funsafe-math-optimizations -ffinite-math-only" } */
/* { dg-skip-if "" { "sh*-*-*" } { "-m1" "-m2*" "-m4al" "*nofpu" "-m4-340*" "-m4-400*" "-m4-500*" "-m5*" } { "" } } */
/* { dg-final { scan-assembler-not "fsrra" } } */ /* { dg-final { scan-assembler-not "fsrra" } } */
#include <math.h> #include <math.h>
...@@ -12,4 +11,3 @@ test_func_00 (float x) ...@@ -12,4 +11,3 @@ test_func_00 (float x)
{ {
return 1 / sqrtf (x); return 1 / sqrtf (x);
} }
/* Check that fpchg is used to switch FPSCR.PR mode on SH4A. */ /* Check that fpchg is used to switch FPSCR.PR mode on SH4A. */
/* { dg-do compile { target { has_fpchg } } } */
/* { dg-additional-options "-O" } */ /* { dg-additional-options "-O" } */
/* { dg-skip-if "" { "sh*-*-*" } { "*" } { "-m4a" "-m4a-single" } } */
/* { dg-final { scan-assembler "fpchg" } } */ /* { dg-final { scan-assembler "fpchg" } } */
/* { dg-final { scan-assembler-not "fpscr" } } */ /* { dg-final { scan-assembler-not "fpscr" } } */
......
...@@ -9,9 +9,8 @@ ...@@ -9,9 +9,8 @@
mov r4,r0 mov r4,r0
rts rts
rotcr r0 */ rotcr r0 */
/* { dg-do compile } */ /* { dg-do compile { target { has_dyn_shift } } } */
/* { dg-options "-O2" } */ /* { dg-options "-O2" } */
/* { dg-skip-if "" { "sh*-*-*" } { "*"} { "-m3* -m2a* -m4*" } } */
/* { dg-final { scan-assembler-not "neg" } } */ /* { dg-final { scan-assembler-not "neg" } } */
unsigned int unsigned int
......
/* The dynamic shift library functions truncate the shift count to 5 bits. /* The dynamic shift library functions truncate the shift count to 5 bits.
Verify that this is taken into account and no extra shift count Verify that this is taken into account and no extra shift count
truncations are generated before the library call. */ truncations are generated before the library call. */
/* { dg-do compile } */ /* { dg-do compile { target { ! has_dyn_shift } } } */
/* { dg-options "-O1" } */ /* { dg-options "-O1" } */
/* { dg-skip-if "" { "sh*-*-*" } { "*" } { "-m1*" "-m2" "-m2e*" } } */
/* { dg-final { scan-assembler-not "and" } } */ /* { dg-final { scan-assembler-not "and" } } */
/* { dg-final { scan-assembler-not "#31" } } */ /* { dg-final { scan-assembler-not "#31" } } */
......
/* Check that the rotcr instruction is generated when shifting the /* Check that the rotcr instruction is generated when shifting the
negated T bit on non-SH2A. */ negated T bit on non-SH2A.
On SH2A expect a movrt rotr sequence instead. */
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O1" } */ /* { dg-options "-O1" } */
/* { dg-skip-if "" { "sh*-*-*" } { "-m5*" "-m2a*" } { "" } } */
/* { dg-final { scan-assembler-times "rotcr" 1 } } */ /* { dg-final { scan-assembler-times "rotcr" 1 { target { ! sh2a } } } } */
/* { dg-final { scan-assembler-times "tst" 1 } } */ /* { dg-final { scan-assembler-times "tst" 1 { target { ! sh2a } } } } */
/* { dg-final { scan-assembler-times "movt" 1 } } */ /* { dg-final { scan-assembler-times "movt" 1 { target { ! sh2a } } } } */
/* { dg-final { scan-assembler-times "movrt" 1 { target { sh2a } } } } */
/* { dg-final { scan-assembler-times "rotr" 1 { target { sh2a } } } } */
int int
test_00 (int a, int b) test_00 (int a, int b)
......
/* Check that the movrt rotr instruction sequence is generated when shifting
the negated T bit on SH2A. */
/* { dg-do compile } */
/* { dg-options "-O1" } */
/* { dg-skip-if "" { "sh*-*-*" } { "*" } { "-m2a*" } } */
/* { dg-final { scan-assembler-times "movrt" 1 } } */
/* { dg-final { scan-assembler-times "rotr" 1 } } */
int
test_00 (int a, int b)
{
int r = a != b;
return r << 31;
}
/* Verify that the delay slot is not stuffed with register pop insns for /* Verify that the delay slot is not stuffed with register pop insns for
interrupt handler function returns on SH1* and SH2* targets, where the interrupt handler function returns on SH1* and SH2* targets, where the
rte insn uses the stack pointer. */ rte insn uses the stack pointer. */
/* { dg-do compile } */ /* { dg-do compile { target { stack_save_isr } } } */
/* { dg-options "-O1" } */ /* { dg-options "-O1" } */
/* { dg-skip-if "" { "sh*-*-*" } { "*" } { "-m1*" "-m2*" } } */
/* { dg-final { scan-assembler-times "nop" 1 } } */ /* { dg-final { scan-assembler-times "nop" 1 } } */
int test00 (int a, int b); int test00 (int a, int b);
......
/* Verify that the rte delay slot is not stuffed with register pop insns /* Verify that the rte delay slot is not stuffed with register pop insns
which touch the banked registers r0..r7 on SH3* and SH4* targets. */ which touch the banked registers r0..r7 on SH3* and SH4* targets. */
/* { dg-do compile } */ /* { dg-do compile { target { banked_r0r7_isr } } } */
/* { dg-options "-O1" } */ /* { dg-options "-O1" } */
/* { dg-skip-if "" { "sh*-*-*" } { "*" } { "-m3*" "-m4*" } } */
/* { dg-final { scan-assembler-times "nop" 1 } } */ /* { dg-final { scan-assembler-times "nop" 1 } } */
int __attribute__ ((interrupt_handler)) int __attribute__ ((interrupt_handler))
......
/* Verify that the delay slot is stuffed with register pop insns on SH3* and /* Verify that the delay slot is stuffed with register pop insns on SH3* and
SH4* targets, where the stack pointer is not used by the rte insn. If SH4* targets, where the stack pointer is not used by the rte insn. If
everything works out, we won't see a nop insn. */ everything works out, we won't see a nop insn. */
/* { dg-do compile } */ /* { dg-do compile { target { banked_r0r7_isr } } } */
/* { dg-options "-O1" } */ /* { dg-options "-O1" } */
/* { dg-skip-if "" { "sh*-*-*" } { "*" } { "-m3*" "-m4*" } } */
/* { dg-final { scan-assembler-not "rte\n\tnop" } } */ /* { dg-final { scan-assembler-not "rte\n\tnop" } } */
int test00 (int a, int b); int test00 (int a, int b);
......
/* Verify that the fsca input value is not converted to float and then back /* Verify that the fsca input value is not converted to float and then back
to int. Notice that we can't count just "lds" insns because mode switches to int. Notice that we can't count just "lds" insns because mode switches
use "lds.l". */ use "lds.l". */
/* { dg-do compile } */ /* { dg-do compile { target { has_fsca } } } */
/* { dg-options "-O2 -mfsca -funsafe-math-optimizations -fno-ipa-icf" } */ /* { dg-options "-O2 -mfsca -funsafe-math-optimizations -fno-ipa-icf" } */
/* { dg-skip-if "" { "sh*-*-*" } { "-m1" "-m2*" "-m3*" "-m4al" "*nofpu" "-m4-340*" "-m4-400*" "-m4-500*" "-m5*" } { "" } } */
/* { dg-final { scan-assembler-times "fsca" 7 } } */ /* { dg-final { scan-assembler-times "fsca" 7 } } */
/* { dg-final { scan-assembler-times "shad" 1 } } */ /* { dg-final { scan-assembler-times "shad" 1 } } */
/* { dg-final { scan-assembler-times "lds\tr\[0-9\],fpul" 6 } } */ /* { dg-final { scan-assembler-times "lds\tr\[0-9\],fpul" 6 } } */
......
/* Verify that the SH2A clips and clipu instructions are generated as /* Verify that the SH2A clips and clipu instructions are generated as
expected. */ expected. */
/* { dg-do compile } */ /* { dg-do compile { target { sh2a } } } */
/* { dg-options "-O2" } */ /* { dg-options "-O2" } */
/* { dg-skip-if "" { "sh*-*-*" } { "*" } { "-m2a*" } } */
/* { dg-final { scan-assembler-times "clips.b" 2 } } */ /* { dg-final { scan-assembler-times "clips.b" 2 } } */
/* { dg-final { scan-assembler-times "clips.w" 2 } } */ /* { dg-final { scan-assembler-times "clips.w" 2 } } */
/* { dg-final { scan-assembler-times "clipu.b" 2 } } */ /* { dg-final { scan-assembler-times "clipu.b" 2 } } */
......
/* Verify that for SH2A smax/smin -> cbranch conversion is done properly /* Verify that for SH2A smax/smin -> cbranch conversion is done properly
if the clips insn is not used and the expected comparison insns are if the clips insn is not used and the expected comparison insns are
generated. */ generated. */
/* { dg-do compile } */ /* { dg-do compile { target { sh2a } } } */
/* { dg-options "-O2" } */ /* { dg-options "-O2" } */
/* { dg-skip-if "" { "sh*-*-*" } { "*" } { "-m2a*" } } */
/* { dg-final { scan-assembler-times "cmp/pl" 4 } } */ /* { dg-final { scan-assembler-times "cmp/pl" 4 } } */
int int
......
/* Verify that the special case (umin (reg const_int 1)) results in the /* Verify that the special case (umin (reg const_int 1)) results in the
expected instruction sequence on SH2A. */ expected instruction sequence on SH2A. */
/* { dg-do compile } */ /* { dg-do compile { target { sh2a } } } */
/* { dg-options "-O2" } */ /* { dg-options "-O2" } */
/* { dg-skip-if "" { "sh*-*-*" } { "*" } { "-m2a*" } } */
/* { dg-final { scan-assembler-times "tst" 1 } } */ /* { dg-final { scan-assembler-times "tst" 1 } } */
/* { dg-final { scan-assembler-times "movrt" 1 } } */ /* { dg-final { scan-assembler-times "movrt" 1 } } */
......
/* Verify that the fmac insn is used for the expression 'a * b + a' and /* Verify that the fmac insn is used for the expression 'a * b + a' and
'a * a + a'. 'a * a + a'.
This assumes that the default compiler setting is -ffp-contract=fast. */ This assumes that the default compiler setting is -ffp-contract=fast. */
/* { dg-do compile } */ /* { dg-do compile { target { any_fpu } } } */
/* { dg-options "-O1" } */ /* { dg-options "-O1" } */
/* { dg-skip-if "" { "sh*-*-*" } { "-m1" "-m2" "-m3" "-m4al" "*nofpu" "-m4-340*" "-m4-400*" "-m4-500*" "-m5*" } { "" } } */
/* { dg-final { scan-assembler-times "fmac" 2 } } */ /* { dg-final { scan-assembler-times "fmac" 2 } } */
float float
......
/* Verify that the fmac insn is used for the expression 'a * b + a' and /* Verify that the fmac insn is used for the expression 'a * b + a' and
'a * a + a' when -ffast-math is specified. */ 'a * a + a' when -ffast-math is specified. */
/* { dg-do compile } */ /* { dg-do compile { target { any_fpu } } } */
/* { dg-options "-O1 -ffast-math" } */ /* { dg-options "-O1 -ffast-math" } */
/* { dg-skip-if "" { "sh*-*-*" } { "-m1" "-m2" "-m3" "-m4al" "*nofpu" "-m4-340*" "-m4-400*" "-m4-500*" "-m5*" } { "" } } */
/* { dg-final { scan-assembler-times "fmac" 2 } } */ /* { dg-final { scan-assembler-times "fmac" 2 } } */
float float
......
/* Verify that we don't switch mode for single moves. */ /* Verify that we don't switch mode for single moves. */
/* { dg-do compile } */ /* { dg-do compile { target { any_fpu && { ! fmovd_enabled } } } } */
/* { dg-require-effective-target hard_float } */ /* { dg-final { scan-assembler-not "fpscr|fpchg" } } */
/* { dg-skip-if "" { *-*-* } { "mfmovd" } { "" } } */
/* { dg-final { scan-assembler-not "fpscr" } } */
float *g; float *g;
......
/* Check that the option -musermode has no effect on targets that do not /* Check that the option -musermode has no effect on targets that do not
support user/privileged mode and that it does not interfere with option support user/privileged mode and that it does not interfere with option
-matomic-model=soft-imask. */ -matomic-model=soft-imask. */
/* { dg-do compile } */ /* { dg-do compile { target { ! has_privileged } } } */
/* { dg-options "-matomic-model=soft-imask" } */ /* { dg-options "-matomic-model=soft-imask" } */
/* { dg-skip-if "" { "sh*-*-*" } { "*"} { "-m1*" "-m2*" } } */
int int
test (void) test (void)
......
/* Check that the XF registers are not clobbered by an integer division /* Check that the XF registers are not clobbered by an integer division
that is done using double precision FPU division. */ that is done using double precision FPU division. */
/* { dg-do run } */
/* { dg-do run { target { default_single_fpu && has_xf_regs } } } */
/* { dg-options "-O1 -mdiv=call-fp" } */ /* { dg-options "-O1 -mdiv=call-fp" } */
/* { dg-skip-if "" { "sh*-*-*" } { "*" } { "-m4*-single" "-m4*-single-only" } } */
#include <assert.h> #include <assert.h>
#include <stdlib.h> #include <stdlib.h>
......
...@@ -3,8 +3,7 @@ ...@@ -3,8 +3,7 @@
(On SH3* and SH4* r0..r7 are banked) (On SH3* and SH4* r0..r7 are banked)
Call-saved registers r8..r14 also don't need to be restored. Call-saved registers r8..r14 also don't need to be restored.
To test that we look for register push insns such as 'mov.l r0,@-r15'. */ To test that we look for register push insns such as 'mov.l r0,@-r15'. */
/* { dg-do compile { target { { "sh*-*-*" } && nonpic } } } */ /* { dg-do compile { target { { banked_r0r7_isr } && nonpic } } } */
/* { dg-skip-if "" { "sh*-*-*" } { "-m1*" "-m2*" "-m5*" } { "" } } */
/* { dg-options "-O" } */ /* { dg-options "-O" } */
/* { dg-final { scan-assembler-times "rte" 1 } } */ /* { dg-final { scan-assembler-times "rte" 1 } } */
/* { dg-final { scan-assembler-not "mov.l\tr\[0-9\],@-r15" } } */ /* { dg-final { scan-assembler-not "mov.l\tr\[0-9\],@-r15" } } */
......
...@@ -2,8 +2,7 @@ ...@@ -2,8 +2,7 @@
The function call will require to load the address first into a register, The function call will require to load the address first into a register,
then use that for a jsr or jmp. It will also need to load a constant then use that for a jsr or jmp. It will also need to load a constant
address in order to load fpscr. */ address in order to load fpscr. */
/* { dg-do compile { target { { "sh*-*-*" } && nonpic } } } */ /* { dg-do compile { target { { any_fpu } && nonpic } } } */
/* { dg-skip-if "" { "sh*-*-*" } { "-m1" "-m2" "-m3" "-m4al" "*nofpu" "-m4-340*" "-m4-400*" "-m4-500*" "-m5*" } { "" } } */
/* { dg-options "-O" } */ /* { dg-options "-O" } */
/* { dg-final { scan-assembler-times "rte" 1 } } */ /* { dg-final { scan-assembler-times "rte" 1 } } */
/* { dg-final { scan-assembler-not "mov.l\tr\[0-9\],@-r15" } } */ /* { dg-final { scan-assembler-not "mov.l\tr\[0-9\],@-r15" } } */
......
/* Testcase to check generation of a SH4 and SH2A operand cache prefetch /* Testcase to check generation of the operand cache prefetch instruction
instruction PREF @Rm. */ PREF @Rm. */
/* { dg-do assemble } */ /* { dg-do compile { target { has_pref } } } */
/* { dg-options "-O0" } */ /* { dg-options "-O0" } */
/* { dg-skip-if "" { "sh*-*-*" } { "*" } { "-m2a*" "-m3*" "-m4*" } } */ /* { dg-final { scan-assembler "pref" } } */
/* { dg-final { scan-assembler "pref"} } */
void void
opt (void) opt (void)
......
/* { dg-do compile } */ /* { dg-do compile { target { stack_save_isr } } } */
/* { dg-options "-O2" } */ /* { dg-options "-O2" } */
/* { dg-skip-if "" { "sh*-*-*" } "*" "-m1 -m2*" } */
/* { dg-final { scan-assembler-not "\trte\t\n\tmov.l\t@r15\\+" } } */ /* { dg-final { scan-assembler-not "\trte\t\n\tmov.l\t@r15\\+" } } */
/* This test checks if the compiler generates a pop instruction /* This test checks if the compiler generates a pop instruction
......
...@@ -42,6 +42,217 @@ proc check_effective_target_sh1 { } { ...@@ -42,6 +42,217 @@ proc check_effective_target_sh1 { } {
} ""] } ""]
} }
# Return 1 if target is SH4A
proc check_effective_target_sh4a { } {
return [check_no_compiler_messages sh4a object {
#ifndef __SH4A__
#error ""
#endif
} ""]
}
# Return 1 if target is big endian
proc check_effective_target_big_endian { } {
return [check_no_compiler_messages big_endian object {
#if __BYTE_ORDER__ != __ORDER_BIG_ENDIAN__
#error ""
#endif
} ""]
}
# Return 1 if target is little endian
proc check_effective_target_little_endian { } {
return [check_no_compiler_messages little_endian object {
#if __BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__
#error ""
#endif
} ""]
}
# Return 1 if the target has any FPU (single or double precision)
proc check_effective_target_any_fpu { } {
return [check_no_compiler_messages any_fpu object {
#ifndef __SH_FPU_ANY__
#error ""
#endif
} ""]
}
# Return 1 if the target has a double precision FPU which is allowed to be
# used by the compiler as such.
proc check_effective_target_double_fpu { } {
return [check_no_compiler_messages double_fpu object {
#ifndef __SH_FPU_DOUBLE__
#error ""
#endif
} ""]
}
# Return 1 if the target has a double precision FPU but it is only being used
# in single precision mode by the compiler
proc check_effective_target_use_single_only_fpu { } {
return [check_no_compiler_messages use_single_only_fpu object {
#if !(defined (__SH2A_SINGLE_ONLY__) \
|| defined (__SH4_SINGLE_ONLY__))
#error ""
#endif
} ""]
}
# Return 1 if the target has an FPU and the default mode is single
proc check_effective_target_default_single_fpu { } {
return [check_no_compiler_messages default_single_fpu object {
#if !(defined (__SH2E__) || defined (__SH3E__) \
|| defined (__SH2A_SINGLE__) \
|| defined (__SH2A_SINGLE_ONLY__) \
|| defined (__SH4_SINGLE__) \
|| defined (__SH4_SINGLE_ONLY__))
#error ""
#endif
} ""]
}
# Return 1 if the target has no FPU
proc check_effective_target_no_fpu { } {
return [check_no_compiler_messages no_fpu object {
#ifdef __SH_FPU_ANY__
#error ""
#endif
} ""]
}
# Return 1 if the target has XF regs
proc check_effective_target_has_xf_regs { } {
return [check_no_compiler_messages has_xf_regs object {
#if !(defined (__SH_FPU_ANY__) \
&& (defined (__SH4__) \
|| defined (__SH4_SINGLE__) \
|| defined (__SH4_SINGLE_ONLY__) \
|| defined (__SH4A__)))
#error ""
#endif
} ""]
}
# Return 1 if the target can do the fsca insn
proc check_effective_target_has_fsca { } {
return [check_no_compiler_messages has_fsca object {
#if !(defined (__SH_FPU_ANY__) \
&& (defined (__SH4__) \
|| defined (__SH4_SINGLE__) \
|| defined (__SH4_SINGLE_ONLY__) \
|| defined (__SH4A__)))
#error ""
#endif
} ""]
}
# Return 1 if the target can do the fsrra insn
proc check_effective_target_has_fsrra { } {
return [check_no_compiler_messages has_fsrra object {
#if !(defined (__SH_FPU_ANY__) \
&& (defined (__SH4__) \
|| defined (__SH4_SINGLE__) \
|| defined (__SH4_SINGLE_ONLY__) \
|| defined (__SH4A__)))
#error ""
#endif
} ""]
}
# Return 1 if the target can do the fpchg insn
proc check_effective_target_has_fpchg { } {
return [check_no_compiler_messages has_fpchg object {
#if !(defined (__SH4A__) && defined (__SH_FPU_ANY__) \
&& !defined (__SH4_SINGLE_ONLY__))
#error ""
#endif
} ""]
}
# Return 1 if the target can do dynamic shifts
proc check_effective_target_has_dyn_shift { } {
return [check_no_compiler_messages has_dyn_shift object {
#if !(defined (__SH3__) \
|| defined (__SH3E__) \
|| defined (__SH2A__) \
|| defined (__SH4__) \
|| defined (__SH4_NOFPU__) \
|| defined (__SH4_SINGLE__) \
|| defined (__SH4_SINGLE_ONLY__) \
|| defined (__SH4A__))
#error ""
#endif
} ""]
}
# Return 1 if the mfmovd option is enabled
proc check_effective_target_fmovd_enabled { } {
return [check_no_compiler_messages fmovd_enabled object {
#ifndef __FMOVD_ENABLED__
#error ""
#endif
} ""]
}
# Return 1 if the target supports privileged mode
proc check_effective_target_has_privileged { } {
return [check_no_compiler_messages has_privileged object {
#if !(defined (__SH3__) \
|| defined (__SH3E__) \
|| defined (__SH4__) \
|| defined (__SH4_NOFPU__) \
|| defined (__SH4_SINGLE__) \
|| defined (__SH4_SINGLE_ONLY__) \
|| defined (__SH4A__))
#error ""
#endif
} ""]
}
# Return 1 if the target supports the prefetch insn
proc check_effective_target_has_pref { } {
return [check_no_compiler_messages has_pref object {
#if !(defined (__SH3__) \
|| defined (__SH3E__) \
|| defined (__SH4__) \
|| defined (__SH4_NOFPU__) \
|| defined (__SH4_SINGLE__) \
|| defined (__SH4_SINGLE_ONLY__) \
|| defined (__SH4A__))
#error ""
#endif
} ""]
}
# Return 1 if target does banked r0..r7 regs type of ISRs
proc check_effective_target_banked_r0r7_isr { } {
return [check_no_compiler_messages banked_r0r7_isr object {
#if !(defined (__SH3__) || defined (__SH3E__) \
|| defined (__SH4__) \
|| defined (__SH4_SINGLE__) \
|| defined (__SH4_SINGLE_ONLY__) \
|| defined (__SH4_NOFPU__) \
|| defined (__SH4A__))
#error ""
#endif
} ""]
}
# Return 1 if target does stack only type of ISRs
proc check_effective_target_stack_save_isr { } {
return [check_no_compiler_messages stack_save_isr object {
#if !(defined (__SH1__) \
|| defined (__SH2__) \
|| defined (__SH2E__) \
|| defined (__SH2A__))
#error ""
#endif
} ""]
}
# Return 1 if target supports atomic-model=soft-gusa # Return 1 if target supports atomic-model=soft-gusa
proc check_effective_target_atomic_model_soft_gusa_available { } { proc check_effective_target_atomic_model_soft_gusa_available { } {
return [check_no_compiler_messages atomic_model_soft_gusa_available object { return [check_no_compiler_messages atomic_model_soft_gusa_available object {
......
/* Testcase to check generation of a SH2A specific instruction for /* Testcase to check generation of a SH2A specific instruction for
"BAND.B #imm3, @(disp12, Rn)". */ "BAND.B #imm3, @(disp12, Rn)". */
/* { dg-do assemble } */ /* { dg-do compile { target { sh2a } } } */
/* { dg-options "-O1 -mbitops" } */ /* { dg-options "-O1 -mbitops" } */
/* { dg-skip-if "" { "sh*-*-*" } "*" "-m2a -m2a-nofpu -m2a-single -m2a-single-only" } */
/* { dg-final { scan-assembler "band.b"} } */ /* { dg-final { scan-assembler "band.b"} } */
volatile struct volatile struct
......
/* Testcase to check generation of a SH2A specific instruction /* Testcase to check generation of a SH2A specific instruction
'BCLR #imm3,Rn'. */ 'BCLR #imm3,Rn'. */
/* { dg-do assemble } */ /* { dg-do compile { target { sh2a } } } */
/* { dg-options "-O1" } */ /* { dg-options "-O1" } */
/* { dg-skip-if "" { "sh*-*-*" } "*" "-m2a -m2a-nofpu -m2a-single -m2a-single-only" } */
/* { dg-final { scan-assembler "bclr"} } */ /* { dg-final { scan-assembler "bclr"} } */
struct a struct a
......
/* Testcase to check generation of a SH2A specific instruction /* Testcase to check generation of a SH2A specific instruction
"BCLR #imm3,@(disp12,Rn)". */ "BCLR #imm3,@(disp12,Rn)". */
/* { dg-do assemble } */ /* { dg-do compile { target { sh2a } } } */
/* { dg-options "-O2 -mbitops" } */ /* { dg-options "-O2 -mbitops" } */
/* { dg-skip-if "" { "sh*-*-*" } "*" "-m2a -m2a-nofpu -m2a-single -m2a-single-only" } */
/* { dg-final { scan-assembler "bclr"} } */ /* { dg-final { scan-assembler "bclr"} } */
/* { dg-final { scan-assembler "bclr.b"} } */ /* { dg-final { scan-assembler "bclr.b"} } */
......
...@@ -4,9 +4,8 @@ ...@@ -4,9 +4,8 @@
BLD #imm3, Rn BLD #imm3, Rn
BLD.B #imm3, @(disp12, Rn) BLD.B #imm3, @(disp12, Rn)
*/ */
/* { dg-do assemble } */ /* { dg-do compile { target { sh2a } } } */
/* { dg-options "-Os -mbitops" } */ /* { dg-options "-Os -mbitops" } */
/* { dg-skip-if "" { "sh*-*-*" } "*" "-m2a -m2a-nofpu -m2a-single -m2a-single-only" } */
/* { dg-final { scan-assembler "bld"} } */ /* { dg-final { scan-assembler "bld"} } */
/* { dg-final { scan-assembler "bld.b"} } */ /* { dg-final { scan-assembler "bld.b"} } */
......
/* Testcase to check generation of a SH2A specific instruction for /* Testcase to check generation of a SH2A specific instruction for
"BOR.B #imm3, @(disp12, Rn)". */ "BOR.B #imm3, @(disp12, Rn)". */
/* { dg-do assemble } */ /* { dg-do compile { target { sh2a } } } */
/* { dg-options "-O1 -mbitops" } */ /* { dg-options "-O1 -mbitops" } */
/* { dg-skip-if "" { "sh*-*-*" } "*" "-m2a -m2a-nofpu -m2a-single -m2a-single-only" } */
/* { dg-final { scan-assembler "bor.b"} } */ /* { dg-final { scan-assembler "bor.b"} } */
volatile struct volatile struct
......
/* Testcase to check generation of a SH2A specific instruction /* Testcase to check generation of a SH2A specific instruction
'BSET #imm3,Rn'. */ 'BSET #imm3,Rn'. */
/* { dg-do assemble } */ /* { dg-do compile { target { sh2a } } } */
/* { dg-options "-O1" } */ /* { dg-options "-O1" } */
/* { dg-skip-if "" { "sh*-*-*" } "*" "-m2a -m2a-nofpu -m2a-single -m2a-single-only" } */
/* { dg-final { scan-assembler "bset"} } */ /* { dg-final { scan-assembler "bset"} } */
struct a struct a
......
/* Testcase to check generation of a SH2A specific instruction /* Testcase to check generation of a SH2A specific instruction
"BSET #imm3,@(disp12,Rn)". */ "BSET #imm3,@(disp12,Rn)". */
/* { dg-do assemble } */ /* { dg-do compile { target { sh2a } } } */
/* { dg-options "-O2 -mbitops" } */ /* { dg-options "-O2 -mbitops" } */
/* { dg-skip-if "" { "sh*-*-*" } "*" "-m2a -m2a-nofpu -m2a-single -m2a-single-only" } */
/* { dg-final { scan-assembler "bset"} } */ /* { dg-final { scan-assembler "bset"} } */
/* { dg-final { scan-assembler "bset.b"} } */ /* { dg-final { scan-assembler "bset.b"} } */
......
/* Testcase to check generation of a SH2A specific instruction for /* Testcase to check generation of a SH2A specific instruction for
"BXOR.B #imm3, @(disp12, Rn)". */ "BXOR.B #imm3, @(disp12, Rn)". */
/* { dg-do assemble } */ /* { dg-do compile { target { sh2a } } } */
/* { dg-options "-O1 -mbitops" } */ /* { dg-options "-O1 -mbitops" } */
/* { dg-skip-if "" { "sh*-*-*" } "*" "-m2a -m2a-nofpu -m2a-single -m2a-single-only" } */
/* { dg-final { scan-assembler "bxor.b"} } */ /* { dg-final { scan-assembler "bxor.b"} } */
volatile struct volatile struct
......
/* Testcase to check generation of a SH2A specific instruction for /* Testcase to check generation of a SH2A specific instruction for
'JSR/N @Rm'. */ 'JSR/N @Rm'. */
/* { dg-do assemble } */ /* { dg-do compile { target { sh2a } } } */
/* { dg-options "-O0" } */ /* { dg-options "-O0" } */
/* { dg-skip-if "" { "sh*-*-*" } "*" "-m2a -m2a-nofpu -m2a-single -m2a-single-only" } */
/* { dg-final { scan-assembler "jsr/n"} } */ /* { dg-final { scan-assembler "jsr/n"} } */
void foo(void) void foo(void)
......
/* Testcase to check generation of 'MOVI20S #imm20, Rn'. */ /* Testcase to check generation of 'MOVI20S #imm20, Rn'. */
/* { dg-do assemble } */ /* { dg-do compile { target { sh2a } } } */
/* { dg-options "-O0" } */ /* { dg-options "-O0" } */
/* { dg-skip-if "" { "sh*-*-*" } "*" "-m2a -m2a-nofpu -m2a-single -m2a-single-only" } */
/* { dg-final { scan-assembler "movi20s"} } */ /* { dg-final { scan-assembler "movi20s"} } */
volatile long la; volatile long la;
......
/* Testcase to check generation of a SH2A specific instruction for /* Testcase to check generation of a SH2A specific instruction for
'MOVRT Rn'. */ 'MOVRT Rn'. */
/* { dg-do assemble } */ /* { dg-do compile { target { sh2a } } } */
/* { dg-options "-O1" } */ /* { dg-options "-O1" } */
/* { dg-skip-if "" { "sh*-*-*" } "*" "-m2a -m2a-nofpu -m2a-single -m2a-single-only" } */ /* { dg-final { scan-assembler "movrt" } } */
/* { dg-final { scan-assembler "movrt"} } */
int int
foo (void) foo (void)
......
/* Test for resbank attribute. */ /* Test for resbank attribute. */
/* { dg-do assemble } */ /* { dg-do compile { target { sh2a } } } */
/* { dg-skip-if "" { "sh*-*-*" } "*" "-m2a -m2a-nofpu -m2a-single -m2a-single-only" } */
/* { dg-final { scan-assembler "resbank" } } */ /* { dg-final { scan-assembler "resbank" } } */
extern void bar(void); extern void bar(void);
......
/* Testcase to check generation of a SH2A specific instruction for /* Testcase to check generation of a SH2A specific instruction for
'RTS/N'. */ 'RTS/N'. */
/* { dg-do assemble } */ /* { dg-do compile { target { sh2a } } } */
/* { dg-options "-O0" } */ /* { dg-options "-O0" } */
/* { dg-skip-if "" { "sh*-*-*" } "*" "-m2a -m2a-nofpu -m2a-single -m2a-single-only" } */
/* { dg-final { scan-assembler "rts/n"} } */ /* { dg-final { scan-assembler "rts/n"} } */
void void
......
/* Testcase to check generation of a SH2A specific, /* Testcase to check generation of a SH2A specific,
TBR relative jump instruction - 'JSR @@(disp8,TBR)'. */ TBR relative jump instruction - 'JSR @@(disp8,TBR)'. */
/* { dg-do assemble } */ /* { dg-do compile { target { sh2a } } } */
/* { dg-options "" } */ /* { dg-options "" } */
/* { dg-skip-if "" { "sh*-*-*" } "*" "-m2a -m2a-nofpu -m2a-single -m2a-single-only" } */
/* { dg-final { scan-assembler-times "jsr/n\\t@@\\(40,tbr\\)" 1} } */ /* { dg-final { scan-assembler-times "jsr/n\\t@@\\(40,tbr\\)" 1} } */
/* { dg-final { scan-assembler-times "jsr/n\\t@@\\(72,tbr\\)" 1} } */ /* { dg-final { scan-assembler-times "jsr/n\\t@@\\(72,tbr\\)" 1} } */
......
/* Verify that we generate movua to load unaligned 32-bit values on SH4A. */ /* Verify that we generate movua to load unaligned 32-bit values on SH4A. */
/* { dg-do run } */ /* { dg-do run { target { sh4a } } } */
/* { dg-options "-O1 -save-temps -fno-inline" } */ /* { dg-options "-O1 -save-temps -fno-inline" } */
/* { dg-skip-if "" { "sh*-*-*" } { "*" } { "-m4a*" } } */
/* { dg-final { scan-assembler-times "movua.l" 6 } } */ /* { dg-final { scan-assembler-times "movua.l" 6 } } */
/* Aligned. */ /* Aligned. */
......
/* Verify that we generate single-precision sine and cosine approximate /* Verify that we generate single-precision sine and cosine approximate
(fsca) in fast math mode on SH4A with FPU. */ (fsca) in fast math mode on SH4A with FPU. */
/* { dg-do compile } */ /* { dg-do compile { target { sh4a && any_fpu } } } */
/* { dg-options "-O -ffast-math" } */ /* { dg-options "-O -ffast-math" } */
/* { dg-skip-if "" { "sh*-*-*" } { "*" } { "-m4a" "-m4a-single" "-m4a-single-only" } } */
/* { dg-final { scan-assembler "fsca" } } */ /* { dg-final { scan-assembler "fsca" } } */
#include <math.h> #include <math.h>
float test(float f) { return cosf(f); } float
test (float f)
{
return cosf (f);
}
/* Verify that we generate single-precision square root reciprocal /* Verify that we generate single-precision square root reciprocal
approximate (fsrra) in fast math mode on SH4A with FPU. */ approximate (fsrra) in fast math mode on SH4A with FPU. */
/* { dg-do compile } */ /* { dg-do compile { target { has_fsrra } } } */
/* { dg-options "-O -ffast-math" } */ /* { dg-options "-O -ffast-math" } */
/* { dg-skip-if "" { "sh*-*-*" } { "*" } { "-m4a" "-m4a-single" "-m4a-single-only" } } */
/* { dg-final { scan-assembler "fsrra" } } */ /* { dg-final { scan-assembler "fsrra" } } */
#include <math.h> #include <math.h>
float test(float f) { return 1 / sqrtf(f); } float
test (float f)
{
return 1 / sqrtf (f);
}
/* Verify that we generate movua to copy unaligned memory regions to /* Verify that we generate movua to copy unaligned memory regions to
32-bit-aligned addresses on SH4A. */ 32-bit-aligned addresses on SH4A. */
/* { dg-do compile { target "sh*-*-*" } } */ /* { dg-do compile { target { sh4a } } } */
/* { dg-options "-O" } */ /* { dg-options "-O" } */
/* { dg-skip-if "" { "sh*-*-*" } { "*" } { "-m4a" "-m4a-single" "-m4a-single-only" "-m4a-nofpu" } } */
/* { dg-final { scan-assembler-times "movua.l" 2 } } */ /* { dg-final { scan-assembler-times "movua.l" 2 } } */
#include <string.h> #include <string.h>
struct s { int i; char a[10], b[10]; } x; struct s { int i; char a[10], b[10]; } x;
int f() {
memcpy(x.a, x.b, 10);
}
int
f (void)
{
memcpy (x.a, x.b, 10);
}
/* Verify that we generate a single single-precision sine and cosine /* Verify that we generate a single single-precision sine and cosine
approximate (fsca) in fast math mode when a function computes both approximate (fsca) in fast math mode when a function computes both
sine and cosine. */ sine and cosine. */
/* { dg-do compile } */ /* { dg-do compile { target { sh4a && any_fpu } } } */
/* { dg-options "-O -ffast-math" } */ /* { dg-options "-O -ffast-math" } */
/* { dg-skip-if "" { "sh*-*-*" } { "*" } { "-m4a" "-m4a-single" "-m4a-single-only" } } */
/* { dg-final { scan-assembler-times "fsca" 1 } } */ /* { dg-final { scan-assembler-times "fsca" 1 } } */
#include <math.h> #include <math.h>
float test(float f) { return sinf(f) + cosf(f); } float
test (float f)
{
return sinf (f) + cosf (f);
}
/* Verify that we generate single-precision sine and cosine approximate /* Verify that we generate single-precision sine and cosine approximate
(fsca) in fast math mode on SH4A with FPU. */ (fsca) in fast math mode on SH4A with FPU. */
/* { dg-do compile } */ /* { dg-do compile { target { sh4a && any_fpu } } } */
/* { dg-options "-O -ffast-math" } */ /* { dg-options "-O -ffast-math" } */
/* { dg-skip-if "" { "sh*-*-*" } { "*" } { "-m4a" "-m4a-single" "-m4a-single-only" } } */
/* { dg-final { scan-assembler "fsca" } } */ /* { dg-final { scan-assembler "fsca" } } */
#include <math.h> #include <math.h>
float test(float f) { return sinf(f); } float
test (float f)
{
return sinf (f);
}
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