I don't know why we should not add frm vfsqrt.v since I saw topper (LLVM maintainer) said we should not add frm into vsqrt.v. Maybe kito knows the reason ? https://github.com/riscv-non-isa/rvv-intrinsic-doc/pull/226 juzhe.zhong@rivai.ai From: Jeff Law Date: 2023-05-15 21:52 To: juzhe.zhong; gcc-patches CC: kito.cheng; kito.cheng; palmer; palmer; rdapp.gcc Subject: Re: [PATCH] RISC-V: Add rounding mode operand for floating point instructions On 5/15/23 05:49, juzhe.zhong@rivai.ai wrote: > From: Juzhe-Zhong > > This patch is adding rounding mode operand and FRM_REGNUM dependency > into floating-point instructions. > > The floating-point instructions we added FRM and rounding mode operand: > 1. vfadd/vfsub > 2. vfwadd/vfwsub > 3. vfmul > 4. vfdiv > 5. vfwmul > 6. vfwmacc/vfwnmacc/vfwmsac/vfwnmsac > 7. vfsqrt7/vfrec7 > 8. floating-point conversions. > 9. floating-point reductions. > > The floating-point instructions we did NOT add FRM and rounding mode operand: > 1. vfsqrt/vfneg Assuming vfsqrt is actually an estimator the best place to handle rounding modes is at the last step(s) after N-R or Goldschmidt refinement steps. I haven't paid too much attention to FP yet, but this is an area I've got fairly extensive experience. Sadly RISC-V's estimator is fairly poor and the single instance FMACs are going to result in an implementation that may not actually be any better than what glibc can do. Jeff