From: Kyrylo Tkachov Date: Wed, 28 Mar 2018 10:38:36 +0000 (+0000) Subject: [arm] PR target/85026: Fix ldrsh length estimate in Thumb state X-Git-Tag: releases/gcc-6.5.0~415 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b10d4e2f653f0acfc7af9d57361fb1a370ec90f7;p=thirdparty%2Fgcc.git [arm] PR target/85026: Fix ldrsh length estimate in Thumb state Backport from mainline 2018-03-23 Kyrylo Tkachov PR target/85026 * config/arm/arm.md (unaligned_loadhis): Remove first alternative. Clean up attributes. * g++.dg/pr85026.C: New test. From-SVN: r258918 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8acb3088d462..6c33f9f143ff 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2018-03-28 Kyrylo Tkachov + + Backport from mainline + 2018-03-23 Kyrylo Tkachov + + PR target/85026 + * config/arm/arm.md (unaligned_loadhis): Remove first alternative. + Clean up attributes. + 2018-03-28 Segher Boessenkool Backport from mainline diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md index 86df1c0366be..9462ba72c4ef 100644 --- a/gcc/config/arm/arm.md +++ b/gcc/config/arm/arm.md @@ -4247,16 +4247,13 @@ (set_attr "type" "load1")]) (define_insn "unaligned_loadhis" - [(set (match_operand:SI 0 "s_register_operand" "=l,r") + [(set (match_operand:SI 0 "s_register_operand" "=r") (sign_extend:SI - (unspec:HI [(match_operand:HI 1 "memory_operand" "Uw,Uh")] + (unspec:HI [(match_operand:HI 1 "memory_operand" "Uh")] UNSPEC_UNALIGNED_LOAD)))] "unaligned_access" "ldrsh%?\t%0, %1\t@ unaligned" - [(set_attr "arch" "t2,any") - (set_attr "length" "2,4") - (set_attr "predicable" "yes") - (set_attr "predicable_short_it" "yes,no") + [(set_attr "predicable" "yes") (set_attr "type" "load_byte")]) (define_insn "unaligned_loadhiu" diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3978f6ddbb08..a9da15358b83 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2018-03-28 Kyrylo Tkachov + + Backport from mainline + 2018-03-23 Kyrylo Tkachov + + PR target/85026 + * g++.dg/pr85026.C: New test. + 2018-03-28 Segher Boessenkool Backport from mainline diff --git a/gcc/testsuite/g++.dg/pr85026.C b/gcc/testsuite/g++.dg/pr85026.C new file mode 100644 index 000000000000..e1e3ccd2e354 --- /dev/null +++ b/gcc/testsuite/g++.dg/pr85026.C @@ -0,0 +1,61 @@ +/* PR target/85026. */ +/* { dg-do assemble } */ +/* { dg-options "-O2 -std=gnu++11" } */ + +template class a; +class b; +struct c { + typedef a &g; +}; +template struct e { typedef typename d::f iter; }; +class h { +public: + void __attribute__((noreturn)) i(); +} ab; +template class a { +public: + typedef b *f; + b &operator[](unsigned m) { + if (ac) + ab.i(); + return ad[m]; + } + f n() { return ad; } + f m_fn3(); + b *ad; + unsigned ac; +}; +class b { +public: + short j; + short k; + signed l; +} __attribute__((__packed__)); +void o(a &m, b &p2, b &p) { + p2 = p = m[0]; + if (bool at = false) + ; + else + for (c::g au(m);; at = true) + if (bool av = false) + ; + else + for (e>::iter aw = au.n(), ax = au.m_fn3(); ax; + av ? (void)0 : (void)0) + if (bool ay = 0) + ; + else + for (b az = *aw; !ay; ay = true) { + if (p2.j) + p2.j = az.j; + else if (p.j) + p.j = az.j; + if (p2.k) + p2.k = az.k; + else if (az.k > p.k) + p.k = az.k; + if (az.l < p2.l) + if (az.l > p.l) + p.l = az.l; + } +}