public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/97170] New: Wrong optimization in fwprop pass
@ 2020-09-23 5:36 rjiejie at me dot com
2020-09-23 5:49 ` [Bug rtl-optimization/97170] " pinskia at gcc dot gnu.org
2020-09-23 8:08 ` rjiejie at me dot com
0 siblings, 2 replies; 3+ messages in thread
From: rjiejie at me dot com @ 2020-09-23 5:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97170
Bug ID: 97170
Summary: Wrong optimization in fwprop pass
Product: gcc
Version: 8.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: rtl-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: rjiejie at me dot com
Target Milestone: ---
insn seqs:
s1:
__builtin_set_float_convert_mode(0);
r1 = __builtin_load(a1, a2);
r2 = __builtin_float_convert(r1);
__builtin_store(a3, r2);
__builtin_set_float_convert_mode(0);
s2:
__builtin_set_float_convert_mode(1);
r1 = __builtin_load(a1, a2);
r2 = __builtin_float_convert(r1);
__builtin_store(a3, r2);
__builtin_set_float_convert_mode(0);
the diference of s1 and s2 only is "__builtin_set_float_convert_mode"
from beginning, the s1 mode is set 0, but s2 mode is set 1.
from optimization 'fwprop', the s2 insns seqs is deleted
as dead code, is it gcc bug ?
builtin patten of __builtin_set_float_convert_mode:
(define_insn "target_fcvtmode"
[(set (reg:SI FCVTMODE_REGNUM)
(unspec_volatile:SI [(match_operand:SI 0 "csr_operand" "rK")]
UNSPECV_FCVTMODE))]
""
"fcvtmode\t%1"
)
builtin patten of __builtin_set_float_convert_mode:
(define_insn "target_fcvt"
[(set (match_operand:SI 0 "register_operand" "=r")
(unspec:SI [(match_operand:SF 1 "register_operand" "f")]
UNSPEC_FCVT))
(use (reg:SI FCVTMODE_REGNUM))]
""
"fcvt\t%0,%1"
)
As far as i know, __builtin_set_float_convert_mode depend on 'FCVTMODE_REGNUM'
which is from
__builtin_set_float_convert_mode, it's not dead code.
or something wrong in my pattens ?
Anyone could give me some hints ?
Thanks
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug rtl-optimization/97170] Wrong optimization in fwprop pass
2020-09-23 5:36 [Bug rtl-optimization/97170] New: Wrong optimization in fwprop pass rjiejie at me dot com
@ 2020-09-23 5:49 ` pinskia at gcc dot gnu.org
2020-09-23 8:08 ` rjiejie at me dot com
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2020-09-23 5:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97170
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |INVALID
Status|UNCONFIRMED |RESOLVED
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
target_fcvt is wrong.
try:
(define_insn "target_fcvt"
[(set (match_operand:SI 0 "register_operand" "=r")
(unspec:SI [(match_operand:SF 1 "register_operand" "f")
(reg:SI FCVTMODE_REGNUM)]
UNSPEC_FCVT))]
""
"fcvt\t%0,%1"
)
instead. Basically the set is not dependent on the reg (FCVTMODE_REGNUM) only
the instruction itself which is what ever.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug rtl-optimization/97170] Wrong optimization in fwprop pass
2020-09-23 5:36 [Bug rtl-optimization/97170] New: Wrong optimization in fwprop pass rjiejie at me dot com
2020-09-23 5:49 ` [Bug rtl-optimization/97170] " pinskia at gcc dot gnu.org
@ 2020-09-23 8:08 ` rjiejie at me dot com
1 sibling, 0 replies; 3+ messages in thread
From: rjiejie at me dot com @ 2020-09-23 8:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97170
--- Comment #2 from jojo <rjiejie at me dot com> ---
(In reply to Andrew Pinski from comment #1)
> target_fcvt is wrong.
> try:
> (define_insn "target_fcvt"
> [(set (match_operand:SI 0 "register_operand" "=r")
> (unspec:SI [(match_operand:SF 1 "register_operand" "f")
> (reg:SI FCVTMODE_REGNUM)]
> UNSPEC_FCVT))]
> ""
> "fcvt\t%0,%1"
> )
>
> instead. Basically the set is not dependent on the reg (FCVTMODE_REGNUM)
> only the instruction itself which is what ever.
It works, Thanks so much :)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-09-23 8:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-23 5:36 [Bug rtl-optimization/97170] New: Wrong optimization in fwprop pass rjiejie at me dot com
2020-09-23 5:49 ` [Bug rtl-optimization/97170] " pinskia at gcc dot gnu.org
2020-09-23 8:08 ` rjiejie at me 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).