[llvm-dev] One element vectors versus scalars

Hal Finkel via llvm-dev
Tue, 10 Nov 2015 12:34:01 -0000

----- 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