[Mlir-commits] [mlir] [mlir][SPIR-V] Add SPIRVToLLVM conversion for SNegate (PR #206950)

Arseniy Obolenskiy llvmlistbot at llvm.org
Fri Jul 10 04:45:51 PDT 2026


================
@@ -921,6 +921,35 @@ class InverseSqrtPattern
   }
 };
 
+/// Converts `spirv.SNegate` to `0 - x`.
+class SNegatePattern : public SPIRVToLLVMConversion<spirv::SNegateOp> {
+public:
+  using SPIRVToLLVMConversion<spirv::SNegateOp>::SPIRVToLLVMConversion;
+
+  LogicalResult
+  matchAndRewrite(spirv::SNegateOp op, OpAdaptor adaptor,
+                  ConversionPatternRewriter &rewriter) const override {
+    auto srcType = op.getType();
+    auto dstType = getTypeConverter()->convertType(srcType);
----------------
aobolensk wrote:

Done

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


More information about the Mlir-commits mailing list