[Mlir-commits] [mlir] [mlir][arith] mul operation regressions (PR #96975)

Andrzej WarzyƄski llvmlistbot at llvm.org
Sun Jun 30 09:24:50 PDT 2024


https://github.com/banach-space commented:

With your latest updates it's so much easier to see what's being tested, thank you! I have one more suggestion re structuring this.

Having `@mulsi_extended_i1()` and `@mulsi_extended_on_i1()` makes it a bit hard to understand what the intended difference is (the names are almost identical). How about:
1. Keep `@mulsi_extended_i1()` and `@mulsi_extended_i8()`
2. Rename `@mulsi_extended_on_i1()` as `@mulsi_extended()` and use it to test all variants of `@mulsi_extended_i{n}()` that you have? (i.e. `@mulsi_extended_i1()` and `@mulsi_extended_i8()`)


So, it would look like this (feel free to re-use):
```mlir
func.func @mulsi_extended_i1(%v1 : i1, %v2 : i1) -> (i1, i1) {
  // Implementation
}

func.func @mulsi_extended_i8(%v1 : i8, %v2 : i8) -> (i8, i8) {
  // Implementation
}

func.func @mulsi_extended() {
  // ------------------------------------------------
  // Test i1
  // ------------------------------------------------
  // mulsi_extended on i1, tests for overflow bit
  // mulsi_extended 1, 1 : i1 = (1, 0)
  %true = arith.constant true
  %false = arith.constant false

  // CHECK:      1
  // CHECK-NEXT: 0
  func.call @mulsi_extended_i1(%true, %true) : (i1, i1) -> (i1, i1)

  // CHECK-NEXT: 0
  // CHECK-NEXT: 0
  func.call @mulsi_extended_i1(%true, %false) : (i1, i1) -> (i1, i1)

  // CHECK-NEXT: 0
  // CHECK-NEXT: 0
  func.call @mulsi_extended_i1(%false, %true) : (i1, i1) -> (i1, i1)

  // CHECK-NEXT: 0
  // CHECK-NEXT: 0
  func.call @mulsi_extended_i1(%false, %false) : (i1, i1) -> (i1, i1)

  // ------------------------------------------------
  // Test i8
  // ------------------------------------------------
  // Some representative tests for i8, e.g. 63 * 2 vs 63 * 3, 64 * 2 vs 64 * (-2), 0 * 127, 1 * (-128)
  
  // ------------------------------------------------
  // Test i16. i32, i64 - TODO
  // ------------------------------------------------ 
}
```

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


More information about the Mlir-commits mailing list