[llvm] [llvm][RISCV] Optimize fcopysign for fixed vectors (PR #193802)

Brandon Wu via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 29 02:20:30 PDT 2026


4vtomat wrote:

> > I think I was missing
> > ```
> > SDValue ClearSignMask = DAG.getConstant(
> >      APInt::getSignedMaxValue(IntVT.getScalarSizeInBits()), DL, IntVT);
> > ```
> > 
> > 
> >     
> >       
> >     
> > 
> >       
> >     
> > 
> >     
> >   
> > and
> > ```
> > SDValue SignMask = DAG.getConstant(
> >      APInt::getSignMask(IntVT.getScalarSizeInBits()), DL, IntVT);
> > ```
> > 
> > 
> >     
> >       
> >     
> > 
> >       
> >     
> > 
> >     
> >   
> > which is probably going to be an `2 * lui + 1 addi`, so I think I need to add 1 in the threshold
> 
> Sorry I was wrong, the `2 * lui` will be CSE away, so there's gonna be 1

Sorry again, I just found the constant construction in different architecture has different instruction count.
I'm gonna leave it as a FIXME for now

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


More information about the llvm-commits mailing list