https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87047
--- Comment #3 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to Andrew Pinski from comment #2)
> I suspect it is treating cost 0 as being free rather than unknown cost. And
> the x86 backend is returning 0 cost for the upper multiple.
There is no truncate RTX present in the dumps.
But in any case, moving 10+ insns out of THEN block seems excessive:
IF-THEN-JOIN block found, pass 1, test 34, then 35, join 15
scanning new insn with uid = 320.
scanning new insn with uid = 321.
scanning new insn with uid = 322.
scanning new insn with uid = 323.
scanning new insn with uid = 324.
scanning new insn with uid = 325.
scanning new insn with uid = 326.
scanning new insn with uid = 327.
scanning new insn with uid = 328.
scanning new insn with uid = 329.
scanning new insn with uid = 330.
if-conversion succeeded through noce_try_cmove_arith
Removing jump 225.
deleting insn with uid = 225.
deleting insn with uid = 235.
deleting insn with uid = 286.
deleting insn with uid = 232.
deleting insn with uid = 231.
deleting insn with uid = 230.
deleting insn with uid = 229.
deleting insn with uid = 284.
deleting insn with uid = 227.
deleting block 35
Conversion succeeded on pass 1.
...
* 224: flags:CCZ=cmp(r245:SI,0)
* REG_DEAD r245:SI
225: pc={(flags:CCZ!=0)?L222:pc}
REG_DEAD flags:CCZ
REG_BR_PROB 536870916
226: NOTE_INSN_BASIC_BLOCK 40
227: {r246:TI=zero_extend(r91:DI)*zero_extend(r136:DI);clobber flags:CC;}
REG_UNUSED flags:CC
284: r262:DI=r246:TI#8
REG_DEAD r246:TI
229: r249:DI=0xfffff
230: {r248:DI=r249:DI-r262:DI;clobber flags:CC;}
REG_DEAD r262:DI
REG_DEAD r249:DI
REG_UNUSED flags:CC
231: {r250:DI=r248:DI<<0x2c;clobber flags:CC;}
REG_DEAD r248:DI
REG_UNUSED flags:CC
232: {r251:TI=zero_extend(r250:DI)*zero_extend(r91:DI);clobber flags:CC;}
REG_DEAD r250:DI
REG_DEAD r91:DI
REG_UNUSED flags:CC
286: r264:DI=r251:TI#8
REG_DEAD r251:TI
235: {r91:DI=r264:DI<<0x1;clobber flags:CC;}
REG_DEAD r264:DI
REG_UNUSED flags:CC
...
is moved to:
...
* 224: flags:CCZ=cmp(r245:SI,0)
* REG_DEAD r245:SI
320: {r246:TI=zero_extend(r91:DI)*zero_extend(r136:DI);clobber flags:CC;}
321: r262:DI=r246:TI#8
322: r249:DI=0xfffff
323: {r248:DI=r249:DI-r262:DI;clobber flags:CC;}
324: {r250:DI=r248:DI<<0x2c;clobber flags:CC;}
325: {r251:TI=zero_extend(r250:DI)*zero_extend(r91:DI);clobber flags:CC;}
326: r264:DI=r251:TI#8
327: {r270:DI=r264:DI<<0x1;clobber flags:CC;}
328: {r269:DI=r243:DI<<0xf;clobber flags:CC;}
* 329: flags:CCZ=cmp(r245:SI,0)
330: r91:DI={(flags:CCZ!=0)?r269:DI:r270:DI}
...
(not to mention that (insn 224) in front should be removed as well, it is
duplicated as (insn 329)).
I don't think x86 declares all moved insn costs as 0.