xref: /llvm-project/mlir/test/Integration/Dialect/Vector/CPU/X86Vector/rsqrt.mlir (revision 435114f9fe2139bec770e5a95799f4eab20639e7)
1// RUN: mlir-opt %s -convert-vector-to-scf -convert-scf-to-cf -convert-vector-to-llvm="enable-x86vector" -convert-func-to-llvm -reconcile-unrealized-casts  | \
2// RUN: mlir-translate --mlir-to-llvmir | \
3// RUN: %lli --entry-function=entry --mattr="avx" --dlopen=%mlir_c_runner_utils | \
4// RUN: FileCheck %s
5
6func.func @entry() -> i32 {
7  %i0 = arith.constant 0 : i32
8
9  %v = arith.constant dense<[0.125, 0.25, 0.5, 1.0, 2.0, 4.0, 8.0, 16.0]> : vector<8xf32>
10  %r = x86vector.avx.rsqrt %v : vector<8xf32>
11  // `rsqrt` may produce slightly different results on Intel and AMD machines: accept both results here.
12  // CHECK: {{( 2.82[0-9]*, 1.99[0-9]*, 1.41[0-9]*, 0.99[0-9]*, 0.70[0-9]*, 0.49[0-9]*, 0.35[0-9]*, 0.24[0-9]* )}}
13  vector.print %r : vector<8xf32>
14
15  return %i0 : i32
16}
17