[llvm] [InstCombine] Fix a cycle when folding fneg(select) with scalable vector types (PR #112465)

via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 16 00:06:44 PDT 2024


ssijaric-nv wrote:

> > 1. if we are dealing with scalable vector constants as there is no
> >    immediate representation for a negative scalable zeroinitializer.
> 
> I thought there was a splat constant for these, this would just be a splat of -0

Thanks for having a look, Matt.  Would a better approach be to generate the following, instead of giving up?

define <vscale x 2 x double> @test_fneg_select_svec(<vscale x 2 x i1> %cond, <vscale x 2 x double> %b) {
  %1 = fneg  fast <vscale x 2 x double> %b
  %2 = select <vscale x 2 x i1> %cond, <vscale x 2 x double> splat(double -0.0), <vscale x 2 x double> %1
  ret <vscale x 2 x double> %2
}

https://github.com/llvm/llvm-project/pull/112465


More information about the llvm-commits mailing list