diff options
author | Claudiu Zissulescu <claziss@synopsys.com> | 2022-02-25 13:39:22 +0200 |
---|---|---|
committer | Claudiu Zissulescu <claziss@synopsys.com> | 2022-02-25 14:51:30 +0200 |
commit | d54cdd1538deebed97fb9531dc3e1a42eaf0a80f (patch) | |
tree | 14c2794f8ec5ffa4806ce8353335296262cedf16 /gcc | |
parent | e25dce501334053239dcc433e4c46ecbddbcb13e (diff) | |
download | gcc-d54cdd1538deebed97fb9531dc3e1a42eaf0a80f.zip gcc-d54cdd1538deebed97fb9531dc3e1a42eaf0a80f.tar.gz gcc-d54cdd1538deebed97fb9531dc3e1a42eaf0a80f.tar.bz2 |
arc: Fail conditional move expand patterns
If the movcc comparison is not valid it triggers an assert in the
current implementation. This behavior is not needed as we can FAIL
the movcc expand pattern.
gcc/
* config/arc/arc.cc (gen_compare_reg): Return NULL_RTX if the
comparison is not valid.
* config/arc/arc.md (movsicc): Fail if comparison is not valid.
(movdicc): Likewise.
(movsfcc): Likewise.
(movdfcc): Likewise.
Signed-off-by: Claudiu Zissulescu <claziss@synopsys.com>
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/config/arc/arc.cc | 3 | ||||
-rw-r--r-- | gcc/config/arc/arc.md | 25 |
2 files changed, 22 insertions, 6 deletions
diff --git a/gcc/config/arc/arc.cc b/gcc/config/arc/arc.cc index 8cc1735..c27ba99 100644 --- a/gcc/config/arc/arc.cc +++ b/gcc/config/arc/arc.cc @@ -2256,7 +2256,8 @@ gen_compare_reg (rtx comparison, machine_mode omode) cmode = GET_MODE (x); if (cmode == VOIDmode) cmode = GET_MODE (y); - gcc_assert (cmode == SImode || cmode == SFmode || cmode == DFmode); + if (cmode != SImode && cmode != SFmode && cmode != DFmode) + return NULL_RTX; if (cmode == SImode) { if (!register_operand (x, SImode)) diff --git a/gcc/config/arc/arc.md b/gcc/config/arc/arc.md index ace3cb7..39b3580 100644 --- a/gcc/config/arc/arc.md +++ b/gcc/config/arc/arc.md @@ -1618,8 +1618,11 @@ core_3, archs4x, archs4xd, archs4xd_slow" (match_operand:SI 2 "nonmemory_operand" "") (match_operand:SI 3 "register_operand" "")))] "" - "operands[1] = gen_compare_reg (operands[1], VOIDmode);") - + " + operands[1] = gen_compare_reg (operands[1], VOIDmode); + if (operands[1] == NULL_RTX) + FAIL; + ") (define_expand "movdicc" [(set (match_operand:DI 0 "dest_reg_operand" "") @@ -1627,7 +1630,11 @@ core_3, archs4x, archs4xd, archs4xd_slow" (match_operand:DI 2 "nonmemory_operand" "") (match_operand:DI 3 "register_operand" "")))] "" - "operands[1] = gen_compare_reg (operands[1], VOIDmode);") + " + operands[1] = gen_compare_reg (operands[1], VOIDmode); + if (operands[1] == NULL_RTX) + FAIL; + ") (define_expand "movsfcc" @@ -1636,7 +1643,11 @@ core_3, archs4x, archs4xd, archs4xd_slow" (match_operand:SF 2 "nonmemory_operand" "") (match_operand:SF 3 "register_operand" "")))] "" - "operands[1] = gen_compare_reg (operands[1], VOIDmode);") + " + operands[1] = gen_compare_reg (operands[1], VOIDmode); + if (operands[1] == NULL_RTX) + FAIL; + ") (define_expand "movdfcc" [(set (match_operand:DF 0 "dest_reg_operand" "") @@ -1644,7 +1655,11 @@ core_3, archs4x, archs4xd, archs4xd_slow" (match_operand:DF 2 "nonmemory_operand" "") (match_operand:DF 3 "register_operand" "")))] "" - "operands[1] = gen_compare_reg (operands[1], VOIDmode);") + " + operands[1] = gen_compare_reg (operands[1], VOIDmode); + if (operands[1] == NULL_RTX) + FAIL; + ") (define_insn "*movsicc_insn" [(set (match_operand:SI 0 "dest_reg_operand" "=w,w") |