49 lines · plain
1// REQUIRES: arm-emulator2 3// DEFINE: %{entry_point} = main4// DEFINE: %{compile} = mlir-opt %s -test-lower-to-llvm5// DEFINE: %{run} = %mcr_aarch64_cmd -march=aarch64 -mattr=+sve \6// DEFINE: -e %{entry_point} -entry-point-result=void \7// DEFINE: -shared-libs=%native_mlir_runner_utils,%native_mlir_c_runner_utils,%native_mlir_arm_runner_utils8 9// RUN: %{compile} | %{run} | FileCheck %s10 11func.func @checkVScale() attributes {no_inline} {12 %vscale = vector.vscale13 vector.print str "vscale = "14 vector.print %vscale : index15 return16}17 18func.func @setAndCheckVL(%bits: i32) {19 func.call @setArmVLBits(%bits) : (i32) -> ()20 func.call @checkVScale() : () -> ()21 return22}23 24func.func @main() {25 // CHECK: vscale = 126 %c128 = arith.constant 128 : i3227 func.call @setAndCheckVL(%c128) : (i32) -> ()28 29 // CHECK: vscale = 230 %c256 = arith.constant 256 : i3231 func.call @setAndCheckVL(%c256) : (i32) -> ()32 33 // CHECK: vscale = 434 %c512 = arith.constant 512 : i3235 func.call @setAndCheckVL(%c512) : (i32) -> ()36 37 // CHECK: vscale = 838 %c1024 = arith.constant 1024 : i3239 func.call @setAndCheckVL(%c1024) : (i32) -> ()40 41 // CHECK: vscale = 1642 %c2048 = arith.constant 2048 : i3243 func.call @setAndCheckVL(%c2048) : (i32) -> ()44 45 return46}47 48func.func private @setArmVLBits(%bits : i32)49