[Mlir-commits] [mlir] [mlir] Rewrites for I2 to I8 signed and unsigned extension (PR #121298)

Andrzej WarzyƄski llvmlistbot at llvm.org
Tue Jan 14 03:44:51 PST 2025


================
@@ -193,6 +193,23 @@ func.func @f3ext(%a: vector<5xi8>) -> vector<8xi17> {
   return %1 : vector<8xi17>
 }
 
+
+// CHECK-LABEL: func.func @aligned_i4_trailing_dim_not_multiple(
+func.func @aligned_i4_trailing_dim_not_multiple(%a: vector<1xi4>) -> vector<1xi8> {
+  // CHECK-NOT: arith.bitcast
+  // CHECK: arith.extsi %[[IN:.*]] : vector<1xi4> to vector<1xi8>
+  %0 = arith.extsi %a : vector<1xi4> to vector<1xi8>
+  return %0 : vector<1xi8>
+}
+
+// CHECK-LABEL: func.func @aligned_i2_trailing_dim_not_multiple(
+func.func @aligned_i2_trailing_dim_not_multiple(%a: vector<2xi2>) -> vector<2xi8> {
+  // CHECK-NOT: arith.bitcast
+  // CHECK: arith.extsi %[[IN:.*]] : vector<2xi2> to vector<2xi8>
+  %0 = arith.extsi %a : vector<2xi2> to vector<2xi8>
+  return %0 : vector<2xi8>
----------------
banach-space wrote:

Right, now I see. Then, still, `aligned` --> `unalagined` ;-) Also, to match the naming convention that follows this:
```mlir
@aligned_i4_trailing_dim_not_multiple --> @unaligned_extsi_i4_to_i8_trailing_dim_not_multiple
```

In fact, I'd do this:
```mlir
// Negative test - the trailing dim 2 is not a multiple of 4 (i.e. 8 / 2).

func.func @unaligned_extsi_i4_to_i8
```

Similar comment for the other negative test.

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


More information about the Mlir-commits mailing list