[Mlir-commits] [mlir] [mlir][spirv] Add spirv-to-llvm conversion for group operations (PR #115501)

Victor Perez llvmlistbot at llvm.org
Fri Nov 8 08:17:31 PST 2024


================
@@ -1089,6 +1096,186 @@ class ControlBarrierPattern
   }
 };
 
+namespace {
+
+StringRef getTypeMangling(Type type, bool isSigned) {
+  return llvm::TypeSwitch<Type, StringRef>(type)
+      .Case<Float16Type>([](auto) { return "Dh"; })
+      .template Case<Float32Type>([](auto) { return "f"; })
+      .template Case<Float64Type>([](auto) { return "d"; })
+      .template Case<IntegerType>([isSigned](IntegerType intTy) {
+        switch (intTy.getWidth()) {
+        case 1:
+          return "b";
+        case 8:
+          return (isSigned) ? "a" : "c";
+        case 16:
+          return (isSigned) ? "s" : "t";
+        case 32:
+          return (isSigned) ? "i" : "j";
+        case 64:
+          return (isSigned) ? "l" : "m";
+        default: {
+          assert(false && "Unsupported integer width");
+          return "";
+        }
----------------
victor-eds wrote:

```suggestion
        default:
          llvm_unreachable("Unsupported integer width");
```

Cleaner?

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


More information about the Mlir-commits mailing list