1// RUN: mlir-opt %s | mlir-opt | FileCheck %s 2// RUN: mlir-opt %s --mlir-print-op-generic | mlir-opt | FileCheck %s 3 4// CHECK-LABEL: test_addi 5func.func @test_addi(%arg0 : i64, %arg1 : i64) -> i64 { 6 %0 = arith.addi %arg0, %arg1 : i64 7 return %0 : i64 8} 9 10// CHECK-LABEL: test_addi_tensor 11func.func @test_addi_tensor(%arg0 : tensor<8x8xi64>, %arg1 : tensor<8x8xi64>) -> tensor<8x8xi64> { 12 %0 = arith.addi %arg0, %arg1 : tensor<8x8xi64> 13 return %0 : tensor<8x8xi64> 14} 15 16// CHECK-LABEL: test_addi_vector 17func.func @test_addi_vector(%arg0 : vector<8xi64>, %arg1 : vector<8xi64>) -> vector<8xi64> { 18 %0 = arith.addi %arg0, %arg1 : vector<8xi64> 19 return %0 : vector<8xi64> 20} 21 22// CHECK-LABEL: test_addi_scalable_vector 23func.func @test_addi_scalable_vector(%arg0 : vector<[8]xi64>, %arg1 : vector<[8]xi64>) -> vector<[8]xi64> { 24 %0 = arith.addi %arg0, %arg1 : vector<[8]xi64> 25 return %0 : vector<[8]xi64> 26} 27 28// CHECK-LABEL: test_subi 29func.func @test_subi(%arg0 : i64, %arg1 : i64) -> i64 { 30 %0 = arith.subi %arg0, %arg1 : i64 31 return %0 : i64 32} 33 34// CHECK-LABEL: test_subi_tensor 35func.func @test_subi_tensor(%arg0 : tensor<8x8xi64>, %arg1 : tensor<8x8xi64>) -> tensor<8x8xi64> { 36 %0 = arith.subi %arg0, %arg1 : tensor<8x8xi64> 37 return %0 : tensor<8x8xi64> 38} 39 40// CHECK-LABEL: test_subi_vector 41func.func @test_subi_vector(%arg0 : vector<8xi64>, %arg1 : vector<8xi64>) -> vector<8xi64> { 42 %0 = arith.subi %arg0, %arg1 : vector<8xi64> 43 return %0 : vector<8xi64> 44} 45 46// CHECK-LABEL: test_subi_scalable_vector 47func.func @test_subi_scalable_vector(%arg0 : vector<[8]xi64>, %arg1 : vector<[8]xi64>) -> vector<[8]xi64> { 48 %0 = arith.subi %arg0, %arg1 : vector<[8]xi64> 49 return %0 : vector<[8]xi64> 50} 51 52// CHECK-LABEL: test_muli 53func.func @test_muli(%arg0 : i64, %arg1 : i64) -> i64 { 54 %0 = arith.muli %arg0, %arg1 : i64 55 return %0 : i64 56} 57 58// CHECK-LABEL: test_muli_tensor 59func.func @test_muli_tensor(%arg0 : tensor<8x8xi64>, %arg1 : tensor<8x8xi64>) -> tensor<8x8xi64> { 60 %0 = arith.muli %arg0, %arg1 : tensor<8x8xi64> 61 return %0 : tensor<8x8xi64> 62} 63 64// CHECK-LABEL: test_muli_vector 65func.func @test_muli_vector(%arg0 : vector<8xi64>, %arg1 : vector<8xi64>) -> vector<8xi64> { 66 %0 = arith.muli %arg0, %arg1 : vector<8xi64> 67 return %0 : vector<8xi64> 68} 69 70// CHECK-LABEL: test_muli_scalable_vector 71func.func @test_muli_scalable_vector(%arg0 : vector<[8]xi64>, %arg1 : vector<[8]xi64>) -> vector<[8]xi64> { 72 %0 = arith.muli %arg0, %arg1 : vector<[8]xi64> 73 return %0 : vector<[8]xi64> 74} 75 76// CHECK-LABEL: test_divui 77func.func @test_divui(%arg0 : i64, %arg1 : i64) -> i64 { 78 %0 = arith.divui %arg0, %arg1 : i64 79 return %0 : i64 80} 81 82// CHECK-LABEL: test_divui_tensor 83func.func @test_divui_tensor(%arg0 : tensor<8x8xi64>, %arg1 : tensor<8x8xi64>) -> tensor<8x8xi64> { 84 %0 = arith.divui %arg0, %arg1 : tensor<8x8xi64> 85 return %0 : tensor<8x8xi64> 86} 87 88// CHECK-LABEL: test_divui_vector 89func.func @test_divui_vector(%arg0 : vector<8xi64>, %arg1 : vector<8xi64>) -> vector<8xi64> { 90 %0 = arith.divui %arg0, %arg1 : vector<8xi64> 91 return %0 : vector<8xi64> 92} 93 94// CHECK-LABEL: test_divui_scalable_vector 95func.func @test_divui_scalable_vector(%arg0 : vector<[8]xi64>, %arg1 : vector<[8]xi64>) -> vector<[8]xi64> { 96 %0 = arith.divui %arg0, %arg1 : vector<[8]xi64> 97 return %0 : vector<[8]xi64> 98} 99 100// CHECK-LABEL: test_divsi 101func.func @test_divsi(%arg0 : i64, %arg1 : i64) -> i64 { 102 %0 = arith.divsi %arg0, %arg1 : i64 103 return %0 : i64 104} 105 106// CHECK-LABEL: test_divsi_tensor 107func.func @test_divsi_tensor(%arg0 : tensor<8x8xi64>, %arg1 : tensor<8x8xi64>) -> tensor<8x8xi64> { 108 %0 = arith.divsi %arg0, %arg1 : tensor<8x8xi64> 109 return %0 : tensor<8x8xi64> 110} 111 112// CHECK-LABEL: test_divsi_vector 113func.func @test_divsi_vector(%arg0 : vector<8xi64>, %arg1 : vector<8xi64>) -> vector<8xi64> { 114 %0 = arith.divsi %arg0, %arg1 : vector<8xi64> 115 return %0 : vector<8xi64> 116} 117 118// CHECK-LABEL: test_divsi_scalable_vector 119func.func @test_divsi_scalable_vector(%arg0 : vector<[8]xi64>, %arg1 : vector<[8]xi64>) -> vector<[8]xi64> { 120 %0 = arith.divsi %arg0, %arg1 : vector<[8]xi64> 121 return %0 : vector<[8]xi64> 122} 123 124// CHECK-LABEL: test_remui 125func.func @test_remui(%arg0 : i64, %arg1 : i64) -> i64 { 126 %0 = arith.remui %arg0, %arg1 : i64 127 return %0 : i64 128} 129 130// CHECK-LABEL: test_remui_tensor 131func.func @test_remui_tensor(%arg0 : tensor<8x8xi64>, %arg1 : tensor<8x8xi64>) -> tensor<8x8xi64> { 132 %0 = arith.remui %arg0, %arg1 : tensor<8x8xi64> 133 return %0 : tensor<8x8xi64> 134} 135 136// CHECK-LABEL: test_remui_vector 137func.func @test_remui_vector(%arg0 : vector<8xi64>, %arg1 : vector<8xi64>) -> vector<8xi64> { 138 %0 = arith.remui %arg0, %arg1 : vector<8xi64> 139 return %0 : vector<8xi64> 140} 141 142// CHECK-LABEL: test_remui_scalable_vector 143func.func @test_remui_scalable_vector(%arg0 : vector<[8]xi64>, %arg1 : vector<[8]xi64>) -> vector<[8]xi64> { 144 %0 = arith.remui %arg0, %arg1 : vector<[8]xi64> 145 return %0 : vector<[8]xi64> 146} 147 148// CHECK-LABEL: test_remsi 149func.func @test_remsi(%arg0 : i64, %arg1 : i64) -> i64 { 150 %0 = arith.remsi %arg0, %arg1 : i64 151 return %0 : i64 152} 153 154// CHECK-LABEL: test_remsi_tensor 155func.func @test_remsi_tensor(%arg0 : tensor<8x8xi64>, %arg1 : tensor<8x8xi64>) -> tensor<8x8xi64> { 156 %0 = arith.remsi %arg0, %arg1 : tensor<8x8xi64> 157 return %0 : tensor<8x8xi64> 158} 159 160// CHECK-LABEL: test_remsi_vector 161func.func @test_remsi_vector(%arg0 : vector<8xi64>, %arg1 : vector<8xi64>) -> vector<8xi64> { 162 %0 = arith.remsi %arg0, %arg1 : vector<8xi64> 163 return %0 : vector<8xi64> 164} 165 166// CHECK-LABEL: test_remsi_scalable_vector 167func.func @test_remsi_scalable_vector(%arg0 : vector<[8]xi64>, %arg1 : vector<[8]xi64>) -> vector<[8]xi64> { 168 %0 = arith.remsi %arg0, %arg1 : vector<[8]xi64> 169 return %0 : vector<[8]xi64> 170} 171 172// CHECK-LABEL: test_andi 173func.func @test_andi(%arg0 : i64, %arg1 : i64) -> i64 { 174 %0 = arith.andi %arg0, %arg1 : i64 175 return %0 : i64 176} 177 178// CHECK-LABEL: test_andi_tensor 179func.func @test_andi_tensor(%arg0 : tensor<8x8xi64>, %arg1 : tensor<8x8xi64>) -> tensor<8x8xi64> { 180 %0 = arith.andi %arg0, %arg1 : tensor<8x8xi64> 181 return %0 : tensor<8x8xi64> 182} 183 184// CHECK-LABEL: test_andi_vector 185func.func @test_andi_vector(%arg0 : vector<8xi64>, %arg1 : vector<8xi64>) -> vector<8xi64> { 186 %0 = arith.andi %arg0, %arg1 : vector<8xi64> 187 return %0 : vector<8xi64> 188} 189 190// CHECK-LABEL: test_andi_scalable_vector 191func.func @test_andi_scalable_vector(%arg0 : vector<[8]xi64>, %arg1 : vector<[8]xi64>) -> vector<[8]xi64> { 192 %0 = arith.andi %arg0, %arg1 : vector<[8]xi64> 193 return %0 : vector<[8]xi64> 194} 195 196// CHECK-LABEL: test_ori 197func.func @test_ori(%arg0 : i64, %arg1 : i64) -> i64 { 198 %0 = arith.ori %arg0, %arg1 : i64 199 return %0 : i64 200} 201 202// CHECK-LABEL: test_ori_tensor 203func.func @test_ori_tensor(%arg0 : tensor<8x8xi64>, %arg1 : tensor<8x8xi64>) -> tensor<8x8xi64> { 204 %0 = arith.ori %arg0, %arg1 : tensor<8x8xi64> 205 return %0 : tensor<8x8xi64> 206} 207 208// CHECK-LABEL: test_ori_vector 209func.func @test_ori_vector(%arg0 : vector<8xi64>, %arg1 : vector<8xi64>) -> vector<8xi64> { 210 %0 = arith.ori %arg0, %arg1 : vector<8xi64> 211 return %0 : vector<8xi64> 212} 213 214// CHECK-LABEL: test_ori_scalable_vector 215func.func @test_ori_scalable_vector(%arg0 : vector<[8]xi64>, %arg1 : vector<[8]xi64>) -> vector<[8]xi64> { 216 %0 = arith.ori %arg0, %arg1 : vector<[8]xi64> 217 return %0 : vector<[8]xi64> 218} 219 220// CHECK-LABEL: test_xori 221func.func @test_xori(%arg0 : i64, %arg1 : i64) -> i64 { 222 %0 = arith.xori %arg0, %arg1 : i64 223 return %0 : i64 224} 225 226// CHECK-LABEL: test_xori_tensor 227func.func @test_xori_tensor(%arg0 : tensor<8x8xi64>, %arg1 : tensor<8x8xi64>) -> tensor<8x8xi64> { 228 %0 = arith.xori %arg0, %arg1 : tensor<8x8xi64> 229 return %0 : tensor<8x8xi64> 230} 231 232// CHECK-LABEL: test_xori_vector 233func.func @test_xori_vector(%arg0 : vector<8xi64>, %arg1 : vector<8xi64>) -> vector<8xi64> { 234 %0 = arith.xori %arg0, %arg1 : vector<8xi64> 235 return %0 : vector<8xi64> 236} 237 238// CHECK-LABEL: test_xori_scalable_vector 239func.func @test_xori_scalable_vector(%arg0 : vector<[8]xi64>, %arg1 : vector<[8]xi64>) -> vector<[8]xi64> { 240 %0 = arith.xori %arg0, %arg1 : vector<[8]xi64> 241 return %0 : vector<[8]xi64> 242} 243 244// CHECK-LABEL: test_ceildivsi 245func.func @test_ceildivsi(%arg0 : i64, %arg1 : i64) -> i64 { 246 %0 = arith.ceildivsi %arg0, %arg1 : i64 247 return %0 : i64 248} 249 250// CHECK-LABEL: test_ceildivsi_tensor 251func.func @test_ceildivsi_tensor(%arg0 : tensor<8x8xi64>, %arg1 : tensor<8x8xi64>) -> tensor<8x8xi64> { 252 %0 = arith.ceildivsi %arg0, %arg1 : tensor<8x8xi64> 253 return %0 : tensor<8x8xi64> 254} 255 256// CHECK-LABEL: test_ceildivsi_vector 257func.func @test_ceildivsi_vector(%arg0 : vector<8xi64>, %arg1 : vector<8xi64>) -> vector<8xi64> { 258 %0 = arith.ceildivsi %arg0, %arg1 : vector<8xi64> 259 return %0 : vector<8xi64> 260} 261 262// CHECK-LABEL: test_ceildivsi_scalable_vector 263func.func @test_ceildivsi_scalable_vector(%arg0 : vector<[8]xi64>, %arg1 : vector<[8]xi64>) -> vector<[8]xi64> { 264 %0 = arith.ceildivsi %arg0, %arg1 : vector<[8]xi64> 265 return %0 : vector<[8]xi64> 266} 267 268// CHECK-LABEL: test_floordivsi 269func.func @test_floordivsi(%arg0 : i64, %arg1 : i64) -> i64 { 270 %0 = arith.floordivsi %arg0, %arg1 : i64 271 return %0 : i64 272} 273 274// CHECK-LABEL: test_floordivsi_tensor 275func.func @test_floordivsi_tensor(%arg0 : tensor<8x8xi64>, %arg1 : tensor<8x8xi64>) -> tensor<8x8xi64> { 276 %0 = arith.floordivsi %arg0, %arg1 : tensor<8x8xi64> 277 return %0 : tensor<8x8xi64> 278} 279 280// CHECK-LABEL: test_floordivsi_vector 281func.func @test_floordivsi_vector(%arg0 : vector<8xi64>, %arg1 : vector<8xi64>) -> vector<8xi64> { 282 %0 = arith.floordivsi %arg0, %arg1 : vector<8xi64> 283 return %0 : vector<8xi64> 284} 285 286// CHECK-LABEL: test_floordivsi_scalable_vector 287func.func @test_floordivsi_scalable_vector(%arg0 : vector<[8]xi64>, %arg1 : vector<[8]xi64>) -> vector<[8]xi64> { 288 %0 = arith.floordivsi %arg0, %arg1 : vector<[8]xi64> 289 return %0 : vector<[8]xi64> 290} 291 292// CHECK-LABEL: test_shli 293func.func @test_shli(%arg0 : i64, %arg1 : i64) -> i64 { 294 %0 = arith.shli %arg0, %arg1 : i64 295 return %0 : i64 296} 297 298// CHECK-LABEL: test_shli_tensor 299func.func @test_shli_tensor(%arg0 : tensor<8x8xi64>, %arg1 : tensor<8x8xi64>) -> tensor<8x8xi64> { 300 %0 = arith.shli %arg0, %arg1 : tensor<8x8xi64> 301 return %0 : tensor<8x8xi64> 302} 303 304// CHECK-LABEL: test_shli_vector 305func.func @test_shli_vector(%arg0 : vector<8xi64>, %arg1 : vector<8xi64>) -> vector<8xi64> { 306 %0 = arith.shli %arg0, %arg1 : vector<8xi64> 307 return %0 : vector<8xi64> 308} 309 310// CHECK-LABEL: test_shli_scalable_vector 311func.func @test_shli_scalable_vector(%arg0 : vector<[8]xi64>, %arg1 : vector<[8]xi64>) -> vector<[8]xi64> { 312 %0 = arith.shli %arg0, %arg1 : vector<[8]xi64> 313 return %0 : vector<[8]xi64> 314} 315 316// CHECK-LABEL: test_shrui 317func.func @test_shrui(%arg0 : i64, %arg1 : i64) -> i64 { 318 %0 = arith.shrui %arg0, %arg1 : i64 319 return %0 : i64 320} 321 322// CHECK-LABEL: test_shrui_tensor 323func.func @test_shrui_tensor(%arg0 : tensor<8x8xi64>, %arg1 : tensor<8x8xi64>) -> tensor<8x8xi64> { 324 %0 = arith.shrui %arg0, %arg1 : tensor<8x8xi64> 325 return %0 : tensor<8x8xi64> 326} 327 328// CHECK-LABEL: test_shrui_vector 329func.func @test_shrui_vector(%arg0 : vector<8xi64>, %arg1 : vector<8xi64>) -> vector<8xi64> { 330 %0 = arith.shrui %arg0, %arg1 : vector<8xi64> 331 return %0 : vector<8xi64> 332} 333 334// CHECK-LABEL: test_shrui_scalable_vector 335func.func @test_shrui_scalable_vector(%arg0 : vector<[8]xi64>, %arg1 : vector<[8]xi64>) -> vector<[8]xi64> { 336 %0 = arith.shrui %arg0, %arg1 : vector<[8]xi64> 337 return %0 : vector<[8]xi64> 338} 339 340// CHECK-LABEL: test_shrsi 341func.func @test_shrsi(%arg0 : i64, %arg1 : i64) -> i64 { 342 %0 = arith.shrsi %arg0, %arg1 : i64 343 return %0 : i64 344} 345 346// CHECK-LABEL: test_shrsi_tensor 347func.func @test_shrsi_tensor(%arg0 : tensor<8x8xi64>, %arg1 : tensor<8x8xi64>) -> tensor<8x8xi64> { 348 %0 = arith.shrsi %arg0, %arg1 : tensor<8x8xi64> 349 return %0 : tensor<8x8xi64> 350} 351 352// CHECK-LABEL: test_shrsi_vector 353func.func @test_shrsi_vector(%arg0 : vector<8xi64>, %arg1 : vector<8xi64>) -> vector<8xi64> { 354 %0 = arith.shrsi %arg0, %arg1 : vector<8xi64> 355 return %0 : vector<8xi64> 356} 357 358// CHECK-LABEL: test_shrsi_scalable_vector 359func.func @test_shrsi_scalable_vector(%arg0 : vector<[8]xi64>, %arg1 : vector<[8]xi64>) -> vector<[8]xi64> { 360 %0 = arith.shrsi %arg0, %arg1 : vector<[8]xi64> 361 return %0 : vector<[8]xi64> 362} 363 364// CHECK-LABEL: test_negf 365func.func @test_negf(%arg0 : f64) -> f64 { 366 %0 = arith.negf %arg0 : f64 367 return %0 : f64 368} 369 370// CHECK-LABEL: test_negf_tensor 371func.func @test_negf_tensor(%arg0 : tensor<8x8xf64>) -> tensor<8x8xf64> { 372 %0 = arith.negf %arg0 : tensor<8x8xf64> 373 return %0 : tensor<8x8xf64> 374} 375 376// CHECK-LABEL: test_negf_vector 377func.func @test_negf_vector(%arg0 : vector<8xf64>) -> vector<8xf64> { 378 %0 = arith.negf %arg0 : vector<8xf64> 379 return %0 : vector<8xf64> 380} 381 382// CHECK-LABEL: test_negf_scalable_vector 383func.func @test_negf_scalable_vector(%arg0 : vector<[8]xf64>) -> vector<[8]xf64> { 384 %0 = arith.negf %arg0 : vector<[8]xf64> 385 return %0 : vector<[8]xf64> 386} 387 388// CHECK-LABEL: test_addf 389func.func @test_addf(%arg0 : f64, %arg1 : f64) -> f64 { 390 %0 = arith.addf %arg0, %arg1 : f64 391 return %0 : f64 392} 393 394// CHECK-LABEL: test_addf_tensor 395func.func @test_addf_tensor(%arg0 : tensor<8x8xf64>, %arg1 : tensor<8x8xf64>) -> tensor<8x8xf64> { 396 %0 = arith.addf %arg0, %arg1 : tensor<8x8xf64> 397 return %0 : tensor<8x8xf64> 398} 399 400// CHECK-LABEL: test_addf_vector 401func.func @test_addf_vector(%arg0 : vector<8xf64>, %arg1 : vector<8xf64>) -> vector<8xf64> { 402 %0 = arith.addf %arg0, %arg1 : vector<8xf64> 403 return %0 : vector<8xf64> 404} 405 406// CHECK-LABEL: test_addf_scalable_vector 407func.func @test_addf_scalable_vector(%arg0 : vector<[8]xf64>, %arg1 : vector<[8]xf64>) -> vector<[8]xf64> { 408 %0 = arith.addf %arg0, %arg1 : vector<[8]xf64> 409 return %0 : vector<[8]xf64> 410} 411 412// CHECK-LABEL: test_subf 413func.func @test_subf(%arg0 : f64, %arg1 : f64) -> f64 { 414 %0 = arith.subf %arg0, %arg1 : f64 415 return %0 : f64 416} 417 418// CHECK-LABEL: test_subf_tensor 419func.func @test_subf_tensor(%arg0 : tensor<8x8xf64>, %arg1 : tensor<8x8xf64>) -> tensor<8x8xf64> { 420 %0 = arith.subf %arg0, %arg1 : tensor<8x8xf64> 421 return %0 : tensor<8x8xf64> 422} 423 424// CHECK-LABEL: test_subf_vector 425func.func @test_subf_vector(%arg0 : vector<8xf64>, %arg1 : vector<8xf64>) -> vector<8xf64> { 426 %0 = arith.subf %arg0, %arg1 : vector<8xf64> 427 return %0 : vector<8xf64> 428} 429 430// CHECK-LABEL: test_subf_scalable_vector 431func.func @test_subf_scalable_vector(%arg0 : vector<[8]xf64>, %arg1 : vector<[8]xf64>) -> vector<[8]xf64> { 432 %0 = arith.subf %arg0, %arg1 : vector<[8]xf64> 433 return %0 : vector<[8]xf64> 434} 435 436// CHECK-LABEL: test_mulf 437func.func @test_mulf(%arg0 : f64, %arg1 : f64) -> f64 { 438 %0 = arith.mulf %arg0, %arg1 : f64 439 return %0 : f64 440} 441 442// CHECK-LABEL: test_mulf_tensor 443func.func @test_mulf_tensor(%arg0 : tensor<8x8xf64>, %arg1 : tensor<8x8xf64>) -> tensor<8x8xf64> { 444 %0 = arith.mulf %arg0, %arg1 : tensor<8x8xf64> 445 return %0 : tensor<8x8xf64> 446} 447 448// CHECK-LABEL: test_mulf_vector 449func.func @test_mulf_vector(%arg0 : vector<8xf64>, %arg1 : vector<8xf64>) -> vector<8xf64> { 450 %0 = arith.mulf %arg0, %arg1 : vector<8xf64> 451 return %0 : vector<8xf64> 452} 453 454// CHECK-LABEL: test_mulf_scalable_vector 455func.func @test_mulf_scalable_vector(%arg0 : vector<[8]xf64>, %arg1 : vector<[8]xf64>) -> vector<[8]xf64> { 456 %0 = arith.mulf %arg0, %arg1 : vector<[8]xf64> 457 return %0 : vector<[8]xf64> 458} 459 460// CHECK-LABEL: test_divf 461func.func @test_divf(%arg0 : f64, %arg1 : f64) -> f64 { 462 %0 = arith.divf %arg0, %arg1 : f64 463 return %0 : f64 464} 465 466// CHECK-LABEL: test_divf_tensor 467func.func @test_divf_tensor(%arg0 : tensor<8x8xf64>, %arg1 : tensor<8x8xf64>) -> tensor<8x8xf64> { 468 %0 = arith.divf %arg0, %arg1 : tensor<8x8xf64> 469 return %0 : tensor<8x8xf64> 470} 471 472// CHECK-LABEL: test_divf_vector 473func.func @test_divf_vector(%arg0 : vector<8xf64>, %arg1 : vector<8xf64>) -> vector<8xf64> { 474 %0 = arith.divf %arg0, %arg1 : vector<8xf64> 475 return %0 : vector<8xf64> 476} 477 478// CHECK-LABEL: test_divf_scalable_vector 479func.func @test_divf_scalable_vector(%arg0 : vector<[8]xf64>, %arg1 : vector<[8]xf64>) -> vector<[8]xf64> { 480 %0 = arith.divf %arg0, %arg1 : vector<[8]xf64> 481 return %0 : vector<[8]xf64> 482} 483 484// CHECK-LABEL: test_remf 485func.func @test_remf(%arg0 : f64, %arg1 : f64) -> f64 { 486 %0 = arith.remf %arg0, %arg1 : f64 487 return %0 : f64 488} 489 490// CHECK-LABEL: test_remf_tensor 491func.func @test_remf_tensor(%arg0 : tensor<8x8xf64>, %arg1 : tensor<8x8xf64>) -> tensor<8x8xf64> { 492 %0 = arith.remf %arg0, %arg1 : tensor<8x8xf64> 493 return %0 : tensor<8x8xf64> 494} 495 496// CHECK-LABEL: test_remf_vector 497func.func @test_remf_vector(%arg0 : vector<8xf64>, %arg1 : vector<8xf64>) -> vector<8xf64> { 498 %0 = arith.remf %arg0, %arg1 : vector<8xf64> 499 return %0 : vector<8xf64> 500} 501 502// CHECK-LABEL: test_remf_scalable_vector 503func.func @test_remf_scalable_vector(%arg0 : vector<[8]xf64>, %arg1 : vector<[8]xf64>) -> vector<[8]xf64> { 504 %0 = arith.remf %arg0, %arg1 : vector<[8]xf64> 505 return %0 : vector<[8]xf64> 506} 507 508// CHECK-LABEL: test_extui 509func.func @test_extui(%arg0 : i32) -> i64 { 510 %0 = arith.extui %arg0 : i32 to i64 511 return %0 : i64 512} 513 514// CHECK-LABEL: test_extui_tensor 515func.func @test_extui_tensor(%arg0 : tensor<8x8xi32>) -> tensor<8x8xi64> { 516 %0 = arith.extui %arg0 : tensor<8x8xi32> to tensor<8x8xi64> 517 return %0 : tensor<8x8xi64> 518} 519 520// CHECK-LABEL: test_extui_vector 521func.func @test_extui_vector(%arg0 : vector<8xi32>) -> vector<8xi64> { 522 %0 = arith.extui %arg0 : vector<8xi32> to vector<8xi64> 523 return %0 : vector<8xi64> 524} 525 526// CHECK-LABEL: test_extui_scalable_vector 527func.func @test_extui_scalable_vector(%arg0 : vector<[8]xi32>) -> vector<[8]xi64> { 528 %0 = arith.extui %arg0 : vector<[8]xi32> to vector<[8]xi64> 529 return %0 : vector<[8]xi64> 530} 531 532// CHECK-LABEL: test_extsi 533func.func @test_extsi(%arg0 : i32) -> i64 { 534 %0 = arith.extsi %arg0 : i32 to i64 535 return %0 : i64 536} 537 538// CHECK-LABEL: test_extsi_tensor 539func.func @test_extsi_tensor(%arg0 : tensor<8x8xi32>) -> tensor<8x8xi64> { 540 %0 = arith.extsi %arg0 : tensor<8x8xi32> to tensor<8x8xi64> 541 return %0 : tensor<8x8xi64> 542} 543 544// CHECK-LABEL: test_extsi_vector 545func.func @test_extsi_vector(%arg0 : vector<8xi32>) -> vector<8xi64> { 546 %0 = arith.extsi %arg0 : vector<8xi32> to vector<8xi64> 547 return %0 : vector<8xi64> 548} 549 550// CHECK-LABEL: test_extsi_scalable_vector 551func.func @test_extsi_scalable_vector(%arg0 : vector<[8]xi32>) -> vector<[8]xi64> { 552 %0 = arith.extsi %arg0 : vector<[8]xi32> to vector<[8]xi64> 553 return %0 : vector<[8]xi64> 554} 555 556// CHECK-LABEL: test_extf 557func.func @test_extf(%arg0 : f32) -> f64 { 558 %0 = arith.extf %arg0 : f32 to f64 559 return %0 : f64 560} 561 562// CHECK-LABEL: test_extf_tensor 563func.func @test_extf_tensor(%arg0 : tensor<8x8xf32>) -> tensor<8x8xf64> { 564 %0 = arith.extf %arg0 : tensor<8x8xf32> to tensor<8x8xf64> 565 return %0 : tensor<8x8xf64> 566} 567 568// CHECK-LABEL: test_extf_vector 569func.func @test_extf_vector(%arg0 : vector<8xf32>) -> vector<8xf64> { 570 %0 = arith.extf %arg0 : vector<8xf32> to vector<8xf64> 571 return %0 : vector<8xf64> 572} 573 574// CHECK-LABEL: test_extf_scalable_vector 575func.func @test_extf_scalable_vector(%arg0 : vector<[8]xf32>) -> vector<[8]xf64> { 576 %0 = arith.extf %arg0 : vector<[8]xf32> to vector<[8]xf64> 577 return %0 : vector<[8]xf64> 578} 579 580// CHECK-LABEL: test_trunci 581func.func @test_trunci(%arg0 : i32) -> i16 { 582 %0 = arith.trunci %arg0 : i32 to i16 583 return %0 : i16 584} 585 586// CHECK-LABEL: test_trunci_tensor 587func.func @test_trunci_tensor(%arg0 : tensor<8x8xi32>) -> tensor<8x8xi16> { 588 %0 = arith.trunci %arg0 : tensor<8x8xi32> to tensor<8x8xi16> 589 return %0 : tensor<8x8xi16> 590} 591 592// CHECK-LABEL: test_trunci_vector 593func.func @test_trunci_vector(%arg0 : vector<8xi32>) -> vector<8xi16> { 594 %0 = arith.trunci %arg0 : vector<8xi32> to vector<8xi16> 595 return %0 : vector<8xi16> 596} 597 598// CHECK-LABEL: test_trunci_scalable_vector 599func.func @test_trunci_scalable_vector(%arg0 : vector<[8]xi32>) -> vector<[8]xi16> { 600 %0 = arith.trunci %arg0 : vector<[8]xi32> to vector<[8]xi16> 601 return %0 : vector<[8]xi16> 602} 603 604// CHECK-LABEL: test_truncf 605func.func @test_truncf(%arg0 : f32) -> bf16 { 606 %0 = arith.truncf %arg0 : f32 to bf16 607 return %0 : bf16 608} 609 610// CHECK-LABEL: test_truncf_tensor 611func.func @test_truncf_tensor(%arg0 : tensor<8x8xf32>) -> tensor<8x8xbf16> { 612 %0 = arith.truncf %arg0 : tensor<8x8xf32> to tensor<8x8xbf16> 613 return %0 : tensor<8x8xbf16> 614} 615 616// CHECK-LABEL: test_truncf_vector 617func.func @test_truncf_vector(%arg0 : vector<8xf32>) -> vector<8xbf16> { 618 %0 = arith.truncf %arg0 : vector<8xf32> to vector<8xbf16> 619 return %0 : vector<8xbf16> 620} 621 622// CHECK-LABEL: test_truncf_scalable_vector 623func.func @test_truncf_scalable_vector(%arg0 : vector<[8]xf32>) -> vector<[8]xbf16> { 624 %0 = arith.truncf %arg0 : vector<[8]xf32> to vector<[8]xbf16> 625 return %0 : vector<[8]xbf16> 626} 627 628// CHECK-LABEL: test_uitofp 629func.func @test_uitofp(%arg0 : i32) -> f32 { 630 %0 = arith.uitofp %arg0 : i32 to f32 631 return %0 : f32 632} 633 634// CHECK-LABEL: test_uitofp_tensor 635func.func @test_uitofp_tensor(%arg0 : tensor<8x8xi32>) -> tensor<8x8xf32> { 636 %0 = arith.uitofp %arg0 : tensor<8x8xi32> to tensor<8x8xf32> 637 return %0 : tensor<8x8xf32> 638} 639 640// CHECK-LABEL: test_uitofp_vector 641func.func @test_uitofp_vector(%arg0 : vector<8xi32>) -> vector<8xf32> { 642 %0 = arith.uitofp %arg0 : vector<8xi32> to vector<8xf32> 643 return %0 : vector<8xf32> 644} 645 646// CHECK-LABEL: test_uitofp_scalable_vector 647func.func @test_uitofp_scalable_vector(%arg0 : vector<[8]xi32>) -> vector<[8]xf32> { 648 %0 = arith.uitofp %arg0 : vector<[8]xi32> to vector<[8]xf32> 649 return %0 : vector<[8]xf32> 650} 651 652// CHECK-LABEL: test_sitofp 653func.func @test_sitofp(%arg0 : i16) -> f64 { 654 %0 = arith.sitofp %arg0 : i16 to f64 655 return %0 : f64 656} 657 658// CHECK-LABEL: test_sitofp_tensor 659func.func @test_sitofp_tensor(%arg0 : tensor<8x8xi16>) -> tensor<8x8xf64> { 660 %0 = arith.sitofp %arg0 : tensor<8x8xi16> to tensor<8x8xf64> 661 return %0 : tensor<8x8xf64> 662} 663 664// CHECK-LABEL: test_sitofp_vector 665func.func @test_sitofp_vector(%arg0 : vector<8xi16>) -> vector<8xf64> { 666 %0 = arith.sitofp %arg0 : vector<8xi16> to vector<8xf64> 667 return %0 : vector<8xf64> 668} 669 670// CHECK-LABEL: test_sitofp_scalable_vector 671func.func @test_sitofp_scalable_vector(%arg0 : vector<[8]xi16>) -> vector<[8]xf64> { 672 %0 = arith.sitofp %arg0 : vector<[8]xi16> to vector<[8]xf64> 673 return %0 : vector<[8]xf64> 674} 675 676// CHECK-LABEL: test_fptoui 677func.func @test_fptoui(%arg0 : bf16) -> i8 { 678 %0 = arith.fptoui %arg0 : bf16 to i8 679 return %0 : i8 680} 681 682// CHECK-LABEL: test_fptoui_tensor 683func.func @test_fptoui_tensor(%arg0 : tensor<8x8xbf16>) -> tensor<8x8xi8> { 684 %0 = arith.fptoui %arg0 : tensor<8x8xbf16> to tensor<8x8xi8> 685 return %0 : tensor<8x8xi8> 686} 687 688// CHECK-LABEL: test_fptoui_vector 689func.func @test_fptoui_vector(%arg0 : vector<8xbf16>) -> vector<8xi8> { 690 %0 = arith.fptoui %arg0 : vector<8xbf16> to vector<8xi8> 691 return %0 : vector<8xi8> 692} 693 694// CHECK-LABEL: test_fptoui_scalable_vector 695func.func @test_fptoui_scalable_vector(%arg0 : vector<[8]xbf16>) -> vector<[8]xi8> { 696 %0 = arith.fptoui %arg0 : vector<[8]xbf16> to vector<[8]xi8> 697 return %0 : vector<[8]xi8> 698} 699 700// CHECK-LABEL: test_fptosi 701func.func @test_fptosi(%arg0 : f64) -> i64 { 702 %0 = arith.fptosi %arg0 : f64 to i64 703 return %0 : i64 704} 705 706// CHECK-LABEL: test_fptosi_tensor 707func.func @test_fptosi_tensor(%arg0 : tensor<8x8xf64>) -> tensor<8x8xi64> { 708 %0 = arith.fptosi %arg0 : tensor<8x8xf64> to tensor<8x8xi64> 709 return %0 : tensor<8x8xi64> 710} 711 712// CHECK-LABEL: test_fptosi_vector 713func.func @test_fptosi_vector(%arg0 : vector<8xf64>) -> vector<8xi64> { 714 %0 = arith.fptosi %arg0 : vector<8xf64> to vector<8xi64> 715 return %0 : vector<8xi64> 716} 717 718// CHECK-LABEL: test_fptosi_scalable_vector 719func.func @test_fptosi_scalable_vector(%arg0 : vector<[8]xf64>) -> vector<[8]xi64> { 720 %0 = arith.fptosi %arg0 : vector<[8]xf64> to vector<[8]xi64> 721 return %0 : vector<[8]xi64> 722} 723 724// CHECK-LABEL: test_index_cast0 725func.func @test_index_cast0(%arg0 : i32) -> index { 726 %0 = arith.index_cast %arg0 : i32 to index 727 return %0 : index 728} 729 730// CHECK-LABEL: test_index_cast_tensor0 731func.func @test_index_cast_tensor0(%arg0 : tensor<8x8xi32>) -> tensor<8x8xindex> { 732 %0 = arith.index_cast %arg0 : tensor<8x8xi32> to tensor<8x8xindex> 733 return %0 : tensor<8x8xindex> 734} 735 736// CHECK-LABEL: test_index_cast_vector0 737func.func @test_index_cast_vector0(%arg0 : vector<8xi32>) -> vector<8xindex> { 738 %0 = arith.index_cast %arg0 : vector<8xi32> to vector<8xindex> 739 return %0 : vector<8xindex> 740} 741 742// CHECK-LABEL: test_index_cast_scalable_vector0 743func.func @test_index_cast_scalable_vector0(%arg0 : vector<[8]xi32>) -> vector<[8]xindex> { 744 %0 = arith.index_cast %arg0 : vector<[8]xi32> to vector<[8]xindex> 745 return %0 : vector<[8]xindex> 746} 747 748// CHECK-LABEL: test_index_cast1 749func.func @test_index_cast1(%arg0 : index) -> i64 { 750 %0 = arith.index_cast %arg0 : index to i64 751 return %0 : i64 752} 753 754// CHECK-LABEL: test_index_cast_tensor1 755func.func @test_index_cast_tensor1(%arg0 : tensor<8x8xindex>) -> tensor<8x8xi64> { 756 %0 = arith.index_cast %arg0 : tensor<8x8xindex> to tensor<8x8xi64> 757 return %0 : tensor<8x8xi64> 758} 759 760// CHECK-LABEL: test_index_cast_vector1 761func.func @test_index_cast_vector1(%arg0 : vector<8xindex>) -> vector<8xi64> { 762 %0 = arith.index_cast %arg0 : vector<8xindex> to vector<8xi64> 763 return %0 : vector<8xi64> 764} 765 766// CHECK-LABEL: test_index_cast_scalable_vector1 767func.func @test_index_cast_scalable_vector1(%arg0 : vector<[8]xindex>) -> vector<[8]xi64> { 768 %0 = arith.index_cast %arg0 : vector<[8]xindex> to vector<[8]xi64> 769 return %0 : vector<[8]xi64> 770} 771 772// CHECK-LABEL: test_bitcast0 773func.func @test_bitcast0(%arg0 : i64) -> f64 { 774 %0 = arith.bitcast %arg0 : i64 to f64 775 return %0 : f64 776} 777 778// CHECK-LABEL: test_bitcast_tensor0 779func.func @test_bitcast_tensor0(%arg0 : tensor<8x8xi64>) -> tensor<8x8xf64> { 780 %0 = arith.bitcast %arg0 : tensor<8x8xi64> to tensor<8x8xf64> 781 return %0 : tensor<8x8xf64> 782} 783 784// CHECK-LABEL: test_bitcast_vector0 785func.func @test_bitcast_vector0(%arg0 : vector<8xi64>) -> vector<8xf64> { 786 %0 = arith.bitcast %arg0 : vector<8xi64> to vector<8xf64> 787 return %0 : vector<8xf64> 788} 789 790// CHECK-LABEL: test_bitcast_scalable_vector0 791func.func @test_bitcast_scalable_vector0(%arg0 : vector<[8]xi64>) -> vector<[8]xf64> { 792 %0 = arith.bitcast %arg0 : vector<[8]xi64> to vector<[8]xf64> 793 return %0 : vector<[8]xf64> 794} 795 796// CHECK-LABEL: test_bitcast1 797func.func @test_bitcast1(%arg0 : f32) -> i32 { 798 %0 = arith.bitcast %arg0 : f32 to i32 799 return %0 : i32 800} 801 802// CHECK-LABEL: test_bitcast_tensor1 803func.func @test_bitcast_tensor1(%arg0 : tensor<8x8xf32>) -> tensor<8x8xi32> { 804 %0 = arith.bitcast %arg0 : tensor<8x8xf32> to tensor<8x8xi32> 805 return %0 : tensor<8x8xi32> 806} 807 808// CHECK-LABEL: test_bitcast_vector1 809func.func @test_bitcast_vector1(%arg0 : vector<8xf32>) -> vector<8xi32> { 810 %0 = arith.bitcast %arg0 : vector<8xf32> to vector<8xi32> 811 return %0 : vector<8xi32> 812} 813 814// CHECK-LABEL: test_bitcast_scalable_vector1 815func.func @test_bitcast_scalable_vector1(%arg0 : vector<[8]xf32>) -> vector<[8]xi32> { 816 %0 = arith.bitcast %arg0 : vector<[8]xf32> to vector<[8]xi32> 817 return %0 : vector<[8]xi32> 818} 819 820// CHECK-LABEL: test_cmpi 821func.func @test_cmpi(%arg0 : i64, %arg1 : i64) -> i1 { 822 %0 = arith.cmpi ne, %arg0, %arg1 : i64 823 return %0 : i1 824} 825 826// CHECK-LABEL: test_cmpi_tensor 827func.func @test_cmpi_tensor(%arg0 : tensor<8x8xi64>, %arg1 : tensor<8x8xi64>) -> tensor<8x8xi1> { 828 %0 = arith.cmpi slt, %arg0, %arg1 : tensor<8x8xi64> 829 return %0 : tensor<8x8xi1> 830} 831 832// CHECK-LABEL: test_cmpi_vector 833func.func @test_cmpi_vector(%arg0 : vector<8xi64>, %arg1 : vector<8xi64>) -> vector<8xi1> { 834 %0 = arith.cmpi ult, %arg0, %arg1 : vector<8xi64> 835 return %0 : vector<8xi1> 836} 837 838// CHECK-LABEL: test_cmpi_scalable_vector 839func.func @test_cmpi_scalable_vector(%arg0 : vector<[8]xi64>, %arg1 : vector<[8]xi64>) -> vector<[8]xi1> { 840 %0 = arith.cmpi ult, %arg0, %arg1 : vector<[8]xi64> 841 return %0 : vector<[8]xi1> 842} 843 844// CHECK-LABEL: test_cmpi_vector_0d 845func.func @test_cmpi_vector_0d(%arg0 : vector<i64>, %arg1 : vector<i64>) -> vector<i1> { 846 %0 = arith.cmpi ult, %arg0, %arg1 : vector<i64> 847 return %0 : vector<i1> 848} 849 850// CHECK-LABEL: test_cmpf 851func.func @test_cmpf(%arg0 : f64, %arg1 : f64) -> i1 { 852 %0 = arith.cmpf oeq, %arg0, %arg1 : f64 853 return %0 : i1 854} 855 856// CHECK-LABEL: test_cmpf_tensor 857func.func @test_cmpf_tensor(%arg0 : tensor<8x8xf64>, %arg1 : tensor<8x8xf64>) -> tensor<8x8xi1> { 858 %0 = arith.cmpf olt, %arg0, %arg1 : tensor<8x8xf64> 859 return %0 : tensor<8x8xi1> 860} 861 862// CHECK-LABEL: test_cmpf_vector 863func.func @test_cmpf_vector(%arg0 : vector<8xf64>, %arg1 : vector<8xf64>) -> vector<8xi1> { 864 %0 = arith.cmpf ult, %arg0, %arg1 : vector<8xf64> 865 return %0 : vector<8xi1> 866} 867 868// CHECK-LABEL: test_cmpf_scalable_vector 869func.func @test_cmpf_scalable_vector(%arg0 : vector<[8]xf64>, %arg1 : vector<[8]xf64>) -> vector<[8]xi1> { 870 %0 = arith.cmpf ult, %arg0, %arg1 : vector<[8]xf64> 871 return %0 : vector<[8]xi1> 872} 873 874// CHECK-LABEL: test_index_cast 875func.func @test_index_cast(%arg0 : index) -> i64 { 876 %0 = arith.index_cast %arg0 : index to i64 877 return %0 : i64 878} 879 880// CHECK-LABEL: test_index_cast_tensor 881func.func @test_index_cast_tensor(%arg0 : tensor<index>) -> tensor<i64> { 882 %0 = arith.index_cast %arg0 : tensor<index> to tensor<i64> 883 return %0 : tensor<i64> 884} 885 886// CHECK-LABEL: test_index_cast_tensor_reverse 887func.func @test_index_cast_tensor_reverse(%arg0 : tensor<i64>) -> tensor<index> { 888 %0 = arith.index_cast %arg0 : tensor<i64> to tensor<index> 889 return %0 : tensor<index> 890} 891 892// CHECK-LABEL: func @bitcast( 893func.func @bitcast(%arg : f32) -> i32 { 894 %res = arith.bitcast %arg : f32 to i32 895 return %res : i32 896} 897 898// CHECK-LABEL: test_constant 899func.func @test_constant() -> () { 900 // CHECK: %c42_i32 = arith.constant 42 : i32 901 %0 = "arith.constant"(){value = 42 : i32} : () -> i32 902 903 // CHECK: %c42_i32_0 = arith.constant 42 : i32 904 %1 = arith.constant 42 : i32 905 906 // CHECK: %c43 = arith.constant {crazy = "func.foo"} 43 : index 907 %2 = arith.constant {crazy = "func.foo"} 43: index 908 909 // CHECK: %cst = arith.constant 4.300000e+01 : bf16 910 %3 = arith.constant 43.0 : bf16 911 912 // CHECK: %cst_1 = arith.constant dense<0> : vector<4xi32> 913 %4 = arith.constant dense<0> : vector<4 x i32> 914 915 // CHECK: %cst_2 = arith.constant dense<0> : tensor<42xi32> 916 %5 = arith.constant dense<0> : tensor<42 x i32> 917 918 // CHECK: %cst_3 = arith.constant dense<0> : vector<42xi32> 919 %6 = arith.constant dense<0> : vector<42 x i32> 920 921 // CHECK: %true = arith.constant true 922 %7 = arith.constant true 923 924 // CHECK: %false = arith.constant false 925 %8 = arith.constant false 926 927 // CHECK: %c-1_i128 = arith.constant -1 : i128 928 %9 = arith.constant 340282366920938463463374607431768211455 : i128 929 930 // CHECK: %c85070591730234615865843651857942052864_i128 = arith.constant 85070591730234615865843651857942052864 : i128 931 %10 = arith.constant 85070591730234615865843651857942052864 : i128 932 933 return 934} 935 936// CHECK-LABEL: func @maximum 937func.func @maximum(%v1: vector<4xf32>, %v2: vector<4xf32>, 938 %sv1: vector<[4]xf32>, %sv2: vector<[4]xf32>, 939 %f1: f32, %f2: f32, 940 %i1: i32, %i2: i32) { 941 %max_vector = arith.maxf %v1, %v2 : vector<4xf32> 942 %max_scalable_vector = arith.maxf %sv1, %sv2 : vector<[4]xf32> 943 %max_float = arith.maxf %f1, %f2 : f32 944 %max_signed = arith.maxsi %i1, %i2 : i32 945 %max_unsigned = arith.maxui %i1, %i2 : i32 946 return 947} 948 949// CHECK-LABEL: func @minimum 950func.func @minimum(%v1: vector<4xf32>, %v2: vector<4xf32>, 951 %sv1: vector<[4]xf32>, %sv2: vector<[4]xf32>, 952 %f1: f32, %f2: f32, 953 %i1: i32, %i2: i32) { 954 %min_vector = arith.minf %v1, %v2 : vector<4xf32> 955 %min_scalable_vector = arith.minf %sv1, %sv2 : vector<[4]xf32> 956 %min_float = arith.minf %f1, %f2 : f32 957 %min_signed = arith.minsi %i1, %i2 : i32 958 %min_unsigned = arith.minui %i1, %i2 : i32 959 return 960} 961