Hi! On Wed, Nov 14, 2018 at 12:37:02AM +0100, Jakub Jelinek wrote: > 2018-11-13 Jakub Jelinek <ja...@redhat.com> > > PR rtl-optimization/87817 > * config/i386/i386.md (nmi2_bzhi_<mode>3, *bmi2_bzhi_<mode>3, > *bmi2_bzhi_<mode>3_1, *bmi2_bzhi_<mode>3_1_ccz): Use IF_THEN_ELSE > in the pattern to avoid triggering UB when operands[2] is zero. > (tbm_bextri_<mode>): New expander. Renamed the old define_insn to ... > (*tbm_bextri_<mode>): ... this.
I'd like to ping this patch, while the folding committed for the PR often triggers and so the RTL passes see literal zero propagated there less often, e.g. the testcase with: -O2 -mbmi2 -fno-tree-ccp -fno-tree-forwprop -fno-tree-fre -fno-tree-pre -fno-tree-vrp -fno-tree-dominator-opts -fno-code-hoisting is still miscompiled and there could be other reasons why a zero appears only after expansion. >From what I understood, the agreement was that zero_extract with 0 size (either literal or just at runtime is incorrect in the middle-end). Jakub