Martin J. O'Riordan via llvm-dev
2015-Nov-10 12:00 UTC
[llvm-dev] One element vectors versus scalars
I am curious as to why LLVM has explicit support for 1 element vectors, for example 'v1i32'. Are there some contexts where handling a value as a 1 element vector can yield better code quality than the corresponding scalar 'i32'? Thanks, MartinO -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151110/8ede523c/attachment.html>
Hal Finkel via llvm-dev
2015-Nov-10 12:34 UTC
[llvm-dev] One element vectors versus scalars
----- Original Message -----> From: "Martin J. O'Riordan via llvm-dev" <llvm-dev at lists.llvm.org> > To: "LLVM Developers" <llvm-dev at lists.llvm.org> > Sent: Tuesday, November 10, 2015 6:00:27 AM > Subject: [llvm-dev] One element vectors versus scalars > > I am curious as to why LLVM has explicit support for 1 element > vectors, for example ‘ v1i32 ’. Are there some contexts where > handling a value as a 1 element vector can yield better code quality > than the corresponding scalar ‘ i32 ’? >Hi Martin, No, but I see two reasons we support 1-element vectors: 1. Having 1-element vectors makes a lot of the SDAG legalization code simpler, allowing us to separate the code that splits vector types from the code that transforms 1-element vectors into scalars. 2. On some platforms, there are ABI differences between the two types. (e.g. i128 and <1 x i128> are passed in different registers across function-call boundaries). -Hal> > > Thanks, > > > > MartinO > > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-- Hal Finkel Assistant Computational Scientist Leadership Computing Facility Argonne National Laboratory
Martin J. O'Riordan via llvm-dev
2015-Nov-10 12:53 UTC
[llvm-dev] One element vectors versus scalars
Thanks Hal. In our case the ABI issue doesn't arise, but I'll have to think about the legalization to see if maybe we could write our type definitions better. MartinO -----Original Message----- From: Hal Finkel [mailto:hfinkel at anl.gov] Sent: 10 November 2015 12:34 ----- Original Message -----> From: "Martin J. O'Riordan via llvm-dev" <llvm-dev at lists.llvm.org> > > I am curious as to why LLVM has explicit support for 1 element > vectors, for example ‘ v1i32 ’. Are there some contexts where handling > a value as a 1 element vector can yield better code quality than the > corresponding scalar ‘ i32 ’?Hi Martin, No, but I see two reasons we support 1-element vectors: 1. Having 1-element vectors makes a lot of the SDAG legalization code simpler, allowing us to separate the code that splits vector types from the code that transforms 1-element vectors into scalars. 2. On some platforms, there are ABI differences between the two types. (e.g. i128 and <1 x i128> are passed in different registers across function-call boundaries). -Hal
Reasonably Related Threads
- [RFC][SDAG] Convert build_vector of ops on extractelts into ops on input vectors
- [RFC][SDAG] Convert build_vector of ops on extractelts into ops on input vectors
- [RFC][SDAG] Convert build_vector of ops on extractelts into ops on input vectors
- Heap Exhaustion during 'DAGCombiner::Run'
- Tablegen PAT limitation?