[llvm] [SPIR-V] Lower llvm.x.with.overflow intrinsics (PR #95012)

Michal Paszkowski via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 11 12:37:50 PDT 2024


michalpaszkowski wrote:

> > Unfortunately, the problem is not as simple to solve, this patch simply extends the existing expansion we had for umul for the remaining operations.
> 
> I'd prefer to solve this sooner rather than later. I'm not so much worried about the size of this particular patch, but this seems like it's going to be a continual maintenance burden for target-independent changes.
> 
> > We generate InsertValue instructions which we directly replace in the SPIRVEmitIntrinsics. We want all of these to "survive" IRTranslation.
> 
> Probably the SPIRV backend should be doing calling convention lowering inside GlobalISel, instead of trying to do it as a pre-pass. Calling convention lowering is all target-specific anyway, so you can generate whatever you need.

I do agree on the high level, there might be some additional details which I do not remember right now, but I will make sure to  experiment with this a bit more and discuss this in the upcoming SPIR-V backend sync up on Monday. Though, the direction and goal is to address this issue. Also simplification here would only benefit us going forward.

For this particular patch, if possible, let's continue with the expansion in the pre-IRTranslation. I will hold on with merging this patch by the end of the day if there are any additional comments.

Still, the implementation will need to be changed in the next patch to use native SPIR-V OpIAddCarry and OpISubBorrow.

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


More information about the llvm-commits mailing list