mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
* Optimize vector load / store. Fixes to alignment. Support typedef with `@simd` and `@align` #2543. Update vector ABI #2542 * Fix alignment issue with indirect arguments.
45 lines
839 B
Plaintext
45 lines
839 B
Plaintext
// #target: linux-x64
|
|
// #opt: --x86cpu=avx512
|
|
module foo;
|
|
|
|
struct StringRef
|
|
{
|
|
char* str;
|
|
usz size;
|
|
}
|
|
|
|
char gc;
|
|
extern fn void take_stringref(StringRef s);
|
|
fn void callit()
|
|
{
|
|
StringRef s = { "asdf" , 4};
|
|
take_stringref(s);
|
|
}
|
|
|
|
typedef Mm256 = float[<8>] @simd;
|
|
typedef Mm512 = float[<16>] @simd;
|
|
extern fn Mm256 get_m256();
|
|
extern fn void take_m256(Mm256 x);
|
|
extern fn Mm512 get_m512();
|
|
extern fn void take_m512(Mm512 x);
|
|
|
|
fn void use_vectors()
|
|
{
|
|
Mm256 v1 = get_m256();
|
|
take_m256(v1);
|
|
Mm512 v2 = get_m512();
|
|
take_m512(v2);
|
|
}
|
|
|
|
/* #expect: foo.ll
|
|
|
|
declare void @take_stringref(ptr, i64) #0
|
|
call void @take_stringref(ptr %lo, i64 %hi)
|
|
|
|
define void @foo.use_vectors() #0 {
|
|
entry:
|
|
%0 = call <8 x float> @get_m256()
|
|
call void @take_m256(<8 x float> %1)
|
|
%2 = call <16 x float> @get_m512()
|
|
call void @take_m512(<16 x float> %3)
|