[Bug target/71321] [6 Regression] x86: worse code for uint8_t % 10 and / 10
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71321 --- Comment #11 from CVS Commits --- The master branch has been updated by Roger Sayle : https://gcc.gnu.org/g:71197a5d13d0b540a9b5efe7ae2512d76386e9d1 commit r11-2621-g71197a5d13d0b540a9b5efe7ae2512d76386e9d1 Author: Roger Sayle Date: Sun Aug 9 23:14:58 2020 +0100 middle-end: Correct calculation of mul_widen_cost and mul_highpart_cost. This patch fixes a subtle bug in the depths of GCC's synth_mult, where the middle-end queries whether (how well) the target supports widening and highpart multiplications by calling targetm.rtx_costs. The code in init_expmed and init_expmed_one_mode iterates over various RTL patterns querying the cost of each. To avoid generating & garbage collecting too much junk, it reuses the same RTL over and over, but adjusting the modes between each call. Alas this reuse of state is a little fragile, and at some point a change to init_expmed_one_conv has resulted in the state (mode of a register) being changed, but not reset before being used again. Using the old software engineering/defensive programming maxim of "why fix a bug just once, if it can be fixed in multiple places", this patch both restores the original value in init_expmed_one_conv, and also sets it to the expected value in init_expmed_one_mode. This should hopefully signal the need to be careful of invariants for anyone modifying this code in future. 2020-08-09 Roger Sayle gcc/ChangeLog * expmed.c (init_expmed_one_conv): Restore all->reg's mode. (init_expmed_one_mode): Set all->reg to desired mode. gcc/testsuite/ChangeLog PR target/71321 * gcc.target/i386/pr71321.c: Check that the code doesn't use the 4B zero displacement lea, not that it uses lea.
[Bug target/71321] [6 Regression] x86: worse code for uint8_t % 10 and / 10
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71321 Jakub Jelinek changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED Target Milestone|6.5 |7.0 --- Comment #10 from Jakub Jelinek --- GCC 6 branch is being closed, fixed in 7.x.
[Bug target/71321] [6 Regression] x86: worse code for uint8_t % 10 and / 10
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71321 Eric Gallager changed: What|Removed |Added CC||egallager at gcc dot gnu.org --- Comment #9 from Eric Gallager --- (In reply to Bernd Schmidt from comment #6) > Author: bernds > Date: Wed Dec 21 16:45:33 2016 > New Revision: 243861 > > URL: https://gcc.gnu.org/viewcvs?rev=243861=gcc=rev > Log: > > PR target/71321 > * config/i386/i386.md (lea_general_2b, lea_general_3b): New > patterns. > * config/i386/predicates.md (const123_operand): New. > > PR target/71321 > * gcc.target/i386/pr71321.c: New test. > > > Added: > trunk/gcc/testsuite/gcc.target/i386/pr71321.c > Modified: > trunk/gcc/ChangeLog > trunk/gcc/config/i386/i386.md > trunk/gcc/config/i386/predicates.md > trunk/gcc/testsuite/ChangeLog Are you still working on a backport for this, Bernd?
[Bug target/71321] [6 Regression] x86: worse code for uint8_t % 10 and / 10
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71321 Richard Biener changed: What|Removed |Added Target Milestone|6.4 |6.5 --- Comment #8 from Richard Biener --- GCC 6.4 is being released, adjusting target milestone.
[Bug target/71321] [6 Regression] x86: worse code for uint8_t % 10 and / 10
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71321 Jeffrey A. Law changed: What|Removed |Added CC||law at redhat dot com Summary|[6/7 Regression] x86: worse |[6 Regression] x86: worse |code for uint8_t % 10 and / |code for uint8_t % 10 and / |10 |10 --- Comment #7 from Jeffrey A. Law --- THe regression relative to gcc-5 has been fixed on the trunk. It would be worth creating a separate bug for the unnecessary AND when compiling with -Os that all versions of GCC exhibit.