* [committed] Fix ICE due to bogus operand predicate in H8 port peepholes
@ 2018-12-03 15:21 Jeff Law
0 siblings, 0 replies; only message in thread
From: Jeff Law @ 2018-12-03 15:21 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 992 bytes --]
This is a bit more interesting than the last H8 fix.
The H8 has peepholes to optimize masking a value down to a byte. They
rely on using gen_lowpart to extract the low byte value of the source
operand which works well on the H8 because accessing the low byte of a
reg is particularly cheap. THey also work on memory operands.
These peepholes don't really work on symbolic operands. And if one
makes it into the peephole we'll abort in gen_lowpart.
Anyway, the peepholes currently accept "general_operand", which of
course allows those problematical symbolic operands. Changing the
operand to "nonimmediate_operand" resolves the issue. Note that
compile-time constants aren't really a concern here as the expression
would have already been simplified.
This fixes a half-dozen failures in the H8 testsuite. More importantly
it makes it less likely that a test will suddenly fail because of
improvements to constant propagation or forward propagation.
Installing on the trunk.
Jeff
[-- Attachment #2: P --]
[-- Type: text/plain, Size: 1157 bytes --]
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index bde3cd4f042..be0aab2c876 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2018-12-03 Jeff Law <law@redhat.com>
+
+ * config/h8300/h8300.md (low byte masking peepholes): Only accept
+ nonimmediate_operand for the to-be-masked operand.
+
2018-12-03 Richard Biener <rguenther@suse.de>
* tree-ssa-sccvn.c (eliminate_dom_walker::eliminate_stmt): Only
diff --git a/gcc/config/h8300/h8300.md b/gcc/config/h8300/h8300.md
index b3ba7e0f719..9e8f7159846 100644
--- a/gcc/config/h8300/h8300.md
+++ b/gcc/config/h8300/h8300.md
@@ -4647,7 +4647,7 @@
(define_peephole2
[(set (match_operand:SI 0 "register_operand" "")
- (match_operand:SI 1 "general_operand" ""))
+ (match_operand:SI 1 "nonimmediate_operand" ""))
(set (match_dup 0)
(and:SI (match_dup 0)
(const_int 255)))]
@@ -4666,7 +4666,7 @@
(define_peephole2
[(set (match_operand 0 "register_operand" "")
- (match_operand 1 "general_operand" ""))
+ (match_operand 1 "nonimmediate_operand" ""))
(set (match_operand:SI 2 "register_operand" "")
(and:SI (match_dup 2)
(match_operand:SI 3 "const_int_qi_operand" "")))]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2018-12-03 15:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-03 15:21 [committed] Fix ICE due to bogus operand predicate in H8 port peepholes Jeff Law
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).