[mlir][NFC] Update textual references of `func` to `func.func` in AMX/Arithmetic/ArmSVE/Async tests

The special case parsing of `func` operations is being removed.
This commit is contained in:
River Riddle 2022-04-20 16:14:19 -07:00
parent 227ed2f448
commit 5e7dea225b
26 changed files with 509 additions and 509 deletions

View File

@ -2,28 +2,28 @@
// -----
func @rowheight() {
func.func @rowheight() {
// expected-error@+1 {{'amx.tile_zero' op bad row height: 17}}
%0 = amx.tile_zero : vector<17x16xbf16>
}
// -----
func @colwidth() {
func.func @colwidth() {
// expected-error@+1 {{'amx.tile_zero' op bad column width: 65}}
%0 = amx.tile_zero : vector<16x65xi8>
}
// -----
func @col4bytemultiple() {
func.func @col4bytemultiple() {
// expected-error@+1 {{'amx.tile_zero' op bad column width: 5}}
%0 = amx.tile_zero : vector<16x5xi8>
}
// -----
func @memtilesize(%arg0: memref<?x?xf32>) {
func.func @memtilesize(%arg0: memref<?x?xf32>) {
%0 = arith.constant 0 : index
// expected-error@+1 {{'amx.tile_load' op bad column width: 68}}
%1 = amx.tile_load %arg0[%0, %0] : memref<?x?xf32> into vector<16x17xf32>
@ -31,7 +31,7 @@ func @memtilesize(%arg0: memref<?x?xf32>) {
// -----
func @memindexsize(%arg0: memref<?x?xf32>) {
func.func @memindexsize(%arg0: memref<?x?xf32>) {
%0 = arith.constant 0 : index
// expected-error@+1 {{'amx.tile_load' op requires 2 indices}}
%1 = amx.tile_load %arg0[%0] : memref<?x?xf32> into vector<16x16xf32>
@ -39,7 +39,7 @@ func @memindexsize(%arg0: memref<?x?xf32>) {
// -----
func @multsize() {
func.func @multsize() {
%0 = amx.tile_zero : vector<8x8xbf16>
%1 = amx.tile_zero : vector<8x8xbf16>
%2 = amx.tile_zero : vector<4x4xf32>

View File

@ -12,7 +12,7 @@
// CHECK: amx.tilestored64
// CHECK: amx.tdpbsud
// CHECK: amx.tilestored64
func @muli(%arg0: memref<?x?xi8>, %arg1: memref<?x?xi32>) {
func.func @muli(%arg0: memref<?x?xi8>, %arg1: memref<?x?xi32>) {
%0 = arith.constant 0 : index
%1 = amx.tile_zero : vector<16x64xi8>
%2 = amx.tile_load %arg0[%0, %0] : memref<?x?xi8> into vector<16x64xi8>
@ -34,7 +34,7 @@ func @muli(%arg0: memref<?x?xi8>, %arg1: memref<?x?xi32>) {
// CHECK: amx.tileloadd64
// CHECK: amx.tdpbf16ps
// CHECK: amx.tilestored64
func @mulf(%arg0: memref<?x?xbf16>, %arg1: memref<?x?xf32>) {
func.func @mulf(%arg0: memref<?x?xbf16>, %arg1: memref<?x?xf32>) {
%0 = arith.constant 0 : index
%1 = amx.tile_zero : vector<16x32xbf16>
%2 = amx.tile_load %arg0[%0, %0] : memref<?x?xbf16> into vector<16x32xbf16>

View File

@ -3,7 +3,7 @@
// CHECK-LABEL: tzero
// CHECK: amx.tile_zero : vector<16x16xbf16>
// CHECK amx.tile_store %{{.*}}[%{{.*}}, %{{.*}}], %{{.*}} : memref<?x?xbf16>, vector<16x16xbf16>
func @tzero(%arg0: memref<?x?xbf16>) {
func.func @tzero(%arg0: memref<?x?xbf16>) {
%0 = arith.constant 0 : index
%1 = amx.tile_zero : vector<16x16xbf16>
amx.tile_store %arg0[%0, %0], %1 : memref<?x?xbf16>, vector<16x16xbf16>
@ -15,7 +15,7 @@ func @tzero(%arg0: memref<?x?xbf16>) {
// CHECK: %[[z:.*]] = amx.tile_load %{{.*}}[%{{.*}}, %{{.*}}] : memref<?x?xf32> into vector<16x16xf32>
// CHECK: %[[m:.*]] = amx.tile_mulf %[[x]], %[[x]], %[[z]] : vector<16x32xbf16>, vector<16x32xbf16>, vector<16x16xf32>
// CHECK: amx.tile_store %{{.*}}[%{{.*}}, %{{.*}}], %[[m]] : memref<?x?xf32>, vector<16x16xf32>
func @tmulf(%arg0: memref<?x?xbf16>, %arg1: memref<?x?xf32>) {
func.func @tmulf(%arg0: memref<?x?xbf16>, %arg1: memref<?x?xf32>) {
%0 = arith.constant 0 : index
%1 = amx.tile_load %arg0[%0, %0] : memref<?x?xbf16> into vector<16x32xbf16>
%2 = amx.tile_load %arg1[%0, %0] : memref<?x?xf32> into vector<16x16xf32>
@ -34,7 +34,7 @@ func @tmulf(%arg0: memref<?x?xbf16>, %arg1: memref<?x?xf32>) {
// CHECK: amx.tile_muli %{{.*}}, %{{.*}} zext, %{{.*}}
// CHECK: amx.tile_muli %{{.*}} zext, %{{.*}}, %{{.*}}
// CHECK: amx.tile_muli %{{.*}}, %{{.*}}, %{{.*}}
func @tmuli(%arg0: memref<?x?xi8>, %arg1: memref<?x?xi8>, %arg2: memref<?x?xi32>) {
func.func @tmuli(%arg0: memref<?x?xi8>, %arg1: memref<?x?xi8>, %arg2: memref<?x?xi32>) {
%0 = arith.constant 0 : index
%1 = amx.tile_load %arg0[%0, %0] : memref<?x?xi8> into vector<16x64xi8>
%2 = amx.tile_load %arg1[%0, %0] : memref<?x?xi8> into vector<16x64xi8>

View File

@ -3,7 +3,7 @@
// CHECK-LABEL: func @index_cast(
// CHECK-SAME: %[[TENSOR:.*]]: tensor<i32>, %[[SCALAR:.*]]: i32
func @index_cast(%tensor: tensor<i32>, %scalar: i32) -> (tensor<index>, index) {
func.func @index_cast(%tensor: tensor<i32>, %scalar: i32) -> (tensor<index>, index) {
%index_tensor = arith.index_cast %tensor : tensor<i32> to tensor<index>
%index_scalar = arith.index_cast %scalar : i32 to index
return %index_tensor, %index_scalar : tensor<index>, index
@ -28,7 +28,7 @@ func @index_cast(%tensor: tensor<i32>, %scalar: i32) -> (tensor<index>, index) {
// ALIGNED-SAME: {alignment = 64 : i64}
// CHECK: @basic
func @basic() -> tensor<3x4xf32> {
func.func @basic() -> tensor<3x4xf32> {
// CHECK: %[[MEMREF:.*]] = memref.get_global @__constant_3x4xf32 : memref<3x4xf32>
// CHECK: %[[TENSOR:.*]] = bufferization.to_tensor %[[MEMREF]]
%0 = arith.constant dense<7.0> : tensor<3x4xf32>
@ -45,7 +45,7 @@ func @basic() -> tensor<3x4xf32> {
// Only one global is created.
// CHECK: memref.global
// CHECK-NOT: memref.global
func @duplicate_constants() -> (tensor<3x4xf32>, tensor<3x4xf32>) {
func.func @duplicate_constants() -> (tensor<3x4xf32>, tensor<3x4xf32>) {
%0 = arith.constant dense<7.0> : tensor<3x4xf32>
%1 = arith.constant dense<7.0> : tensor<3x4xf32>
return %0, %1 : tensor<3x4xf32>, tensor<3x4xf32>
@ -61,7 +61,7 @@ func @duplicate_constants() -> (tensor<3x4xf32>, tensor<3x4xf32>) {
// CHECK: memref.global
// CHECK: memref.global
// CHECK-NOT: memref.global
func @multiple_constants() -> (tensor<3x4xf32>, tensor<3x4xf32>) {
func.func @multiple_constants() -> (tensor<3x4xf32>, tensor<3x4xf32>) {
%0 = arith.constant dense<7.0> : tensor<3x4xf32>
%1 = arith.constant dense<8.0> : tensor<3x4xf32>
return %0, %1 : tensor<3x4xf32>, tensor<3x4xf32>
@ -74,7 +74,7 @@ func @multiple_constants() -> (tensor<3x4xf32>, tensor<3x4xf32>) {
// CHECK-LABEL: module {
// We don't convert non-tensor globals.
// CHECK-NOT: memref.global
func @non_tensor() {
func.func @non_tensor() {
%0 = arith.constant 7 : i32
return
}
@ -92,7 +92,7 @@ func @non_tensor() {
// CHECK: %[[RET_MEMREF:.*]] = arith.select %[[PRED]], %[[TRUE_VAL_MEMREF]], %[[FALSE_VAL_MEMREF]] : memref<f32>
// CHECK: %[[RET:.*]] = bufferization.to_tensor %[[RET_MEMREF]] : memref<f32>
// CHECK: return %[[RET]] : tensor<f32>
func @select(%arg0: i1, %arg1: tensor<f32>, %arg2: tensor<f32>) -> tensor<f32> {
func.func @select(%arg0: i1, %arg1: tensor<f32>, %arg2: tensor<f32>) -> tensor<f32> {
%0 = arith.select %arg0, %arg1, %arg2 : tensor<f32>
return %0 : tensor<f32>
}

View File

@ -2,14 +2,14 @@
// CHECK-LABEL: @select_same_val
// CHECK: return %arg1
func @select_same_val(%arg0: i1, %arg1: i64) -> i64 {
func.func @select_same_val(%arg0: i1, %arg1: i64) -> i64 {
%0 = arith.select %arg0, %arg1, %arg1 : i64
return %0 : i64
}
// CHECK-LABEL: @select_cmp_eq_select
// CHECK: return %arg1
func @select_cmp_eq_select(%arg0: i64, %arg1: i64) -> i64 {
func.func @select_cmp_eq_select(%arg0: i64, %arg1: i64) -> i64 {
%0 = arith.cmpi eq, %arg0, %arg1 : i64
%1 = arith.select %0, %arg0, %arg1 : i64
return %1 : i64
@ -17,7 +17,7 @@ func @select_cmp_eq_select(%arg0: i64, %arg1: i64) -> i64 {
// CHECK-LABEL: @select_cmp_ne_select
// CHECK: return %arg0
func @select_cmp_ne_select(%arg0: i64, %arg1: i64) -> i64 {
func.func @select_cmp_ne_select(%arg0: i64, %arg1: i64) -> i64 {
%0 = arith.cmpi ne, %arg0, %arg1 : i64
%1 = arith.select %0, %arg0, %arg1 : i64
return %1 : i64
@ -26,7 +26,7 @@ func @select_cmp_ne_select(%arg0: i64, %arg1: i64) -> i64 {
// CHECK-LABEL: @select_extui
// CHECK: %[[res:.+]] = arith.extui %arg0 : i1 to i64
// CHECK: return %[[res]]
func @select_extui(%arg0: i1) -> i64 {
func.func @select_extui(%arg0: i1) -> i64 {
%c0_i64 = arith.constant 0 : i64
%c1_i64 = arith.constant 1 : i64
%res = arith.select %arg0, %c1_i64, %c0_i64 : i64
@ -38,7 +38,7 @@ func @select_extui(%arg0: i1) -> i64 {
// CHECK-DAG: %[[xor:.+]] = arith.xori %arg0, %true : i1
// CHECK-DAG: %[[res:.+]] = arith.extui %[[xor]] : i1 to i64
// CHECK: return %[[res]]
func @select_extui2(%arg0: i1) -> i64 {
func.func @select_extui2(%arg0: i1) -> i64 {
%c0_i64 = arith.constant 0 : i64
%c1_i64 = arith.constant 1 : i64
%res = arith.select %arg0, %c0_i64, %c1_i64 : i64
@ -47,7 +47,7 @@ func @select_extui2(%arg0: i1) -> i64 {
// CHECK-LABEL: @select_extui_i1
// CHECK-NEXT: return %arg0
func @select_extui_i1(%arg0: i1) -> i1 {
func.func @select_extui_i1(%arg0: i1) -> i1 {
%c0_i1 = arith.constant false
%c1_i1 = arith.constant true
%res = arith.select %arg0, %c1_i1, %c0_i1 : i1
@ -58,7 +58,7 @@ func @select_extui_i1(%arg0: i1) -> i1 {
// CHECK: %[[trueval:.+]] = arith.constant true
// CHECK: %[[res:.+]] = arith.xori %arg0, %[[trueval]] : i1
// CHECK: return %[[res]]
func @selToNot(%arg0: i1) -> i1 {
func.func @selToNot(%arg0: i1) -> i1 {
%true = arith.constant true
%false = arith.constant false
%res = arith.select %arg0, %false, %true : i1
@ -72,7 +72,7 @@ func @selToNot(%arg0: i1) -> i1 {
// CHECK-NEXT: %[[condfalse:.+]] = arith.andi %[[notcmp]], %arg2 : i1
// CHECK-NEXT: %[[res:.+]] = arith.ori %[[condtrue]], %[[condfalse]] : i1
// CHECK: return %[[res]]
func @selToArith(%arg0: i1, %arg1 : i1, %arg2 : i1) -> i1 {
func.func @selToArith(%arg0: i1, %arg1 : i1, %arg2 : i1) -> i1 {
%res = arith.select %arg0, %arg1, %arg2 : i1
return %res : i1
}
@ -83,7 +83,7 @@ func @selToArith(%arg0: i1, %arg1 : i1, %arg2 : i1) -> i1 {
// CHECK-DAG: %[[F:.*]] = arith.constant false
// CHECK: return %[[T]], %[[T]], %[[T]], %[[T]], %[[T]],
// CHECK-SAME: %[[F]], %[[F]], %[[F]], %[[F]], %[[F]]
func @cmpi_equal_operands(%arg0: i64)
func.func @cmpi_equal_operands(%arg0: i64)
-> (i1, i1, i1, i1, i1, i1, i1, i1, i1, i1) {
%0 = arith.cmpi eq, %arg0, %arg0 : i64
%1 = arith.cmpi sle, %arg0, %arg0 : i64
@ -105,7 +105,7 @@ func @cmpi_equal_operands(%arg0: i64)
// CHECK-DAG: %[[F:.*]] = arith.constant dense<false>
// CHECK: return %[[T]], %[[T]], %[[T]], %[[T]], %[[T]],
// CHECK-SAME: %[[F]], %[[F]], %[[F]], %[[F]], %[[F]]
func @cmpi_equal_vector_operands(%arg0: vector<1x8xi64>)
func.func @cmpi_equal_vector_operands(%arg0: vector<1x8xi64>)
-> (vector<1x8xi1>, vector<1x8xi1>, vector<1x8xi1>, vector<1x8xi1>,
vector<1x8xi1>, vector<1x8xi1>, vector<1x8xi1>, vector<1x8xi1>,
vector<1x8xi1>, vector<1x8xi1>) {
@ -129,7 +129,7 @@ func @cmpi_equal_vector_operands(%arg0: vector<1x8xi64>)
// CHECK-LABEL: @cmpOfExtSI
// CHECK-NEXT: return %arg0
func @cmpOfExtSI(%arg0: i1) -> i1 {
func.func @cmpOfExtSI(%arg0: i1) -> i1 {
%ext = arith.extsi %arg0 : i1 to i64
%c0 = arith.constant 0 : i64
%res = arith.cmpi ne, %ext, %c0 : i64
@ -138,7 +138,7 @@ func @cmpOfExtSI(%arg0: i1) -> i1 {
// CHECK-LABEL: @cmpOfExtUI
// CHECK-NEXT: return %arg0
func @cmpOfExtUI(%arg0: i1) -> i1 {
func.func @cmpOfExtUI(%arg0: i1) -> i1 {
%ext = arith.extui %arg0 : i1 to i64
%c0 = arith.constant 0 : i64
%res = arith.cmpi ne, %ext, %c0 : i64
@ -150,7 +150,7 @@ func @cmpOfExtUI(%arg0: i1) -> i1 {
// CHECK-LABEL: @extSIOfExtUI
// CHECK: %[[res:.+]] = arith.extui %arg0 : i1 to i64
// CHECK: return %[[res]]
func @extSIOfExtUI(%arg0: i1) -> i64 {
func.func @extSIOfExtUI(%arg0: i1) -> i64 {
%ext1 = arith.extui %arg0 : i1 to i8
%ext2 = arith.extsi %ext1 : i8 to i64
return %ext2 : i64
@ -159,7 +159,7 @@ func @extSIOfExtUI(%arg0: i1) -> i64 {
// CHECK-LABEL: @extUIOfExtUI
// CHECK: %[[res:.+]] = arith.extui %arg0 : i1 to i64
// CHECK: return %[[res]]
func @extUIOfExtUI(%arg0: i1) -> i64 {
func.func @extUIOfExtUI(%arg0: i1) -> i64 {
%ext1 = arith.extui %arg0 : i1 to i8
%ext2 = arith.extui %ext1 : i8 to i64
return %ext2 : i64
@ -168,7 +168,7 @@ func @extUIOfExtUI(%arg0: i1) -> i64 {
// CHECK-LABEL: @extSIOfExtSI
// CHECK: %[[res:.+]] = arith.extsi %arg0 : i1 to i64
// CHECK: return %[[res]]
func @extSIOfExtSI(%arg0: i1) -> i64 {
func.func @extSIOfExtSI(%arg0: i1) -> i64 {
%ext1 = arith.extsi %arg0 : i1 to i8
%ext2 = arith.extsi %ext1 : i8 to i64
return %ext2 : i64
@ -179,7 +179,7 @@ func @extSIOfExtSI(%arg0: i1) -> i64 {
// CHECK-LABEL: @cmpIExtSINE
// CHECK: %[[comb:.+]] = arith.cmpi ne, %arg0, %arg1 : i8
// CHECK: return %[[comb]]
func @cmpIExtSINE(%arg0: i8, %arg1: i8) -> i1 {
func.func @cmpIExtSINE(%arg0: i8, %arg1: i8) -> i1 {
%ext0 = arith.extsi %arg0 : i8 to i64
%ext1 = arith.extsi %arg1 : i8 to i64
%res = arith.cmpi ne, %ext0, %ext1 : i64
@ -189,7 +189,7 @@ func @cmpIExtSINE(%arg0: i8, %arg1: i8) -> i1 {
// CHECK-LABEL: @cmpIExtSIEQ
// CHECK: %[[comb:.+]] = arith.cmpi eq, %arg0, %arg1 : i8
// CHECK: return %[[comb]]
func @cmpIExtSIEQ(%arg0: i8, %arg1: i8) -> i1 {
func.func @cmpIExtSIEQ(%arg0: i8, %arg1: i8) -> i1 {
%ext0 = arith.extsi %arg0 : i8 to i64
%ext1 = arith.extsi %arg1 : i8 to i64
%res = arith.cmpi eq, %ext0, %ext1 : i64
@ -199,7 +199,7 @@ func @cmpIExtSIEQ(%arg0: i8, %arg1: i8) -> i1 {
// CHECK-LABEL: @cmpIExtUINE
// CHECK: %[[comb:.+]] = arith.cmpi ne, %arg0, %arg1 : i8
// CHECK: return %[[comb]]
func @cmpIExtUINE(%arg0: i8, %arg1: i8) -> i1 {
func.func @cmpIExtUINE(%arg0: i8, %arg1: i8) -> i1 {
%ext0 = arith.extui %arg0 : i8 to i64
%ext1 = arith.extui %arg1 : i8 to i64
%res = arith.cmpi ne, %ext0, %ext1 : i64
@ -209,7 +209,7 @@ func @cmpIExtUINE(%arg0: i8, %arg1: i8) -> i1 {
// CHECK-LABEL: @cmpIExtUIEQ
// CHECK: %[[comb:.+]] = arith.cmpi eq, %arg0, %arg1 : i8
// CHECK: return %[[comb]]
func @cmpIExtUIEQ(%arg0: i8, %arg1: i8) -> i1 {
func.func @cmpIExtUIEQ(%arg0: i8, %arg1: i8) -> i1 {
%ext0 = arith.extui %arg0 : i8 to i64
%ext1 = arith.extui %arg1 : i8 to i64
%res = arith.cmpi eq, %ext0, %ext1 : i64
@ -222,7 +222,7 @@ func @cmpIExtUIEQ(%arg0: i8, %arg1: i8) -> i1 {
// CHECK: %[[comb:.+]] = arith.andi %arg0, %arg1 : i8
// CHECK: %[[ext:.+]] = arith.extsi %[[comb]] : i8 to i64
// CHECK: return %[[ext]]
func @andOfExtSI(%arg0: i8, %arg1: i8) -> i64 {
func.func @andOfExtSI(%arg0: i8, %arg1: i8) -> i64 {
%ext0 = arith.extsi %arg0 : i8 to i64
%ext1 = arith.extsi %arg1 : i8 to i64
%res = arith.andi %ext0, %ext1 : i64
@ -233,7 +233,7 @@ func @andOfExtSI(%arg0: i8, %arg1: i8) -> i64 {
// CHECK: %[[comb:.+]] = arith.andi %arg0, %arg1 : i8
// CHECK: %[[ext:.+]] = arith.extui %[[comb]] : i8 to i64
// CHECK: return %[[ext]]
func @andOfExtUI(%arg0: i8, %arg1: i8) -> i64 {
func.func @andOfExtUI(%arg0: i8, %arg1: i8) -> i64 {
%ext0 = arith.extui %arg0 : i8 to i64
%ext1 = arith.extui %arg1 : i8 to i64
%res = arith.andi %ext0, %ext1 : i64
@ -244,7 +244,7 @@ func @andOfExtUI(%arg0: i8, %arg1: i8) -> i64 {
// CHECK: %[[comb:.+]] = arith.ori %arg0, %arg1 : i8
// CHECK: %[[ext:.+]] = arith.extsi %[[comb]] : i8 to i64
// CHECK: return %[[ext]]
func @orOfExtSI(%arg0: i8, %arg1: i8) -> i64 {
func.func @orOfExtSI(%arg0: i8, %arg1: i8) -> i64 {
%ext0 = arith.extsi %arg0 : i8 to i64
%ext1 = arith.extsi %arg1 : i8 to i64
%res = arith.ori %ext0, %ext1 : i64
@ -255,7 +255,7 @@ func @orOfExtSI(%arg0: i8, %arg1: i8) -> i64 {
// CHECK: %[[comb:.+]] = arith.ori %arg0, %arg1 : i8
// CHECK: %[[ext:.+]] = arith.extui %[[comb]] : i8 to i64
// CHECK: return %[[ext]]
func @orOfExtUI(%arg0: i8, %arg1: i8) -> i64 {
func.func @orOfExtUI(%arg0: i8, %arg1: i8) -> i64 {
%ext0 = arith.extui %arg0 : i8 to i64
%ext1 = arith.extui %arg1 : i8 to i64
%res = arith.ori %ext0, %ext1 : i64
@ -267,7 +267,7 @@ func @orOfExtUI(%arg0: i8, %arg1: i8) -> i64 {
// CHECK-LABEL: @indexCastOfSignExtend
// CHECK: %[[res:.+]] = arith.index_cast %arg0 : i8 to index
// CHECK: return %[[res]]
func @indexCastOfSignExtend(%arg0: i8) -> index {
func.func @indexCastOfSignExtend(%arg0: i8) -> index {
%ext = arith.extsi %arg0 : i8 to i16
%idx = arith.index_cast %ext : i16 to index
return %idx : index
@ -276,7 +276,7 @@ func @indexCastOfSignExtend(%arg0: i8) -> index {
// CHECK-LABEL: @signExtendConstant
// CHECK: %[[cres:.+]] = arith.constant -2 : i16
// CHECK: return %[[cres]]
func @signExtendConstant() -> i16 {
func.func @signExtendConstant() -> i16 {
%c-2 = arith.constant -2 : i8
%ext = arith.extsi %c-2 : i8 to i16
return %ext : i16
@ -285,7 +285,7 @@ func @signExtendConstant() -> i16 {
// CHECK-LABEL: @signExtendConstantSplat
// CHECK: %[[cres:.+]] = arith.constant dense<-2> : vector<4xi16>
// CHECK: return %[[cres]]
func @signExtendConstantSplat() -> vector<4xi16> {
func.func @signExtendConstantSplat() -> vector<4xi16> {
%c-2 = arith.constant -2 : i8
%splat = vector.splat %c-2 : vector<4xi8>
%ext = arith.extsi %splat : vector<4xi8> to vector<4xi16>
@ -295,7 +295,7 @@ func @signExtendConstantSplat() -> vector<4xi16> {
// CHECK-LABEL: @signExtendConstantVector
// CHECK: %[[cres:.+]] = arith.constant dense<[1, 3, 5, 7]> : vector<4xi16>
// CHECK: return %[[cres]]
func @signExtendConstantVector() -> vector<4xi16> {
func.func @signExtendConstantVector() -> vector<4xi16> {
%vector = arith.constant dense<[1, 3, 5, 7]> : vector<4xi8>
%ext = arith.extsi %vector : vector<4xi8> to vector<4xi16>
return %ext : vector<4xi16>
@ -304,7 +304,7 @@ func @signExtendConstantVector() -> vector<4xi16> {
// CHECK-LABEL: @unsignedExtendConstant
// CHECK: %[[cres:.+]] = arith.constant 2 : i16
// CHECK: return %[[cres]]
func @unsignedExtendConstant() -> i16 {
func.func @unsignedExtendConstant() -> i16 {
%c2 = arith.constant 2 : i8
%ext = arith.extui %c2 : i8 to i16
return %ext : i16
@ -313,7 +313,7 @@ func @unsignedExtendConstant() -> i16 {
// CHECK-LABEL: @unsignedExtendConstantSplat
// CHECK: %[[cres:.+]] = arith.constant dense<2> : vector<4xi16>
// CHECK: return %[[cres]]
func @unsignedExtendConstantSplat() -> vector<4xi16> {
func.func @unsignedExtendConstantSplat() -> vector<4xi16> {
%c2 = arith.constant 2 : i8
%splat = vector.splat %c2 : vector<4xi8>
%ext = arith.extui %splat : vector<4xi8> to vector<4xi16>
@ -323,7 +323,7 @@ func @unsignedExtendConstantSplat() -> vector<4xi16> {
// CHECK-LABEL: @unsignedExtendConstantVector
// CHECK: %[[cres:.+]] = arith.constant dense<[1, 3, 5, 7]> : vector<4xi16>
// CHECK: return %[[cres]]
func @unsignedExtendConstantVector() -> vector<4xi16> {
func.func @unsignedExtendConstantVector() -> vector<4xi16> {
%vector = arith.constant dense<[1, 3, 5, 7]> : vector<4xi8>
%ext = arith.extui %vector : vector<4xi8> to vector<4xi16>
return %ext : vector<4xi16>
@ -332,7 +332,7 @@ func @unsignedExtendConstantVector() -> vector<4xi16> {
// CHECK-LABEL: @truncConstant
// CHECK: %[[cres:.+]] = arith.constant -2 : i16
// CHECK: return %[[cres]]
func @truncConstant(%arg0: i8) -> i16 {
func.func @truncConstant(%arg0: i8) -> i16 {
%c-2 = arith.constant -2 : i32
%tr = arith.trunci %c-2 : i32 to i16
return %tr : i16
@ -341,7 +341,7 @@ func @truncConstant(%arg0: i8) -> i16 {
// CHECK-LABEL: @truncConstantSplat
// CHECK: %[[cres:.+]] = arith.constant dense<-2> : vector<4xi8>
// CHECK: return %[[cres]]
func @truncConstantSplat() -> vector<4xi8> {
func.func @truncConstantSplat() -> vector<4xi8> {
%c-2 = arith.constant -2 : i16
%splat = vector.splat %c-2 : vector<4xi16>
%trunc = arith.trunci %splat : vector<4xi16> to vector<4xi8>
@ -351,7 +351,7 @@ func @truncConstantSplat() -> vector<4xi8> {
// CHECK-LABEL: @truncConstantVector
// CHECK: %[[cres:.+]] = arith.constant dense<[1, 3, 5, 7]> : vector<4xi8>
// CHECK: return %[[cres]]
func @truncConstantVector() -> vector<4xi8> {
func.func @truncConstantVector() -> vector<4xi8> {
%vector = arith.constant dense<[1, 3, 5, 7]> : vector<4xi16>
%trunc = arith.trunci %vector : vector<4xi16> to vector<4xi8>
return %trunc : vector<4xi8>
@ -360,7 +360,7 @@ func @truncConstantVector() -> vector<4xi8> {
// CHECK-LABEL: @truncTrunc
// CHECK: %[[cres:.+]] = arith.trunci %arg0 : i64 to i8
// CHECK: return %[[cres]]
func @truncTrunc(%arg0: i64) -> i8 {
func.func @truncTrunc(%arg0: i64) -> i8 {
%tr1 = arith.trunci %arg0 : i64 to i32
%tr2 = arith.trunci %tr1 : i32 to i8
return %tr2 : i8
@ -369,7 +369,7 @@ func @truncTrunc(%arg0: i64) -> i8 {
// CHECK-LABEL: @truncFPConstant
// CHECK: %[[cres:.+]] = arith.constant 1.000000e+00 : bf16
// CHECK: return %[[cres]]
func @truncFPConstant() -> bf16 {
func.func @truncFPConstant() -> bf16 {
%cst = arith.constant 1.000000e+00 : f32
%0 = arith.truncf %cst : f32 to bf16
return %0 : bf16
@ -379,7 +379,7 @@ func @truncFPConstant() -> bf16 {
// CHECK-LABEL: @truncFPConstantRounding
// CHECK: arith.constant 1.444000e+25 : f32
// CHECK: truncf
func @truncFPConstantRounding() -> bf16 {
func.func @truncFPConstantRounding() -> bf16 {
%cst = arith.constant 1.444000e+25 : f32
%0 = arith.truncf %cst : f32 to bf16
return %0 : bf16
@ -389,7 +389,7 @@ func @truncFPConstantRounding() -> bf16 {
// CHECK: %[[cres:.+]] = arith.constant 59 : index
// CHECK: %[[add:.+]] = arith.addi %arg0, %[[cres]] : index
// CHECK: return %[[add]]
func @tripleAddAdd(%arg0: index) -> index {
func.func @tripleAddAdd(%arg0: index) -> index {
%c17 = arith.constant 17 : index
%c42 = arith.constant 42 : index
%add1 = arith.addi %c17, %arg0 : index
@ -401,7 +401,7 @@ func @tripleAddAdd(%arg0: index) -> index {
// CHECK: %[[cres:.+]] = arith.constant 59 : index
// CHECK: %[[add:.+]] = arith.subi %[[cres]], %arg0 : index
// CHECK: return %[[add]]
func @tripleAddSub0(%arg0: index) -> index {
func.func @tripleAddSub0(%arg0: index) -> index {
%c17 = arith.constant 17 : index
%c42 = arith.constant 42 : index
%add1 = arith.subi %c17, %arg0 : index
@ -413,7 +413,7 @@ func @tripleAddSub0(%arg0: index) -> index {
// CHECK: %[[cres:.+]] = arith.constant 25 : index
// CHECK: %[[add:.+]] = arith.addi %arg0, %[[cres]] : index
// CHECK: return %[[add]]
func @tripleAddSub1(%arg0: index) -> index {
func.func @tripleAddSub1(%arg0: index) -> index {
%c17 = arith.constant 17 : index
%c42 = arith.constant 42 : index
%add1 = arith.subi %arg0, %c17 : index
@ -425,7 +425,7 @@ func @tripleAddSub1(%arg0: index) -> index {
// CHECK: %[[cres:.+]] = arith.constant 25 : index
// CHECK: %[[add:.+]] = arith.subi %[[cres]], %arg0 : index
// CHECK: return %[[add]]
func @tripleSubAdd0(%arg0: index) -> index {
func.func @tripleSubAdd0(%arg0: index) -> index {
%c17 = arith.constant 17 : index
%c42 = arith.constant 42 : index
%add1 = arith.addi %c17, %arg0 : index
@ -437,7 +437,7 @@ func @tripleSubAdd0(%arg0: index) -> index {
// CHECK: %[[cres:.+]] = arith.constant -25 : index
// CHECK: %[[add:.+]] = arith.addi %arg0, %[[cres]] : index
// CHECK: return %[[add]]
func @tripleSubAdd1(%arg0: index) -> index {
func.func @tripleSubAdd1(%arg0: index) -> index {
%c17 = arith.constant 17 : index
%c42 = arith.constant 42 : index
%add1 = arith.addi %c17, %arg0 : index
@ -449,7 +449,7 @@ func @tripleSubAdd1(%arg0: index) -> index {
// CHECK: %[[cres:.+]] = arith.constant 25 : index
// CHECK: %[[add:.+]] = arith.addi %arg0, %[[cres]] : index
// CHECK: return %[[add]]
func @tripleSubSub0(%arg0: index) -> index {
func.func @tripleSubSub0(%arg0: index) -> index {
%c17 = arith.constant 17 : index
%c42 = arith.constant 42 : index
%add1 = arith.subi %c17, %arg0 : index
@ -461,7 +461,7 @@ func @tripleSubSub0(%arg0: index) -> index {
// CHECK: %[[cres:.+]] = arith.constant -25 : index
// CHECK: %[[add:.+]] = arith.subi %[[cres]], %arg0 : index
// CHECK: return %[[add]]
func @tripleSubSub1(%arg0: index) -> index {
func.func @tripleSubSub1(%arg0: index) -> index {
%c17 = arith.constant 17 : index
%c42 = arith.constant 42 : index
%add1 = arith.subi %c17, %arg0 : index
@ -473,7 +473,7 @@ func @tripleSubSub1(%arg0: index) -> index {
// CHECK: %[[cres:.+]] = arith.constant 59 : index
// CHECK: %[[add:.+]] = arith.subi %[[cres]], %arg0 : index
// CHECK: return %[[add]]
func @tripleSubSub2(%arg0: index) -> index {
func.func @tripleSubSub2(%arg0: index) -> index {
%c17 = arith.constant 17 : index
%c42 = arith.constant 42 : index
%add1 = arith.subi %arg0, %c17 : index
@ -485,7 +485,7 @@ func @tripleSubSub2(%arg0: index) -> index {
// CHECK: %[[cres:.+]] = arith.constant 59 : index
// CHECK: %[[add:.+]] = arith.subi %arg0, %[[cres]] : index
// CHECK: return %[[add]]
func @tripleSubSub3(%arg0: index) -> index {
func.func @tripleSubSub3(%arg0: index) -> index {
%c17 = arith.constant 17 : index
%c42 = arith.constant 42 : index
%add1 = arith.subi %arg0, %c17 : index
@ -495,7 +495,7 @@ func @tripleSubSub3(%arg0: index) -> index {
// CHECK-LABEL: @doubleAddSub1
// CHECK-NEXT: return %arg0
func @doubleAddSub1(%arg0: index, %arg1 : index) -> index {
func.func @doubleAddSub1(%arg0: index, %arg1 : index) -> index {
%sub = arith.subi %arg0, %arg1 : index
%add = arith.addi %sub, %arg1 : index
return %add : index
@ -503,7 +503,7 @@ func @doubleAddSub1(%arg0: index, %arg1 : index) -> index {
// CHECK-LABEL: @doubleAddSub2
// CHECK-NEXT: return %arg0
func @doubleAddSub2(%arg0: index, %arg1 : index) -> index {
func.func @doubleAddSub2(%arg0: index, %arg1 : index) -> index {
%sub = arith.subi %arg0, %arg1 : index
%add = arith.addi %arg1, %sub : index
return %add : index
@ -512,7 +512,7 @@ func @doubleAddSub2(%arg0: index, %arg1 : index) -> index {
// CHECK-LABEL: @notCmpEQ
// CHECK: %[[cres:.+]] = arith.cmpi ne, %arg0, %arg1 : i8
// CHECK: return %[[cres]]
func @notCmpEQ(%arg0: i8, %arg1: i8) -> i1 {
func.func @notCmpEQ(%arg0: i8, %arg1: i8) -> i1 {
%true = arith.constant true
%cmp = arith.cmpi "eq", %arg0, %arg1 : i8
%ncmp = arith.xori %cmp, %true : i1
@ -522,7 +522,7 @@ func @notCmpEQ(%arg0: i8, %arg1: i8) -> i1 {
// CHECK-LABEL: @notCmpEQ2
// CHECK: %[[cres:.+]] = arith.cmpi ne, %arg0, %arg1 : i8
// CHECK: return %[[cres]]
func @notCmpEQ2(%arg0: i8, %arg1: i8) -> i1 {
func.func @notCmpEQ2(%arg0: i8, %arg1: i8) -> i1 {
%true = arith.constant true
%cmp = arith.cmpi "eq", %arg0, %arg1 : i8
%ncmp = arith.xori %true, %cmp : i1
@ -532,7 +532,7 @@ func @notCmpEQ2(%arg0: i8, %arg1: i8) -> i1 {
// CHECK-LABEL: @notCmpNE
// CHECK: %[[cres:.+]] = arith.cmpi eq, %arg0, %arg1 : i8
// CHECK: return %[[cres]]
func @notCmpNE(%arg0: i8, %arg1: i8) -> i1 {
func.func @notCmpNE(%arg0: i8, %arg1: i8) -> i1 {
%true = arith.constant true
%cmp = arith.cmpi "ne", %arg0, %arg1 : i8
%ncmp = arith.xori %cmp, %true : i1
@ -542,7 +542,7 @@ func @notCmpNE(%arg0: i8, %arg1: i8) -> i1 {
// CHECK-LABEL: @notCmpSLT
// CHECK: %[[cres:.+]] = arith.cmpi sge, %arg0, %arg1 : i8
// CHECK: return %[[cres]]
func @notCmpSLT(%arg0: i8, %arg1: i8) -> i1 {
func.func @notCmpSLT(%arg0: i8, %arg1: i8) -> i1 {
%true = arith.constant true
%cmp = arith.cmpi "slt", %arg0, %arg1 : i8
%ncmp = arith.xori %cmp, %true : i1
@ -552,7 +552,7 @@ func @notCmpSLT(%arg0: i8, %arg1: i8) -> i1 {
// CHECK-LABEL: @notCmpSLE
// CHECK: %[[cres:.+]] = arith.cmpi sgt, %arg0, %arg1 : i8
// CHECK: return %[[cres]]
func @notCmpSLE(%arg0: i8, %arg1: i8) -> i1 {
func.func @notCmpSLE(%arg0: i8, %arg1: i8) -> i1 {
%true = arith.constant true
%cmp = arith.cmpi "sle", %arg0, %arg1 : i8
%ncmp = arith.xori %cmp, %true : i1
@ -562,7 +562,7 @@ func @notCmpSLE(%arg0: i8, %arg1: i8) -> i1 {
// CHECK-LABEL: @notCmpSGT
// CHECK: %[[cres:.+]] = arith.cmpi sle, %arg0, %arg1 : i8
// CHECK: return %[[cres]]
func @notCmpSGT(%arg0: i8, %arg1: i8) -> i1 {
func.func @notCmpSGT(%arg0: i8, %arg1: i8) -> i1 {
%true = arith.constant true
%cmp = arith.cmpi "sgt", %arg0, %arg1 : i8
%ncmp = arith.xori %cmp, %true : i1
@ -572,7 +572,7 @@ func @notCmpSGT(%arg0: i8, %arg1: i8) -> i1 {
// CHECK-LABEL: @notCmpSGE
// CHECK: %[[cres:.+]] = arith.cmpi slt, %arg0, %arg1 : i8
// CHECK: return %[[cres]]
func @notCmpSGE(%arg0: i8, %arg1: i8) -> i1 {
func.func @notCmpSGE(%arg0: i8, %arg1: i8) -> i1 {
%true = arith.constant true
%cmp = arith.cmpi "sge", %arg0, %arg1 : i8
%ncmp = arith.xori %cmp, %true : i1
@ -582,7 +582,7 @@ func @notCmpSGE(%arg0: i8, %arg1: i8) -> i1 {
// CHECK-LABEL: @notCmpULT
// CHECK: %[[cres:.+]] = arith.cmpi uge, %arg0, %arg1 : i8
// CHECK: return %[[cres]]
func @notCmpULT(%arg0: i8, %arg1: i8) -> i1 {
func.func @notCmpULT(%arg0: i8, %arg1: i8) -> i1 {
%true = arith.constant true
%cmp = arith.cmpi "ult", %arg0, %arg1 : i8
%ncmp = arith.xori %cmp, %true : i1
@ -592,7 +592,7 @@ func @notCmpULT(%arg0: i8, %arg1: i8) -> i1 {
// CHECK-LABEL: @notCmpULE
// CHECK: %[[cres:.+]] = arith.cmpi ugt, %arg0, %arg1 : i8
// CHECK: return %[[cres]]
func @notCmpULE(%arg0: i8, %arg1: i8) -> i1 {
func.func @notCmpULE(%arg0: i8, %arg1: i8) -> i1 {
%true = arith.constant true
%cmp = arith.cmpi "ule", %arg0, %arg1 : i8
%ncmp = arith.xori %cmp, %true : i1
@ -602,7 +602,7 @@ func @notCmpULE(%arg0: i8, %arg1: i8) -> i1 {
// CHECK-LABEL: @notCmpUGT
// CHECK: %[[cres:.+]] = arith.cmpi ule, %arg0, %arg1 : i8
// CHECK: return %[[cres]]
func @notCmpUGT(%arg0: i8, %arg1: i8) -> i1 {
func.func @notCmpUGT(%arg0: i8, %arg1: i8) -> i1 {
%true = arith.constant true
%cmp = arith.cmpi "ugt", %arg0, %arg1 : i8
%ncmp = arith.xori %cmp, %true : i1
@ -612,7 +612,7 @@ func @notCmpUGT(%arg0: i8, %arg1: i8) -> i1 {
// CHECK-LABEL: @notCmpUGE
// CHECK: %[[cres:.+]] = arith.cmpi ult, %arg0, %arg1 : i8
// CHECK: return %[[cres]]
func @notCmpUGE(%arg0: i8, %arg1: i8) -> i1 {
func.func @notCmpUGE(%arg0: i8, %arg1: i8) -> i1 {
%true = arith.constant true
%cmp = arith.cmpi "uge", %arg0, %arg1 : i8
%ncmp = arith.xori %cmp, %true : i1
@ -624,7 +624,7 @@ func @notCmpUGE(%arg0: i8, %arg1: i8) -> i1 {
// CHECK-LABEL: @xorxor(
// CHECK-NOT: xori
// CHECK: return %arg0
func @xorxor(%cmp : i1) -> i1 {
func.func @xorxor(%cmp : i1) -> i1 {
%true = arith.constant true
%ncmp = arith.xori %cmp, %true : i1
%nncmp = arith.xori %ncmp, %true : i1
@ -635,7 +635,7 @@ func @xorxor(%cmp : i1) -> i1 {
// CHECK-LABEL: @bitcastSameType(
// CHECK-SAME: %[[ARG:[a-zA-Z0-9_]*]]
func @bitcastSameType(%arg : f32) -> f32 {
func.func @bitcastSameType(%arg : f32) -> f32 {
// CHECK: return %[[ARG]]
%res = arith.bitcast %arg : f32 to f32
return %res : f32
@ -644,7 +644,7 @@ func @bitcastSameType(%arg : f32) -> f32 {
// -----
// CHECK-LABEL: @bitcastConstantFPtoI(
func @bitcastConstantFPtoI() -> i32 {
func.func @bitcastConstantFPtoI() -> i32 {
// CHECK: %[[C0:.+]] = arith.constant 0 : i32
// CHECK: return %[[C0]]
%c0 = arith.constant 0.0 : f32
@ -655,7 +655,7 @@ func @bitcastConstantFPtoI() -> i32 {
// -----
// CHECK-LABEL: @bitcastConstantItoFP(
func @bitcastConstantItoFP() -> f32 {
func.func @bitcastConstantItoFP() -> f32 {
// CHECK: %[[C0:.+]] = arith.constant 0.0{{.*}} : f32
// CHECK: return %[[C0]]
%c0 = arith.constant 0 : i32
@ -666,7 +666,7 @@ func @bitcastConstantItoFP() -> f32 {
// -----
// CHECK-LABEL: @bitcastConstantFPtoFP(
func @bitcastConstantFPtoFP() -> f16 {
func.func @bitcastConstantFPtoFP() -> f16 {
// CHECK: %[[C0:.+]] = arith.constant 0.0{{.*}} : f16
// CHECK: return %[[C0]]
%c0 = arith.constant 0.0 : bf16
@ -677,7 +677,7 @@ func @bitcastConstantFPtoFP() -> f16 {
// -----
// CHECK-LABEL: @bitcastConstantVecFPtoI(
func @bitcastConstantVecFPtoI() -> vector<3xf32> {
func.func @bitcastConstantVecFPtoI() -> vector<3xf32> {
// CHECK: %[[C0:.+]] = arith.constant dense<0.0{{.*}}> : vector<3xf32>
// CHECK: return %[[C0]]
%c0 = arith.constant dense<0> : vector<3xi32>
@ -688,7 +688,7 @@ func @bitcastConstantVecFPtoI() -> vector<3xf32> {
// -----
// CHECK-LABEL: @bitcastConstantVecItoFP(
func @bitcastConstantVecItoFP() -> vector<3xi32> {
func.func @bitcastConstantVecItoFP() -> vector<3xi32> {
// CHECK: %[[C0:.+]] = arith.constant dense<0> : vector<3xi32>
// CHECK: return %[[C0]]
%c0 = arith.constant dense<0.0> : vector<3xf32>
@ -699,7 +699,7 @@ func @bitcastConstantVecItoFP() -> vector<3xi32> {
// -----
// CHECK-LABEL: @bitcastConstantVecFPtoFP(
func @bitcastConstantVecFPtoFP() -> vector<3xbf16> {
func.func @bitcastConstantVecFPtoFP() -> vector<3xbf16> {
// CHECK: %[[C0:.+]] = arith.constant dense<0.0{{.*}}> : vector<3xbf16>
// CHECK: return %[[C0]]
%c0 = arith.constant dense<0.0> : vector<3xf16>
@ -711,7 +711,7 @@ func @bitcastConstantVecFPtoFP() -> vector<3xbf16> {
// CHECK-LABEL: @bitcastBackAndForth(
// CHECK-SAME: %[[ARG:[a-zA-Z0-9_]*]]
func @bitcastBackAndForth(%arg : i32) -> i32 {
func.func @bitcastBackAndForth(%arg : i32) -> i32 {
// CHECK: return %[[ARG]]
%f = arith.bitcast %arg : i32 to f32
%res = arith.bitcast %f : f32 to i32
@ -722,7 +722,7 @@ func @bitcastBackAndForth(%arg : i32) -> i32 {
// CHECK-LABEL: @bitcastOfBitcast(
// CHECK-SAME: %[[ARG:[a-zA-Z0-9_]*]]
func @bitcastOfBitcast(%arg : i16) -> i16 {
func.func @bitcastOfBitcast(%arg : i16) -> i16 {
// CHECK: return %[[ARG]]
%f = arith.bitcast %arg : i16 to f16
%bf = arith.bitcast %f : f16 to bf16
@ -737,7 +737,7 @@ func @bitcastOfBitcast(%arg : i16) -> i16 {
// CHECK: %[[MAX_INT_CST:.+]] = arith.constant 127
// CHECK: %[[X:.+]] = arith.maxsi %arg0, %[[C0]]
// CHECK: return %arg0, %[[MAX_INT_CST]], %arg0, %[[X]]
func @test_maxsi(%arg0 : i8) -> (i8, i8, i8, i8) {
func.func @test_maxsi(%arg0 : i8) -> (i8, i8, i8, i8) {
%maxIntCst = arith.constant 127 : i8
%minIntCst = arith.constant -128 : i8
%c0 = arith.constant 42 : i8
@ -753,7 +753,7 @@ func @test_maxsi(%arg0 : i8) -> (i8, i8, i8, i8) {
// CHECK: %[[MAX_INT_CST:.+]] = arith.constant 127
// CHECK: %[[X:.+]] = arith.maxsi %arg0, %[[C0]]
// CHECK: return %arg0, %[[MAX_INT_CST]], %arg0, %[[X]]
func @test_maxsi2(%arg0 : i8) -> (i8, i8, i8, i8) {
func.func @test_maxsi2(%arg0 : i8) -> (i8, i8, i8, i8) {
%maxIntCst = arith.constant 127 : i8
%minIntCst = arith.constant -128 : i8
%c0 = arith.constant 42 : i8
@ -771,7 +771,7 @@ func @test_maxsi2(%arg0 : i8) -> (i8, i8, i8, i8) {
// CHECK: %[[MAX_INT_CST:.+]] = arith.constant -1
// CHECK: %[[X:.+]] = arith.maxui %arg0, %[[C0]]
// CHECK: return %arg0, %[[MAX_INT_CST]], %arg0, %[[X]]
func @test_maxui(%arg0 : i8) -> (i8, i8, i8, i8) {
func.func @test_maxui(%arg0 : i8) -> (i8, i8, i8, i8) {
%maxIntCst = arith.constant 255 : i8
%minIntCst = arith.constant 0 : i8
%c0 = arith.constant 42 : i8
@ -787,7 +787,7 @@ func @test_maxui(%arg0 : i8) -> (i8, i8, i8, i8) {
// CHECK: %[[MAX_INT_CST:.+]] = arith.constant -1
// CHECK: %[[X:.+]] = arith.maxui %arg0, %[[C0]]
// CHECK: return %arg0, %[[MAX_INT_CST]], %arg0, %[[X]]
func @test_maxui2(%arg0 : i8) -> (i8, i8, i8, i8) {
func.func @test_maxui2(%arg0 : i8) -> (i8, i8, i8, i8) {
%maxIntCst = arith.constant 255 : i8
%minIntCst = arith.constant 0 : i8
%c0 = arith.constant 42 : i8
@ -805,7 +805,7 @@ func @test_maxui2(%arg0 : i8) -> (i8, i8, i8, i8) {
// CHECK: %[[MIN_INT_CST:.+]] = arith.constant -128
// CHECK: %[[X:.+]] = arith.minsi %arg0, %[[C0]]
// CHECK: return %arg0, %arg0, %[[MIN_INT_CST]], %[[X]]
func @test_minsi(%arg0 : i8) -> (i8, i8, i8, i8) {
func.func @test_minsi(%arg0 : i8) -> (i8, i8, i8, i8) {
%maxIntCst = arith.constant 127 : i8
%minIntCst = arith.constant -128 : i8
%c0 = arith.constant 42 : i8
@ -821,7 +821,7 @@ func @test_minsi(%arg0 : i8) -> (i8, i8, i8, i8) {
// CHECK: %[[MIN_INT_CST:.+]] = arith.constant -128
// CHECK: %[[X:.+]] = arith.minsi %arg0, %[[C0]]
// CHECK: return %arg0, %arg0, %[[MIN_INT_CST]], %[[X]]
func @test_minsi2(%arg0 : i8) -> (i8, i8, i8, i8) {
func.func @test_minsi2(%arg0 : i8) -> (i8, i8, i8, i8) {
%maxIntCst = arith.constant 127 : i8
%minIntCst = arith.constant -128 : i8
%c0 = arith.constant 42 : i8
@ -839,7 +839,7 @@ func @test_minsi2(%arg0 : i8) -> (i8, i8, i8, i8) {
// CHECK: %[[MIN_INT_CST:.+]] = arith.constant 0
// CHECK: %[[X:.+]] = arith.minui %arg0, %[[C0]]
// CHECK: return %arg0, %arg0, %[[MIN_INT_CST]], %[[X]]
func @test_minui(%arg0 : i8) -> (i8, i8, i8, i8) {
func.func @test_minui(%arg0 : i8) -> (i8, i8, i8, i8) {
%maxIntCst = arith.constant 255 : i8
%minIntCst = arith.constant 0 : i8
%c0 = arith.constant 42 : i8
@ -855,7 +855,7 @@ func @test_minui(%arg0 : i8) -> (i8, i8, i8, i8) {
// CHECK: %[[MIN_INT_CST:.+]] = arith.constant 0
// CHECK: %[[X:.+]] = arith.minui %arg0, %[[C0]]
// CHECK: return %arg0, %arg0, %[[MIN_INT_CST]], %[[X]]
func @test_minui2(%arg0 : i8) -> (i8, i8, i8, i8) {
func.func @test_minui2(%arg0 : i8) -> (i8, i8, i8, i8) {
%maxIntCst = arith.constant 255 : i8
%minIntCst = arith.constant 0 : i8
%c0 = arith.constant 42 : i8
@ -869,7 +869,7 @@ func @test_minui2(%arg0 : i8) -> (i8, i8, i8, i8) {
// -----
// CHECK-LABEL: @test_minf(
func @test_minf(%arg0 : f32) -> (f32, f32, f32) {
func.func @test_minf(%arg0 : f32) -> (f32, f32, f32) {
// CHECK-DAG: %[[C0:.+]] = arith.constant 0.0
// CHECK-NEXT: %[[X:.+]] = arith.minf %arg0, %[[C0]]
// CHECK-NEXT: return %[[X]], %arg0, %arg0
@ -884,7 +884,7 @@ func @test_minf(%arg0 : f32) -> (f32, f32, f32) {
// -----
// CHECK-LABEL: @test_maxf(
func @test_maxf(%arg0 : f32) -> (f32, f32, f32) {
func.func @test_maxf(%arg0 : f32) -> (f32, f32, f32) {
// CHECK-DAG: %[[C0:.+]] = arith.constant
// CHECK-NEXT: %[[X:.+]] = arith.maxf %arg0, %[[C0]]
// CHECK-NEXT: return %[[X]], %arg0, %arg0
@ -899,7 +899,7 @@ func @test_maxf(%arg0 : f32) -> (f32, f32, f32) {
// -----
// CHECK-LABEL: @test_addf(
func @test_addf(%arg0 : f32) -> (f32, f32, f32, f32) {
func.func @test_addf(%arg0 : f32) -> (f32, f32, f32, f32) {
// CHECK-DAG: %[[C2:.+]] = arith.constant 2.0
// CHECK-DAG: %[[C0:.+]] = arith.constant 0.0
// CHECK-NEXT: %[[X:.+]] = arith.addf %arg0, %[[C0]]
@ -917,7 +917,7 @@ func @test_addf(%arg0 : f32) -> (f32, f32, f32, f32) {
// -----
// CHECK-LABEL: @test_subf(
func @test_subf(%arg0 : f16) -> (f16, f16, f16) {
func.func @test_subf(%arg0 : f16) -> (f16, f16, f16) {
// CHECK-DAG: %[[C1:.+]] = arith.constant -1.0
// CHECK-DAG: %[[C0:.+]] = arith.constant -0.0
// CHECK-NEXT: %[[X:.+]] = arith.subf %arg0, %[[C0]]
@ -934,7 +934,7 @@ func @test_subf(%arg0 : f16) -> (f16, f16, f16) {
// -----
// CHECK-LABEL: @test_mulf(
func @test_mulf(%arg0 : f32) -> (f32, f32, f32, f32) {
func.func @test_mulf(%arg0 : f32) -> (f32, f32, f32, f32) {
// CHECK-DAG: %[[C2:.+]] = arith.constant 2.0
// CHECK-DAG: %[[C4:.+]] = arith.constant 4.0
// CHECK-NEXT: %[[X:.+]] = arith.mulf %arg0, %[[C2]]
@ -951,7 +951,7 @@ func @test_mulf(%arg0 : f32) -> (f32, f32, f32, f32) {
// -----
// CHECK-LABEL: @test_divf(
func @test_divf(%arg0 : f64) -> (f64, f64) {
func.func @test_divf(%arg0 : f64) -> (f64, f64) {
// CHECK-NEXT: %[[C5:.+]] = arith.constant 5.000000e-01
// CHECK-NEXT: return %arg0, %[[C5]]
%c1 = arith.constant 1.0 : f64
@ -964,7 +964,7 @@ func @test_divf(%arg0 : f64) -> (f64, f64) {
// -----
// CHECK-LABEL: @test_cmpf(
func @test_cmpf(%arg0 : f32) -> (i1, i1, i1, i1) {
func.func @test_cmpf(%arg0 : f32) -> (i1, i1, i1, i1) {
// CHECK-DAG: %[[T:.*]] = arith.constant true
// CHECK-DAG: %[[F:.*]] = arith.constant false
// CHECK: return %[[F]], %[[F]], %[[T]], %[[T]]
@ -979,7 +979,7 @@ func @test_cmpf(%arg0 : f32) -> (i1, i1, i1, i1) {
// -----
// CHECK-LABEL: @constant_FPtoUI(
func @constant_FPtoUI() -> i32 {
func.func @constant_FPtoUI() -> i32 {
// CHECK: %[[C0:.+]] = arith.constant 2 : i32
// CHECK: return %[[C0]]
%c0 = arith.constant 2.0 : f32
@ -988,7 +988,7 @@ func @constant_FPtoUI() -> i32 {
}
// CHECK-LABEL: @constant_FPtoUI_splat(
func @constant_FPtoUI_splat() -> vector<4xi32> {
func.func @constant_FPtoUI_splat() -> vector<4xi32> {
// CHECK: %[[C0:.+]] = arith.constant dense<2> : vector<4xi32>
// CHECK: return %[[C0]]
%c0 = arith.constant 2.0 : f32
@ -998,7 +998,7 @@ func @constant_FPtoUI_splat() -> vector<4xi32> {
}
// CHECK-LABEL: @constant_FPtoUI_vector(
func @constant_FPtoUI_vector() -> vector<4xi32> {
func.func @constant_FPtoUI_vector() -> vector<4xi32> {
// CHECK: %[[C0:.+]] = arith.constant dense<[1, 3, 5, 7]> : vector<4xi32>
// CHECK: return %[[C0]]
%vector = arith.constant dense<[1.0, 3.0, 5.0, 7.0]> : vector<4xf32>
@ -1008,7 +1008,7 @@ func @constant_FPtoUI_vector() -> vector<4xi32> {
// -----
// CHECK-LABEL: @invalid_constant_FPtoUI(
func @invalid_constant_FPtoUI() -> i32 {
func.func @invalid_constant_FPtoUI() -> i32 {
// CHECK: %[[C0:.+]] = arith.constant -2.000000e+00 : f32
// CHECK: %[[C1:.+]] = arith.fptoui %[[C0]] : f32 to i32
// CHECK: return %[[C1]]
@ -1019,7 +1019,7 @@ func @invalid_constant_FPtoUI() -> i32 {
// -----
// CHECK-LABEL: @constant_FPtoSI(
func @constant_FPtoSI() -> i32 {
func.func @constant_FPtoSI() -> i32 {
// CHECK: %[[C0:.+]] = arith.constant -2 : i32
// CHECK: return %[[C0]]
%c0 = arith.constant -2.0 : f32
@ -1028,7 +1028,7 @@ func @constant_FPtoSI() -> i32 {
}
// CHECK-LABEL: @constant_FPtoSI_splat(
func @constant_FPtoSI_splat() -> vector<4xi32> {
func.func @constant_FPtoSI_splat() -> vector<4xi32> {
// CHECK: %[[C0:.+]] = arith.constant dense<-2> : vector<4xi32>
// CHECK: return %[[C0]]
%c0 = arith.constant -2.0 : f32
@ -1038,7 +1038,7 @@ func @constant_FPtoSI_splat() -> vector<4xi32> {
}
// CHECK-LABEL: @constant_FPtoSI_vector(
func @constant_FPtoSI_vector() -> vector<4xi32> {
func.func @constant_FPtoSI_vector() -> vector<4xi32> {
// CHECK: %[[C0:.+]] = arith.constant dense<[-1, -3, -5, -7]> : vector<4xi32>
// CHECK: return %[[C0]]
%vector = arith.constant dense<[-1.0, -3.0, -5.0, -7.0]> : vector<4xf32>
@ -1048,7 +1048,7 @@ func @constant_FPtoSI_vector() -> vector<4xi32> {
// -----
// CHECK-LABEL: @invalid_constant_FPtoSI(
func @invalid_constant_FPtoSI() -> i8 {
func.func @invalid_constant_FPtoSI() -> i8 {
// CHECK: %[[C0:.+]] = arith.constant 2.000000e+10 : f32
// CHECK: %[[C1:.+]] = arith.fptosi %[[C0]] : f32 to i8
// CHECK: return %[[C1]]
@ -1058,7 +1058,7 @@ func @invalid_constant_FPtoSI() -> i8 {
}
// CHECK-LABEL: @constant_SItoFP(
func @constant_SItoFP() -> f32 {
func.func @constant_SItoFP() -> f32 {
// CHECK: %[[C0:.+]] = arith.constant -2.000000e+00 : f32
// CHECK: return %[[C0]]
%c0 = arith.constant -2 : i32
@ -1067,7 +1067,7 @@ func @constant_SItoFP() -> f32 {
}
// CHECK-LABEL: @constant_SItoFP_splat(
func @constant_SItoFP_splat() -> vector<4xf32> {
func.func @constant_SItoFP_splat() -> vector<4xf32> {
// CHECK: %[[C0:.+]] = arith.constant dense<2.000000e+00> : vector<4xf32>
// CHECK: return %[[C0]]
%c0 = arith.constant 2 : i32
@ -1077,7 +1077,7 @@ func @constant_SItoFP_splat() -> vector<4xf32> {
}
// CHECK-LABEL: @constant_SItoFP_vector(
func @constant_SItoFP_vector() -> vector<4xf32> {
func.func @constant_SItoFP_vector() -> vector<4xf32> {
// CHECK: %[[C0:.+]] = arith.constant dense<[1.000000e+00, 3.000000e+00, 5.000000e+00, 7.000000e+00]> : vector<4xf32>
// CHECK: return %[[C0]]
%vector = arith.constant dense<[1, 3, 5, 7]> : vector<4xi32>
@ -1087,7 +1087,7 @@ func @constant_SItoFP_vector() -> vector<4xf32> {
// -----
// CHECK-LABEL: @constant_UItoFP(
func @constant_UItoFP() -> f32 {
func.func @constant_UItoFP() -> f32 {
// CHECK: %[[C0:.+]] = arith.constant 2.000000e+00 : f32
// CHECK: return %[[C0]]
%c0 = arith.constant 2 : i32
@ -1096,7 +1096,7 @@ func @constant_UItoFP() -> f32 {
}
// CHECK-LABEL: @constant_UItoFP_splat(
func @constant_UItoFP_splat() -> vector<4xf32> {
func.func @constant_UItoFP_splat() -> vector<4xf32> {
// CHECK: %[[C0:.+]] = arith.constant dense<2.000000e+00> : vector<4xf32>
// CHECK: return %[[C0]]
%c0 = arith.constant 2 : i32
@ -1106,7 +1106,7 @@ func @constant_UItoFP_splat() -> vector<4xf32> {
}
// CHECK-LABEL: @constant_UItoFP_vector(
func @constant_UItoFP_vector() -> vector<4xf32> {
func.func @constant_UItoFP_vector() -> vector<4xf32> {
// CHECK: %[[C0:.+]] = arith.constant dense<[1.000000e+00, 3.000000e+00, 5.000000e+00, 7.000000e+00]> : vector<4xf32>
// CHECK: return %[[C0]]
%vector = arith.constant dense<[1, 3, 5, 7]> : vector<4xi32>
@ -1122,7 +1122,7 @@ func @constant_UItoFP_vector() -> vector<4xf32> {
// CHECK-LABEL: @test1(
// CHECK-SAME: %[[arg0:.+]]:
func @test1(%arg0: i32) -> i1 {
func.func @test1(%arg0: i32) -> i1 {
%cst = arith.constant 0.000000e+00 : f64
%1 = arith.uitofp %arg0: i32 to f64
%2 = arith.cmpf ole, %1, %cst : f64
@ -1133,7 +1133,7 @@ func @test1(%arg0: i32) -> i1 {
// CHECK-LABEL: @test2(
// CHECK-SAME: %[[arg0:.+]]:
func @test2(%arg0: i32) -> i1 {
func.func @test2(%arg0: i32) -> i1 {
%cst = arith.constant 0.000000e+00 : f64
%1 = arith.uitofp %arg0: i32 to f64
%2 = arith.cmpf olt, %1, %cst : f64
@ -1144,7 +1144,7 @@ func @test2(%arg0: i32) -> i1 {
// CHECK-LABEL: @test3(
// CHECK-SAME: %[[arg0:.+]]:
func @test3(%arg0: i32) -> i1 {
func.func @test3(%arg0: i32) -> i1 {
%cst = arith.constant 0.000000e+00 : f64
%1 = arith.uitofp %arg0: i32 to f64
%2 = arith.cmpf oge, %1, %cst : f64
@ -1155,7 +1155,7 @@ func @test3(%arg0: i32) -> i1 {
// CHECK-LABEL: @test4(
// CHECK-SAME: %[[arg0:.+]]:
func @test4(%arg0: i32) -> i1 {
func.func @test4(%arg0: i32) -> i1 {
%cst = arith.constant 0.000000e+00 : f64
%1 = arith.uitofp %arg0: i32 to f64
%2 = arith.cmpf ogt, %1, %cst : f64
@ -1165,7 +1165,7 @@ func @test4(%arg0: i32) -> i1 {
}
// CHECK-LABEL: @test5(
func @test5(%arg0: i32) -> i1 {
func.func @test5(%arg0: i32) -> i1 {
%cst = arith.constant -4.400000e+00 : f64
%1 = arith.uitofp %arg0: i32 to f64
%2 = arith.cmpf ogt, %1, %cst : f64
@ -1175,7 +1175,7 @@ func @test5(%arg0: i32) -> i1 {
}
// CHECK-LABEL: @test6(
func @test6(%arg0: i32) -> i1 {
func.func @test6(%arg0: i32) -> i1 {
%cst = arith.constant -4.400000e+00 : f64
%1 = arith.uitofp %arg0: i32 to f64
%2 = arith.cmpf olt, %1, %cst : f64
@ -1188,7 +1188,7 @@ func @test6(%arg0: i32) -> i1 {
// positive and negative constants.
// CHECK-LABEL: @test7(
// CHECK-SAME: %[[arg0:.+]]:
func @test7(%arg0: i32) -> i1 {
func.func @test7(%arg0: i32) -> i1 {
%cst = arith.constant 3.200000e+00 : f64
%1 = arith.uitofp %arg0: i32 to f64
%2 = arith.cmpf oge, %1, %cst : f64
@ -1202,7 +1202,7 @@ func @test7(%arg0: i32) -> i1 {
// CHECK-LABEL: @foldShl(
// CHECK: %[[res:.+]] = arith.constant 4294967296 : i64
// CHECK: return %[[res]]
func @foldShl() -> i64 {
func.func @foldShl() -> i64 {
%c1 = arith.constant 1 : i64
%c32 = arith.constant 32 : i64
%r = arith.shli %c1, %c32 : i64
@ -1212,7 +1212,7 @@ func @foldShl() -> i64 {
// CHECK-LABEL: @nofoldShl(
// CHECK: %[[res:.+]] = arith.shli
// CHECK: return %[[res]]
func @nofoldShl() -> i64 {
func.func @nofoldShl() -> i64 {
%c1 = arith.constant 1 : i64
%c132 = arith.constant 132 : i64
%r = arith.shli %c1, %c132 : i64
@ -1222,7 +1222,7 @@ func @nofoldShl() -> i64 {
// CHECK-LABEL: @nofoldShl2(
// CHECK: %[[res:.+]] = arith.shli
// CHECK: return %[[res]]
func @nofoldShl2() -> i64 {
func.func @nofoldShl2() -> i64 {
%c1 = arith.constant 1 : i64
%cm32 = arith.constant -32 : i64
%r = arith.shli %c1, %cm32 : i64
@ -1232,7 +1232,7 @@ func @nofoldShl2() -> i64 {
// CHECK-LABEL: @foldShru(
// CHECK: %[[res:.+]] = arith.constant 2 : i64
// CHECK: return %[[res]]
func @foldShru() -> i64 {
func.func @foldShru() -> i64 {
%c1 = arith.constant 8 : i64
%c32 = arith.constant 2 : i64
%r = arith.shrui %c1, %c32 : i64
@ -1242,7 +1242,7 @@ func @foldShru() -> i64 {
// CHECK-LABEL: @foldShru2(
// CHECK: %[[res:.+]] = arith.constant 9223372036854775807 : i64
// CHECK: return %[[res]]
func @foldShru2() -> i64 {
func.func @foldShru2() -> i64 {
%c1 = arith.constant -2 : i64
%c32 = arith.constant 1 : i64
%r = arith.shrui %c1, %c32 : i64
@ -1252,7 +1252,7 @@ func @foldShru2() -> i64 {
// CHECK-LABEL: @nofoldShru(
// CHECK: %[[res:.+]] = arith.shrui
// CHECK: return %[[res]]
func @nofoldShru() -> i64 {
func.func @nofoldShru() -> i64 {
%c1 = arith.constant 8 : i64
%c132 = arith.constant 132 : i64
%r = arith.shrui %c1, %c132 : i64
@ -1262,7 +1262,7 @@ func @nofoldShru() -> i64 {
// CHECK-LABEL: @nofoldShru2(
// CHECK: %[[res:.+]] = arith.shrui
// CHECK: return %[[res]]
func @nofoldShru2() -> i64 {
func.func @nofoldShru2() -> i64 {
%c1 = arith.constant 8 : i64
%cm32 = arith.constant -32 : i64
%r = arith.shrui %c1, %cm32 : i64
@ -1272,7 +1272,7 @@ func @nofoldShru2() -> i64 {
// CHECK-LABEL: @foldShrs(
// CHECK: %[[res:.+]] = arith.constant 2 : i64
// CHECK: return %[[res]]
func @foldShrs() -> i64 {
func.func @foldShrs() -> i64 {
%c1 = arith.constant 8 : i64
%c32 = arith.constant 2 : i64
%r = arith.shrsi %c1, %c32 : i64
@ -1282,7 +1282,7 @@ func @foldShrs() -> i64 {
// CHECK-LABEL: @foldShrs2(
// CHECK: %[[res:.+]] = arith.constant -1 : i64
// CHECK: return %[[res]]
func @foldShrs2() -> i64 {
func.func @foldShrs2() -> i64 {
%c1 = arith.constant -2 : i64
%c32 = arith.constant 1 : i64
%r = arith.shrsi %c1, %c32 : i64
@ -1292,7 +1292,7 @@ func @foldShrs2() -> i64 {
// CHECK-LABEL: @nofoldShrs(
// CHECK: %[[res:.+]] = arith.shrsi
// CHECK: return %[[res]]
func @nofoldShrs() -> i64 {
func.func @nofoldShrs() -> i64 {
%c1 = arith.constant 8 : i64
%c132 = arith.constant 132 : i64
%r = arith.shrsi %c1, %c132 : i64
@ -1302,7 +1302,7 @@ func @nofoldShrs() -> i64 {
// CHECK-LABEL: @nofoldShrs2(
// CHECK: %[[res:.+]] = arith.shrsi
// CHECK: return %[[res]]
func @nofoldShrs2() -> i64 {
func.func @nofoldShrs2() -> i64 {
%c1 = arith.constant 8 : i64
%cm32 = arith.constant -32 : i64
%r = arith.shrsi %c1, %cm32 : i64
@ -1314,7 +1314,7 @@ func @nofoldShrs2() -> i64 {
// CHECK-LABEL: @test_negf(
// CHECK: %[[res:.+]] = arith.constant -2.0
// CHECK: return %[[res]]
func @test_negf() -> (f32) {
func.func @test_negf() -> (f32) {
%c = arith.constant 2.0 : f32
%0 = arith.negf %c : f32
return %0: f32

View File

@ -3,7 +3,7 @@
// Test ceil divide with signed integer
// CHECK-LABEL: func @ceildivi
// CHECK-SAME: ([[ARG0:%.+]]: i32, [[ARG1:%.+]]: i32) -> i32 {
func @ceildivi(%arg0: i32, %arg1: i32) -> (i32) {
func.func @ceildivi(%arg0: i32, %arg1: i32) -> (i32) {
%res = arith.ceildivsi %arg0, %arg1 : i32
return %res : i32
@ -33,7 +33,7 @@ func @ceildivi(%arg0: i32, %arg1: i32) -> (i32) {
// Test ceil divide with index type
// CHECK-LABEL: func @ceildivi_index
// CHECK-SAME: ([[ARG0:%.+]]: index, [[ARG1:%.+]]: index) -> index {
func @ceildivi_index(%arg0: index, %arg1: index) -> (index) {
func.func @ceildivi_index(%arg0: index, %arg1: index) -> (index) {
%res = arith.ceildivsi %arg0, %arg1 : index
return %res : index
@ -63,7 +63,7 @@ func @ceildivi_index(%arg0: index, %arg1: index) -> (index) {
// Test floor divide with signed integer
// CHECK-LABEL: func @floordivi
// CHECK-SAME: ([[ARG0:%.+]]: i32, [[ARG1:%.+]]: i32) -> i32 {
func @floordivi(%arg0: i32, %arg1: i32) -> (i32) {
func.func @floordivi(%arg0: i32, %arg1: i32) -> (i32) {
%res = arith.floordivsi %arg0, %arg1 : i32
return %res : i32
// CHECK: [[ONE:%.+]] = arith.constant 1 : i32
@ -90,7 +90,7 @@ func @floordivi(%arg0: i32, %arg1: i32) -> (i32) {
// Test floor divide with index type
// CHECK-LABEL: func @floordivi_index
// CHECK-SAME: ([[ARG0:%.+]]: index, [[ARG1:%.+]]: index) -> index {
func @floordivi_index(%arg0: index, %arg1: index) -> (index) {
func.func @floordivi_index(%arg0: index, %arg1: index) -> (index) {
%res = arith.floordivsi %arg0, %arg1 : index
return %res : index
// CHECK: [[ONE:%.+]] = arith.constant 1 : index
@ -117,7 +117,7 @@ func @floordivi_index(%arg0: index, %arg1: index) -> (index) {
// Test ceil divide with unsigned integer
// CHECK-LABEL: func @ceildivui
// CHECK-SAME: ([[ARG0:%.+]]: i32, [[ARG1:%.+]]: i32) -> i32 {
func @ceildivui(%arg0: i32, %arg1: i32) -> (i32) {
func.func @ceildivui(%arg0: i32, %arg1: i32) -> (i32) {
%res = arith.ceildivui %arg0, %arg1 : i32
return %res : i32
// CHECK: [[ZERO:%.+]] = arith.constant 0 : i32
@ -134,7 +134,7 @@ func @ceildivui(%arg0: i32, %arg1: i32) -> (i32) {
// Test unsigned ceil divide with index
// CHECK-LABEL: func @ceildivui_index
// CHECK-SAME: ([[ARG0:%.+]]: index, [[ARG1:%.+]]: index) -> index {
func @ceildivui_index(%arg0: index, %arg1: index) -> (index) {
func.func @ceildivui_index(%arg0: index, %arg1: index) -> (index) {
%res = arith.ceildivui %arg0, %arg1 : index
return %res : index
// CHECK: [[ZERO:%.+]] = arith.constant 0 : index
@ -149,7 +149,7 @@ func @ceildivui_index(%arg0: index, %arg1: index) -> (index) {
// -----
// CHECK-LABEL: func @maxf
func @maxf(%a: f32, %b: f32) -> f32 {
func.func @maxf(%a: f32, %b: f32) -> f32 {
%result = arith.maxf %a, %b : f32
return %result : f32
}
@ -163,7 +163,7 @@ func @maxf(%a: f32, %b: f32) -> f32 {
// -----
// CHECK-LABEL: func @maxf_vector
func @maxf_vector(%a: vector<4xf16>, %b: vector<4xf16>) -> vector<4xf16> {
func.func @maxf_vector(%a: vector<4xf16>, %b: vector<4xf16>) -> vector<4xf16> {
%result = arith.maxf %a, %b : vector<4xf16>
return %result : vector<4xf16>
}
@ -177,7 +177,7 @@ func @maxf_vector(%a: vector<4xf16>, %b: vector<4xf16>) -> vector<4xf16> {
// -----
// CHECK-LABEL: func @minf
func @minf(%a: f32, %b: f32) -> f32 {
func.func @minf(%a: f32, %b: f32) -> f32 {
%result = arith.minf %a, %b : f32
return %result : f32
}
@ -192,7 +192,7 @@ func @minf(%a: f32, %b: f32) -> f32 {
// -----
// CHECK-LABEL: func @maxsi
func @maxsi(%a: i32, %b: i32) -> i32 {
func.func @maxsi(%a: i32, %b: i32) -> i32 {
%result = arith.maxsi %a, %b : i32
return %result : i32
}
@ -202,7 +202,7 @@ func @maxsi(%a: i32, %b: i32) -> i32 {
// -----
// CHECK-LABEL: func @minsi
func @minsi(%a: i32, %b: i32) -> i32 {
func.func @minsi(%a: i32, %b: i32) -> i32 {
%result = arith.minsi %a, %b : i32
return %result : i32
}
@ -213,7 +213,7 @@ func @minsi(%a: i32, %b: i32) -> i32 {
// -----
// CHECK-LABEL: func @maxui
func @maxui(%a: i32, %b: i32) -> i32 {
func.func @maxui(%a: i32, %b: i32) -> i32 {
%result = arith.maxui %a, %b : i32
return %result : i32
}
@ -224,7 +224,7 @@ func @maxui(%a: i32, %b: i32) -> i32 {
// -----
// CHECK-LABEL: func @minui
func @minui(%a: i32, %b: i32) -> i32 {
func.func @minui(%a: i32, %b: i32) -> i32 {
%result = arith.minui %a, %b : i32
return %result : i32
}

View File

@ -1,6 +1,6 @@
// RUN: mlir-opt -split-input-file %s -verify-diagnostics
func @test_index_cast_shape_error(%arg0 : tensor<index>) -> tensor<2xi64> {
func.func @test_index_cast_shape_error(%arg0 : tensor<index>) -> tensor<2xi64> {
// expected-error @+1 {{'arith.index_cast' op requires the same shape for all operands and results}}
%0 = arith.index_cast %arg0 : tensor<index> to tensor<2xi64>
return %0 : tensor<2xi64>
@ -8,7 +8,7 @@ func @test_index_cast_shape_error(%arg0 : tensor<index>) -> tensor<2xi64> {
// -----
func @test_index_cast_tensor_error(%arg0 : tensor<index>) -> i64 {
func.func @test_index_cast_tensor_error(%arg0 : tensor<index>) -> i64 {
// expected-error @+1 {{'arith.index_cast' op requires the same shape for all operands and results}}
%0 = arith.index_cast %arg0 : tensor<index> to i64
return %0 : i64
@ -16,7 +16,7 @@ func @test_index_cast_tensor_error(%arg0 : tensor<index>) -> i64 {
// -----
func @non_signless_constant() {
func.func @non_signless_constant() {
// expected-error @+1 {{'arith.constant' op integer return type must be signless}}
%0 = arith.constant 0 : ui32
return
@ -24,7 +24,7 @@ func @non_signless_constant() {
// -----
func @complex_constant_wrong_attribute_type() {
func.func @complex_constant_wrong_attribute_type() {
// expected-error @+1 {{'arith.constant' op failed to verify that result and attribute have the same type}}
%0 = "arith.constant" () {value = 1.0 : f32} : () -> complex<f32>
return
@ -32,7 +32,7 @@ func @complex_constant_wrong_attribute_type() {
// -----
func @non_signless_constant() {
func.func @non_signless_constant() {
// expected-error @+1 {{'arith.constant' op integer return type must be signless}}
%0 = arith.constant 0 : si32
return
@ -40,7 +40,7 @@ func @non_signless_constant() {
// -----
func @bitcast_different_bit_widths(%arg : f16) -> f32 {
func.func @bitcast_different_bit_widths(%arg : f16) -> f32 {
// expected-error@+1 {{are cast incompatible}}
%res = arith.bitcast %arg : f16 to f32
return %res : f32
@ -48,7 +48,7 @@ func @bitcast_different_bit_widths(%arg : f16) -> f32 {
// -----
func @constant() {
func.func @constant() {
^bb:
%x = "arith.constant"(){value = "xyz"} : () -> i32 // expected-error {{'arith.constant' op failed to verify that result and attribute have the same type}}
return
@ -56,7 +56,7 @@ func @constant() {
// -----
func @constant_out_of_range() {
func.func @constant_out_of_range() {
^bb:
%x = "arith.constant"(){value = 100} : () -> i1 // expected-error {{'arith.constant' op failed to verify that result and attribute have the same type}}
return
@ -64,7 +64,7 @@ func @constant_out_of_range() {
// -----
func @constant_wrong_type() {
func.func @constant_wrong_type() {
^bb:
%x = "arith.constant"(){value = 10.} : () -> f32 // expected-error {{'arith.constant' op failed to verify that result and attribute have the same type}}
return
@ -72,7 +72,7 @@ func @constant_wrong_type() {
// -----
func @intlimit2() {
func.func @intlimit2() {
^bb:
%0 = "arith.constant"() {value = 0} : () -> i16777215
%1 = "arith.constant"() {value = 1} : () -> i16777216 // expected-error {{integer bitwidth is limited to 16777215 bits}}
@ -81,28 +81,28 @@ func @intlimit2() {
// -----
func @func_with_ops(f32) {
func.func @func_with_ops(f32) {
^bb0(%a : f32):
%sf = arith.addf %a, %a, %a : f32 // expected-error {{expected ':'}}
}
// -----
func @func_with_ops(f32) {
func.func @func_with_ops(f32) {
^bb0(%a : f32):
%sf = arith.addf(%a, %a) : f32 // expected-error {{expected SSA operand}}
}
// -----
func @func_with_ops(f32) {
func.func @func_with_ops(f32) {
^bb0(%a : f32):
%sf = arith.addf{%a, %a} : f32 // expected-error {{expected SSA operand}}
}
// -----
func @func_with_ops(f32) {
func.func @func_with_ops(f32) {
^bb0(%a : f32):
// expected-error@+1 {{'arith.addi' op operand #0 must be signless-integer-like}}
%sf = arith.addi %a, %a : f32
@ -110,14 +110,14 @@ func @func_with_ops(f32) {
// -----
func @func_with_ops(i32) {
func.func @func_with_ops(i32) {
^bb0(%a : i32):
%sf = arith.addf %a, %a : i32 // expected-error {{'arith.addf' op operand #0 must be floating-point-like}}
}
// -----
func @func_with_ops(i32) {
func.func @func_with_ops(i32) {
^bb0(%a : i32):
// expected-error@+1 {{failed to satisfy constraint: allowed 64-bit signless integer cases: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9}}
%r = "arith.cmpi"(%a, %a) {predicate = 42} : (i32, i32) -> i1
@ -126,7 +126,7 @@ func @func_with_ops(i32) {
// -----
// Comparison are defined for arguments of the same type.
func @func_with_ops(i32, i64) {
func.func @func_with_ops(i32, i64) {
^bb0(%a : i32, %b : i64): // expected-note {{prior use here}}
%r = arith.cmpi eq, %a, %b : i32 // expected-error {{use of value '%b' expects different type than prior uses}}
}
@ -134,7 +134,7 @@ func @func_with_ops(i32, i64) {
// -----
// Comparisons must have the "predicate" attribute.
func @func_with_ops(i32, i32) {
func.func @func_with_ops(i32, i32) {
^bb0(%a : i32, %b : i32):
%r = arith.cmpi %a, %b : i32 // expected-error {{expected string or keyword containing one of the following enum values}}
}
@ -142,7 +142,7 @@ func @func_with_ops(i32, i32) {
// -----
// Integer comparisons are not recognized for float types.
func @func_with_ops(f32, f32) {
func.func @func_with_ops(f32, f32) {
^bb0(%a : f32, %b : f32):
%r = arith.cmpi eq, %a, %b : f32 // expected-error {{'lhs' must be signless-integer-like, but got 'f32'}}
}
@ -150,14 +150,14 @@ func @func_with_ops(f32, f32) {
// -----
// Result type must be boolean like.
func @func_with_ops(i32, i32) {
func.func @func_with_ops(i32, i32) {
^bb0(%a : i32, %b : i32):
%r = "arith.cmpi"(%a, %b) {predicate = 0} : (i32, i32) -> i32 // expected-error {{op result #0 must be bool-like}}
}
// -----
func @func_with_ops(i32, i32) {
func.func @func_with_ops(i32, i32) {
^bb0(%a : i32, %b : i32):
// expected-error@+1 {{requires attribute 'predicate'}}
%r = "arith.cmpi"(%a, %b) {foo = 1} : (i32, i32) -> i1
@ -165,7 +165,7 @@ func @func_with_ops(i32, i32) {
// -----
func @func_with_ops() {
func.func @func_with_ops() {
^bb0:
%c = arith.constant dense<0> : vector<42 x i32>
// expected-error@+1 {{op failed to verify that result type has i1 element type and same shape as operands}}
@ -174,73 +174,73 @@ func @func_with_ops() {
// -----
func @invalid_cmp_shape(%idx : () -> ()) {
func.func @invalid_cmp_shape(%idx : () -> ()) {
// expected-error@+1 {{'lhs' must be signless-integer-like, but got '() -> ()'}}
%cmp = arith.cmpi eq, %idx, %idx : () -> ()
// -----
func @invalid_cmp_attr(%idx : i32) {
func.func @invalid_cmp_attr(%idx : i32) {
// expected-error@+1 {{expected string or keyword containing one of the following enum values}}
%cmp = arith.cmpi i1, %idx, %idx : i32
// -----
func @cmpf_generic_invalid_predicate_value(%a : f32) {
func.func @cmpf_generic_invalid_predicate_value(%a : f32) {
// expected-error@+1 {{attribute 'predicate' failed to satisfy constraint: allowed 64-bit signless integer cases}}
%r = "arith.cmpf"(%a, %a) {predicate = 42} : (f32, f32) -> i1
}
// -----
func @cmpf_canonical_invalid_predicate_value(%a : f32) {
func.func @cmpf_canonical_invalid_predicate_value(%a : f32) {
// expected-error@+1 {{expected string or keyword containing one of the following enum values}}
%r = arith.cmpf foo, %a, %a : f32
}
// -----
func @cmpf_canonical_invalid_predicate_value_signed(%a : f32) {
func.func @cmpf_canonical_invalid_predicate_value_signed(%a : f32) {
// expected-error@+1 {{expected string or keyword containing one of the following enum values}}
%r = arith.cmpf sge, %a, %a : f32
}
// -----
func @cmpf_canonical_invalid_predicate_value_no_order(%a : f32) {
func.func @cmpf_canonical_invalid_predicate_value_no_order(%a : f32) {
// expected-error@+1 {{expected string or keyword containing one of the following enum values}}
%r = arith.cmpf eq, %a, %a : f32
}
// -----
func @cmpf_canonical_no_predicate_attr(%a : f32, %b : f32) {
func.func @cmpf_canonical_no_predicate_attr(%a : f32, %b : f32) {
%r = arith.cmpf %a, %b : f32 // expected-error {{}}
}
// -----
func @cmpf_generic_no_predicate_attr(%a : f32, %b : f32) {
func.func @cmpf_generic_no_predicate_attr(%a : f32, %b : f32) {
// expected-error@+1 {{requires attribute 'predicate'}}
%r = "arith.cmpf"(%a, %b) {foo = 1} : (f32, f32) -> i1
}
// -----
func @cmpf_wrong_type(%a : i32, %b : i32) {
func.func @cmpf_wrong_type(%a : i32, %b : i32) {
%r = arith.cmpf oeq, %a, %b : i32 // expected-error {{must be floating-point-like}}
}
// -----
func @cmpf_generic_wrong_result_type(%a : f32, %b : f32) {
func.func @cmpf_generic_wrong_result_type(%a : f32, %b : f32) {
// expected-error@+1 {{result #0 must be bool-like}}
%r = "arith.cmpf"(%a, %b) {predicate = 0} : (f32, f32) -> f32
}
// -----
func @cmpf_canonical_wrong_result_type(%a : f32, %b : f32) -> f32 {
func.func @cmpf_canonical_wrong_result_type(%a : f32, %b : f32) -> f32 {
%r = arith.cmpf oeq, %a, %b : f32 // expected-note {{prior use here}}
// expected-error@+1 {{use of value '%r' expects different type than prior uses}}
return %r : f32
@ -248,35 +248,35 @@ func @cmpf_canonical_wrong_result_type(%a : f32, %b : f32) -> f32 {
// -----
func @cmpf_result_shape_mismatch(%a : vector<42xf32>) {
func.func @cmpf_result_shape_mismatch(%a : vector<42xf32>) {
// expected-error@+1 {{op failed to verify that result type has i1 element type and same shape as operands}}
%r = "arith.cmpf"(%a, %a) {predicate = 0} : (vector<42 x f32>, vector<42 x f32>) -> vector<41 x i1>
}
// -----
func @cmpf_operand_shape_mismatch(%a : vector<42xf32>, %b : vector<41xf32>) {
func.func @cmpf_operand_shape_mismatch(%a : vector<42xf32>, %b : vector<41xf32>) {
// expected-error@+1 {{op requires all operands to have the same type}}
%r = "arith.cmpf"(%a, %b) {predicate = 0} : (vector<42 x f32>, vector<41 x f32>) -> vector<42 x i1>
}
// -----
func @cmpf_generic_operand_type_mismatch(%a : f32, %b : f64) {
func.func @cmpf_generic_operand_type_mismatch(%a : f32, %b : f64) {
// expected-error@+1 {{op requires all operands to have the same type}}
%r = "arith.cmpf"(%a, %b) {predicate = 0} : (f32, f64) -> i1
}
// -----
func @cmpf_canonical_type_mismatch(%a : f32, %b : f64) { // expected-note {{prior use here}}
func.func @cmpf_canonical_type_mismatch(%a : f32, %b : f64) { // expected-note {{prior use here}}
// expected-error@+1 {{use of value '%b' expects different type than prior uses}}
%r = arith.cmpf oeq, %a, %b : f32
}
// -----
func @index_cast_index_to_index(%arg0: index) {
func.func @index_cast_index_to_index(%arg0: index) {
// expected-error@+1 {{are cast incompatible}}
%0 = arith.index_cast %arg0: index to index
return
@ -284,7 +284,7 @@ func @index_cast_index_to_index(%arg0: index) {
// -----
func @index_cast_float(%arg0: index, %arg1: f32) {
func.func @index_cast_float(%arg0: index, %arg1: f32) {
// expected-error@+1 {{op result #0 must be signless-integer-like or memref of signless-integer, but got 'f32'}}
%0 = arith.index_cast %arg0 : index to f32
return
@ -292,7 +292,7 @@ func @index_cast_float(%arg0: index, %arg1: f32) {
// -----
func @index_cast_float_to_index(%arg0: f32) {
func.func @index_cast_float_to_index(%arg0: f32) {
// expected-error@+1 {{op operand #0 must be signless-integer-like or memref of signless-integer, but got 'f32'}}
%0 = arith.index_cast %arg0 : f32 to index
return
@ -300,7 +300,7 @@ func @index_cast_float_to_index(%arg0: f32) {
// -----
func @sitofp_i32_to_i64(%arg0 : i32) {
func.func @sitofp_i32_to_i64(%arg0 : i32) {
// expected-error@+1 {{op result #0 must be floating-point-like, but got 'i64'}}
%0 = arith.sitofp %arg0 : i32 to i64
return
@ -308,7 +308,7 @@ func @sitofp_i32_to_i64(%arg0 : i32) {
// -----
func @sitofp_f32_to_i32(%arg0 : f32) {
func.func @sitofp_f32_to_i32(%arg0 : f32) {
// expected-error@+1 {{op operand #0 must be signless-fixed-width-integer-like, but got 'f32'}}
%0 = arith.sitofp %arg0 : f32 to i32
return
@ -316,7 +316,7 @@ func @sitofp_f32_to_i32(%arg0 : f32) {
// -----
func @fpext_f32_to_f16(%arg0 : f32) {
func.func @fpext_f32_to_f16(%arg0 : f32) {
// expected-error@+1 {{are cast incompatible}}
%0 = arith.extf %arg0 : f32 to f16
return
@ -324,7 +324,7 @@ func @fpext_f32_to_f16(%arg0 : f32) {
// -----
func @fpext_f16_to_f16(%arg0 : f16) {
func.func @fpext_f16_to_f16(%arg0 : f16) {
// expected-error@+1 {{are cast incompatible}}
%0 = arith.extf %arg0 : f16 to f16
return
@ -332,7 +332,7 @@ func @fpext_f16_to_f16(%arg0 : f16) {
// -----
func @fpext_i32_to_f32(%arg0 : i32) {
func.func @fpext_i32_to_f32(%arg0 : i32) {
// expected-error@+1 {{op operand #0 must be floating-point-like, but got 'i32'}}
%0 = arith.extf %arg0 : i32 to f32
return
@ -340,7 +340,7 @@ func @fpext_i32_to_f32(%arg0 : i32) {
// -----
func @fpext_f32_to_i32(%arg0 : f32) {
func.func @fpext_f32_to_i32(%arg0 : f32) {
// expected-error@+1 {{op result #0 must be floating-point-like, but got 'i32'}}
%0 = arith.extf %arg0 : f32 to i32
return
@ -348,7 +348,7 @@ func @fpext_f32_to_i32(%arg0 : f32) {
// -----
func @fpext_vec(%arg0 : vector<2xf16>) {
func.func @fpext_vec(%arg0 : vector<2xf16>) {
// expected-error@+1 {{op requires the same shape for all operands and results}}
%0 = arith.extf %arg0 : vector<2xf16> to vector<3xf32>
return
@ -356,7 +356,7 @@ func @fpext_vec(%arg0 : vector<2xf16>) {
// -----
func @fpext_vec_f32_to_f16(%arg0 : vector<2xf32>) {
func.func @fpext_vec_f32_to_f16(%arg0 : vector<2xf32>) {
// expected-error@+1 {{are cast incompatible}}
%0 = arith.extf %arg0 : vector<2xf32> to vector<2xf16>
return
@ -364,7 +364,7 @@ func @fpext_vec_f32_to_f16(%arg0 : vector<2xf32>) {
// -----
func @fpext_vec_f16_to_f16(%arg0 : vector<2xf16>) {
func.func @fpext_vec_f16_to_f16(%arg0 : vector<2xf16>) {
// expected-error@+1 {{are cast incompatible}}
%0 = arith.extf %arg0 : vector<2xf16> to vector<2xf16>
return
@ -372,7 +372,7 @@ func @fpext_vec_f16_to_f16(%arg0 : vector<2xf16>) {
// -----
func @fpext_vec_i32_to_f32(%arg0 : vector<2xi32>) {
func.func @fpext_vec_i32_to_f32(%arg0 : vector<2xi32>) {
// expected-error@+1 {{op operand #0 must be floating-point-like, but got 'vector<2xi32>'}}
%0 = arith.extf %arg0 : vector<2xi32> to vector<2xf32>
return
@ -380,7 +380,7 @@ func @fpext_vec_i32_to_f32(%arg0 : vector<2xi32>) {
// -----
func @fpext_vec_f32_to_i32(%arg0 : vector<2xf32>) {
func.func @fpext_vec_f32_to_i32(%arg0 : vector<2xf32>) {
// expected-error@+1 {{op result #0 must be floating-point-like, but got 'vector<2xi32>'}}
%0 = arith.extf %arg0 : vector<2xf32> to vector<2xi32>
return
@ -388,7 +388,7 @@ func @fpext_vec_f32_to_i32(%arg0 : vector<2xf32>) {
// -----
func @fptrunc_f16_to_f32(%arg0 : f16) {
func.func @fptrunc_f16_to_f32(%arg0 : f16) {
// expected-error@+1 {{are cast incompatible}}
%0 = arith.truncf %arg0 : f16 to f32
return
@ -396,7 +396,7 @@ func @fptrunc_f16_to_f32(%arg0 : f16) {
// -----
func @fptrunc_f32_to_f32(%arg0 : f32) {
func.func @fptrunc_f32_to_f32(%arg0 : f32) {
// expected-error@+1 {{are cast incompatible}}
%0 = arith.truncf %arg0 : f32 to f32
return
@ -404,7 +404,7 @@ func @fptrunc_f32_to_f32(%arg0 : f32) {
// -----
func @fptrunc_i32_to_f32(%arg0 : i32) {
func.func @fptrunc_i32_to_f32(%arg0 : i32) {
// expected-error@+1 {{op operand #0 must be floating-point-like, but got 'i32'}}
%0 = arith.truncf %arg0 : i32 to f32
return
@ -412,7 +412,7 @@ func @fptrunc_i32_to_f32(%arg0 : i32) {
// -----
func @fptrunc_f32_to_i32(%arg0 : f32) {
func.func @fptrunc_f32_to_i32(%arg0 : f32) {
// expected-error@+1 {{op result #0 must be floating-point-like, but got 'i32'}}
%0 = arith.truncf %arg0 : f32 to i32
return
@ -420,7 +420,7 @@ func @fptrunc_f32_to_i32(%arg0 : f32) {
// -----
func @fptrunc_vec(%arg0 : vector<2xf16>) {
func.func @fptrunc_vec(%arg0 : vector<2xf16>) {
// expected-error@+1 {{op requires the same shape for all operands and results}}
%0 = arith.truncf %arg0 : vector<2xf16> to vector<3xf32>
return
@ -428,7 +428,7 @@ func @fptrunc_vec(%arg0 : vector<2xf16>) {
// -----
func @fptrunc_vec_f16_to_f32(%arg0 : vector<2xf16>) {
func.func @fptrunc_vec_f16_to_f32(%arg0 : vector<2xf16>) {
// expected-error@+1 {{are cast incompatible}}
%0 = arith.truncf %arg0 : vector<2xf16> to vector<2xf32>
return
@ -436,7 +436,7 @@ func @fptrunc_vec_f16_to_f32(%arg0 : vector<2xf16>) {
// -----
func @fptrunc_vec_f32_to_f32(%arg0 : vector<2xf32>) {
func.func @fptrunc_vec_f32_to_f32(%arg0 : vector<2xf32>) {
// expected-error@+1 {{are cast incompatible}}
%0 = arith.truncf %arg0 : vector<2xf32> to vector<2xf32>
return
@ -444,7 +444,7 @@ func @fptrunc_vec_f32_to_f32(%arg0 : vector<2xf32>) {
// -----
func @fptrunc_vec_i32_to_f32(%arg0 : vector<2xi32>) {
func.func @fptrunc_vec_i32_to_f32(%arg0 : vector<2xi32>) {
// expected-error@+1 {{op operand #0 must be floating-point-like, but got 'vector<2xi32>'}}
%0 = arith.truncf %arg0 : vector<2xi32> to vector<2xf32>
return
@ -452,7 +452,7 @@ func @fptrunc_vec_i32_to_f32(%arg0 : vector<2xi32>) {
// -----
func @fptrunc_vec_f32_to_i32(%arg0 : vector<2xf32>) {
func.func @fptrunc_vec_f32_to_i32(%arg0 : vector<2xf32>) {
// expected-error@+1 {{op result #0 must be floating-point-like, but got 'vector<2xi32>'}}
%0 = arith.truncf %arg0 : vector<2xf32> to vector<2xi32>
return
@ -460,7 +460,7 @@ func @fptrunc_vec_f32_to_i32(%arg0 : vector<2xf32>) {
// -----
func @sexti_index_as_operand(%arg0 : index) {
func.func @sexti_index_as_operand(%arg0 : index) {
// expected-error@+1 {{op operand #0 must be signless-fixed-width-integer-like, but got 'index'}}
%0 = arith.extsi %arg0 : index to i128
return
@ -468,7 +468,7 @@ func @sexti_index_as_operand(%arg0 : index) {
// -----
func @zexti_index_as_operand(%arg0 : index) {
func.func @zexti_index_as_operand(%arg0 : index) {
// expected-error@+1 {{op operand #0 must be signless-fixed-width-integer-like, but got 'index'}}
%0 = arith.extui %arg0 : index to i128
return
@ -476,7 +476,7 @@ func @zexti_index_as_operand(%arg0 : index) {
// -----
func @trunci_index_as_operand(%arg0 : index) {
func.func @trunci_index_as_operand(%arg0 : index) {
// expected-error@+1 {{op operand #0 must be signless-fixed-width-integer-like, but got 'index'}}
%2 = arith.trunci %arg0 : index to i128
return
@ -484,7 +484,7 @@ func @trunci_index_as_operand(%arg0 : index) {
// -----
func @sexti_index_as_result(%arg0 : i1) {
func.func @sexti_index_as_result(%arg0 : i1) {
// expected-error@+1 {{op result #0 must be signless-fixed-width-integer-like, but got 'index'}}
%0 = arith.extsi %arg0 : i1 to index
return
@ -492,7 +492,7 @@ func @sexti_index_as_result(%arg0 : i1) {
// -----
func @zexti_index_as_operand(%arg0 : i1) {
func.func @zexti_index_as_operand(%arg0 : i1) {
// expected-error@+1 {{op result #0 must be signless-fixed-width-integer-like, but got 'index'}}
%0 = arith.extui %arg0 : i1 to index
return
@ -500,7 +500,7 @@ func @zexti_index_as_operand(%arg0 : i1) {
// -----
func @trunci_index_as_result(%arg0 : i128) {
func.func @trunci_index_as_result(%arg0 : i128) {
// expected-error@+1 {{op result #0 must be signless-fixed-width-integer-like, but got 'index'}}
%2 = arith.trunci %arg0 : i128 to index
return
@ -508,7 +508,7 @@ func @trunci_index_as_result(%arg0 : i128) {
// -----
func @sexti_cast_to_narrower(%arg0 : i16) {
func.func @sexti_cast_to_narrower(%arg0 : i16) {
// expected-error@+1 {{are cast incompatible}}
%0 = arith.extsi %arg0 : i16 to i15
return
@ -516,7 +516,7 @@ func @sexti_cast_to_narrower(%arg0 : i16) {
// -----
func @zexti_cast_to_narrower(%arg0 : i16) {
func.func @zexti_cast_to_narrower(%arg0 : i16) {
// expected-error@+1 {{are cast incompatible}}
%0 = arith.extui %arg0 : i16 to i15
return
@ -524,7 +524,7 @@ func @zexti_cast_to_narrower(%arg0 : i16) {
// -----
func @trunci_cast_to_wider(%arg0 : i16) {
func.func @trunci_cast_to_wider(%arg0 : i16) {
// expected-error@+1 {{are cast incompatible}}
%0 = arith.trunci %arg0 : i16 to i17
return
@ -532,7 +532,7 @@ func @trunci_cast_to_wider(%arg0 : i16) {
// -----
func @sexti_cast_to_same_width(%arg0 : i16) {
func.func @sexti_cast_to_same_width(%arg0 : i16) {
// expected-error@+1 {{are cast incompatible}}
%0 = arith.extsi %arg0 : i16 to i16
return
@ -540,7 +540,7 @@ func @sexti_cast_to_same_width(%arg0 : i16) {
// -----
func @zexti_cast_to_same_width(%arg0 : i16) {
func.func @zexti_cast_to_same_width(%arg0 : i16) {
// expected-error@+1 {{are cast incompatible}}
%0 = arith.extui %arg0 : i16 to i16
return
@ -548,7 +548,7 @@ func @zexti_cast_to_same_width(%arg0 : i16) {
// -----
func @trunci_cast_to_same_width(%arg0 : i16) {
func.func @trunci_cast_to_same_width(%arg0 : i16) {
// expected-error@+1 {{are cast incompatible}}
%0 = arith.trunci %arg0 : i16 to i16
return
@ -556,7 +556,7 @@ func @trunci_cast_to_same_width(%arg0 : i16) {
// -----
func @trunci_scalable_to_fl(%arg0 : vector<[4]xi32>) {
func.func @trunci_scalable_to_fl(%arg0 : vector<[4]xi32>) {
// expected-error@+1 {{'arith.trunci' op requires the same shape for all operands and results}}
%0 = arith.trunci %arg0 : vector<[4]xi32> to vector<4xi8>
return
@ -564,7 +564,7 @@ func @trunci_scalable_to_fl(%arg0 : vector<[4]xi32>) {
// -----
func @truncf_scalable_to_fl(%arg0 : vector<[4]xf64>) {
func.func @truncf_scalable_to_fl(%arg0 : vector<[4]xf64>) {
// expected-error@+1 {{'arith.truncf' op requires the same shape for all operands and results}}
%0 = arith.truncf %arg0 : vector<[4]xf64> to vector<4xf32>
return
@ -572,7 +572,7 @@ func @truncf_scalable_to_fl(%arg0 : vector<[4]xf64>) {
// -----
func @extui_scalable_to_fl(%arg0 : vector<[4]xi32>) {
func.func @extui_scalable_to_fl(%arg0 : vector<[4]xi32>) {
// expected-error@+1 {{'arith.extui' op requires the same shape for all operands and results}}
%0 = arith.extui %arg0 : vector<[4]xi32> to vector<4xi64>
return
@ -580,7 +580,7 @@ func @extui_scalable_to_fl(%arg0 : vector<[4]xi32>) {
// -----
func @extsi_scalable_to_fl(%arg0 : vector<[4]xi32>) {
func.func @extsi_scalable_to_fl(%arg0 : vector<[4]xi32>) {
// expected-error@+1 {{'arith.extsi' op requires the same shape for all operands and results}}
%0 = arith.extsi %arg0 : vector<[4]xi32> to vector<4xi64>
return
@ -588,7 +588,7 @@ func @extsi_scalable_to_fl(%arg0 : vector<[4]xi32>) {
// -----
func @extf_scalable_to_fl(%arg0 : vector<[4]xf32>) {
func.func @extf_scalable_to_fl(%arg0 : vector<[4]xf32>) {
// expected-error@+1 {{'arith.extf' op requires the same shape for all operands and results}}
%0 = arith.extf %arg0 : vector<[4]xf32> to vector<4xf64>
return
@ -596,7 +596,7 @@ func @extf_scalable_to_fl(%arg0 : vector<[4]xf32>) {
// -----
func @fptoui_scalable_to_fl(%arg0 : vector<[4]xf64>) {
func.func @fptoui_scalable_to_fl(%arg0 : vector<[4]xf64>) {
// expected-error@+1 {{'arith.fptoui' op requires the same shape for all operands and results}}
%0 = arith.fptoui %arg0 : vector<[4]xf64> to vector<4xi32>
return
@ -604,7 +604,7 @@ func @fptoui_scalable_to_fl(%arg0 : vector<[4]xf64>) {
// -----
func @fptosi_scalable_to_fl(%arg0 : vector<[4]xf32>) {
func.func @fptosi_scalable_to_fl(%arg0 : vector<[4]xf32>) {
// expected-error@+1 {{'arith.fptosi' op requires the same shape for all operands and results}}
%0 = arith.fptosi %arg0 : vector<[4]xf32> to vector<4xi32>
return
@ -612,7 +612,7 @@ func @fptosi_scalable_to_fl(%arg0 : vector<[4]xf32>) {
// -----
func @uitofp_scalable_to_fl(%arg0 : vector<[4]xi32>) {
func.func @uitofp_scalable_to_fl(%arg0 : vector<[4]xi32>) {
// expected-error@+1 {{'arith.uitofp' op requires the same shape for all operands and results}}
%0 = arith.uitofp %arg0 : vector<[4]xi32> to vector<4xf32>
return
@ -620,7 +620,7 @@ func @uitofp_scalable_to_fl(%arg0 : vector<[4]xi32>) {
// -----
func @sitofp_scalable_to_fl(%arg0 : vector<[4]xi32>) {
func.func @sitofp_scalable_to_fl(%arg0 : vector<[4]xi32>) {
// expected-error@+1 {{'arith.sitofp' op requires the same shape for all operands and results}}
%0 = arith.sitofp %arg0 : vector<[4]xi32> to vector<4xf32>
return
@ -628,7 +628,7 @@ func @sitofp_scalable_to_fl(%arg0 : vector<[4]xi32>) {
// -----
func @bitcast_scalable_to_fl(%arg0 : vector<[4]xf32>) {
func.func @bitcast_scalable_to_fl(%arg0 : vector<[4]xf32>) {
// expected-error@+1 {{'arith.bitcast' op requires the same shape for all operands and results}}
%0 = arith.bitcast %arg0 : vector<[4]xf32> to vector<4xi32>
return
@ -636,7 +636,7 @@ func @bitcast_scalable_to_fl(%arg0 : vector<[4]xf32>) {
// -----
func @trunci_fl_to_scalable(%arg0 : vector<4xi32>) {
func.func @trunci_fl_to_scalable(%arg0 : vector<4xi32>) {
// expected-error@+1 {{'arith.trunci' op requires the same shape for all operands and results}}
%0 = arith.trunci %arg0 : vector<4xi32> to vector<[4]xi8>
return
@ -644,7 +644,7 @@ func @trunci_fl_to_scalable(%arg0 : vector<4xi32>) {
// -----
func @truncf_fl_to_scalable(%arg0 : vector<4xf64>) {
func.func @truncf_fl_to_scalable(%arg0 : vector<4xf64>) {
// expected-error@+1 {{'arith.truncf' op requires the same shape for all operands and results}}
%0 = arith.truncf %arg0 : vector<4xf64> to vector<[4]xf32>
return
@ -652,7 +652,7 @@ func @truncf_fl_to_scalable(%arg0 : vector<4xf64>) {
// -----
func @extui_fl_to_scalable(%arg0 : vector<4xi32>) {
func.func @extui_fl_to_scalable(%arg0 : vector<4xi32>) {
// expected-error@+1 {{'arith.extui' op requires the same shape for all operands and results}}
%0 = arith.extui %arg0 : vector<4xi32> to vector<[4]xi64>
return
@ -660,7 +660,7 @@ func @extui_fl_to_scalable(%arg0 : vector<4xi32>) {
// -----
func @extsi_fl_to_scalable(%arg0 : vector<4xi32>) {
func.func @extsi_fl_to_scalable(%arg0 : vector<4xi32>) {
// expected-error@+1 {{'arith.extsi' op requires the same shape for all operands and results}}
%0 = arith.extsi %arg0 : vector<4xi32> to vector<[4]xi64>
return
@ -668,7 +668,7 @@ func @extsi_fl_to_scalable(%arg0 : vector<4xi32>) {
// -----
func @extf_fl_to_scalable(%arg0 : vector<4xf32>) {
func.func @extf_fl_to_scalable(%arg0 : vector<4xf32>) {
// expected-error@+1 {{'arith.extf' op requires the same shape for all operands and results}}
%0 = arith.extf %arg0 : vector<4xf32> to vector<[4]xf64>
return
@ -676,7 +676,7 @@ func @extf_fl_to_scalable(%arg0 : vector<4xf32>) {
// -----
func @fptoui_fl_to_scalable(%arg0 : vector<4xf64>) {
func.func @fptoui_fl_to_scalable(%arg0 : vector<4xf64>) {
// expected-error@+1 {{'arith.fptoui' op requires the same shape for all operands and results}}
%0 = arith.fptoui %arg0 : vector<4xf64> to vector<[4]xi32>
return
@ -684,7 +684,7 @@ func @fptoui_fl_to_scalable(%arg0 : vector<4xf64>) {
// -----
func @fptosi_fl_to_scalable(%arg0 : vector<4xf32>) {
func.func @fptosi_fl_to_scalable(%arg0 : vector<4xf32>) {
// expected-error@+1 {{'arith.fptosi' op requires the same shape for all operands and results}}
%0 = arith.fptosi %arg0 : vector<4xf32> to vector<[4]xi32>
return
@ -692,7 +692,7 @@ func @fptosi_fl_to_scalable(%arg0 : vector<4xf32>) {
// -----
func @uitofp_fl_to_scalable(%arg0 : vector<4xi32>) {
func.func @uitofp_fl_to_scalable(%arg0 : vector<4xi32>) {
// expected-error@+1 {{'arith.uitofp' op requires the same shape for all operands and results}}
%0 = arith.uitofp %arg0 : vector<4xi32> to vector<[4]xf32>
return
@ -700,7 +700,7 @@ func @uitofp_fl_to_scalable(%arg0 : vector<4xi32>) {
// -----
func @sitofp_fl_to_scalable(%arg0 : vector<4xi32>) {
func.func @sitofp_fl_to_scalable(%arg0 : vector<4xi32>) {
// expected-error@+1 {{'arith.sitofp' op requires the same shape for all operands and results}}
%0 = arith.sitofp %arg0 : vector<4xi32> to vector<[4]xf32>
return
@ -708,7 +708,7 @@ func @sitofp_fl_to_scalable(%arg0 : vector<4xi32>) {
// -----
func @bitcast_fl_to_scalable(%arg0 : vector<4xf32>) {
func.func @bitcast_fl_to_scalable(%arg0 : vector<4xf32>) {
// expected-error@+1 {{'arith.bitcast' op requires the same shape for all operands and results}}
%0 = arith.bitcast %arg0 : vector<4xf32> to vector<[4]xi32>
return

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
// -----
func @a_is_2d(%a : vector<2x2xi32>, %b : vector<4x4xi8>) -> vector<2x2xi32> {
func.func @a_is_2d(%a : vector<2x2xi32>, %b : vector<4x4xi8>) -> vector<2x2xi32> {
// expected-error@+1 {{operand `a` should be 1-dimensional}}
%0 = arm_neon.2d.sdot %a, %b, %b : vector<4x4xi8>, vector<4x4xi8> to vector<2x2xi32>
return %0 : vector<2x2xi32>
@ -10,7 +10,7 @@ func @a_is_2d(%a : vector<2x2xi32>, %b : vector<4x4xi8>) -> vector<2x2xi32> {
// -----
func @b_is_3d(%a : vector<4xi32>, %b : vector<1x4x4xi8>) -> vector<4xi32> {
func.func @b_is_3d(%a : vector<4xi32>, %b : vector<1x4x4xi8>) -> vector<4xi32> {
// expected-error@+1 {{operand `b` should be 2-dimensional}}
%0 = arm_neon.2d.sdot %a, %b, %b : vector<1x4x4xi8>, vector<1x4x4xi8> to vector<4xi32>
return %0 : vector<4xi32>
@ -18,7 +18,7 @@ func @b_is_3d(%a : vector<4xi32>, %b : vector<1x4x4xi8>) -> vector<4xi32> {
// -----
func @b_has_2_columns(%a : vector<4xi32>, %b : vector<4x2xi8>) -> vector<4xi32> {
func.func @b_has_2_columns(%a : vector<4xi32>, %b : vector<4x2xi8>) -> vector<4xi32> {
// expected-error@+1 {{operand `b` should have 4 columns}}
%0 = arm_neon.2d.sdot %a, %b, %b : vector<4x2xi8>, vector<4x2xi8> to vector<4xi32>
return %0 : vector<4xi32>
@ -26,7 +26,7 @@ func @b_has_2_columns(%a : vector<4xi32>, %b : vector<4x2xi8>) -> vector<4xi32>
// -----
func @b_has_2_rows_but_a_has_length_4(%a : vector<4xi32>, %b : vector<2x4xi8>) -> vector<4xi32> {
func.func @b_has_2_rows_but_a_has_length_4(%a : vector<4xi32>, %b : vector<2x4xi8>) -> vector<4xi32> {
// expected-error@+1 {{operand `b` should have as many rows as the size of operand `a`}}
%0 = arm_neon.2d.sdot %a, %b, %b : vector<2x4xi8>, vector<2x4xi8> to vector<4xi32>
return %0 : vector<4xi32>

View File

@ -1,7 +1,7 @@
// RUN: mlir-opt -verify-diagnostics %s | mlir-opt | FileCheck %s
// CHECK-LABEL: arm_neon_smull
func @arm_neon_smull(%a: vector<8xi8>, %b: vector<8xi8>)
func.func @arm_neon_smull(%a: vector<8xi8>, %b: vector<8xi8>)
-> (vector<8xi16>, vector<4xi32>, vector<2xi64>) {
// CHECK: arm_neon.intr.smull {{.*}}: vector<8xi8> to vector<8xi16>
%0 = arm_neon.intr.smull %a, %b : vector<8xi8> to vector<8xi16>
@ -20,7 +20,7 @@ func @arm_neon_smull(%a: vector<8xi8>, %b: vector<8xi8>)
}
// CHECK-LABEL: arm_neon_sdot
func @arm_neon_sdot(%a: vector<2xi32>, %b: vector<8xi8>, %c: vector<8xi8>) -> vector<2xi32> {
func.func @arm_neon_sdot(%a: vector<2xi32>, %b: vector<8xi8>, %c: vector<8xi8>) -> vector<2xi32> {
// CHECK: arm_neon.intr.sdot {{.*}}: vector<8xi8>, vector<8xi8> to vector<2xi32>
%0 = arm_neon.intr.sdot %a, %b, %c : vector<8xi8>, vector<8xi8> to vector<2xi32>
return %0 : vector<2xi32>

View File

@ -1,6 +1,6 @@
// RUN: mlir-opt %s -convert-vector-to-llvm="enable-arm-sve" -convert-func-to-llvm -reconcile-unrealized-casts | mlir-opt | FileCheck %s
func @arm_sve_sdot(%a: vector<[16]xi8>,
func.func @arm_sve_sdot(%a: vector<[16]xi8>,
%b: vector<[16]xi8>,
%c: vector<[4]xi32>)
-> vector<[4]xi32> {
@ -10,7 +10,7 @@ func @arm_sve_sdot(%a: vector<[16]xi8>,
return %0 : vector<[4]xi32>
}
func @arm_sve_smmla(%a: vector<[16]xi8>,
func.func @arm_sve_smmla(%a: vector<[16]xi8>,
%b: vector<[16]xi8>,
%c: vector<[4]xi32>)
-> vector<[4]xi32> {
@ -20,7 +20,7 @@ func @arm_sve_smmla(%a: vector<[16]xi8>,
return %0 : vector<[4]xi32>
}
func @arm_sve_udot(%a: vector<[16]xi8>,
func.func @arm_sve_udot(%a: vector<[16]xi8>,
%b: vector<[16]xi8>,
%c: vector<[4]xi32>)
-> vector<[4]xi32> {
@ -30,7 +30,7 @@ func @arm_sve_udot(%a: vector<[16]xi8>,
return %0 : vector<[4]xi32>
}
func @arm_sve_ummla(%a: vector<[16]xi8>,
func.func @arm_sve_ummla(%a: vector<[16]xi8>,
%b: vector<[16]xi8>,
%c: vector<[4]xi32>)
-> vector<[4]xi32> {
@ -40,7 +40,7 @@ func @arm_sve_ummla(%a: vector<[16]xi8>,
return %0 : vector<[4]xi32>
}
func @arm_sve_arithi_masked(%a: vector<[4]xi32>,
func.func @arm_sve_arithi_masked(%a: vector<[4]xi32>,
%b: vector<[4]xi32>,
%c: vector<[4]xi32>,
%d: vector<[4]xi32>,
@ -65,7 +65,7 @@ func @arm_sve_arithi_masked(%a: vector<[4]xi32>,
return %4 : vector<[4]xi32>
}
func @arm_sve_arithf_masked(%a: vector<[4]xf32>,
func.func @arm_sve_arithf_masked(%a: vector<[4]xf32>,
%b: vector<[4]xf32>,
%c: vector<[4]xf32>,
%d: vector<[4]xf32>,
@ -87,7 +87,7 @@ func @arm_sve_arithf_masked(%a: vector<[4]xf32>,
return %3 : vector<[4]xf32>
}
func @arm_sve_abs_diff(%a: vector<[4]xi32>,
func.func @arm_sve_abs_diff(%a: vector<[4]xi32>,
%b: vector<[4]xi32>)
-> vector<[4]xi32> {
// CHECK: llvm.mlir.constant(dense<0> : vector<[4]xi32>) : vector<[4]xi32>
@ -111,7 +111,7 @@ func @arm_sve_abs_diff(%a: vector<[4]xi32>,
return %3 : vector<[4]xi32>
}
func @get_vector_scale() -> index {
func.func @get_vector_scale() -> index {
// CHECK: llvm.intr.vscale
%0 = vector.vscale
return %0 : index

View File

@ -1,6 +1,6 @@
// RUN: mlir-opt -verify-diagnostics %s | mlir-opt | FileCheck %s
func @arm_sve_sdot(%a: vector<[16]xi8>,
func.func @arm_sve_sdot(%a: vector<[16]xi8>,
%b: vector<[16]xi8>,
%c: vector<[4]xi32>) -> vector<[4]xi32> {
// CHECK: arm_sve.sdot {{.*}}: vector<[16]xi8> to vector<[4]xi32
@ -9,7 +9,7 @@ func @arm_sve_sdot(%a: vector<[16]xi8>,
return %0 : vector<[4]xi32>
}
func @arm_sve_smmla(%a: vector<[16]xi8>,
func.func @arm_sve_smmla(%a: vector<[16]xi8>,
%b: vector<[16]xi8>,
%c: vector<[4]xi32>) -> vector<[4]xi32> {
// CHECK: arm_sve.smmla {{.*}}: vector<[16]xi8> to vector<[4]xi3
@ -18,7 +18,7 @@ func @arm_sve_smmla(%a: vector<[16]xi8>,
return %0 : vector<[4]xi32>
}
func @arm_sve_udot(%a: vector<[16]xi8>,
func.func @arm_sve_udot(%a: vector<[16]xi8>,
%b: vector<[16]xi8>,
%c: vector<[4]xi32>) -> vector<[4]xi32> {
// CHECK: arm_sve.udot {{.*}}: vector<[16]xi8> to vector<[4]xi32
@ -27,7 +27,7 @@ func @arm_sve_udot(%a: vector<[16]xi8>,
return %0 : vector<[4]xi32>
}
func @arm_sve_ummla(%a: vector<[16]xi8>,
func.func @arm_sve_ummla(%a: vector<[16]xi8>,
%b: vector<[16]xi8>,
%c: vector<[4]xi32>) -> vector<[4]xi32> {
// CHECK: arm_sve.ummla {{.*}}: vector<[16]xi8> to vector<[4]xi3
@ -36,7 +36,7 @@ func @arm_sve_ummla(%a: vector<[16]xi8>,
return %0 : vector<[4]xi32>
}
func @arm_sve_masked_arithi(%a: vector<[4]xi32>,
func.func @arm_sve_masked_arithi(%a: vector<[4]xi32>,
%b: vector<[4]xi32>,
%c: vector<[4]xi32>,
%d: vector<[4]xi32>,
@ -61,7 +61,7 @@ func @arm_sve_masked_arithi(%a: vector<[4]xi32>,
return %2 : vector<[4]xi32>
}
func @arm_sve_masked_arithf(%a: vector<[4]xf32>,
func.func @arm_sve_masked_arithf(%a: vector<[4]xf32>,
%b: vector<[4]xf32>,
%c: vector<[4]xf32>,
%d: vector<[4]xf32>,

View File

@ -3,7 +3,7 @@
// CHECK-LABEL: @loop_1d(
// CHECK-SAME: %[[LB:.*]]: index, %[[UB:.*]]: index, %[[STEP:.*]]: index
func @loop_1d(%arg0: index, %arg1: index, %arg2: index, %arg3: memref<?xf32>) {
func.func @loop_1d(%arg0: index, %arg1: index, %arg2: index, %arg3: memref<?xf32>) {
// CHECK: %[[C0:.*]] = arith.constant 0 : index
// CHECK: %[[RANGE:.*]] = arith.subi %[[UB]], %[[LB]]
@ -64,7 +64,7 @@ func @loop_1d(%arg0: index, %arg1: index, %arg2: index, %arg3: memref<?xf32>) {
// -----
// CHECK-LABEL: @loop_2d
func @loop_2d(%arg0: index, %arg1: index, %arg2: index, // lb, ub, step
func.func @loop_2d(%arg0: index, %arg1: index, %arg2: index, // lb, ub, step
%arg3: index, %arg4: index, %arg5: index, // lb, ub, step
%arg6: memref<?x?xf32>) {
// CHECK: %[[GROUP:.*]] = async.create_group

View File

@ -14,7 +14,7 @@
// CHECK-LABEL: @loop_1d(
// CHECK: %[[MEMREF:.*]]: memref<?xf32>
func @loop_1d(%arg0: memref<?xf32>) {
func.func @loop_1d(%arg0: memref<?xf32>) {
// CHECK-DAG: %[[C0:.*]] = arith.constant 0 : index
// CHECK-DAG: %[[C1:.*]] = arith.constant 1 : index
// CHECK-DAG: %[[C100:.*]] = arith.constant 100 : index

View File

@ -12,7 +12,7 @@
// of parallel compute function arguments.
// CHECK-LABEL: func @clone_constant(
func @clone_constant(%arg0: memref<?xf32>, %lb: index, %ub: index, %st: index) {
func.func @clone_constant(%arg0: memref<?xf32>, %lb: index, %ub: index, %st: index) {
%one = arith.constant 1.0 : f32
scf.parallel (%i) = (%lb) to (%ub) step (%st) {
@ -40,7 +40,7 @@ func @clone_constant(%arg0: memref<?xf32>, %lb: index, %ub: index, %st: index) {
// Check that constant loop bound sunk into the parallel compute function.
// CHECK-LABEL: func @sink_constant_step(
func @sink_constant_step(%arg0: memref<?xf32>, %lb: index, %ub: index) {
func.func @sink_constant_step(%arg0: memref<?xf32>, %lb: index, %ub: index) {
%one = arith.constant 1.0 : f32
%st = arith.constant 123 : index
@ -73,7 +73,7 @@ func @sink_constant_step(%arg0: memref<?xf32>, %lb: index, %ub: index) {
// inner loop uses statically known loop trip counts.
// CHECK-LABEL: func @sink_constant_step(
func @sink_constant_step(%arg0: memref<?x10xf32>, %lb: index, %ub: index) {
func.func @sink_constant_step(%arg0: memref<?x10xf32>, %lb: index, %ub: index) {
%one = arith.constant 1.0 : f32
%c0 = arith.constant 0 : index

View File

@ -3,7 +3,7 @@
// CHECK-LABEL: @num_worker_threads(
// CHECK: %[[MEMREF:.*]]: memref<?xf32>
func @num_worker_threads(%arg0: memref<?xf32>) {
func.func @num_worker_threads(%arg0: memref<?xf32>) {
// CHECK-DAG: %[[scalingCstInit:.*]] = arith.constant 8.000000e+00 : f32
// CHECK-DAG: %[[bracketLowerBound4:.*]] = arith.constant 4 : index

View File

@ -5,7 +5,7 @@
// Here we only check the structure of the sequential dispatch loop.
// CHECK-LABEL: @loop_1d
func @loop_1d(%arg0: index, %arg1: index, %arg2: index, %arg3: memref<?xf32>) {
func.func @loop_1d(%arg0: index, %arg1: index, %arg2: index, %arg3: memref<?xf32>) {
// CHECK: %[[GROUP:.*]] = async.create_group
// CHECK: scf.for
// CHECK: %[[TOKEN:.*]] = async.execute
@ -28,7 +28,7 @@ func @loop_1d(%arg0: index, %arg1: index, %arg2: index, %arg3: memref<?xf32>) {
// -----
// CHECK-LABEL: @loop_2d
func @loop_2d(%arg0: index, %arg1: index, %arg2: index, // lb, ub, step
func.func @loop_2d(%arg0: index, %arg1: index, %arg2: index, // lb, ub, step
%arg3: index, %arg4: index, %arg5: index, // lb, ub, step
%arg6: memref<?x?xf32>) {
// CHECK: %[[GROUP:.*]] = async.create_group

View File

@ -2,7 +2,7 @@
// CHECK-LABEL: @token_await
// CHECK: %[[TOKEN:.*]]: !async.token
func @token_await(%arg0: !async.token) {
func.func @token_await(%arg0: !async.token) {
// CHECK: async.runtime.await %[[TOKEN]]
// CHECK-NOT: async.runtime.drop_ref
async.runtime.await %arg0 : !async.token
@ -11,7 +11,7 @@ func @token_await(%arg0: !async.token) {
// CHECK-LABEL: @group_await
// CHECK: %[[GROUP:.*]]: !async.group
func @group_await(%arg0: !async.group) {
func.func @group_await(%arg0: !async.group) {
// CHECK: async.runtime.await %[[GROUP]]
// CHECK-NOT: async.runtime.drop_ref
async.runtime.await %arg0 : !async.group
@ -21,7 +21,7 @@ func @group_await(%arg0: !async.group) {
// CHECK-LABEL: @add_token_to_group
// CHECK: %[[GROUP:.*]]: !async.group
// CHECK: %[[TOKEN:.*]]: !async.token
func @add_token_to_group(%arg0: !async.group, %arg1: !async.token) {
func.func @add_token_to_group(%arg0: !async.group, %arg1: !async.token) {
// CHECK: async.runtime.add_to_group %[[TOKEN]], %[[GROUP]]
// CHECK: async.runtime.drop_ref %[[TOKEN]] {count = 1 : i64}
async.runtime.add_to_group %arg1, %arg0 : !async.token
@ -30,7 +30,7 @@ func @add_token_to_group(%arg0: !async.group, %arg1: !async.token) {
// CHECK-LABEL: @value_load
// CHECK: %[[VALUE:.*]]: !async.value<f32>
func @value_load(%arg0: !async.value<f32>) {
func.func @value_load(%arg0: !async.value<f32>) {
// CHECK: async.runtime.load %[[VALUE]]
// CHECK: async.runtime.drop_ref %[[VALUE]] {count = 1 : i64}
%0 = async.runtime.load %arg0 : !async.value<f32>
@ -39,7 +39,7 @@ func @value_load(%arg0: !async.value<f32>) {
// CHECK-LABEL: @error_check
// CHECK: %[[TOKEN:.*]]: !async.token
func @error_check(%arg0: !async.token) {
func.func @error_check(%arg0: !async.token) {
// CHECK: async.runtime.is_error %[[TOKEN]]
// CHECK: async.runtime.drop_ref %[[TOKEN]] {count = 1 : i64}
%0 = async.runtime.is_error %arg0 : !async.token

View File

@ -1,9 +1,9 @@
// RUN: mlir-opt %s -async-runtime-ref-counting-opt | FileCheck %s
func private @consume_token(%arg0: !async.token)
func.func private @consume_token(%arg0: !async.token)
// CHECK-LABEL: @cancellable_operations_0
func @cancellable_operations_0(%arg0: !async.token) {
func.func @cancellable_operations_0(%arg0: !async.token) {
// CHECK-NOT: async.runtime.add_ref
// CHECK-NOT: async.runtime.drop_ref
async.runtime.add_ref %arg0 {count = 1 : i64} : !async.token
@ -13,7 +13,7 @@ func @cancellable_operations_0(%arg0: !async.token) {
}
// CHECK-LABEL: @cancellable_operations_1
func @cancellable_operations_1(%arg0: !async.token) {
func.func @cancellable_operations_1(%arg0: !async.token) {
// CHECK-NOT: async.runtime.add_ref
async.runtime.add_ref %arg0 {count = 1 : i64} : !async.token
// CHECK: call @consume_toke
@ -25,7 +25,7 @@ func @cancellable_operations_1(%arg0: !async.token) {
}
// CHECK-LABEL: @cancellable_operations_2
func @cancellable_operations_2(%arg0: !async.token) {
func.func @cancellable_operations_2(%arg0: !async.token) {
// CHECK: async.runtime.await
// CHECK-NEXT: async.runtime.await
// CHECK-NEXT: async.runtime.await
@ -41,7 +41,7 @@ func @cancellable_operations_2(%arg0: !async.token) {
}
// CHECK-LABEL: @cancellable_operations_3
func @cancellable_operations_3(%arg0: !async.token) {
func.func @cancellable_operations_3(%arg0: !async.token) {
// CHECK-NOT: add_ref
async.runtime.add_ref %arg0 {count = 1 : i64} : !async.token
// CHECK: call @consume_toke
@ -55,7 +55,7 @@ func @cancellable_operations_3(%arg0: !async.token) {
}
// CHECK-LABEL: @not_cancellable_operations_0
func @not_cancellable_operations_0(%arg0: !async.token) {
func.func @not_cancellable_operations_0(%arg0: !async.token) {
// CHECK: add_ref
async.runtime.add_ref %arg0 {count = 1 : i64} : !async.token
// CHECK: call @consume_toke

View File

@ -1,23 +1,23 @@
// RUN: mlir-opt %s -async-runtime-ref-counting | FileCheck %s
// CHECK-LABEL: @token
func private @token() -> !async.token
func.func private @token() -> !async.token
// CHECK-LABEL: @cond
func private @cond() -> i1
func.func private @cond() -> i1
// CHECK-LABEL: @take_token
func private @take_token(%arg0: !async.token)
func.func private @take_token(%arg0: !async.token)
// CHECK-LABEL: @token_arg_no_uses
// CHECK: %[[TOKEN:.*]]: !async.token
func @token_arg_no_uses(%arg0: !async.token) {
func.func @token_arg_no_uses(%arg0: !async.token) {
// CHECK: async.runtime.drop_ref %[[TOKEN]] {count = 1 : i64}
return
}
// CHECK-LABEL: @token_value_no_uses
func @token_value_no_uses() {
func.func @token_value_no_uses() {
// CHECK: %[[TOKEN:.*]] = async.runtime.create : !async.token
// CHECK: async.runtime.drop_ref %[[TOKEN]] {count = 1 : i64}
%0 = async.runtime.create : !async.token
@ -25,7 +25,7 @@ func @token_value_no_uses() {
}
// CHECK-LABEL: @token_returned_no_uses
func @token_returned_no_uses() {
func.func @token_returned_no_uses() {
// CHECK: %[[TOKEN:.*]] = call @token
// CHECK: async.runtime.drop_ref %[[TOKEN]] {count = 1 : i64}
%0 = call @token() : () -> !async.token
@ -34,7 +34,7 @@ func @token_returned_no_uses() {
// CHECK-LABEL: @token_arg_to_func
// CHECK: %[[TOKEN:.*]]: !async.token
func @token_arg_to_func(%arg0: !async.token) {
func.func @token_arg_to_func(%arg0: !async.token) {
// CHECK: async.runtime.add_ref %[[TOKEN]] {count = 1 : i64} : !async.token
call @take_token(%arg0): (!async.token) -> ()
// CHECK: async.runtime.drop_ref %[[TOKEN]] {count = 1 : i64} : !async.token
@ -42,7 +42,7 @@ func @token_arg_to_func(%arg0: !async.token) {
}
// CHECK-LABEL: @token_value_to_func
func @token_value_to_func() {
func.func @token_value_to_func() {
// CHECK: %[[TOKEN:.*]] = async.runtime.create : !async.token
%0 = async.runtime.create : !async.token
// CHECK: async.runtime.add_ref %[[TOKEN]] {count = 1 : i64} : !async.token
@ -53,7 +53,7 @@ func @token_value_to_func() {
// CHECK-LABEL: @token_arg_cond_br_await_with_fallthough
// CHECK: %[[TOKEN:.*]]: !async.token
func @token_arg_cond_br_await_with_fallthough(%arg0: !async.token, %arg1: i1) {
func.func @token_arg_cond_br_await_with_fallthough(%arg0: !async.token, %arg1: i1) {
// CHECK: cf.cond_br
// CHECK-SAME: ^[[BB1:.*]], ^[[BB2:.*]]
cf.cond_br %arg1, ^bb1, ^bb2
@ -70,7 +70,7 @@ func @token_arg_cond_br_await_with_fallthough(%arg0: !async.token, %arg1: i1) {
}
// CHECK-LABEL: @token_simple_return
func @token_simple_return() -> !async.token {
func.func @token_simple_return() -> !async.token {
// CHECK: %[[TOKEN:.*]] = async.runtime.create : !async.token
%token = async.runtime.create : !async.token
// CHECK: return %[[TOKEN]]
@ -80,7 +80,7 @@ func @token_simple_return() -> !async.token {
// CHECK-LABEL: @token_coro_return
// CHECK-NOT: async.runtime.drop_ref
// CHECK-NOT: async.runtime.add_ref
func @token_coro_return() -> !async.token {
func.func @token_coro_return() -> !async.token {
%token = async.runtime.create : !async.token
%id = async.coro.id
%hdl = async.coro.begin %id
@ -99,7 +99,7 @@ func @token_coro_return() -> !async.token {
// CHECK-LABEL: @token_coro_await_and_resume
// CHECK: %[[TOKEN:.*]]: !async.token
func @token_coro_await_and_resume(%arg0: !async.token) -> !async.token {
func.func @token_coro_await_and_resume(%arg0: !async.token) -> !async.token {
%token = async.runtime.create : !async.token
%id = async.coro.id
%hdl = async.coro.begin %id
@ -120,7 +120,7 @@ func @token_coro_await_and_resume(%arg0: !async.token) -> !async.token {
// CHECK-LABEL: @value_coro_await_and_resume
// CHECK: %[[VALUE:.*]]: !async.value<f32>
func @value_coro_await_and_resume(%arg0: !async.value<f32>) -> !async.token {
func.func @value_coro_await_and_resume(%arg0: !async.value<f32>) -> !async.token {
%token = async.runtime.create : !async.token
%id = async.coro.id
%hdl = async.coro.begin %id
@ -148,7 +148,7 @@ func @value_coro_await_and_resume(%arg0: !async.value<f32>) -> !async.token {
// CHECK-LABEL: @outlined_async_execute
// CHECK: %[[TOKEN:.*]]: !async.token
func private @outlined_async_execute(%arg0: !async.token) -> !async.token {
func.func private @outlined_async_execute(%arg0: !async.token) -> !async.token {
%0 = async.runtime.create : !async.token
%1 = async.coro.id
%2 = async.coro.begin %1
@ -182,7 +182,7 @@ func private @outlined_async_execute(%arg0: !async.token) -> !async.token {
// CHECK-LABEL: @token_await_inside_nested_region
// CHECK: %[[ARG:.*]]: i1
func @token_await_inside_nested_region(%arg0: i1) {
func.func @token_await_inside_nested_region(%arg0: i1) {
// CHECK: %[[TOKEN:.*]] = call @token()
%token = call @token() : () -> !async.token
// CHECK: scf.if %[[ARG]] {
@ -197,7 +197,7 @@ func @token_await_inside_nested_region(%arg0: i1) {
}
// CHECK-LABEL: @token_defined_in_the_loop
func @token_defined_in_the_loop() {
func.func @token_defined_in_the_loop() {
cf.br ^bb1
^bb1:
// CHECK: ^[[BB1:.*]]:
@ -215,7 +215,7 @@ func @token_defined_in_the_loop() {
}
// CHECK-LABEL: @divergent_liveness_one_token
func @divergent_liveness_one_token(%arg0 : i1) {
func.func @divergent_liveness_one_token(%arg0 : i1) {
// CHECK: %[[TOKEN:.*]] = call @token()
%token = call @token() : () -> !async.token
// CHECK: cf.cond_br %arg0, ^[[LIVE_IN:.*]], ^[[REF_COUNTING:.*]]
@ -237,7 +237,7 @@ func @divergent_liveness_one_token(%arg0 : i1) {
}
// CHECK-LABEL: @divergent_liveness_unique_predecessor
func @divergent_liveness_unique_predecessor(%arg0 : i1) {
func.func @divergent_liveness_unique_predecessor(%arg0 : i1) {
// CHECK: %[[TOKEN:.*]] = call @token()
%token = call @token() : () -> !async.token
// CHECK: cf.cond_br %arg0, ^[[LIVE_IN:.*]], ^[[NO_LIVE_IN:.*]]
@ -261,7 +261,7 @@ func @divergent_liveness_unique_predecessor(%arg0 : i1) {
}
// CHECK-LABEL: @divergent_liveness_two_tokens
func @divergent_liveness_two_tokens(%arg0 : i1) {
func.func @divergent_liveness_two_tokens(%arg0 : i1) {
// CHECK: %[[TOKEN0:.*]] = call @token()
// CHECK: %[[TOKEN1:.*]] = call @token()
%token0 = call @token() : () -> !async.token

View File

@ -5,7 +5,7 @@
// CHECK-LABEL: func @simple_callee
// CHECK-SAME: (%[[ARG:.*]]: f32)
// CHECK-SAME: -> (!async.token, !async.value<f32> {builtin.foo = "bar"})
func @simple_callee(%arg0: f32) -> (f32 {builtin.foo = "bar"}) {
func.func @simple_callee(%arg0: f32) -> (f32 {builtin.foo = "bar"}) {
// CHECK: %[[TOKEN:.*]] = async.runtime.create : !async.token
// CHECK: %[[RETURNED_STORAGE:.*]] = async.runtime.create : !async.value<f32>
// CHECK: %[[ID:.*]] = async.coro.id
@ -58,7 +58,7 @@ func @simple_callee(%arg0: f32) -> (f32 {builtin.foo = "bar"}) {
// CHECK-LABEL: func @simple_caller()
// CHECK-SAME: -> (!async.token, !async.value<f32>)
func @simple_caller() -> f32 {
func.func @simple_caller() -> f32 {
// CHECK: %[[TOKEN:.*]] = async.runtime.create : !async.token
// CHECK: %[[RETURNED_STORAGE:.*]] = async.runtime.create : !async.value<f32>
// CHECK: %[[ID:.*]] = async.coro.id
@ -107,7 +107,7 @@ func @simple_caller() -> f32 {
// CHECK-LABEL: func @double_caller()
// CHECK-SAME: -> (!async.token, !async.value<f32>)
func @double_caller() -> f32 {
func.func @double_caller() -> f32 {
// CHECK: %[[TOKEN:.*]] = async.runtime.create : !async.token
// CHECK: %[[RETURNED_STORAGE:.*]] = async.runtime.create : !async.value<f32>
// CHECK: %[[ID:.*]] = async.coro.id
@ -172,7 +172,7 @@ func @double_caller() -> f32 {
// CHECK-LABEL: func @recursive
// CHECK-SAME: (%[[ARG:.*]]: !async.token) -> !async.token
func @recursive(%arg: !async.token) {
func.func @recursive(%arg: !async.token) {
// CHECK: %[[TOKEN:.*]] = async.runtime.create : !async.token
// CHECK: %[[ID:.*]] = async.coro.id
// CHECK: %[[HDL:.*]] = async.coro.begin %[[ID]]
@ -218,7 +218,7 @@ return
// CHECK-LABEL: func @corecursive1
// CHECK-SAME: (%[[ARG:.*]]: !async.token) -> !async.token
func @corecursive1(%arg: !async.token) {
func.func @corecursive1(%arg: !async.token) {
// CHECK: %[[TOKEN:.*]] = async.runtime.create : !async.token
// CHECK: %[[ID:.*]] = async.coro.id
// CHECK: %[[HDL:.*]] = async.coro.begin %[[ID]]
@ -264,7 +264,7 @@ return
// CHECK-LABEL: func @corecursive2
// CHECK-SAME: (%[[ARG:.*]]: !async.token) -> !async.token
func @corecursive2(%arg: !async.token) {
func.func @corecursive2(%arg: !async.token) {
// CHECK: %[[TOKEN:.*]] = async.runtime.create : !async.token
// CHECK: %[[ID:.*]] = async.coro.id
// CHECK: %[[HDL:.*]] = async.coro.begin %[[ID]]
@ -310,7 +310,7 @@ return
// CHECK-LABEL: func @caller_allowed_to_block
// CHECK-SAME: () -> f32
func @caller_allowed_to_block() -> f32 attributes { async.allowed_to_block } {
func.func @caller_allowed_to_block() -> f32 attributes { async.allowed_to_block } {
// CHECK: %[[CONSTANT:.*]] = arith.constant
%c = arith.constant 1.0 : f32
// CHECK: %[[RETURNED_TO_CALLER:.*]]:2 = call @simple_callee(%[[CONSTANT]]) : (f32) -> (!async.token, !async.value<f32>)

View File

@ -2,7 +2,7 @@
// RUN: | FileCheck %s --dump-input=always
// CHECK-LABEL: @execute_no_async_args
func @execute_no_async_args(%arg0: f32, %arg1: memref<1xf32>) {
func.func @execute_no_async_args(%arg0: f32, %arg1: memref<1xf32>) {
%token = async.execute {
%c0 = arith.constant 0 : index
memref.store %arg0, %arg1[%c0] : memref<1xf32>
@ -44,7 +44,7 @@ func @execute_no_async_args(%arg0: f32, %arg1: memref<1xf32>) {
// -----
// CHECK-LABEL: @nested_async_execute
func @nested_async_execute(%arg0: f32, %arg1: f32, %arg2: memref<1xf32>) {
func.func @nested_async_execute(%arg0: f32, %arg1: f32, %arg2: memref<1xf32>) {
// CHECK: %[[TOKEN:.*]] = call @async_execute_fn_0(%arg0, %arg2, %arg1)
%token0 = async.execute {
%c0 = arith.constant 0 : index
@ -123,7 +123,7 @@ func @nested_async_execute(%arg0: f32, %arg1: f32, %arg2: memref<1xf32>) {
// -----
// CHECK-LABEL: @async_execute_token_dependency
func @async_execute_token_dependency(%arg0: f32, %arg1: memref<1xf32>) {
func.func @async_execute_token_dependency(%arg0: f32, %arg1: memref<1xf32>) {
// CHECK: %[[TOKEN:.*]] = call @async_execute_fn
%token = async.execute {
%c0 = arith.constant 0 : index
@ -182,7 +182,7 @@ func @async_execute_token_dependency(%arg0: f32, %arg1: memref<1xf32>) {
// -----
// CHECK-LABEL: @async_group_await_all
func @async_group_await_all(%arg0: f32, %arg1: memref<1xf32>) {
func.func @async_group_await_all(%arg0: f32, %arg1: memref<1xf32>) {
// CHECK: %[[C:.*]] = arith.constant 1 : index
%c = arith.constant 1 : index
// CHECK: %[[GROUP:.*]] = async.runtime.create_group %[[C]] : !async.group
@ -237,7 +237,7 @@ func @async_group_await_all(%arg0: f32, %arg1: memref<1xf32>) {
// -----
// CHECK-LABEL: @execute_and_return_f32
func @execute_and_return_f32() -> f32 {
func.func @execute_and_return_f32() -> f32 {
// CHECK: %[[RET:.*]]:2 = call @async_execute_fn
%token, %result = async.execute -> !async.value<f32> {
%c0 = arith.constant 123.0 : f32
@ -276,7 +276,7 @@ func @execute_and_return_f32() -> f32 {
// -----
// CHECK-LABEL: @async_value_operands
func @async_value_operands() {
func.func @async_value_operands() {
// CHECK: %[[RET:.*]]:2 = call @async_execute_fn
%token, %result = async.execute -> !async.value<f32> {
%c0 = arith.constant 123.0 : f32
@ -333,7 +333,7 @@ func @async_value_operands() {
// -----
// CHECK-LABEL: @execute_assertion
func @execute_assertion(%arg0: i1) {
func.func @execute_assertion(%arg0: i1) {
%token = async.execute {
cf.assert %arg0, "error"
async.yield
@ -384,7 +384,7 @@ func @execute_assertion(%arg0: i1) {
// lowered to branch-based control flow to enable coroutine CFG rewrite.
// CHECK-LABEL: @lower_scf_to_cfg
func @lower_scf_to_cfg(%arg0: f32, %arg1: memref<1xf32>, %arg2: i1) {
func.func @lower_scf_to_cfg(%arg0: f32, %arg1: memref<1xf32>, %arg2: i1) {
%token0 = async.execute { async.yield }
%token1 = async.execute {
scf.if %arg2 {
@ -416,7 +416,7 @@ func @lower_scf_to_cfg(%arg0: f32, %arg1: memref<1xf32>, %arg2: i1) {
// outline async execute function.
// CHECK-LABEL: @clone_constants
func @clone_constants(%arg0: f32, %arg1: memref<1xf32>) {
func.func @clone_constants(%arg0: f32, %arg1: memref<1xf32>) {
%c0 = arith.constant 0 : index
%token = async.execute {
memref.store %arg0, %arg1[%c0] : memref<1xf32>

View File

@ -1,7 +1,7 @@
// RUN: mlir-opt %s | FileCheck %s --dump-input=always
// CHECK-LABEL: @coro_id
func @coro_id() -> !async.coro.id {
func.func @coro_id() -> !async.coro.id {
// CHECK: %0 = async.coro.id
// CHECK: return %0 : !async.coro.id
%0 = async.coro.id
@ -9,7 +9,7 @@ func @coro_id() -> !async.coro.id {
}
// CHECK-LABEL: @coro_handle
func @coro_handle(%arg0: !async.coro.id) -> !async.coro.handle {
func.func @coro_handle(%arg0: !async.coro.id) -> !async.coro.handle {
// CHECK: %0 = async.coro.begin %arg0
// CHECK: return %0 : !async.coro.handle
%0 = async.coro.begin %arg0
@ -17,21 +17,21 @@ func @coro_handle(%arg0: !async.coro.id) -> !async.coro.handle {
}
// CHECK-LABEL: @coro_free
func @coro_free(%arg0: !async.coro.id, %arg1: !async.coro.handle) {
func.func @coro_free(%arg0: !async.coro.id, %arg1: !async.coro.handle) {
// CHECK: async.coro.free %arg0, %arg1
async.coro.free %arg0, %arg1
return
}
// CHECK-LABEL: @coro_end
func @coro_end(%arg0: !async.coro.handle) {
func.func @coro_end(%arg0: !async.coro.handle) {
// CHECK: async.coro.end %arg0
async.coro.end %arg0
return
}
// CHECK-LABEL: @coro_save
func @coro_save(%arg0: !async.coro.handle) -> !async.coro.state {
func.func @coro_save(%arg0: !async.coro.handle) -> !async.coro.state {
// CHECK: %0 = async.coro.save %arg0
%0 = async.coro.save %arg0
// CHECK: return %0 : !async.coro.state
@ -39,7 +39,7 @@ func @coro_save(%arg0: !async.coro.handle) -> !async.coro.state {
}
// CHECK-LABEL: @coro_suspend
func @coro_suspend(%arg0: !async.coro.state) {
func.func @coro_suspend(%arg0: !async.coro.state) {
// CHECK: async.coro.suspend %arg0
// CHECK-SAME: ^[[SUSPEND:.*]], ^[[RESUME:.*]], ^[[CLEANUP:.*]]
async.coro.suspend %arg0, ^suspend, ^resume, ^cleanup

View File

@ -1,19 +1,19 @@
// RUN: mlir-opt %s | FileCheck %s
// CHECK-LABEL: @identity_token
func @identity_token(%arg0: !async.token) -> !async.token {
func.func @identity_token(%arg0: !async.token) -> !async.token {
// CHECK: return %arg0 : !async.token
return %arg0 : !async.token
}
// CHECK-LABEL: @identity_value
func @identity_value(%arg0 : !async.value<f32>) -> !async.value<f32> {
func.func @identity_value(%arg0 : !async.value<f32>) -> !async.value<f32> {
// CHECK: return %arg0 : !async.value<f32>
return %arg0 : !async.value<f32>
}
// CHECK-LABEL: @empty_async_execute
func @empty_async_execute() -> !async.token {
func.func @empty_async_execute() -> !async.token {
// CHECK: async.execute
%token = async.execute {
async.yield
@ -24,7 +24,7 @@ func @empty_async_execute() -> !async.token {
}
// CHECK-LABEL: @return_async_value
func @return_async_value() -> !async.value<f32> {
func.func @return_async_value() -> !async.value<f32> {
// CHECK: async.execute -> !async.value<f32>
%token, %results = async.execute -> !async.value<f32> {
%cst = arith.constant 1.000000e+00 : f32
@ -36,7 +36,7 @@ func @return_async_value() -> !async.value<f32> {
}
// CHECK-LABEL: @return_captured_value
func @return_captured_value() -> !async.token {
func.func @return_captured_value() -> !async.token {
%cst = arith.constant 1.000000e+00 : f32
// CHECK: async.execute -> !async.value<f32>
%token, %results = async.execute -> !async.value<f32> {
@ -48,7 +48,7 @@ func @return_captured_value() -> !async.token {
}
// CHECK-LABEL: @return_async_values
func @return_async_values() -> (!async.value<f32>, !async.value<f32>) {
func.func @return_async_values() -> (!async.value<f32>, !async.value<f32>) {
%token, %results:2 = async.execute -> (!async.value<f32>, !async.value<f32>) {
%cst1 = arith.constant 1.000000e+00 : f32
%cst2 = arith.constant 2.000000e+00 : f32
@ -60,7 +60,7 @@ func @return_async_values() -> (!async.value<f32>, !async.value<f32>) {
}
// CHECK-LABEL: @async_token_dependencies
func @async_token_dependencies(%arg0: !async.token) -> !async.token {
func.func @async_token_dependencies(%arg0: !async.token) -> !async.token {
// CHECK: async.execute [%arg0]
%token = async.execute [%arg0] {
async.yield
@ -71,7 +71,7 @@ func @async_token_dependencies(%arg0: !async.token) -> !async.token {
}
// CHECK-LABEL: @async_value_operands
func @async_value_operands(%arg0: !async.value<f32>) -> !async.token {
func.func @async_value_operands(%arg0: !async.value<f32>) -> !async.token {
// CHECK: async.execute (%arg0 as %arg1: !async.value<f32>) -> !async.value<f32>
%token, %results = async.execute (%arg0 as %arg1: !async.value<f32>) -> !async.value<f32> {
async.yield %arg1 : f32
@ -82,7 +82,7 @@ func @async_value_operands(%arg0: !async.value<f32>) -> !async.token {
}
// CHECK-LABEL: @async_token_and_value_operands
func @async_token_and_value_operands(%arg0: !async.token, %arg1: !async.value<f32>) -> !async.token {
func.func @async_token_and_value_operands(%arg0: !async.token, %arg1: !async.value<f32>) -> !async.token {
// CHECK: async.execute [%arg0] (%arg1 as %arg2: !async.value<f32>) -> !async.value<f32>
%token, %results = async.execute [%arg0] (%arg1 as %arg2: !async.value<f32>) -> !async.value<f32> {
async.yield %arg2 : f32
@ -93,7 +93,7 @@ func @async_token_and_value_operands(%arg0: !async.token, %arg1: !async.value<f3
}
// CHECK-LABEL: @empty_tokens_or_values_operands
func @empty_tokens_or_values_operands() {
func.func @empty_tokens_or_values_operands() {
// CHECK: async.execute {
%token0 = async.execute [] () -> () { async.yield }
// CHECK: async.execute {
@ -108,21 +108,21 @@ func @empty_tokens_or_values_operands() {
}
// CHECK-LABEL: @await_token
func @await_token(%arg0: !async.token) {
func.func @await_token(%arg0: !async.token) {
// CHECK: async.await %arg0
async.await %arg0 : !async.token
return
}
// CHECK-LABEL: @await_value
func @await_value(%arg0: !async.value<f32>) -> f32 {
func.func @await_value(%arg0: !async.value<f32>) -> f32 {
// CHECK: async.await %arg0
%0 = async.await %arg0 : !async.value<f32>
return %0 : f32
}
// CHECK-LABEL: @create_group_and_await_all
func @create_group_and_await_all(%arg0: !async.token,
func.func @create_group_and_await_all(%arg0: !async.token,
%arg1: !async.value<f32>) -> index {
%c = arith.constant 2 : index
%0 = async.create_group %c : !async.group

View File

@ -1,7 +1,7 @@
// RUN: mlir-opt %s | FileCheck %s --dump-input=always
// CHECK-LABEL: @create_token
func @create_token() -> !async.token {
func.func @create_token() -> !async.token {
// CHECK: %0 = async.runtime.create : !async.token
%0 = async.runtime.create : !async.token
// CHECK: return %0 : !async.token
@ -9,7 +9,7 @@ func @create_token() -> !async.token {
}
// CHECK-LABEL: @create_value
func @create_value() -> !async.value<f32> {
func.func @create_value() -> !async.value<f32> {
// CHECK: %0 = async.runtime.create : !async.value<f32>
%0 = async.runtime.create : !async.value<f32>
// CHECK: return %0 : !async.value<f32>
@ -17,7 +17,7 @@ func @create_value() -> !async.value<f32> {
}
// CHECK-LABEL: @create_group
func @create_group() -> !async.group {
func.func @create_group() -> !async.group {
// CHECK: %[[C:.*]] = arith.constant 10 : index
%c = arith.constant 10 : index
// CHECK: %[[V:.*]] = async.runtime.create_group %[[C]] : !async.group
@ -27,77 +27,77 @@ func @create_group() -> !async.group {
}
// CHECK-LABEL: @set_token_available
func @set_token_available(%arg0: !async.token) {
func.func @set_token_available(%arg0: !async.token) {
// CHECK: async.runtime.set_available %arg0 : !async.token
async.runtime.set_available %arg0 : !async.token
return
}
// CHECK-LABEL: @set_value_available
func @set_value_available(%arg0: !async.value<f32>) {
func.func @set_value_available(%arg0: !async.value<f32>) {
// CHECK: async.runtime.set_available %arg0 : !async.value<f32>
async.runtime.set_available %arg0 : !async.value<f32>
return
}
// CHECK-LABEL: @set_token_error
func @set_token_error(%arg0: !async.token) {
func.func @set_token_error(%arg0: !async.token) {
// CHECK: async.runtime.set_error %arg0 : !async.token
async.runtime.set_error %arg0 : !async.token
return
}
// CHECK-LABEL: @set_value_error
func @set_value_error(%arg0: !async.value<f32>) {
func.func @set_value_error(%arg0: !async.value<f32>) {
// CHECK: async.runtime.set_error %arg0 : !async.value<f32>
async.runtime.set_error %arg0 : !async.value<f32>
return
}
// CHECK-LABEL: @is_token_error
func @is_token_error(%arg0: !async.token) -> i1 {
func.func @is_token_error(%arg0: !async.token) -> i1 {
// CHECK: %[[ERR:.*]] = async.runtime.is_error %arg0 : !async.token
%0 = async.runtime.is_error %arg0 : !async.token
return %0 : i1
}
// CHECK-LABEL: @is_value_error
func @is_value_error(%arg0: !async.value<f32>) -> i1 {
func.func @is_value_error(%arg0: !async.value<f32>) -> i1 {
// CHECK: %[[ERR:.*]] = async.runtime.is_error %arg0 : !async.value<f32>
%0 = async.runtime.is_error %arg0 : !async.value<f32>
return %0 : i1
}
// CHECK-LABEL: @is_group_error
func @is_group_error(%arg0: !async.group) -> i1 {
func.func @is_group_error(%arg0: !async.group) -> i1 {
// CHECK: %[[ERR:.*]] = async.runtime.is_error %arg0 : !async.group
%0 = async.runtime.is_error %arg0 : !async.group
return %0 : i1
}
// CHECK-LABEL: @await_token
func @await_token(%arg0: !async.token) {
func.func @await_token(%arg0: !async.token) {
// CHECK: async.runtime.await %arg0 : !async.token
async.runtime.await %arg0 : !async.token
return
}
// CHECK-LABEL: @await_value
func @await_value(%arg0: !async.value<f32>) {
func.func @await_value(%arg0: !async.value<f32>) {
// CHECK: async.runtime.await %arg0 : !async.value<f32>
async.runtime.await %arg0 : !async.value<f32>
return
}
// CHECK-LABEL: @await_group
func @await_group(%arg0: !async.group) {
func.func @await_group(%arg0: !async.group) {
// CHECK: async.runtime.await %arg0 : !async.group
async.runtime.await %arg0 : !async.group
return
}
// CHECK-LABEL: @await_and_resume_token
func @await_and_resume_token(%arg0: !async.token,
func.func @await_and_resume_token(%arg0: !async.token,
%arg1: !async.coro.handle) {
// CHECK: async.runtime.await_and_resume %arg0, %arg1 : !async.token
async.runtime.await_and_resume %arg0, %arg1 : !async.token
@ -105,7 +105,7 @@ func @await_and_resume_token(%arg0: !async.token,
}
// CHECK-LABEL: @await_and_resume_value
func @await_and_resume_value(%arg0: !async.value<f32>,
func.func @await_and_resume_value(%arg0: !async.value<f32>,
%arg1: !async.coro.handle) {
// CHECK: async.runtime.await_and_resume %arg0, %arg1 : !async.value<f32>
async.runtime.await_and_resume %arg0, %arg1 : !async.value<f32>
@ -113,7 +113,7 @@ func @await_and_resume_value(%arg0: !async.value<f32>,
}
// CHECK-LABEL: @await_and_resume_group
func @await_and_resume_group(%arg0: !async.group,
func.func @await_and_resume_group(%arg0: !async.group,
%arg1: !async.coro.handle) {
// CHECK: async.runtime.await_and_resume %arg0, %arg1 : !async.group
async.runtime.await_and_resume %arg0, %arg1 : !async.group
@ -121,21 +121,21 @@ func @await_and_resume_group(%arg0: !async.group,
}
// CHECK-LABEL: @resume
func @resume(%arg0: !async.coro.handle) {
func.func @resume(%arg0: !async.coro.handle) {
// CHECK: async.runtime.resume %arg0
async.runtime.resume %arg0
return
}
// CHECK-LABEL: @store
func @store(%arg0: f32, %arg1: !async.value<f32>) {
func.func @store(%arg0: f32, %arg1: !async.value<f32>) {
// CHECK: async.runtime.store %arg0, %arg1 : <f32>
async.runtime.store %arg0, %arg1 : <f32>
return
}
// CHECK-LABEL: @load
func @load(%arg0: !async.value<f32>) -> f32 {
func.func @load(%arg0: !async.value<f32>) -> f32 {
// CHECK: %0 = async.runtime.load %arg0 : <f32>
// CHECK: return %0 : f32
%0 = async.runtime.load %arg0 : <f32>
@ -143,7 +143,7 @@ func @load(%arg0: !async.value<f32>) -> f32 {
}
// CHECK-LABEL: @add_to_group
func @add_to_group(%arg0: !async.token, %arg1: !async.value<f32>,
func.func @add_to_group(%arg0: !async.token, %arg1: !async.value<f32>,
%arg2: !async.group) {
// CHECK: async.runtime.add_to_group %arg0, %arg2 : !async.token
async.runtime.add_to_group %arg0, %arg2 : !async.token
@ -153,14 +153,14 @@ func @add_to_group(%arg0: !async.token, %arg1: !async.value<f32>,
}
// CHECK-LABEL: @add_ref
func @add_ref(%arg0: !async.token) {
func.func @add_ref(%arg0: !async.token) {
// CHECK: async.runtime.add_ref %arg0 {count = 1 : i64}
async.runtime.add_ref %arg0 {count = 1 : i64} : !async.token
return
}
// CHECK-LABEL: @drop_ref
func @drop_ref(%arg0: !async.token) {
func.func @drop_ref(%arg0: !async.token) {
// CHECK: async.runtime.drop_ref %arg0 {count = 1 : i64}
async.runtime.drop_ref %arg0 {count = 1 : i64} : !async.token
return

View File

@ -2,20 +2,20 @@
// FileCheck test must have at least one CHECK statement.
// CHECK-LABEL: @no_op
func @no_op(%arg0: !async.token) {
func.func @no_op(%arg0: !async.token) {
return
}
// -----
func @wrong_async_await_arg_type(%arg0: f32) {
func.func @wrong_async_await_arg_type(%arg0: f32) {
// expected-error @+1 {{'async.await' op operand #0 must be async value type or async token type, but got 'f32'}}
async.await %arg0 : f32
}
// -----
func @wrong_async_await_result_type(%arg0: !async.value<f32>) {
func.func @wrong_async_await_result_type(%arg0: !async.value<f32>) {
// expected-error @+1 {{'async.await' op result type 'f64' does not match async value type 'f32'}}
%0 = "async.await"(%arg0): (!async.value<f32>) -> f64
}