Hi Jakub,

Thanks for your feedback.

> This can only happen in the min_prec == prec case and in that case there
> should be no extension at all if c is non-NULL, as the copying from c
> covers the whole size already.
> And the code in there really assumes what is earlier ensured, that if
> min_prec < prec, then there is no padding in it, even in the abi_limb_prec >
> limb_prec case:
>                       if (min_prec > (unsigned) limb_prec
>                           && abi_limb_prec > limb_prec)
>                         {
>                           /* For targets with ABI limb precision higher than
>                              limb precision round to ABI limb precision,
>                              otherwise c can contain padding bits.  */
>                           min_prec
>                             = CEIL (min_prec, abi_limb_prec) * abi_limb_prec;
>                           if (min_prec > prec - rem - 2 * limb_prec)
>                             min_prec = prec;
>                         }
> Normally for the min_prec == prec case we take the
>                   if (c)
>                     {
>                       if (VAR_P (v1) && min_prec == prec)
>                         {
>                           tree v2 = build1 (VIEW_CONVERT_EXPR,
>                                             TREE_TYPE (v1), c);
>                           g = gimple_build_assign (v1, v2);
>                           gsi_insert_on_edge (e, g);
>                           edge_insertions = true;
>                           break;
>                         }
> path, except here v1 is not a VAR_DECL but PARM_DECL and so we need to
> go through the VCE path even for v1.

What I was not sure about is whether, when abi_limb_prec > limb_prec,
the top 64 bits of padding in c are guaranteed to have already been
zero- or sign-extended, or they could contain undefined bits.

If the existing logic guarantees the extension, I agree that no additional
extension is needed.

> So, I think we should do following instead.
> Tested on x86_64-linux with
> make -j32 -k check-gcc GCC_TEST_RUN_EXPENSIVE=1 
> RUNTESTFLAGS="GCC_TEST_RUN_EXPENSIVE=1 dg.exp='*bitint* pr112673.c 
> builtin-stdc-bit-*.c pr112566-2.c pr112511.c pr116588.c pr116003.c pr113693.c 
> pr113602.c flex-array-counted-by-7.c' dg-torture.exp='*bitint* pr116480-2.c 
> pr114312.c pr114121.c' dfp.exp=*bitint* 
> vect.exp='vect-early-break_99-pr113287.c' tree-ssa.exp=pr113735.c"
> so far, will bootstrap/regtest on x86_64-linux, i686-linux and aarch64-linux
> tonight.

I just bootstrapped and tested your patch on aarch64-linux and no issue
is found.

Thanks,
Pengfei

Reply via email to