Page MenuHomePhabricator

[PPC] add extract significand/ extract exponent/test data class for vector float and vector double -- clang portion
ClosedPublic

Authored by sfertile on Nov 2 2016, 9:24 PM.

Details

Summary

Add support in altivec.h for the following functions, as well as matching builtins:
vector unsigned long long vec_extract_exp (vector double);
vector unsigned int vec_extract_exp (vector float);
vector unsigned long long vec_extract_sig (vector double)
vector unsigned int vec_extract_sig (vector float)

Add builtins mapping to the vector float/vector double 'test data class' instructions, as well as a function like macro that will expand to the equivalent of either:
vector bool int vec_test_data_class (vector float, const int);
vector bool long long vec_test_data_class (vector double, const int);

as well as defines for all the masks used as the second argument to vec_test_data_class.

Diff Detail

Repository
rL LLVM

Event Timeline

sfertile updated this revision to Diff 76812.Nov 2 2016, 9:24 PM
sfertile retitled this revision from to [PPC} add extract significand/ extract exponent/test data class for vector float and vector double -- clang portion.
sfertile updated this object.
sfertile set the repository for this revision to rL LLVM.
sfertile added subscribers: cfe-commits, echristo.
nemanjai edited edge metadata.Nov 3 2016, 1:34 AM

LGTM but I'll let @kbarton have a look and provide the final approval.

lib/Headers/altivec.h
15629

I don't know what happens if the type of the first argument is neither of the two types, but I think we should verify that something sane happens. Namely, some sort of overload resolution error message.

sfertile added inline comments.Nov 3 2016, 6:02 AM
lib/Headers/altivec.h
15629

We do get a decent error diagnostic:

test_data_class_bad.c:9:26: error: controlling expression type '__vector unsigned char' (vector of 16 'unsigned char' values) not compatible with any generic association type

vector bool int res_f = vec_test_data_class(vfa, 4);
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~

/home/sfertile/LLVM/publish/assert/bin/../lib/clang/4.0.0/include/altivec.h:15629:18: note: expanded from macro 'vec_test_data_class'

_Generic((__a),                                                    \
         ^~~~~

1 error generated.

kbarton accepted this revision.Nov 7 2016, 7:48 PM
kbarton edited edge metadata.

LGTM

This revision is now accepted and ready to land.Nov 7 2016, 7:48 PM
jtony edited edge metadata.Nov 7 2016, 8:00 PM

A very small nit, the bracket does not match in the title, do you mean [PPC] instead of [PPC}?

sfertile retitled this revision from [PPC} add extract significand/ extract exponent/test data class for vector float and vector double -- clang portion to [PPC] add extract significand/ extract exponent/test data class for vector float and vector double -- clang portion.Nov 10 2016, 6:21 PM
sfertile edited edge metadata.