Add missing op support for the LLVM translation path.
The previous work in #6009 established MLIR compatibility and confidence in xdsl-translate, but many ops still lack translation support.
Conversion passes
convert-arith-to-llvm pass ⚡🔥
Target LLVM ops already in dialect: add, sub, mul, sdiv, udiv, srem, urem, fadd, fsub, fmul, fdiv, frem, fneg, and, or, xor, shl, ashr, lshr, icmp, fcmp, trunc, zext, sext, sitofp, fpext, bitcast, mlir.constant, select
Missing LLVM ops needed: uitofp, fptosi, fptoui, fptrunc
Missing intrinsics needed: llvm.intr.minimum, llvm.intr.maximum, llvm.intr.smax, llvm.intr.smin, llvm.intr.umax, llvm.intr.umin
Also needs: IndexType backend support (dialects: (llvm) reject incompatible types in LLVMFunctionType #5705 )
convert-cf-to-llvm pass ⚡
Target LLVM ops already in dialect: br, cond_br, unreachable
Missing LLVM ops needed: switch
convert-func-to-llvm pass ⚡
convert-math-to-llvm pass 🔥
Intrinsics already in dialect: fabs, ceil, sqrt, log, fma, maxnum
Missing: exp dialects: (llvm) add FExpOp #5857 , cos dialects: (llvm) add FCosOp #5858 , log2 dialects: (llvm) add FLog2Op #5859 , floor dialects: (llvm) add FFloorOp #5860 , sin dialects: (llvm) add FSinOp #5863 , copysign dialects: (llvm) add FCopySignOp #5864 , exp2 dialects: (llvm) add FExp2Op #5867 , minnum dialects: (llvm) add VectorFMinOp #5868 , pow dialects: (llvm) add FPowOp #5870 , log10, tan, round, roundeven, trunc (fp), nearbyint, rint, tanh, fmuladd, powi, ctlz, cttz, ctpop
convert-vector-to-llvm pass 🔥
Target LLVM ops already in dialect: load, store, insertelement, shufflevector, intr.masked.store, intr.fma
Missing: vector.ReductionOp conversion dialects: (llvm) add llvm.intr.vector.reduce.fadd op #5866 , vector.BitcastOp conversion backend: (llvm) add vector.BitcastOp conversion #5869 , extractelement, masked.load, masked.gather, masked.scatter, masked.compressstore, masked.expandload, all vector.reduce.* (15 variants), matrix.transpose, matrix.multiply
convert-omp-to-llvm pass
Missing LLVM dialect ops (non-intrinsic)
Needed by conversion passes above:
Other standard LLVM ops not yet in dialect:
Missing LLVM intrinsic ops
Float unary (convert-math-to-llvm)
Float binary (convert-math-to-llvm, convert-arith-to-llvm)
Float ternary
Integer intrinsics (convert-arith-to-llvm)
llvm.intr.abs
llvm.intr.bitreverse
llvm.intr.bswap
llvm.intr.ctlz
llvm.intr.cttz
llvm.intr.ctpop
llvm.intr.smax, llvm.intr.smin, llvm.intr.umax, llvm.intr.umin
llvm.intr.scmp, llvm.intr.ucmp
Saturating: sadd.sat, uadd.sat, ssub.sat, usub.sat, sshl.sat, ushl.sat
With overflow: sadd.with.overflow, uadd.with.overflow, ssub.with.overflow, usub.with.overflow, smul.with.overflow, umul.with.overflow
Funnel shifts: llvm.intr.fshl, llvm.intr.fshr
Masked memory (convert-vector-to-llvm)
Vector reductions (convert-vector-to-llvm)
llvm.intr.vector.reduce.add, .and, .or, .xor, .mul
llvm.intr.vector.reduce.fadd, .fmul, .fmax, .fmin, .fmaximum, .fminimum
llvm.intr.vector.reduce.smax, .smin, .umax, .umin
Memory
Lower priority (VP ops, constrained FP, coroutines, debug)
MLIR defines ~70 more intrinsics (50 VP ops, 11 constrained FP ops, 10 coroutine ops, debug/annotation ops) that are not listed here. These are unlikely to be needed in the near term.
Missing backend support
Currently implemented: 58 dialect ops, 7 intrinsic ops, 14 backend type conversions, 57 backend op conversions.
⚡ = eliminates patches_xdsl_llvm.py by enabling proper index-typed IR (no more _unwrap_i64 / _loop_upper_bound_as_i64 hacks). Combined with the GEP work in #6074 .
🔥 = eliminates patches_xdsl_intrinsics.py by enabling exojit to emit vector/arith/math ops instead of named llvm.CallOp intrinsics.
Add missing op support for the LLVM translation path.
The previous work in #6009 established MLIR compatibility and confidence in xdsl-translate, but many ops still lack translation support.
Conversion passes
convert-arith-to-llvmpass ⚡🔥add,sub,mul,sdiv,udiv,srem,urem,fadd,fsub,fmul,fdiv,frem,fneg,and,or,xor,shl,ashr,lshr,icmp,fcmp,trunc,zext,sext,sitofp,fpext,bitcast,mlir.constant,selectuitofp,fptosi,fptoui,fptruncllvm.intr.minimum,llvm.intr.maximum,llvm.intr.smax,llvm.intr.smin,llvm.intr.umax,llvm.intr.uminIndexTypebackend support (dialects: (llvm) reject incompatible types in LLVMFunctionType #5705)convert-cf-to-llvmpass ⚡br,cond_br,unreachableswitchconvert-func-to-llvmpass ⚡func,return,callIndexTypebackend support (dialects: (llvm) reject incompatible types in LLVMFunctionType #5705)convert-math-to-llvmpass 🔥fabs,ceil,sqrt,log,fma,maxnumexpdialects: (llvm) add FExpOp #5857,cosdialects: (llvm) add FCosOp #5858,log2dialects: (llvm) add FLog2Op #5859,floordialects: (llvm) add FFloorOp #5860,sindialects: (llvm) add FSinOp #5863,copysigndialects: (llvm) add FCopySignOp #5864,exp2dialects: (llvm) add FExp2Op #5867,minnumdialects: (llvm) add VectorFMinOp #5868,powdialects: (llvm) add FPowOp #5870,log10,tan,round,roundeven,trunc(fp),nearbyint,rint,tanh,fmuladd,powi,ctlz,cttz,ctpopconvert-vector-to-llvmpass 🔥load,store,insertelement,shufflevector,intr.masked.store,intr.fmavector.ReductionOpconversion dialects: (llvm) add llvm.intr.vector.reduce.fadd op #5866,vector.BitcastOpconversion backend: (llvm) add vector.BitcastOp conversion #5869,extractelement,masked.load,masked.gather,masked.scatter,masked.compressstore,masked.expandload, allvector.reduce.*(15 variants),matrix.transpose,matrix.multiplyconvert-omp-to-llvmpassomp.parallel-> outlinedllvm.func+llvm.call @__kmpc_fork_callomp.wsloop->llvm.call @__kmpc_for_static_init_8/@__kmpc_for_static_finiomp.loop_nest->llvm.br/llvm.cond_brloop header with IVomp.yield->llvm.brback-edgeomp.terminator->llvm.returnin outlined functionMissing LLVM dialect ops (non-intrinsic)
Needed by conversion passes above:
llvm.extractelement(convert-vector-to-llvm)llvm.fptrunc(convert-arith-to-llvm)llvm.uitofp(convert-arith-to-llvm)llvm.fptosi(convert-arith-to-llvm)llvm.fptoui(convert-arith-to-llvm)llvm.switch(convert-cf-to-llvm)Other standard LLVM ops not yet in dialect:
llvm.freezellvm.invokellvm.landingpadllvm.resumellvm.phillvm.fencellvm.atomicrmwllvm.cmpxchgMissing LLVM intrinsic ops
Float unary (convert-math-to-llvm)
llvm.intr.expdialects: (llvm) add FExpOp #5857llvm.intr.cosdialects: (llvm) add FCosOp #5858llvm.intr.log2dialects: (llvm) add FLog2Op #5859llvm.intr.floordialects: (llvm) add FFloorOp #5860llvm.intr.sindialects: (llvm) add FSinOp #5863llvm.intr.exp2dialects: (llvm) add FExp2Op #5867llvm.intr.tanllvm.intr.asinllvm.intr.acosllvm.intr.atanllvm.intr.sinhllvm.intr.coshllvm.intr.tanhllvm.intr.log10llvm.intr.exp10llvm.intr.nearbyintllvm.intr.rintllvm.intr.roundllvm.intr.roundevenllvm.intr.trunc(fp truncation intrinsic, not the integer trunc op)Float binary (convert-math-to-llvm, convert-arith-to-llvm)
llvm.intr.copysigndialects: (llvm) add FCopySignOp #5864llvm.intr.minnumdialects: (llvm) add VectorFMinOp #5868llvm.intr.powdialects: (llvm) add FPowOp #5870llvm.intr.minimumllvm.intr.maximumllvm.intr.powillvm.intr.ldexpllvm.intr.atan2Float ternary
llvm.intr.fmuladdInteger intrinsics (convert-arith-to-llvm)
llvm.intr.absllvm.intr.bitreversellvm.intr.bswapllvm.intr.ctlzllvm.intr.cttzllvm.intr.ctpopllvm.intr.smax,llvm.intr.smin,llvm.intr.umax,llvm.intr.uminllvm.intr.scmp,llvm.intr.ucmpsadd.sat,uadd.sat,ssub.sat,usub.sat,sshl.sat,ushl.satsadd.with.overflow,uadd.with.overflow,ssub.with.overflow,usub.with.overflow,smul.with.overflow,umul.with.overflowllvm.intr.fshl,llvm.intr.fshrMasked memory (convert-vector-to-llvm)
llvm.intr.masked.loadllvm.intr.masked.gatherllvm.intr.masked.scatterllvm.intr.masked.compressstorellvm.intr.masked.expandloadVector reductions (convert-vector-to-llvm)
llvm.intr.vector.reduce.add,.and,.or,.xor,.mulllvm.intr.vector.reduce.fadd,.fmul,.fmax,.fmin,.fmaximum,.fminimumllvm.intr.vector.reduce.smax,.smin,.umax,.uminMemory
llvm.intr.memcpyllvm.intr.memmovellvm.intr.memsetllvm.intr.stacksave,llvm.intr.stackrestorellvm.intr.lifetime.start,llvm.intr.lifetime.endLower priority (VP ops, constrained FP, coroutines, debug)
MLIR defines ~70 more intrinsics (50 VP ops, 11 constrained FP ops, 10 coroutine ops, debug/annotation ops) that are not listed here. These are unlikely to be needed in the near term.
Missing backend support
IndexType->i64type conversion dialects: (llvm) reject incompatible types in LLVMFunctionType #5705BFloat16Type->ir.BFloat16Typetype conversion (xdsl added bf16 in core: Printing and parsing support for bf16 #6029)GlobalOpop conversion (only dialect op with noconvert_op.pyhandler)vector.ReductionOpop conversion dialects: (llvm) add llvm.intr.vector.reduce.fadd op #5866vector.BitcastOpop conversion backend: (llvm) add vector.BitcastOp conversion #5869Currently implemented: 58 dialect ops, 7 intrinsic ops, 14 backend type conversions, 57 backend op conversions.
⚡ = eliminates
patches_xdsl_llvm.pyby enabling properindex-typed IR (no more_unwrap_i64/_loop_upper_bound_as_i64hacks). Combined with the GEP work in #6074.🔥 = eliminates
patches_xdsl_intrinsics.pyby enabling exojit to emitvector/arith/mathops instead of namedllvm.CallOpintrinsics.