This is an archive of the discontinued LLVM Phabricator instance.

TLI: Add addVectorizableFunctionsFromVecLib.
ClosedPublic

Authored by mzolotukhin on Mar 6 2015, 5:22 PM.

Details

Summary

Add a function addVectorizableFunctionsFromVecLib to TLI. It is a wrapper for
addVectorizableFunctions and uses preset tables for known vector-libraries.

Diff Detail

Event Timeline

mzolotukhin updated this revision to Diff 21412.Mar 6 2015, 5:22 PM
mzolotukhin retitled this revision from to TLI: Add addVectorizableFunctionsFromVecLib..
mzolotukhin updated this object.
mzolotukhin edited the test plan for this revision. (Show Details)
mzolotukhin added a subscriber: Unknown Object (MLST).
hfinkel added inline comments.Mar 8 2015, 2:43 PM
include/llvm/Analysis/TargetLibraryInfo.h
74

Please add a comment here explaining what this general feature is, and that it can be used via the addVectorizableFunctionsFromVecLib function.

134

Please don't put this implementation in the header. It will become large quickly.

hfinkel edited edge metadata.Mar 8 2015, 2:47 PM

Also, please add a command line option that can call addVectorizableFunctionsFromVecLib from the constructor so that we can test this via opt. We'll need this so that you can write regression tests for all of the Accelerate functions being added.

mzolotukhin updated this revision to Diff 21533.Mar 9 2015, 5:39 PM
mzolotukhin edited edge metadata.

Address Hal's remarks:

  • Move addVectorizableFunctionsFromVecLib from header file.
  • Add CL option for specifying vector library.
  • Add comment beforei 'enum VectorLibrary'.
hfinkel added inline comments.Mar 9 2015, 5:44 PM
include/llvm/Analysis/TargetLibraryInfo.h
20

This should be included only in the .cpp file.

326

This does not belong here; just have it in the .cpp file.

hfinkel added inline comments.Mar 9 2015, 5:46 PM
lib/Analysis/TargetLibraryInfo.cpp
19

Implied by the other comments, but this should be static.

mzolotukhin updated this revision to Diff 21539.Mar 9 2015, 6:06 PM
  • Make ClVectorLibrary static.

LGTM, pending the addition of regression tests.

  • Add regression tests for veclib calls.
  • Fix regex in the regression tests.

This test depends on the X86 code model, and needs to be in the test/Transforms/LoopVectorize/X86 directory.

test/Transforms/LoopVectorize/veclib-calls.ll
7 ↗(On Diff #21671)

Please, here and below, check for the 'v' in the name, so we make sure that we've actually produced a call to the vector function, not an incorrect call to the scalar function with vector types somehow.

Also, please add tests where you convert the intrinsics into function calls. Please add a negative test where the nobuiltin attribute is present.

  • Update tests according to Hal's remarks.
hfinkel accepted this revision.Mar 16 2015, 10:44 PM
hfinkel edited edge metadata.

LGTM.

This revision is now accepted and ready to land.Mar 16 2015, 10:44 PM
mzolotukhin closed this revision.Mar 17 2015, 12:56 PM

Hal, thank you for the reviews!

The patch was committed in r232531.