[Bug rtl-optimization/110042] [14 Regression] missed cmov optimization after r14-1014-gc5df248509b489364c573e8
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110042 Andrew Pinski changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|--- |FIXED --- Comment #8 from Andrew Pinski --- Fixed.
[Bug rtl-optimization/110042] [14 Regression] missed cmov optimization after r14-1014-gc5df248509b489364c573e8
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110042 --- Comment #7 from CVS Commits --- The trunk branch has been updated by Andrew Pinski : https://gcc.gnu.org/g:df0853d72d38247aed577a4511450c91794f2f06 commit r14-1507-gdf0853d72d38247aed577a4511450c91794f2f06 Author: Andrew Pinski Date: Tue May 30 15:54:32 2023 -0700 Fix PR 110042: ifcvt regression due to paradoxical subregs After r14-1014-gc5df248509b489364c573e8, GCC started to emit directly a zero_extract for `(t1&0x8)!=0`. This introduced a small regression where ifcvt would not do the ifconversion as there is now a paradoxical subreg in the dest which was being rejected. Since paradoxical subreg set the whole register, we can treat it as the same as a reg in the two places. OK? Bootstrapped and tested on x86_64-linux-gnu and aarch64-linux-gnu. gcc/ChangeLog: PR rtl-optimization/110042 * ifcvt.cc (bbs_ok_for_cmove_arith): Allow paradoxical subregs. (bb_valid_for_noce_process_p): Strip the subreg for the SET_DEST. gcc/testsuite/ChangeLog: PR rtl-optimization/110042 * gcc.target/aarch64/csel_bfx_2.c: New test.
[Bug rtl-optimization/110042] [14 Regression] missed cmov optimization after r14-1014-gc5df248509b489364c573e8
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110042 --- Comment #6 from Andrew Pinski --- Created attachment 55219 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55219=edit untested patch I am going to test this on both x86_64 and aarch64 tonight.
[Bug rtl-optimization/110042] [14 Regression] missed cmov optimization after r14-1014-gc5df248509b489364c573e8
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110042 Andrew Pinski changed: What|Removed |Added Last reconfirmed||2023-05-30 Assignee|unassigned at gcc dot gnu.org |pinskia at gcc dot gnu.org Ever confirmed|0 |1 Status|UNCONFIRMED |ASSIGNED --- Comment #5 from Andrew Pinski --- I have a patch which adds support for paradoxical subregs. Since paradoxical subregs as the dest always assign the full register still, there is no reason to reject it.
[Bug rtl-optimization/110042] [14 Regression] missed cmov optimization after r14-1014-gc5df248509b489364c573e8
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110042 --- Comment #4 from Andrew Pinski --- Because of the subreg.
[Bug rtl-optimization/110042] [14 Regression] missed cmov optimization after r14-1014-gc5df248509b489364c573e8
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110042 --- Comment #3 from Andrew Pinski --- bb_valid_for_noce_process_p returns false for the zero_extract case ...
[Bug rtl-optimization/110042] [14 Regression] missed cmov optimization after r14-1014-gc5df248509b489364c573e8
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110042 --- Comment #2 from Andrew Pinski --- Here is a bitfield testcase which shows this was a latent issue: ``` struct f { unsigned t:3; unsigned t1:4; }; unsigned f2(struct f); unsigned f1(int t, struct f y) { int tt = 0; if(t) tt = y.t1; return tt; } ``` We should produce: ``` ubfxw8, w1, #3, #4 cmp w0, #0 cselw0, wzr, w8, eq ret `` But currently produces: ``` cbz w0, .L3 ubfxx0, x1, 3, 4 ret .L3: mov w0, 0 ret ``` The IR is similar too: ``` (insn 11 10 12 3 (set (subreg:DI (reg:QI 96) 0) (zero_extract:DI (subreg:DI (reg/v:SI 95 [ y ]) 0) (const_int 4 [0x4]) (const_int 3 [0x3]))) "/app/example.cpp":12:11 832 {*extzvdi} (expr_list:REG_DEAD (reg/v:SI 95 [ y ]) (nil))) (insn 12 11 24 3 (set (reg:SI 93 [ ]) (zero_extend:SI (reg:QI 96))) "/app/example.cpp":13:10 146 {*zero_extendqisi2_aarch64} (expr_list:REG_DEAD (reg:QI 96) (nil))) ```
[Bug rtl-optimization/110042] [14 Regression] missed cmov optimization after r14-1014-gc5df248509b489364c573e8
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110042 Andrew Pinski changed: What|Removed |Added Target Milestone|--- |14.0
[Bug rtl-optimization/110042] [14 Regression] missed cmov optimization after r14-1014-gc5df248509b489364c573e8
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110042 --- Comment #1 from Andrew Pinski --- I am still looking into this. This is definitely a latent bug and maybe even can be reproduced some bitfield extractions too.