@@ -3798,6 +3798,28 @@ riscv_pass_in_vector_p (const_tree type)
3798
3798
}
3799
3799
}
3800
3800
3801
+ /* Initialize a variable CUM of type CUMULATIVE_ARGS
3802
+ for a call to a function whose data type is FNTYPE.
3803
+ For a library call, FNTYPE is 0. */
3804
+
3805
+ void
3806
+ init_cumulative_args (CUMULATIVE_ARGS *cum, /* Argument info to initialize */
3807
+ tree fntype, /* tree ptr for function decl */
3808
+ rtx libname, /* SYMBOL_REF of library name or 0 */
3809
+ tree fndecl,
3810
+ int caller)
3811
+ {
3812
+ memset (cum, 0 , sizeof (*cum));
3813
+
3814
+ if (fndecl)
3815
+ {
3816
+ const tree_function_decl &fn = FUNCTION_DECL_CHECK (fndecl)->function_decl ;
3817
+
3818
+ if (fn.built_in_class == NOT_BUILT_IN)
3819
+ cum->rvv_psabi_warning = 1 ;
3820
+ }
3821
+ }
3822
+
3801
3823
/* Fill INFO with information about a single argument, and return an
3802
3824
RTL pattern to pass or return the argument. CUM is the cumulative
3803
3825
state for earlier arguments. MODE is the mode of this argument and
@@ -3882,8 +3904,11 @@ riscv_get_arg_info (struct riscv_arg_info *info, const CUMULATIVE_ARGS *cum,
3882
3904
}
3883
3905
}
3884
3906
3885
- /* Only check existing of vector type. */
3886
- riscv_pass_in_vector_p (type);
3907
+ if (cum->rvv_psabi_warning )
3908
+ {
3909
+ /* Only check existing of vector type. */
3910
+ riscv_pass_in_vector_p (type);
3911
+ }
3887
3912
3888
3913
/* Work out the size of the argument. */
3889
3914
num_bytes = type ? int_size_in_bytes (type) : GET_MODE_SIZE (mode).to_constant ();
@@ -3972,7 +3997,18 @@ riscv_function_value (const_tree type, const_tree func, machine_mode mode)
3972
3997
}
3973
3998
3974
3999
memset (&args, 0 , sizeof args);
3975
- return riscv_get_arg_info (&info, &args, mode, type, true , true );
4000
+
4001
+ const_tree arg_type = type;
4002
+ if (func && DECL_RESULT (func))
4003
+ {
4004
+ const tree_function_decl &fn = FUNCTION_DECL_CHECK (func)->function_decl ;
4005
+ if (fn.built_in_class == NOT_BUILT_IN)
4006
+ args.rvv_psabi_warning = 1 ;
4007
+
4008
+ arg_type = TREE_TYPE (DECL_RESULT (func));
4009
+ }
4010
+
4011
+ return riscv_get_arg_info (&info, &args, mode, arg_type, true , true );
3976
4012
}
3977
4013
3978
4014
/* Implement TARGET_PASS_BY_REFERENCE. */
0 commit comments