[Bug target/110170] Sub-optimal conditional jumps in conditional-swap with floating point
crazylht at gmail dot com
gcc-bugzilla@gcc.gnu.org
Mon Jun 12 09:09:31 GMT 2023
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110170
--- Comment #9 from Hongtao.liu <crazylht at gmail dot com> ---
(In reply to Hongtao.liu from comment #8)
> ix86_expand_sse_fp_minmax failed since rtx_equal_p (cmp_op0, if_true) is
> false,
>
> 249(reg:DF 86 [ _1 ]) (if_true)
> 250(reg:DF 83 [ _2 ]) (if_false)
> 251(reg:DF 82 [ _1 ]) (cmp0_op0)
> 252(reg:DF 83 [ _2 ]) (cmp1_op1)
>
> but here if_true is just a copy from cmp_op0 but with different REGNO,
> rtx_equal_p seems too conservative here.
>
But if_convert didn't maintain DF_CHAIN info, and and backend can't get
DF_REG_DEF_* info to figure out if_true is just a single_set of cmp_op0.
With -march=x86-64-v2, gcc generates
movsd (%rdi), %xmm2
movsd (%rsi), %xmm1
movapd %xmm2, %xmm0
movapd %xmm1, %xmm3
cmpltsd %xmm1, %xmm0
maxsd %xmm2, %xmm3
blendvpd %xmm0, %xmm2, %xmm1
movsd %xmm3, (%rsi)
movsd %xmm1, (%rdi)
ret
Which can be further optimized: cmpltsd + blendvpd -> minsd
More information about the Gcc-bugs
mailing list