This repository has been archived by the owner on May 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 275
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This patch adds support to check function's argument or return is vector type and throw warning if yes. gcc/ChangeLog: * config/riscv/riscv.cc (riscv_vector_psabi_warnning): (riscv_arg_has_vector): (riscv_pass_in_vector_p): (riscv_get_arg_info): gcc/testsuite/ChangeLog: * gcc.target/riscv/vector-abi-1.c: New test. * gcc.target/riscv/vector-abi-2.c: New test. * gcc.target/riscv/vector-abi-3.c: New test. * gcc.target/riscv/vector-abi-4.c: New test. * gcc.target/riscv/vector-abi-5.c: New test. Signed-off-by: Yanzhang Wang <[email protected]> Co-authored-by: Kito Cheng <[email protected]>
- Loading branch information
1 parent
ec92be4
commit 2c68135
Showing
6 changed files
with
135 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* { dg-do compile } */ | ||
/* { dg-options "-O0 -march=rv64gcv -mabi=lp64d" } */ | ||
|
||
#include "riscv_vector.h" | ||
|
||
void | ||
fun (vint32m1_t a) { } /* { dg-warning "the vector type" } */ | ||
|
||
void | ||
bar () | ||
{ | ||
vint32m1_t a; | ||
fun (a); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* { dg-do compile } */ | ||
/* { dg-options "-march=rv64gcv -mabi=lp64d" } */ | ||
|
||
#include "riscv_vector.h" | ||
|
||
vint32m1_t | ||
fun (vint32m1_t* a) { return *a; } /* { dg-warning "the vector type" } */ | ||
|
||
void | ||
bar () | ||
{ | ||
vint32m1_t a; | ||
fun (&a); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* { dg-do compile } */ | ||
/* { dg-options "-march=rv64gcv -mabi=lp64d" } */ | ||
|
||
#include "riscv_vector.h" | ||
|
||
vint32m1_t* | ||
fun (vint32m1_t* a) { return a; } /* { dg-bogus "the vector type" } */ | ||
|
||
void | ||
bar () | ||
{ | ||
vint32m1_t a; | ||
fun (&a); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* { dg-do compile } */ | ||
/* { dg-options "-march=rv64gcv -mabi=lp64d" } */ | ||
|
||
#include "riscv_vector.h" | ||
|
||
typedef int v4si __attribute__ ((vector_size (16))); | ||
|
||
v4si | ||
fun (v4si a) { return a; } /* { dg-warning "the vector type" } */ | ||
|
||
void | ||
bar () | ||
{ | ||
v4si a; | ||
fun (a); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* { dg-do compile } */ | ||
/* { dg-options "-march=rv64gcv -mabi=lp64d" } */ | ||
|
||
#include "riscv_vector.h" | ||
typedef int v4si __attribute__ ((vector_size (16))); | ||
|
||
v4si* | ||
fun (v4si* a) { return a; } /* { dg-bogus "the vector type" } */ | ||
|
||
void | ||
bar () | ||
{ | ||
v4si a; | ||
fun (&a); | ||
} |