xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGen/mips-vector-arg.c (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1f4a2713aSLionel Sambuc // RUN: %clang -target mipsel-unknown-linux -O3 -S -o - -emit-llvm %s | FileCheck %s -check-prefix=O32
2f4a2713aSLionel Sambuc // RUN: %clang -target mips64el-unknown-linux -O3 -S -mabi=n64 -o - -emit-llvm %s | FileCheck %s -check-prefix=N64
3f4a2713aSLionel Sambuc 
4f4a2713aSLionel Sambuc // check that
5f4a2713aSLionel Sambuc // 1. vector arguments are passed in integer registers
6f4a2713aSLionel Sambuc // 2. argument alignment is no larger than 8-byte for O32 and 16-byte for N64.
7f4a2713aSLionel Sambuc 
8f4a2713aSLionel Sambuc typedef float  v4sf __attribute__ ((__vector_size__ (16)));
9f4a2713aSLionel Sambuc typedef int v4i32 __attribute__ ((__vector_size__ (16)));
10f4a2713aSLionel Sambuc 
11*0a6a1f1dSLionel Sambuc // O32: define void @test_v4sf(i32 inreg %a1.coerce0, i32 inreg %a1.coerce1, i32 inreg %a1.coerce2, i32 inreg %a1.coerce3, i32 signext %a2, i32, i32 inreg %a3.coerce0, i32 inreg %a3.coerce1, i32 inreg %a3.coerce2, i32 inreg %a3.coerce3) [[NUW:#[0-9]+]]
12*0a6a1f1dSLionel Sambuc // O32: declare i32 @test_v4sf_2(i32 inreg, i32 inreg, i32 inreg, i32 inreg, i32 signext, i32, i32 inreg, i32 inreg, i32 inreg, i32 inreg)
13*0a6a1f1dSLionel Sambuc // N64: define void @test_v4sf(i64 inreg %a1.coerce0, i64 inreg %a1.coerce1, i32 signext %a2, i64, i64 inreg %a3.coerce0, i64 inreg %a3.coerce1) [[NUW:#[0-9]+]]
14*0a6a1f1dSLionel Sambuc // N64: declare i32 @test_v4sf_2(i64 inreg, i64 inreg, i32 signext, i64, i64 inreg, i64 inreg)
15f4a2713aSLionel Sambuc extern test_v4sf_2(v4sf, int, v4sf);
test_v4sf(v4sf a1,int a2,v4sf a3)16f4a2713aSLionel Sambuc void test_v4sf(v4sf a1, int a2, v4sf a3) {
17f4a2713aSLionel Sambuc   test_v4sf_2(a3, a2, a1);
18f4a2713aSLionel Sambuc }
19f4a2713aSLionel Sambuc 
20*0a6a1f1dSLionel Sambuc // O32: define void @test_v4i32(i32 inreg %a1.coerce0, i32 inreg %a1.coerce1, i32 inreg %a1.coerce2, i32 inreg %a1.coerce3, i32 signext %a2, i32, i32 inreg %a3.coerce0, i32 inreg %a3.coerce1, i32 inreg %a3.coerce2, i32 inreg %a3.coerce3) [[NUW]]
21*0a6a1f1dSLionel Sambuc // O32: declare i32 @test_v4i32_2(i32 inreg, i32 inreg, i32 inreg, i32 inreg, i32 signext, i32, i32 inreg, i32 inreg, i32 inreg, i32 inreg)
22*0a6a1f1dSLionel Sambuc // N64: define void @test_v4i32(i64 inreg %a1.coerce0, i64 inreg %a1.coerce1, i32 signext %a2, i64, i64 inreg %a3.coerce0, i64 inreg %a3.coerce1) [[NUW]]
23*0a6a1f1dSLionel Sambuc // N64: declare i32 @test_v4i32_2(i64 inreg, i64 inreg, i32 signext, i64, i64 inreg, i64 inreg)
24f4a2713aSLionel Sambuc extern test_v4i32_2(v4i32, int, v4i32);
test_v4i32(v4i32 a1,int a2,v4i32 a3)25f4a2713aSLionel Sambuc void test_v4i32(v4i32 a1, int a2, v4i32 a3) {
26f4a2713aSLionel Sambuc   test_v4i32_2(a3, a2, a1);
27f4a2713aSLionel Sambuc }
28f4a2713aSLionel Sambuc 
29f4a2713aSLionel Sambuc // O32: attributes [[NUW]] = { nounwind{{.*}} }
30f4a2713aSLionel Sambuc 
31f4a2713aSLionel Sambuc // N64: attributes [[NUW]] = { nounwind{{.*}} }
32