This is an archive of the discontinued LLVM Phabricator instance.

[compiler-rt][builtins][PowerPC] Enable builtins tests on PowerPC 64 bit LE
ClosedPublic

Authored by amyk on Nov 12 2018, 2:12 PM.

Details

Summary

This patch aims to enable the tests for the builtin functions (that currently already exist for PowerPC within compiler-rt) for PowerPC 64bit LE (ppc64le). Previously when regression tests are run, these tests would be reported as UNSUPPORTED, perhaps due to the incorrect target architecture.

The following changes were made in this patch:

  • Updating the REQUIRES line for each test, to enable testing on ppc64le
  • Adding %librt in the RUN line, to link against compiler-rt when running the tests

With this patch, seven tests are run, but two are failures. The failures are from floatditf.c and floatunditf.c respectively, due to the use of COMPILER_RT_ABI in these two test files. This patch will require input on whether or not COMPILER_RT_ABI should or should not be included within these tests.

Diff Detail

Event Timeline

amyk created this revision.Nov 12 2018, 2:12 PM
amyk added a comment.Nov 12 2018, 2:13 PM

@weimingz I noticed that you have previously added the REQUIRES and RUN lines to these tests, and have added you as a reviewer in regards to me updating the lines you have previously added.

amyk added a comment.Nov 12 2018, 2:15 PM

@dschuff Is it possible to elaborate on why COMPILER_RT_ABI is needed in floatditf.c and floatunditf.c, and/of if it still needed?

dschuff added a comment.EditedNov 12 2018, 3:20 PM

Conceptually, COMPILER_RT_ABI is the calling convention used by all compiler-rt functions. It is explicitly named and used because it may be different from the default calling convention on some targets. In practice I believe it only affects ARM, where the calling convention uses ARM's soft-float ABI (where IIRC floats are passed in integer registers) even on targets that use the hard-float ABI by default. The compiler knows the calling conventions and emits the right code when it emits the libcalls, and the ABI declaration on the implementations causes the right calling convention to be used there. The unusual thing about the tests is that they locally declare the compiler-rt functions explicitly. So this declaration has to match the implementation. It may not matter for PPC but my recommendation would be "just use it everywhere in compiler-rt" for simplicity.

Conceptually, COMPILER_RT_ABI is the calling convention used by all compiler-rt functions. It is explicitly named and used because it may be different from the default calling convention on some targets. In practice I believe it only affects ARM, where the calling convention uses ARM's soft-float ABI (where IIRC floats are passed in integer registers) even on targets that use the hard-float ABI by default. The compiler knows the calling conventions and emits the right code when it emits the libcalls, and the ABI declaration on the implementations causes the right calling convention to be used there. The unusual thing about the tests is that they locally declare the compiler-rt functions explicitly. So this declaration has to match the implementation. It may not matter for PPC but my recommendation would be "just use it everywhere in compiler-rt" for simplicity.

Fair enough, but shouldn't the header used for the tests #include "lib/builtins/int_lib.h" in order to have the macro def available?

amyk added a comment.Nov 26 2018, 6:43 AM

Are there any more comments regarding on if all of these tests should contain COMPILER_RT_ABI (and the relevant include statement) if all compiler-rt functions should have them anyway?

nemanjai accepted this revision.Nov 30 2018, 8:26 AM

Let's add the #include for the file that defines the pertinent macros and push this change so we start running the test cases on PPC64LE.

This revision is now accepted and ready to land.Nov 30 2018, 8:26 AM
This revision was automatically updated to reflect the committed changes.