[PATCH] D34950: [compiler-rt][builtins] XFAIL tests involving complex divide for ARM hard float targets

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 3 08:29:45 PDT 2017


peter.smith created this revision.
Herald added subscribers: kristof.beyls, dberris, aemerson.

The check-builtins is failing 3 tests on a v7 armhf target:

- divtc3_test.c
- divdc3_test.c
- divxc3_test.c
- mulsc3_test.c (already marked UNSUPPORTED, but for the same underlying cause)

Clang is always using the soft float calling convention for implicit calls to the complex divide functions, such as in the expression used to detect whether test results are within a reasonable tolerance:

  if (cabsl((r - z)/r) > 1.e-6) ...

This gives an incorrect result for the hard float calling convention as the builtin function in compiler-rt (or libgcc) is expecting hard float. I think that this is clang/llvm https://bugs.llvm.org/show_bug.cgi?id=28164 . Given that the compiler-rt builtin is working correctly and the problem is in clang/llvm, I think the tests should be marked as XFAIL.

A possible alternative is to not use the divide operator in (r-z)/r and instead call out to a function that evaluates the division without calling a complex divide builtin. I've prototyped this and the tests all pass, but such an implementation wouldn't have caught the problem in 28164.

As an aside the divsc3_test doesn't use the expression above to check the result of __divsc3, instead it uses if (r != z), which I guess is a bit inconsistent with the other complex divide routines but doesn't seem to be causing any problems right now.


https://reviews.llvm.org/D34950

Files:
  test/builtins/Unit/divdc3_test.c
  test/builtins/Unit/divtc3_test.c
  test/builtins/Unit/divxc3_test.c
  test/builtins/Unit/mulsc3_test.c


Index: test/builtins/Unit/mulsc3_test.c
===================================================================
--- test/builtins/Unit/mulsc3_test.c
+++ test/builtins/Unit/mulsc3_test.c
@@ -1,6 +1,6 @@
 // RUN: %clang_builtins %s %librt -lm -o %t && %run %t
-// UNSUPPORTED: armhf-target-arch
-// see pr 32475.
+// XFAIL: armhf-target-arch
+// see pr 28164.
 //===-- mulsc3_test.c - Test __mulsc3 -------------------------------------===//
 //
 //                     The LLVM Compiler Infrastructure
Index: test/builtins/Unit/divxc3_test.c
===================================================================
--- test/builtins/Unit/divxc3_test.c
+++ test/builtins/Unit/divxc3_test.c
@@ -1,4 +1,6 @@
 // RUN: %clang_builtins %s %librt -lm -o %t && %run %t
+// XFAIL: armhf-target-arch
+// see pr 28164.
 //===-- divxc3_test.c - Test __divxc3 -------------------------------------===//
 //
 //                     The LLVM Compiler Infrastructure
Index: test/builtins/Unit/divtc3_test.c
===================================================================
--- test/builtins/Unit/divtc3_test.c
+++ test/builtins/Unit/divtc3_test.c
@@ -1,4 +1,6 @@
 // RUN: %clang_builtins %s %librt -lm -o %t && %run %t
+// XFAIL: armhf-target-arch
+// see pr 28164.
 //===-- divtc3_test.c - Test __divtc3 -------------------------------------===//
 //
 //                     The LLVM Compiler Infrastructure
Index: test/builtins/Unit/divdc3_test.c
===================================================================
--- test/builtins/Unit/divdc3_test.c
+++ test/builtins/Unit/divdc3_test.c
@@ -1,4 +1,6 @@
 // RUN: %clang_builtins %s %librt -o %t && %run %t
+// XFAIL: armhf-target-arch
+// see pr 28164.
 //===-- divdc3_test.c - Test __divdc3 -------------------------------------===//
 //
 //                     The LLVM Compiler Infrastructure


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34950.105079.patch
Type: text/x-patch
Size: 1825 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170703/fcb5b7f9/attachment.bin>


More information about the llvm-commits mailing list