[PATCH] Simplify vector ((VCE?(a cmp b ? -1 : 0)) < 0) ? c : d to just VCE:((a cmp b) ? (VCE c) : (VCE d)).

2023-11-09 Thread liuhongt
When I'm working on PR112443, I notice there's some misoptimizations: after we fold _mm{,256}_blendv_epi8/pd/ps into gimple, the backend fails to combine it back to v{,p}blendv{v,ps,pd} since the pattern is too complicated, so I think maybe we should hanlde it in the gimple level. The dump is like

[v3 PATCH] Simplify vector ((VCE (a cmp b ? -1 : 0)) < 0) ? c : d to just (VCE ((a cmp b) ? (VCE c) : (VCE d))).

2023-12-10 Thread liuhongt
> since you are looking at TYPE_PRECISION below you want > VECTOR_INTIEGER_TYPE_P here as well? The alternative > would be to compare TYPE_SIZE. > > Some of the checks feel redundant but are probably good for > documentation purposes. > > OK with using VECTOR_INTIEGER_TYPE_P Actually, the data typ

Re: [PATCH] Simplify vector ((VCE?(a cmp b ? -1 : 0)) < 0) ? c : d to just VCE:((a cmp b) ? (VCE c) : (VCE d)).

2023-11-12 Thread Hongtao Liu
On Fri, Nov 10, 2023 at 2:14 PM liuhongt wrote: > > When I'm working on PR112443, I notice there's some misoptimizations: > after we fold _mm{,256}_blendv_epi8/pd/ps into gimple, the backend > fails to combine it back to v{,p}blendv{v,ps,pd} since the pattern is > too complicated, so I think maybe

[V2 PATCH] Simplify vector ((VCE (a cmp b ? -1 : 0)) < 0) ? c : d to just (VCE ((a cmp b) ? (VCE c) : (VCE d))).

2023-11-16 Thread liuhongt
Update in V2: 1) Add some comments before the pattern. 2) Remove ? from view_convert. Bootstrapped and regtested on x86_64-pc-linux-gnu{-m32,}. Ok for trunk? When I'm working on PR112443, I notice there's some misoptimizations: after we fold _mm{,256}_blendv_epi8/pd/ps into gimple, the backend fa

Re: [V2 PATCH] Simplify vector ((VCE (a cmp b ? -1 : 0)) < 0) ? c : d to just (VCE ((a cmp b) ? (VCE c) : (VCE d))).

2023-12-07 Thread Hongtao Liu
ping. On Thu, Nov 16, 2023 at 6:49 PM liuhongt wrote: > > Update in V2: > 1) Add some comments before the pattern. > 2) Remove ? from view_convert. > > Bootstrapped and regtested on x86_64-pc-linux-gnu{-m32,}. > Ok for trunk? > > When I'm working on PR112443, I notice there's some misoptimization

Re: [V2 PATCH] Simplify vector ((VCE (a cmp b ? -1 : 0)) < 0) ? c : d to just (VCE ((a cmp b) ? (VCE c) : (VCE d))).

2023-12-08 Thread Richard Biener
On Thu, Nov 16, 2023 at 11:49 AM liuhongt wrote: > > Update in V2: > 1) Add some comments before the pattern. > 2) Remove ? from view_convert. > > Bootstrapped and regtested on x86_64-pc-linux-gnu{-m32,}. > Ok for trunk? > > When I'm working on PR112443, I notice there's some misoptimizations: > a

Re: [v3 PATCH] Simplify vector ((VCE (a cmp b ? -1 : 0)) < 0) ? c : d to just (VCE ((a cmp b) ? (VCE c) : (VCE d))).

2023-12-11 Thread Richard Biener
On Mon, Dec 11, 2023 at 7:51 AM liuhongt wrote: > > > since you are looking at TYPE_PRECISION below you want > > VECTOR_INTIEGER_TYPE_P here as well? The alternative > > would be to compare TYPE_SIZE. > > > > Some of the checks feel redundant but are probably good for > > documentation purposes.

Re: [v3 PATCH] Simplify vector ((VCE (a cmp b ? -1 : 0)) < 0) ? c : d to just (VCE ((a cmp b) ? (VCE c) : (VCE d))).

2023-12-11 Thread Hongtao Liu
On Mon, Dec 11, 2023 at 4:14 PM Richard Biener wrote: > > On Mon, Dec 11, 2023 at 7:51 AM liuhongt wrote: > > > > > since you are looking at TYPE_PRECISION below you want > > > VECTOR_INTIEGER_TYPE_P here as well? The alternative > > > would be to compare TYPE_SIZE. > > > > > > Some of the check