diff options
author | Kyrylo Tkachov <kyrylo.tkachov@arm.com> | 2016-04-08 09:39:44 +0000 |
---|---|---|
committer | Kyrylo Tkachov <ktkachov@gcc.gnu.org> | 2016-04-08 09:39:44 +0000 |
commit | bae7adda10c0e1d813ebb602a719ca66ff16fae9 (patch) | |
tree | eb144d97f0e4370882793d9dfeab03680e68ba79 /gcc | |
parent | 211f3d57b17a275835d37b631591efbd1b446a46 (diff) | |
download | gcc-bae7adda10c0e1d813ebb602a719ca66ff16fae9.zip gcc-bae7adda10c0e1d813ebb602a719ca66ff16fae9.tar.gz gcc-bae7adda10c0e1d813ebb602a719ca66ff16fae9.tar.bz2 |
[ARM] PR target/70566 Check that condition register is dead in tst-imm -> lsls-imm Thumb2 peepholes
PR target/70566
* config/arm/thumb2.md (tst + branch-> lsls + branch
peephole below *orsi_not_shiftsi_si): Require that condition
register is dead after the peephole.
(second peephole after the above): Likewise.
* gcc.c-torture/execute/pr70566.c: New test.
From-SVN: r234825
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/config/arm/thumb2.md | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/execute/pr70566.c | 47 |
4 files changed, 64 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 980ae25..7fe1c42 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2016-04-08 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + PR target/70566 + * config/arm/thumb2.md (tst + branch-> lsls + branch + peephole below *orsi_not_shiftsi_si): Require that condition + register is dead after the peephole. + (second peephole after the above): Likewise. + 2016-04-08 Alan Modra <amodra@gmail.com> PR target/70117 diff --git a/gcc/config/arm/thumb2.md b/gcc/config/arm/thumb2.md index 9925365..ab08288 100644 --- a/gcc/config/arm/thumb2.md +++ b/gcc/config/arm/thumb2.md @@ -1550,7 +1550,8 @@ (match_operand 5 "" "") (match_operand 6 "" "")))] "TARGET_THUMB2 - && (INTVAL (operands[2]) >= 0 && INTVAL (operands[2]) < 32)" + && (INTVAL (operands[2]) >= 0 && INTVAL (operands[2]) < 32) + && peep2_reg_dead_p (2, operands[0])" [(parallel [(set (match_dup 0) (compare:CC_NOOV (ashift:SI (match_dup 1) (match_dup 2)) (const_int 0))) @@ -1578,7 +1579,8 @@ (match_operand 5 "" "") (match_operand 6 "" "")))] "TARGET_THUMB2 - && (INTVAL (operands[2]) > 0 && INTVAL (operands[2]) < 32)" + && (INTVAL (operands[2]) > 0 && INTVAL (operands[2]) < 32) + && peep2_reg_dead_p (2, operands[0])" [(parallel [(set (match_dup 0) (compare:CC_NOOV (ashift:SI (match_dup 1) (match_dup 2)) (const_int 0))) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bd77314..2668b0d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-04-08 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + PR target/70566 + * gcc.c-torture/execute/pr70566.c: New test. + 2016-04-08 Tom de Vries <tom@codesourcery.com> * c-c++-common/goacc/uninit-copy-clause.c: New test. diff --git a/gcc/testsuite/gcc.c-torture/execute/pr70566.c b/gcc/testsuite/gcc.c-torture/execute/pr70566.c new file mode 100644 index 0000000..f47106e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr70566.c @@ -0,0 +1,47 @@ +/* PR target/70566. */ + +#define NULL 0 + +struct mystruct +{ + unsigned int f1 : 1; + unsigned int f2 : 1; + unsigned int f3 : 1; +}; + +__attribute__ ((noinline)) void +myfunc (int a, void *b) +{ +} +__attribute__ ((noinline)) int +myfunc2 (void *a) +{ + return 0; +} + +static void +set_f2 (struct mystruct *user, int f2) +{ + if (user->f2 != f2) + myfunc (myfunc2 (NULL), NULL); + else + __builtin_abort (); +} + +__attribute__ ((noinline)) void +foo (void *data) +{ + struct mystruct *user = data; + if (!user->f2) + set_f2 (user, 1); +} + +int +main (void) +{ + struct mystruct a; + a.f1 = 1; + a.f2 = 0; + foo (&a); + return 0; +} |