mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
142 lines
3.5 KiB
C
142 lines
3.5 KiB
C
// #target: macos-x64
|
|
// #opt: --x86vec=avx
|
|
module test;
|
|
|
|
define Mm256 = float[<8>];
|
|
struct St256 {
|
|
Mm256 m;
|
|
}
|
|
|
|
St256 x38;
|
|
Mm256 x37;
|
|
|
|
extern fn void f38(St256 x);
|
|
extern fn void f37(Mm256 x);
|
|
fn void f39() { f38(x38); f37(x37); }
|
|
|
|
// The two next tests make sure that the struct below is passed
|
|
// in the same way regardless of avx being used
|
|
|
|
// CHECK: declare void @func40(%struct.t128* byval(%struct.t128) align 16)
|
|
|
|
define Mm128 = float[<4>];
|
|
struct Two128 {
|
|
Mm128 m;
|
|
Mm128 n;
|
|
}
|
|
|
|
extern fn void func40(Two128 s);
|
|
fn void func41(Two128 s) {
|
|
func40(s);
|
|
}
|
|
|
|
struct Atwo128 {
|
|
Mm128[2] array;
|
|
}
|
|
|
|
struct Sa {
|
|
Atwo128 x;
|
|
}
|
|
|
|
extern fn void func42(Sa s);
|
|
fn void func43(Sa s) {
|
|
func42(s);
|
|
}
|
|
|
|
|
|
define Vec46 = float[<2>];
|
|
extern fn void f46(Vec46,Vec46,Vec46,Vec46,Vec46,Vec46,Vec46,Vec46,Vec46,Vec46);
|
|
fn void test46() { Vec46 x = {1,2}; f46(x,x,x,x,x,x,x,x,x,x); }
|
|
|
|
struct Vec47 { uint a; }
|
|
extern fn void f47(int,int,int,int,int,int,Vec47);
|
|
fn void test47(int a, Vec47 b) { f47(a, a, a, a, a, a, b); }
|
|
|
|
fn void test49_helper(double, ...);
|
|
fn void test49(double d, double e) { test49_helper(d, e); }
|
|
|
|
struct Complex { double i; double c; }
|
|
extern fn void test52_helper(int, ...);
|
|
Mm256 x52;
|
|
fn void test52() {
|
|
test52_helper(0, x52, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, Complex { 0, 1.0 });
|
|
}
|
|
|
|
extern fn void test54_helper(Mm256, ...);
|
|
Mm256 x54;
|
|
fn void test54() {
|
|
test54_helper(x54, x54, 1.0, 1.0, 1.0, 1.0, 1.0, Complex { 0, 1.0 });
|
|
test54_helper(x54, x54, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, Complex { 0, 1.0 });
|
|
}
|
|
|
|
define Mm512 = float[<16>];
|
|
struct St512 {
|
|
Mm512 m;
|
|
}
|
|
|
|
St512 x55;
|
|
Mm512 x56;
|
|
|
|
extern fn void f55(St512 x);
|
|
|
|
extern fn void f56(Mm512 x);
|
|
fn void f57() { f55(x55); f56(x56); }
|
|
|
|
struct Two256 {
|
|
Mm256 m;
|
|
Mm256 n;
|
|
}
|
|
|
|
extern fn void f58(Two256 s);
|
|
fn void f59(Two256 s) {
|
|
f58(s);
|
|
}
|
|
|
|
struct Atwo256 {
|
|
Mm256[2] array;
|
|
}
|
|
|
|
struct SAtwo256 {
|
|
Atwo256 x;
|
|
}
|
|
|
|
extern fn void f60(SAtwo256 s);
|
|
fn void f61(SAtwo256 s) {
|
|
f60(s);
|
|
}
|
|
|
|
|
|
/* #expect: test.ll
|
|
|
|
declare void @f38(<8 x float>)
|
|
declare void @f37(<8 x float>)
|
|
|
|
declare void @func40(ptr byval(%Two128) align 16)
|
|
define void @test_func41(ptr byval(%Two128) align 16 %0)
|
|
|
|
declare void @func42(ptr byval(%Sa) align 16)
|
|
define void @test_func43(ptr byval(%Sa) align 16 %0)
|
|
|
|
declare void @f46(double, double, double, double, double, double, double, double, ptr byval(<2 x float>) align 8, ptr byval(<2 x float>) align 8) #0
|
|
declare void @f47(i32, i32, i32, i32, i32, i32, i32)
|
|
|
|
declare void @test_test49_helper(double, ...)
|
|
define void @test_test49(double %0, double %1)
|
|
entry:
|
|
call void (double, ...) @test_test49_helper(double %0, double %1)
|
|
ret void
|
|
|
|
call void (i32, ...) @test52_helper(i32 0, <8 x float> %0, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double %lo, double %hi)
|
|
call void (<8 x float>, ...) @test54_helper(<8 x float> %0, <8 x float> %1, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double %lo, double %hi)
|
|
call void (<8 x float>, ...) @test54_helper(<8 x float> %6, <8 x float> %7, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, ptr byval(%Complex) align 8 %literal1)
|
|
|
|
declare void @f55(ptr byval(%St512) align 64)
|
|
declare void @f56(ptr byval(<16 x float>) align 64)
|
|
|
|
declare void @f58(ptr byval(%Two256) align 32)
|
|
define void @test_f59(ptr byval(%Two256) align 32 %0)
|
|
|
|
declare void @f60(ptr byval(%SAtwo256) align 32)
|
|
|
|
define void @test_f61(ptr byval(%SAtwo256) align 32 %0) #0 {
|