From cdabf11564339deb4f2cbc9d7f82d05f474587ef Mon Sep 17 00:00:00 2001 From: sebastianperta Date: Fri, 9 Feb 2018 17:43:11 +0000 Subject: [PATCH] 2018-02-09 Sebastian Perta *config/rx.md: updated "movsicc" expand to be matched by GCC *testsuite/gcc.target/rx/movsicc.c: new test case git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@257533 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 ++ gcc/config/rx/rx.md | 7 ++- gcc/testsuite/gcc.target/rx/movsicc.c | 94 +++++++++++++++++++++++++++++++++++ 3 files changed, 105 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/rx/movsicc.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c42ffa648bc..7f198589476 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2018-02-09 Sebastian Perta + + *config/rx.md: updated "movsicc" expand to be matched by GCC + *testsuite/gcc.target/rx/movsicc.c: new test case + 2018-02-09 Peter Bergner PR target/83926 diff --git a/gcc/config/rx/rx.md b/gcc/config/rx/rx.md index 35263b1adc7..3fb2ac854b0 100644 --- a/gcc/config/rx/rx.md +++ b/gcc/config/rx/rx.md @@ -733,12 +733,17 @@ (define_expand "movsicc" [(parallel [(set (match_operand:SI 0 "register_operand") - (if_then_else:SI (match_operand:SI 1 "comparison_operator") + (if_then_else:SI (match_operand 1 "comparison_operator") (match_operand:SI 2 "nonmemory_operand") (match_operand:SI 3 "nonmemory_operand"))) (clobber (reg:CC CC_REG))])] "" { + /* Make sure that we have an integer comparison... */ + if (GET_MODE (XEXP (operands[1], 0)) != CCmode + && GET_MODE (XEXP (operands[1], 0)) != SImode) + FAIL; + /* One operand must be a constant or a register, the other must be a register. */ if ( ! CONSTANT_P (operands[2]) && ! CONSTANT_P (operands[3]) diff --git a/gcc/testsuite/gcc.target/rx/movsicc.c b/gcc/testsuite/gcc.target/rx/movsicc.c new file mode 100644 index 00000000000..d8e6bcc3055 --- /dev/null +++ b/gcc/testsuite/gcc.target/rx/movsicc.c @@ -0,0 +1,94 @@ +/* { dg-do compile } */ +/* { dg-options "-Os" } */ + +typedef unsigned char u8; +typedef unsigned short u16; +signed int Xa, Xb; + +signed int stzreg_beq(int i, int a, int b) +{ + signed int x; + x = a; + if (i) + x = b; + return x; +} + +/* { dg-final { scan-assembler "bne 1f" } } */ + +signed int stzreg_bge(int i, int a, int b, int c) +{ + signed int x; + x = a; + if (i0) + x = b; + return x; +} + +/* { dg-final { scan-assembler "bgt 1f" } } */ + +signed int stzreg_blt(int i, int a, int b) +{ + signed int x; + x = a; + if (i<0) + x = b; + return x; +} + +/* { dg-final { scan-assembler "blt 1f" } } */ + +signed int stzreg_bne(int i, int a, int b) +{ + signed int x; + x = a; + if (!i) + x = b; + return x; +} + +/* { dg-final { scan-assembler "beq 1f" } } */ + +signed int stzimm_le( int i, int a ) +{ + signed int x; + x = a; + if (i>0) + x = 5; + return x; +} + +/* { dg-final { scan-assembler "ble 1f" } } */ + +signed int stzimm_le_r( int i, int a ) +{ + signed int x; + x = a; + if (i<0) + x = 5; + return x; +} + +/* { dg-final { scan-assembler "bge 1f" } } */ -- 2.11.4.GIT