public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug middle-end/41738] New: optabs expands rotate using wrong mode @ 2009-10-17 14:39 hutchinsonandy at gcc dot gnu dot org 2009-10-17 15:05 ` [Bug middle-end/41738] " rguenth at gcc dot gnu dot org ` (6 more replies) 0 siblings, 7 replies; 8+ messages in thread From: hutchinsonandy at gcc dot gnu dot org @ 2009-10-17 14:39 UTC (permalink / raw) To: gcc-bugs I have been adding rotate capability to AVR port and have come this bug in optabs.c: expand_binop() This occurs during a rotate expansion. For example target = op0 rotated by op1 In the particular situation (code extract below) it tries a reverse rotate of (bits - op1). Where this expression is then expanded into an integer, a negation or subtraction depending on type of op1 and target. The expansion of the subtraction is using the mode of the target - it should be using the mode of op1. The mode of the rotation amount need not be the same as the target. target:DI = Op0:DI rotate op1:HI In my testcase it is not and I get asserts latter in simplfy_rtx with the mismatched inner/outer modes. The negation mode looks equally wrong. I found this on testcase 20010226-1.c with gcc 4.42 (line 55) - however, it would appear to be on 4.5 and perhaps earlier versions. Revision 126370 added this particular code to optabs.c in July 2007 /* If we were trying to rotate, and that didn't work, try rotating the other direction before falling back to shifts and bitwise-or. */ if (((binoptab == rotl_optab && optab_handler (rotr_optab, mode)->insn_code != CODE_FOR_nothing) || (binoptab == rotr_optab && optab_handler (rotl_optab, mode)->insn_code != CODE_FOR_nothing)) && mclass == MODE_INT) { optab otheroptab = (binoptab == rotl_optab ? rotr_optab : rotl_optab); rtx newop1; unsigned int bits = GET_MODE_BITSIZE (mode); if (CONST_INT_P (op1)) newop1 = GEN_INT (bits - INTVAL (op1)); else if (targetm.shift_truncation_mask (mode) == bits - 1) newop1 = negate_rtx (mode, op1); else newop1 = expand_binop (mode, sub_optab, GEN_INT (bits), op1, NULL_RTX, unsignedp, OPTAB_DIRECT); -- Summary: optabs expands rotate using wrong mode Product: gcc Version: 4.4.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: hutchinsonandy at gcc dot gnu dot org GCC host triplet: i686-pc-linux-gnu GCC target triplet: avr-unknown-none http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41738 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/41738] optabs expands rotate using wrong mode 2009-10-17 14:39 [Bug middle-end/41738] New: optabs expands rotate using wrong mode hutchinsonandy at gcc dot gnu dot org @ 2009-10-17 15:05 ` rguenth at gcc dot gnu dot org 2009-10-17 22:42 ` hutchinsonandy at gcc dot gnu dot org ` (5 subsequent siblings) 6 siblings, 0 replies; 8+ messages in thread From: rguenth at gcc dot gnu dot org @ 2009-10-17 15:05 UTC (permalink / raw) To: gcc-bugs ------- Comment #1 from rguenth at gcc dot gnu dot org 2009-10-17 15:04 ------- Confirmed. -- rguenth at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Keywords| |wrong-code Last reconfirmed|0000-00-00 00:00:00 |2009-10-17 15:04:59 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41738 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/41738] optabs expands rotate using wrong mode 2009-10-17 14:39 [Bug middle-end/41738] New: optabs expands rotate using wrong mode hutchinsonandy at gcc dot gnu dot org 2009-10-17 15:05 ` [Bug middle-end/41738] " rguenth at gcc dot gnu dot org @ 2009-10-17 22:42 ` hutchinsonandy at gcc dot gnu dot org 2009-10-17 22:45 ` hutchinsonandy at gcc dot gnu dot org ` (4 subsequent siblings) 6 siblings, 0 replies; 8+ messages in thread From: hutchinsonandy at gcc dot gnu dot org @ 2009-10-17 22:42 UTC (permalink / raw) To: gcc-bugs ------- Comment #2 from hutchinsonandy at gcc dot gnu dot org 2009-10-17 22:42 ------- Subject: Bug 41738 Author: hutchinsonandy Date: Sat Oct 17 22:42:17 2009 New Revision: 152961 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=152961 Log: 2009-10-17 Andy Hutchinson <hutchinsonandy@gcc.gnu.org> PR middle-end/41738 * optabs.c (expand_binop): Make mode of shift count expression mode of shift count not target. Remove indent nit. Modified: trunk/gcc/ChangeLog trunk/gcc/optabs.c -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41738 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/41738] optabs expands rotate using wrong mode 2009-10-17 14:39 [Bug middle-end/41738] New: optabs expands rotate using wrong mode hutchinsonandy at gcc dot gnu dot org 2009-10-17 15:05 ` [Bug middle-end/41738] " rguenth at gcc dot gnu dot org 2009-10-17 22:42 ` hutchinsonandy at gcc dot gnu dot org @ 2009-10-17 22:45 ` hutchinsonandy at gcc dot gnu dot org 2009-11-22 19:04 ` hutchinsonandy at gcc dot gnu dot org ` (3 subsequent siblings) 6 siblings, 0 replies; 8+ messages in thread From: hutchinsonandy at gcc dot gnu dot org @ 2009-10-17 22:45 UTC (permalink / raw) To: gcc-bugs -- hutchinsonandy at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |4.4.3 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41738 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/41738] optabs expands rotate using wrong mode 2009-10-17 14:39 [Bug middle-end/41738] New: optabs expands rotate using wrong mode hutchinsonandy at gcc dot gnu dot org ` (2 preceding siblings ...) 2009-10-17 22:45 ` hutchinsonandy at gcc dot gnu dot org @ 2009-11-22 19:04 ` hutchinsonandy at gcc dot gnu dot org 2010-01-21 13:19 ` jakub at gcc dot gnu dot org ` (2 subsequent siblings) 6 siblings, 0 replies; 8+ messages in thread From: hutchinsonandy at gcc dot gnu dot org @ 2009-11-22 19:04 UTC (permalink / raw) To: gcc-bugs ------- Comment #3 from hutchinsonandy at gcc dot gnu dot org 2009-11-22 19:04 ------- Fixed 4.5 Back port needed. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41738 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/41738] optabs expands rotate using wrong mode 2009-10-17 14:39 [Bug middle-end/41738] New: optabs expands rotate using wrong mode hutchinsonandy at gcc dot gnu dot org ` (3 preceding siblings ...) 2009-11-22 19:04 ` hutchinsonandy at gcc dot gnu dot org @ 2010-01-21 13:19 ` jakub at gcc dot gnu dot org 2010-04-30 8:57 ` [Bug middle-end/41738] [4.3/4.4 Regression] " jakub at gcc dot gnu dot org 2010-09-20 3:06 ` eric dot weddington at atmel dot com 6 siblings, 0 replies; 8+ messages in thread From: jakub at gcc dot gnu dot org @ 2010-01-21 13:19 UTC (permalink / raw) To: gcc-bugs -- jakub at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|4.4.3 |4.4.4 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41738 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/41738] [4.3/4.4 Regression] optabs expands rotate using wrong mode 2009-10-17 14:39 [Bug middle-end/41738] New: optabs expands rotate using wrong mode hutchinsonandy at gcc dot gnu dot org ` (4 preceding siblings ...) 2010-01-21 13:19 ` jakub at gcc dot gnu dot org @ 2010-04-30 8:57 ` jakub at gcc dot gnu dot org 2010-09-20 3:06 ` eric dot weddington at atmel dot com 6 siblings, 0 replies; 8+ messages in thread From: jakub at gcc dot gnu dot org @ 2010-04-30 8:57 UTC (permalink / raw) To: gcc-bugs -- jakub at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|4.4.4 |4.4.5 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41738 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/41738] [4.3/4.4 Regression] optabs expands rotate using wrong mode 2009-10-17 14:39 [Bug middle-end/41738] New: optabs expands rotate using wrong mode hutchinsonandy at gcc dot gnu dot org ` (5 preceding siblings ...) 2010-04-30 8:57 ` [Bug middle-end/41738] [4.3/4.4 Regression] " jakub at gcc dot gnu dot org @ 2010-09-20 3:06 ` eric dot weddington at atmel dot com 6 siblings, 0 replies; 8+ messages in thread From: eric dot weddington at atmel dot com @ 2010-09-20 3:06 UTC (permalink / raw) To: gcc-bugs ------- Comment #4 from eric dot weddington at atmel dot com 2010-09-20 03:05 ------- Closing as fixed in 4.5.0. -- eric dot weddington at atmel dot com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED Target Milestone|4.4.5 |4.5.0 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41738 ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2010-09-20 3:06 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2009-10-17 14:39 [Bug middle-end/41738] New: optabs expands rotate using wrong mode hutchinsonandy at gcc dot gnu dot org 2009-10-17 15:05 ` [Bug middle-end/41738] " rguenth at gcc dot gnu dot org 2009-10-17 22:42 ` hutchinsonandy at gcc dot gnu dot org 2009-10-17 22:45 ` hutchinsonandy at gcc dot gnu dot org 2009-11-22 19:04 ` hutchinsonandy at gcc dot gnu dot org 2010-01-21 13:19 ` jakub at gcc dot gnu dot org 2010-04-30 8:57 ` [Bug middle-end/41738] [4.3/4.4 Regression] " jakub at gcc dot gnu dot org 2010-09-20 3:06 ` eric dot weddington at atmel dot com
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).