[Bug c/113134] gcc does not version loops with early break conditions that don't have side-effects

2023-12-28 Thread juzhe.zhong at rivai dot ai via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113134 --- Comment #17 from JuzheZhong --- (In reply to Tamar Christina from comment #16) > > > > I wonder whether ARM SVE can also use this approach VEC_EXTRACT with index = > > 0. > > Perhaps, I'll look into it thanks. though this is ofcourse only

[Bug c/113134] gcc does not version loops with early break conditions that don't have side-effects

2023-12-27 Thread tnfchris at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113134 --- Comment #16 from Tamar Christina --- > > I wonder whether ARM SVE can also use this approach VEC_EXTRACT with index = > 0. Perhaps, I'll look into it thanks. though this is ofcourse only applicable when the mask comes from whilelo. In

[Bug c/113134] gcc does not version loops with early break conditions that don't have side-effects

2023-12-27 Thread tnfchris at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113134 --- Comment #15 from Tamar Christina --- (In reply to JuzheZhong from comment #14) > > > > sure, but you can't use BIT_FIELD_REF on VLA vectors. > > > > > > So, for length partial vector. We can use VEC_EXTRACT with index = 0 since > > >

[Bug c/113134] gcc does not version loops with early break conditions that don't have side-effects

2023-12-27 Thread juzhe.zhong at rivai dot ai via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113134 --- Comment #14 from JuzheZhong --- (In reply to Tamar Christina from comment #13) > (In reply to JuzheZhong from comment #12) > > (In reply to Tamar Christina from comment #11) > > > (In reply to JuzheZhong from comment #10) > > > > (In reply

[Bug c/113134] gcc does not version loops with early break conditions that don't have side-effects

2023-12-27 Thread tnfchris at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113134 --- Comment #13 from Tamar Christina --- (In reply to JuzheZhong from comment #12) > (In reply to Tamar Christina from comment #11) > > (In reply to JuzheZhong from comment #10) > > > (In reply to Tamar Christina from comment #9) > > > > (In

[Bug c/113134] gcc does not version loops with early break conditions that don't have side-effects

2023-12-27 Thread juzhe.zhong at rivai dot ai via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113134 --- Comment #12 from JuzheZhong --- (In reply to Tamar Christina from comment #11) > (In reply to JuzheZhong from comment #10) > > (In reply to Tamar Christina from comment #9) > > > (In reply to JuzheZhong from comment #8) > > > > Suppose the

[Bug c/113134] gcc does not version loops with early break conditions that don't have side-effects

2023-12-27 Thread tnfchris at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113134 --- Comment #11 from Tamar Christina --- (In reply to JuzheZhong from comment #10) > (In reply to Tamar Christina from comment #9) > > (In reply to JuzheZhong from comment #8) > > > Suppose the loop mask is generated by whilelo instruction of

[Bug c/113134] gcc does not version loops with early break conditions that don't have side-effects

2023-12-27 Thread juzhe.zhong at rivai dot ai via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113134 --- Comment #10 from JuzheZhong --- (In reply to Tamar Christina from comment #9) > (In reply to JuzheZhong from comment #8) > > Suppose the loop mask is generated by whilelo instruction of ARM SVE. > > > > Suppose we have 8 elements in a

[Bug c/113134] gcc does not version loops with early break conditions that don't have side-effects

2023-12-27 Thread tnfchris at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113134 --- Comment #9 from Tamar Christina --- (In reply to JuzheZhong from comment #8) > Suppose the loop mask is generated by whilelo instruction of ARM SVE. > > Suppose we have 8 elements in a single whole vector. > > mask = whilo (0, res) if res

[Bug c/113134] gcc does not version loops with early break conditions that don't have side-effects

2023-12-27 Thread juzhe.zhong at rivai dot ai via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113134 --- Comment #8 from JuzheZhong --- (In reply to Tamar Christina from comment #7) > You may be able to use the same approach as > > else if (LOOP_VINFO_FULLY_MASKED_P (loop_vinfo)) > > that is, reverse both the mask and the vector and using

[Bug c/113134] gcc does not version loops with early break conditions that don't have side-effects

2023-12-27 Thread tnfchris at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113134 --- Comment #7 from Tamar Christina --- You may be able to use the same approach as else if (LOOP_VINFO_FULLY_MASKED_P (loop_vinfo)) that is, reverse both the mask and the vector and using extract last. It's not going to be performance

[Bug c/113134] gcc does not version loops with early break conditions that don't have side-effects

2023-12-27 Thread tnfchris at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113134 --- Comment #6 from Tamar Christina --- (In reply to JuzheZhong from comment #5) > (In reply to Tamar Christina from comment #4) > > (In reply to JuzheZhong from comment #3) > > > I guess this code is just disabling partial vector for length

[Bug c/113134] gcc does not version loops with early break conditions that don't have side-effects

2023-12-27 Thread juzhe.zhong at rivai dot ai via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113134 --- Comment #5 from JuzheZhong --- (In reply to Tamar Christina from comment #4) > (In reply to JuzheZhong from comment #3) > > I guess this code is just disabling partial vector for length for now. > > > > And need me to test and port this

[Bug c/113134] gcc does not version loops with early break conditions that don't have side-effects

2023-12-27 Thread tnfchris at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113134 --- Comment #4 from Tamar Christina --- (In reply to JuzheZhong from comment #3) > I guess this code is just disabling partial vector for length for now. > > And need me to test and port this part for length in the followup patches. > > Am I

[Bug c/113134] gcc does not version loops with early break conditions that don't have side-effects

2023-12-27 Thread juzhe.zhong at rivai dot ai via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113134 --- Comment #3 from JuzheZhong --- Thanks Tamar. And I agree with you. This is not supposed to let early break to handle that. It should be optimization on scalar IR instead of loop vectorizer. I believe it is GCC-15 topic. Btw, I am trying