Commit 4653da0b by Claudiu Zissulescu Committed by Claudiu Zissulescu

[ARC] Don't split ior/mov predicated insns.

Do not split long immediate constants for predicated instructions.

gcc/
xxxx-xx-xx  Claudiu Zissulescu  <claziss@synopsys.com>

	* config/arc/arc.c (arc_split_ior): Add asserts.
	(arc_split_mov_const): Likewise.
	(arc_check_ior_const): Do not match known short immediate values.
	* config/arc/arc.md (movsi): Don't split predicated instructions.
	(iorsi): Likewise.

testsuite/
xxxx-xx-xx  Claudiu Zissulescu  <claziss@synopsys.com>
	Sahahb Vahedi  <shahab@synopsys.com>
	Cupertino Miranda  <cmiranda@synopsys.com>

	* gcc.target/arc/or-cnst-size2.c: New test.

Co-Authored-By: Sahahb Vahedi <shahab@synopsys.com>

From-SVN: r277885
parent 4d932965
2019-11-06 Claudiu Zissulescu <claziss@synopsys.com> 2019-11-06 Claudiu Zissulescu <claziss@synopsys.com>
* config/arc/arc.c (arc_split_ior): Add asserts.
(arc_split_mov_const): Likewise.
(arc_check_ior_const): Do not match known short immediate values.
* config/arc/arc.md (movsi): Don't split predicated instructions
(iorsi): Likewise.
2019-11-06 Claudiu Zissulescu <claziss@synopsys.com>
* config/arc/arc.opt (mea): Update help string. * config/arc/arc.opt (mea): Update help string.
* doc/invoke.texi(ARC): Update mea option info. * doc/invoke.texi(ARC): Update mea option info.
...@@ -11495,8 +11495,10 @@ arc_split_ior (rtx *operands) ...@@ -11495,8 +11495,10 @@ arc_split_ior (rtx *operands)
emit_insn (gen_rtx_SET (operands[0], emit_insn (gen_rtx_SET (operands[0],
gen_rtx_IOR (SImode, op1, GEN_INT (maskx)))); gen_rtx_IOR (SImode, op1, GEN_INT (maskx))));
break; break;
default: case 0:
break; break;
default:
gcc_unreachable ();
} }
} }
...@@ -11506,6 +11508,10 @@ bool ...@@ -11506,6 +11508,10 @@ bool
arc_check_ior_const (HOST_WIDE_INT ival) arc_check_ior_const (HOST_WIDE_INT ival)
{ {
unsigned int mask = (unsigned int) (ival & 0xffffffff); unsigned int mask = (unsigned int) (ival & 0xffffffff);
if (UNSIGNED_INT6 (ival)
|| IS_POWEROF2_P (mask))
return false;
if (__builtin_popcount (mask) <= 3) if (__builtin_popcount (mask) <= 3)
return true; return true;
if (__builtin_popcount (mask & ~0x3f) <= 1) if (__builtin_popcount (mask & ~0x3f) <= 1)
...@@ -11527,9 +11533,6 @@ arc_split_mov_const (rtx *operands) ...@@ -11527,9 +11533,6 @@ arc_split_mov_const (rtx *operands)
gcc_assert (CONST_INT_P (operands[1])); gcc_assert (CONST_INT_P (operands[1]));
ival = INTVAL (operands[1]) & 0xffffffff; ival = INTVAL (operands[1]) & 0xffffffff;
if (SIGNED_INT12 (ival))
return false;
/* 1. Check if we can just rotate limm by 8 but using ROR8. */ /* 1. Check if we can just rotate limm by 8 but using ROR8. */
if (TARGET_BARREL_SHIFTER && TARGET_V2 if (TARGET_BARREL_SHIFTER && TARGET_V2
&& ((ival & ~0x3f000000) == 0)) && ((ival & ~0x3f000000) == 0))
...@@ -11596,7 +11599,7 @@ arc_split_mov_const (rtx *operands) ...@@ -11596,7 +11599,7 @@ arc_split_mov_const (rtx *operands)
return true; return true;
} }
return false; gcc_unreachable ();
} }
/* Helper to check Cax constraint. */ /* Helper to check Cax constraint. */
...@@ -11606,6 +11609,9 @@ arc_check_mov_const (HOST_WIDE_INT ival) ...@@ -11606,6 +11609,9 @@ arc_check_mov_const (HOST_WIDE_INT ival)
{ {
ival = ival & 0xffffffff; ival = ival & 0xffffffff;
if (SIGNED_INT12 (ival))
return false;
if ((ival & ~0x8000001f) == 0) if ((ival & ~0x8000001f) == 0)
return true; return true;
......
...@@ -816,8 +816,11 @@ core_3, archs4x, archs4xd, archs4xd_slow" ...@@ -816,8 +816,11 @@ core_3, archs4x, archs4xd, archs4xd_slow"
st%U0%V0\\t%1,%0 ;26 st%U0%V0\\t%1,%0 ;26
st%U0%V0\\t%1,%0 ;37 st%U0%V0\\t%1,%0 ;37
st%U0%V0\\t%1,%0 ;28" st%U0%V0\\t%1,%0 ;28"
"reload_completed && satisfies_constraint_Cax (operands[1]) "reload_completed
&& register_operand (operands[0], SImode)" && GET_CODE (PATTERN (insn)) != COND_EXEC
&& register_operand (operands[0], SImode)
&& IN_RANGE (REGNO (operands[0]) ^ 4, 4, 11)
&& satisfies_constraint_Cax (operands[1])"
[(const_int 0)] [(const_int 0)]
" "
arc_split_mov_const (operands); arc_split_mov_const (operands);
...@@ -3370,7 +3373,11 @@ core_3, archs4x, archs4xd, archs4xd_slow" ...@@ -3370,7 +3373,11 @@ core_3, archs4x, archs4xd, archs4xd_slow"
# #
or%?\\t%0,%1,%2 or%?\\t%0,%1,%2
or%?\\t%0,%1,%2" or%?\\t%0,%1,%2"
"reload_completed && satisfies_constraint_C0x (operands[2])" "reload_completed
&& GET_CODE (PATTERN (insn)) != COND_EXEC
&& register_operand (operands[0], SImode)
&& IN_RANGE (REGNO (operands[0]) ^ 4, 4, 11)
&& satisfies_constraint_C0x (operands[2])"
[(const_int 0)] [(const_int 0)]
" "
arc_split_ior (operands); arc_split_ior (operands);
......
2019-11-06 Claudiu Zissulescu <claziss@synopsys.com>
Sahahb Vahedi <shahab@synopsys.com>
Cupertino Miranda <cmiranda@synopsys.com
* gcc.target/arc/or-cnst-size2.c: New test.
2019-11-06 Richard Sandiford <richard.sandiford@arm.com> 2019-11-06 Richard Sandiford <richard.sandiford@arm.com>
* gcc.dg/vect/slp-9.c: Use scan-tree-dump rather than * gcc.dg/vect/slp-9.c: Use scan-tree-dump rather than
......
/* Check if we optimize the immediate of a predicated instruction. */
/* { dg-options "-Os -fif-conversion -fif-conversion2" } */
int a;
int foo (void)
{
if ((a & 60) == 0)
return a | 64;
}
/* { dg-final { scan-assembler "tst" } } */
/* { dg-final { scan-assembler "bset.eq" } } */
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