[Bug target/79752] incorrect code generation for __divkf3 with -O2 -mcpu=power9
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79752 --- Comment #5 from acsawdey at gcc dot gnu.org --- Author: acsawdey Date: Tue Mar 14 14:43:03 2017 New Revision: 246127 URL: https://gcc.gnu.org/viewcvs?rev=246127=gcc=rev Log: This showed up in power9 code for __divkf3 software float support and caused a divd to be emitted where we needed a divdu. Index: gcc/config/rs6000/rs6000.md === --- gcc/config/rs6000/rs6000.md (revision 246123) +++ gcc/config/rs6000/rs6000.md (working copy) @@ -3063,8 +3063,8 @@ && ! reg_mentioned_p (operands[3], operands[1]) && ! reg_mentioned_p (operands[3], operands[2])" [(set (match_dup 0) - (div:GPR (match_dup 1) -(match_dup 2))) + (udiv:GPR (match_dup 1) + (match_dup 2))) (set (match_dup 3) (mult:GPR (match_dup 0) (match_dup 2))) 2017-03-14 Aaron SawdeyBackport from mainline 2017-02-28 Aaron Sawdey PR target/79752 * config/rs6000/rs6000.md (peephole2 for udiv/umod): Should emit udiv rather than div since input pattern is unsigned. Modified: branches/gcc-6-branch/gcc/ChangeLog branches/gcc-6-branch/gcc/config/rs6000/rs6000.md
[Bug target/79752] incorrect code generation for __divkf3 with -O2 -mcpu=power9
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79752 acsawdey at gcc dot gnu.org changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|--- |FIXED --- Comment #4 from acsawdey at gcc dot gnu.org --- Fixed in 245817.
[Bug target/79752] incorrect code generation for __divkf3 with -O2 -mcpu=power9
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79752 --- Comment #3 from acsawdey at gcc dot gnu.org --- Author: acsawdey Date: Wed Mar 1 19:58:05 2017 New Revision: 245817 URL: https://gcc.gnu.org/viewcvs?rev=245817=gcc=rev Log: 2017-03-01 Aaron SawdeyPR target/79752 * config/rs6000/rs6000.md (peephole2 for udiv/umod): Should emit udiv rather than div since input pattern is unsigned. Modified: trunk/gcc/ChangeLog trunk/gcc/config/rs6000/rs6000.md
[Bug target/79752] incorrect code generation for __divkf3 with -O2 -mcpu=power9
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79752 --- Comment #2 from Michael Meissner --- On Tue, Feb 28, 2017 at 09:13:42PM +, acsawdey at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79752 > > --- Comment #1 from acsawdey at gcc dot gnu.org --- > Meissner spotted the cause. Verified that this fixes it: > > Index: ../trunk/gcc/config/rs6000/rs6000.md > === > --- ../trunk/gcc/config/rs6000/rs6000.md(revision 245787) > +++ ../trunk/gcc/config/rs6000/rs6000.md(working copy) > @@ -3161,7 +3161,7 @@ > && ! reg_mentioned_p (operands[3], operands[1]) > && ! reg_mentioned_p (operands[3], operands[2])" >[(set (match_dup 0) > - (div:GPR (match_dup 1) > + (udiv:GPR (match_dup 1) > (match_dup 2))) > (set (match_dup 3) > (mult:GPR (match_dup 0) > > Now to bootstrap/regtest this and post. One minor formatting nit. When you change div -> udiv, you will need to indent the (match_dup 20 on the next line by one space.
[Bug target/79752] incorrect code generation for __divkf3 with -O2 -mcpu=power9
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79752 --- Comment #1 from acsawdey at gcc dot gnu.org --- Meissner spotted the cause. Verified that this fixes it: Index: ../trunk/gcc/config/rs6000/rs6000.md === --- ../trunk/gcc/config/rs6000/rs6000.md(revision 245787) +++ ../trunk/gcc/config/rs6000/rs6000.md(working copy) @@ -3161,7 +3161,7 @@ && ! reg_mentioned_p (operands[3], operands[1]) && ! reg_mentioned_p (operands[3], operands[2])" [(set (match_dup 0) - (div:GPR (match_dup 1) + (udiv:GPR (match_dup 1) (match_dup 2))) (set (match_dup 3) (mult:GPR (match_dup 0) Now to bootstrap/regtest this and post.