Message ID | 137d4a86-0a33-edfe-f7ea-1c9a0d985f8a@mentor.com |
---|---|
State | New |
Headers | show |
Series | Handle TARGET_SPLIT_COMPLEX_ARG in default VA_ARG_EXPR implementation | expand |
Ping. On 2018/8/2 5:17 PM, Chung-Lin Tang wrote: > Hi, during testing of the new in-review C-SKY port, we discovered some FAILs due to > the default va_args gimplifying (targhooks.c:std_gimplify_va_arg_expr) not properly > having the logic to handle the TARGET_SPLIT_COMPLEX_ARG hook. > > It appears that all other targets that happen to use TARGET_SPLIT_COMPLEX_ARG also > defines TARGET_GIMPLIFY_VA_ARG_EXPR, so this went undiscovered. > The C-SKY port happens to only have TARGET_SPLIT_COMPLEX_ARG defined. > > This patch completes this handling in std_gimplify_va_arg_expr(), though at the > moment it's only really exercised by the C-SKY port, which we tested to fix several > _Complex va_args related FAILs and without regressions. > (the patch fragment is actually adapted from the xtensa port, FWIW) > > Is this okay for trunk? > > Thanks, > Chung-Lin > > 2018-08-02 Chung-Lin Tang <cltang@codesourcery.com> > > * targhooks.c (std_gimplify_va_arg_expr): Properly handle case of when > TARGET_SPLIT_COMPLEX_ARG is defined.
On 08/02/2018 03:17 AM, Chung-Lin Tang wrote: > 2018-08-02 Chung-Lin Tang <cltang@codesourcery.com> > > * targhooks.c (std_gimplify_va_arg_expr): Properly handle case of when > > TARGET_SPLIT_COMPLEX_ARG is defined. Thanks. I've committed this to the trunk. jeff
Index: targhooks.c =================================================================== --- targhooks.c (revision 263244) +++ targhooks.c (working copy) @@ -2154,6 +2154,23 @@ std_gimplify_va_arg_expr (tree valist, tree type, if (indirect) type = build_pointer_type (type); + if (targetm.calls.split_complex_arg + && TREE_CODE (type) == COMPLEX_TYPE + && targetm.calls.split_complex_arg (type)) + { + tree real_part, imag_part; + + real_part = std_gimplify_va_arg_expr (valist, + TREE_TYPE (type), pre_p, NULL); + real_part = get_initialized_tmp_var (real_part, pre_p, NULL); + + imag_part = std_gimplify_va_arg_expr (unshare_expr (valist), + TREE_TYPE (type), pre_p, NULL); + imag_part = get_initialized_tmp_var (imag_part, pre_p, NULL); + + return build2 (COMPLEX_EXPR, type, real_part, imag_part); + } + align = PARM_BOUNDARY / BITS_PER_UNIT; boundary = targetm.calls.function_arg_boundary (TYPE_MODE (type), type);