From ff1f317b3c1fdcfb061e20f3474f77c183189830 Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Wed, 9 Nov 2016 20:21:11 +0100 Subject: [PATCH] re PR target/78262 (wrong code with -fschedule-insns) PR target/78262 * config/i386/i386.md (*3_doubleword): Mark operand 0 as earlyclobber. testsuite/ChangeLog: PR target/78262 * gcc.target/i386/pr78262.c: New test. From-SVN: r242013 --- gcc/ChangeLog | 8 ++++++- gcc/config/i386/i386.md | 2 +- gcc/testsuite/ChangeLog | 5 ++++ gcc/testsuite/gcc.target/i386/pr78262.c | 32 +++++++++++++++++++++++++ 4 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr78262.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 28f64ed3e19..55c6e6f096e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-11-09 Uros Bizjak + + PR target/78262 + * config/i386/i386.md (*3_doubleword): Mark + operand 0 as earlyclobber. + 2016-11-09 Martin Liska * fold-const-call.c (fold_const_call): Fix up type of s0 and s1. @@ -107,7 +113,7 @@ * sanitizer.def (__asan_version_mismatch_check_v6): Replace with __asan_version_mismatch_check_v8. - 2016-11-08 David Edelsohn +2016-11-08 David Edelsohn * dwarf2asm.c (USE_LINKONCE_INDIRECT): Test XCOFF_DEBUGGING_INFO at runtime. diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index 6e0348de7bc..a5650a1ea14 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -10339,7 +10339,7 @@ "operands[2] = gen_lowpart (QImode, operands[2]);") (define_insn_and_split "*3_doubleword" - [(set (match_operand:DWI 0 "register_operand" "=r") + [(set (match_operand:DWI 0 "register_operand" "=&r") (any_shiftrt:DWI (match_operand:DWI 1 "register_operand" "0") (match_operand:QI 2 "nonmemory_operand" "c"))) (clobber (reg:CC FLAGS_REG))] diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7def8a781cd..bc80499f3d0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-11-09 Uros Bizjak + + PR target/78262 + * gcc.target/i386/pr78262.c: New test. + 2016-11-09 Fritz O. Reese PR fortran/78259 diff --git a/gcc/testsuite/gcc.target/i386/pr78262.c b/gcc/testsuite/gcc.target/i386/pr78262.c new file mode 100644 index 00000000000..a0ead417191 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr78262.c @@ -0,0 +1,32 @@ +/* { dg-do run } */ +/* { dg-require-effective-target int128 } */ +/* { dg-options "-O -fschedule-insns" } */ + +typedef unsigned char u8; +typedef unsigned __int128 u128; + +static u128 u128_0; +static u128 *p128; + +u128 __attribute__ ((noinline, noclone)) +foo(u8 u8_0) +{ + p128 = &u128_0; + u128_0 = u8_0; + u128_0 = u128_0 << 127 | u128_0 >> 1; + u128_0 >>= (u8)u128_0; + return 2 + u128_0; +} + +int +main() +{ + u128 x = foo(5); + if (p128 != &u128_0) + __builtin_abort(); + if (u128_0 != ((u128)2 << 124)) + __builtin_abort(); + if (x != ((u128)2 << 124) + 2) + __builtin_abort(); + return 0; +} -- 2.30.2