X86Vector: relax checks in rsqrt's integration test
authorEmilio Cota <ecg@google.com>
Fri, 8 Oct 2021 20:28:04 +0000 (13:28 -0700)
committerAart Bik <ajcbik@google.com>
Fri, 8 Oct 2021 20:59:18 +0000 (13:59 -0700)
Instead of hard-coding results for both Intel and AMD, let's relax
the checks to simplify the test while supporting both implementations.
Note that:
- If a new hardware implementation comes up in the future, it is likely
  to pass the relaxed tests, i.e. no future maintenance burden for us.
- If something terribly wrong happens (e.g. instead of rsqrt we
  execute 1/sqrt), the tests will probably catch it, since the relaxed
  tests expect low precision (e.g. rsqrt(1) != 1.0).

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D111461

mlir/test/Integration/Dialect/Vector/CPU/X86Vector/test-rsqrt.mlir

index 37cded3f4b574a93721a053c4dc47de14c304ae5..03248e4114b66a86625cfbef68af5f18e9cfe48b 100644 (file)
@@ -9,7 +9,7 @@ func @entry() -> i32 {
   %v = std.constant dense<[0.125, 0.25, 0.5, 1.0, 2.0, 4.0, 8.0, 16.0]> : vector<8xf32>
   %r = x86vector.avx.rsqrt %v : vector<8xf32>
   // `rsqrt` may produce slightly different results on Intel and AMD machines: accept both results here.
-  // CHECK: {{( 2.82764, 1.99951, 1.41382, 0.999756, 0.706909, 0.499878, 0.353455, 0.249939 | 2.82812, 1.99976, 1.41406, 0.999878, 0.707031, 0.499939, 0.353516, 0.249969 )}}
+  // 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]* )}}
   vector.print %r : vector<8xf32>
 
   return %i0 : i32