Skip to content
This repository was archived by the owner on May 7, 2024. It is now read-only.

Commit 51fbc2e

Browse files
author
Yanzhang Wang
committed
fix: disable warning for intrinsic assign.
1 parent 33484c5 commit 51fbc2e

File tree

7 files changed

+54
-14
lines changed

7 files changed

+54
-14
lines changed

gcc/config/riscv/riscv.cc

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3785,16 +3785,28 @@ riscv_arg_has_vector (const_tree type)
37853785
Only check the value type and no checking for vector pointer type. */
37863786

37873787
static void
3788-
riscv_pass_in_vector_p (const_tree type)
3788+
riscv_pass_in_vector_p (const tree type, bool pass_by_reference)
37893789
{
37903790
static int warned = 0;
37913791

3792-
if (type && riscv_arg_has_vector (type) && !warned)
3792+
if (type)
37933793
{
3794-
warning (OPT_Wpsabi, "ABI for the scalable vector type is currently in "
3795-
"experimental stage and may changes in the upcoming version of "
3796-
"GCC.");
3797-
warned = 1;
3794+
3795+
bool has_vector = false;
3796+
3797+
if (TREE_CODE (type) == POINTER_TYPE && pass_by_reference)
3798+
has_vector = riscv_arg_has_vector (TREE_TYPE (type));
3799+
else
3800+
has_vector = riscv_arg_has_vector (type);
3801+
3802+
if (has_vector && !warned)
3803+
{
3804+
3805+
warning (OPT_Wpsabi, "ABI for the scalable vector type is currently "
3806+
"in experimental stage and may changes in the upcoming "
3807+
"version of GCC.");
3808+
warned = 1;
3809+
}
37983810
}
37993811
}
38003812

@@ -3882,9 +3894,6 @@ riscv_get_arg_info (struct riscv_arg_info *info, const CUMULATIVE_ARGS *cum,
38823894
}
38833895
}
38843896

3885-
/* Only check existing of vector type. */
3886-
riscv_pass_in_vector_p (type);
3887-
38883897
/* Work out the size of the argument. */
38893898
num_bytes = type ? int_size_in_bytes (type) : GET_MODE_SIZE (mode).to_constant ();
38903899
num_words = (num_bytes + UNITS_PER_WORD - 1) / UNITS_PER_WORD;
@@ -3915,6 +3924,8 @@ riscv_function_arg (cumulative_args_t cum_v, const function_arg_info &arg)
39153924
if (arg.end_marker_p ())
39163925
return NULL;
39173926

3927+
riscv_pass_in_vector_p (arg.type, arg.pass_by_reference);
3928+
39183929
return riscv_get_arg_info (&info, cum, arg.mode, arg.type, arg.named, false);
39193930
}
39203931

@@ -3971,6 +3982,13 @@ riscv_function_value (const_tree type, const_tree func, machine_mode mode)
39713982
mode = promote_function_mode (type, mode, &unsigned_p, func, 1);
39723983
}
39733984

3985+
if (func && DECL_RESULT (func))
3986+
{
3987+
tree return_type = TREE_TYPE (DECL_RESULT (func));
3988+
riscv_pass_in_vector_p (const_cast<tree> (type),
3989+
TREE_CODE (return_type) != POINTER_TYPE);
3990+
}
3991+
39743992
memset (&args, 0, sizeof args);
39753993
return riscv_get_arg_info (&info, &args, mode, type, true, true);
39763994
}

gcc/testsuite/gcc.target/riscv/vector-abi-1.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
/* { dg-do compile } */
22
/* { dg-options "-O0 -march=rv64gcv -mabi=lp64d" } */
3+
/* { dg-skip-if "" { *-*-* } { "-flto" } { "" } } */
34

45
#include "riscv_vector.h"
56

67
void
7-
fun (vint32m1_t a) { } /* { dg-warning "the vector type" } */
8+
fun (vint32m1_t a) { } /* { dg-warning "the scalable vector type" } */
89

910
void
1011
bar ()

gcc/testsuite/gcc.target/riscv/vector-abi-2.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
/* { dg-do compile } */
22
/* { dg-options "-march=rv64gcv -mabi=lp64d" } */
3+
/* { dg-skip-if "" { *-*-* } { "-flto" } { "" } } */
34

45
#include "riscv_vector.h"
56

67
vint32m1_t
7-
fun (vint32m1_t* a) { return *a; } /* { dg-warning "the vector type" } */
8+
fun (vint32m1_t* a) { return *a; } /* { dg-warning "the scalable vector type" } */
89

910
void
1011
bar ()

gcc/testsuite/gcc.target/riscv/vector-abi-3.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include "riscv_vector.h"
55

66
vint32m1_t*
7-
fun (vint32m1_t* a) { return a; } /* { dg-bogus "the vector type" } */
7+
fun (vint32m1_t* a) { return a; } /* { dg-bogus "the scalable vector type" } */
88

99
void
1010
bar ()

gcc/testsuite/gcc.target/riscv/vector-abi-4.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
typedef int v4si __attribute__ ((vector_size (16)));
77

88
v4si
9-
fun (v4si a) { return a; } /* { dg-bogus "the vector type" } */
9+
fun (v4si a) { return a; } /* { dg-bogus "the scalable vector type" } */
1010

1111
void
1212
bar ()

gcc/testsuite/gcc.target/riscv/vector-abi-5.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ typedef int v4si __attribute__ ((vector_size (16)));
55
struct A { int a; v4si b; };
66

77
void
8-
fun (struct A a) {} /* { dg-bogus "the vector type" } */
8+
fun (struct A a) {} /* { dg-bogus "the scalable vector type" } */
99

1010
void
1111
bar ()
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/* { dg-do compile } */
2+
/* { dg-options "-march=rv64gcv -mabi=lp64d" } */
3+
#include "riscv_vector.h"
4+
5+
void
6+
foo(int32_t *in1, int32_t *in2, int32_t *in3, int32_t *out,
7+
size_t n, int cond) {
8+
size_t vl;
9+
if (cond)
10+
vl = __riscv_vsetvlmax_e32m1();
11+
else
12+
vl = __riscv_vsetvlmax_e16mf2();
13+
for (size_t i = 0; i < n; i += 1)
14+
{
15+
vint32m1_t a = __riscv_vle32_v_i32m1(in1, vl); /* { dg-bogus "the scalable vector type" } */
16+
vint32m1_t b = __riscv_vle32_v_i32m1_tu(a, in2, vl);
17+
vint32m1_t c = __riscv_vle32_v_i32m1_tu(b, in3, vl);
18+
__riscv_vse32_v_i32m1(out, c, vl);
19+
}
20+
}

0 commit comments

Comments
 (0)