From ad02b21deadf29ab0ab64aa18208b755a411991b Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Mon, 13 May 2013 19:14:26 +0200 Subject: [PATCH] re PR target/57264 (cld not emitted when string instructions used, and '-mcld' on command line) PR target/57264 Backport from mainline 2013-01-22 Jakub Jelinek PR target/55686 * config/i386/i386.md (UNSPEC_STOS): New. (strset_singleop, *strsetdi_rex_1, *strsetsi_1, *strsethi_1, *strsetqi_1): Add UNSPEC_STOS. testsuite/ChangeLog: PR target/57264 * gcc.target/i386/pr57264.c: New test. From-SVN: r198837 --- gcc/ChangeLog | 11 +++++++++++ gcc/config/i386/i386.md | 16 +++++++++++----- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.target/i386/pr57264.c | 18 ++++++++++++++++++ 4 files changed, 45 insertions(+), 5 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr57264.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 23e08670e25e..cd8552dd33c6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2013-05-13 Uros Bizjak + + PR target/57264 + Backport from mainline + 2013-01-22 Jakub Jelinek + + PR target/55686 + * config/i386/i386.md (UNSPEC_STOS): New. + (strset_singleop, *strsetdi_rex_1, *strsetsi_1, *strsethi_1, + *strsetqi_1): Add UNSPEC_STOS. + 2013-05-10 Joey Ye Backport from mainline diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index 627beee98f92..900252df781a 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -109,6 +109,7 @@ UNSPEC_CALL_NEEDS_VZEROUPPER UNSPEC_PAUSE UNSPEC_LEA_ADDR + UNSPEC_STOS ;; For SSE/MMX support: UNSPEC_FIX_NOTRUNC @@ -15912,7 +15913,8 @@ [(parallel [(set (match_operand 1 "memory_operand" "") (match_operand 2 "register_operand" "")) (set (match_operand 0 "register_operand" "") - (match_operand 3 "" ""))])] + (match_operand 3 "" "")) + (unspec [(const_int 0)] UNSPEC_STOS)])] "" "ix86_current_function_needs_cld = 1;") @@ -15921,7 +15923,8 @@ (match_operand:DI 2 "register_operand" "a")) (set (match_operand:DI 0 "register_operand" "=D") (plus:DI (match_dup 1) - (const_int 8)))] + (const_int 8))) + (unspec [(const_int 0)] UNSPEC_STOS)] "TARGET_64BIT && !(fixed_regs[AX_REG] || fixed_regs[DI_REG])" "stosq" @@ -15934,7 +15937,8 @@ (match_operand:SI 2 "register_operand" "a")) (set (match_operand:P 0 "register_operand" "=D") (plus:P (match_dup 1) - (const_int 4)))] + (const_int 4))) + (unspec [(const_int 0)] UNSPEC_STOS)] "!(fixed_regs[AX_REG] || fixed_regs[DI_REG])" "stos{l|d}" [(set_attr "type" "str") @@ -15946,7 +15950,8 @@ (match_operand:HI 2 "register_operand" "a")) (set (match_operand:P 0 "register_operand" "=D") (plus:P (match_dup 1) - (const_int 2)))] + (const_int 2))) + (unspec [(const_int 0)] UNSPEC_STOS)] "!(fixed_regs[AX_REG] || fixed_regs[DI_REG])" "stosw" [(set_attr "type" "str") @@ -15958,7 +15963,8 @@ (match_operand:QI 2 "register_operand" "a")) (set (match_operand:P 0 "register_operand" "=D") (plus:P (match_dup 1) - (const_int 1)))] + (const_int 1))) + (unspec [(const_int 0)] UNSPEC_STOS)] "!(fixed_regs[AX_REG] || fixed_regs[DI_REG])" "stosb" [(set_attr "type" "str") diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index db60bd739a98..eda744322b74 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-05-13 Uros Bizjak + + PR target/57264 + * gcc.target/i386/pr57264.c: New test. + 2013-05-07 Michael Meissner Backport from trunk diff --git a/gcc/testsuite/gcc.target/i386/pr57264.c b/gcc/testsuite/gcc.target/i386/pr57264.c new file mode 100644 index 000000000000..46fce7f04e56 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr57264.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -mcld" } */ + +void test (int x, int **pp) +{ + while (x) + { + int *ip = *pp; + int *op = *pp; + while (*ip) + { + int v = *ip++; + *op++ = v + 1; + } + } +} + +/* { dg-final { scan-assembler-not "stosl" } } */ -- 2.47.2