This is an archive of the discontinued LLVM Phabricator instance.

[Power9] vector load/store with length - clang portion
ClosedPublic

Authored by syzaara on Nov 4 2016, 12:16 PM.

Details

Summary

Add builtin functions for prototypes:

vector signed char vec_xl_len (signed char *, size_t);
vector unsigned char vec_xl_len (unsigned char *, size_t);
vector signed int vec_xl_len (signed int *, size_t);
vector unsigned int vec_xl_len (unsigned int *, size_t);
vector signed int128 vec_xl_len (signed int128 *, size_t);
vector unsigned int128 vec_xl_len (unsigned int128 *, size_t);
vector signed long long vec_xl_len (signed long long *, size_t);
vector unsigned long long vec_xl_len (unsigned long long *, size_t);
vector signed short vec_xl_len (signed short *, size_t);
vector unsigned short vec_xl_len (unsigned short *, size_t);
vector double vec_xl_len (double *, size_t);
vector float vec_xl_len (float *, size_t);

vector unsigned char vec_xl_len_r (unsigned char *, size_t);

void vec_xst_len (vector signed char, signed char *, size_t);
void vec_xst_len (vector unsigned char, unsigned char *, size_t);
void vec_xst_len (vector signed int, signed int *, size_t);
void vec_xst_len (vector unsigned int, unsigned int *, size_t);
void vec_xst_len (vector signed int128, signed int128 *, size_t);
void vec_xst_len (vector unsigned int128, unsigned int128 *, size_t);
void vec_xst_len (vector signed long long, signed long long *, size_t);
void vec_xst_len (vector unsigned long long, unsigned long long *, size_t);
void vec_xst_len (vector signed short, signed short *, size_t);
void vec_xst_len (vector unsigned short, unsigned short *, size_t);
void vec_xst_len (vector double, double *, size_t);
void vec_xst_len (vector float, float *, size_t);

void vec_xst_len_r (vector unsigned char, unsigned char *, size_t);

Diff Detail

Event Timeline

syzaara updated this revision to Diff 76927.Nov 4 2016, 12:16 PM
syzaara retitled this revision from to [Power9] vector load/store with length - clang portion.
syzaara updated this object.
syzaara added subscribers: echristo, cfe-commits.
nemanjai edited edge metadata.Nov 4 2016, 3:52 PM

Zaara, prior to committing this patch, can you write a test case that will actually use these builtins in an executable test case and confirm the results. We'll then run it on the simulator to ensure functional correctness.

lib/Headers/altivec.h
38

I think size_t is only used for the load/store with length which are Power9 specific. I think we should guard this include with that macro as well to avoid changing behaviour of existing code inadvertently.

2641

This is undefined behaviour in 32-bit mode. Please guard for 64-bit mode unless this is already in such a block.

test/CodeGen/builtins-ppc-p9vector.c
29

I don't think we need to initialize these. And if we keep the initialization, let's use the same formatting (i.e. left curly brace, space, list of initializers, space, right curly brace).

35

Please select a naming scheme that does not lead to such unfortunate variable names.

nemanjai added inline comments.Nov 8 2016, 5:51 AM
include/clang/Basic/BuiltinsPPC.def
304

Also, in addition to guarding for 64-bit, these should be defined to take the length parameter as a 64-bit integer.

kbarton accepted this revision.Nov 8 2016, 10:36 AM
kbarton edited edge metadata.

With the suggestions above, this LGTM.

This revision is now accepted and ready to land.Nov 8 2016, 10:36 AM
syzaara updated this revision to Diff 77618.EditedNov 11 2016, 7:59 AM
syzaara edited edge metadata.

Guard for 64-bit mode and update to use unsigned long long rather than unsigned int for length parameter.

syzaara closed this revision.Nov 21 2016, 11:55 AM