Commit d37a91e5 by Jakub Jelinek Committed by Jakub Jelinek

re PR target/86314 (GCC 7.x and 8.x zero out "eax" before using "rax" in "lock bts")

	PR target/86314
	* config/i386/i386.md (setcc + movzbl to xor + setcc peephole2s):
	Check reg_overlap_mentioned_p in addition to reg_set_p with the same
	operands.

	* gcc.dg/pr86314.c: New test.

From-SVN: r262141
parent f0391511
2018-06-26 Jakub Jelinek <jakub@redhat.com>
PR target/86314
* config/i386/i386.md (setcc + movzbl to xor + setcc peephole2s):
Check reg_overlap_mentioned_p in addition to reg_set_p with the same
operands.
2018-06-26 Richard Biener <rguenther@suse.de>
PR tree-optimization/86287
......
......@@ -12761,6 +12761,7 @@
"(peep2_reg_dead_p (3, operands[1])
|| operands_match_p (operands[1], operands[3]))
&& ! reg_overlap_mentioned_p (operands[3], operands[0])
&& ! reg_overlap_mentioned_p (operands[3], operands[4])
&& ! reg_set_p (operands[3], operands[4])
&& peep2_regno_dead_p (0, FLAGS_REG)"
[(parallel [(set (match_dup 5) (match_dup 0))
......@@ -12786,6 +12787,7 @@
|| operands_match_p (operands[2], operands[4]))
&& ! reg_overlap_mentioned_p (operands[4], operands[0])
&& ! reg_overlap_mentioned_p (operands[4], operands[1])
&& ! reg_overlap_mentioned_p (operands[4], operands[5])
&& ! reg_set_p (operands[4], operands[5])
&& refers_to_regno_p (FLAGS_REG, operands[1], (rtx *)NULL)
&& peep2_regno_dead_p (0, FLAGS_REG)"
......@@ -12835,6 +12837,7 @@
"(peep2_reg_dead_p (3, operands[1])
|| operands_match_p (operands[1], operands[3]))
&& ! reg_overlap_mentioned_p (operands[3], operands[0])
&& ! reg_overlap_mentioned_p (operands[3], operands[4])
&& ! reg_set_p (operands[3], operands[4])
&& peep2_regno_dead_p (0, FLAGS_REG)"
[(parallel [(set (match_dup 5) (match_dup 0))
......@@ -12861,6 +12864,7 @@
|| operands_match_p (operands[2], operands[4]))
&& ! reg_overlap_mentioned_p (operands[4], operands[0])
&& ! reg_overlap_mentioned_p (operands[4], operands[1])
&& ! reg_overlap_mentioned_p (operands[4], operands[5])
&& ! reg_set_p (operands[4], operands[5])
&& refers_to_regno_p (FLAGS_REG, operands[1], (rtx *)NULL)
&& peep2_regno_dead_p (0, FLAGS_REG)"
......
2018-06-26 Jakub Jelinek <jakub@redhat.com>
PR target/86314
* gcc.dg/pr86314.c: New test.
PR debug/86257
* gcc.target/i386/pr86257.c: Add -mtls-dialect=gnu to dg-options.
......
// PR target/86314
// { dg-do run { target sync_int_long } }
// { dg-options "-O2" }
__attribute__((noinline, noclone)) unsigned long
foo (unsigned long *p)
{
unsigned long m = 1UL << ((*p & 1) ? 1 : 0);
unsigned long n = __atomic_fetch_or (p, m, __ATOMIC_SEQ_CST);
return (n & m) == 0;
}
int
main ()
{
unsigned long v = 1;
if (foo (&v) != 1)
__builtin_abort ();
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment