On Sat, Aug 02, 2025 at 05:14:22PM +0800, Yang Yujie wrote: > tree > -bitint_large_huge::limb_access (tree type, tree var, tree idx, bool write_p) > +bitint_large_huge::limb_access (tree type, tree var, tree idx, bool write_p, > + bool abi_load_p) > { > tree atype = (tree_fits_uhwi_p (idx) > ? limb_access_type (type, idx) : m_limb_type); > - tree ltype = m_limb_type; > + > + tree ltype = (bitint_extended && abi_load_p) ? atype : m_limb_type; > + > addr_space_t as = TYPE_ADDR_SPACE (TREE_TYPE (var)); > if (as != TYPE_ADDR_SPACE (ltype)) > ltype = build_qualified_type (ltype, TYPE_QUALS (ltype) > @@ -651,12 +654,21 @@ bitint_large_huge::limb_access (tree type, tree var, > tree idx, bool write_p) > { > unsigned HOST_WIDE_INT nelts > = CEIL (tree_to_uhwi (TYPE_SIZE (TREE_TYPE (var))), limb_prec); > - tree atype = build_array_type_nelts (ltype, nelts); > + > + /* Build the array type with m_limb_type from the right address > + space. */ > + tree limb_type_a = m_limb_type; > + if (as != TYPE_ADDR_SPACE (m_limb_type)) > + limb_type_a = build_qualified_type (m_limb_type, > + TYPE_QUALS (m_limb_type) > + | ENCODE_QUAL_ADDR_SPACE (as)); > + > + tree atype = build_array_type_nelts (limb_type_a, nelts); > var = build1 (VIEW_CONVERT_EXPR, atype, var); > } > ret = build4 (ARRAY_REF, ltype, var, idx, NULL_TREE, NULL_TREE); > } > - if (!write_p && !useless_type_conversion_p (atype, m_limb_type)) > + if (!write_p && !useless_type_conversion_p (atype, ltype))
This part is not correct. For non-generic address space this will be always non-useless conversion. If you want to do nothing for the bitint_extended && abi_load_p case, I'd write it as if (!write_p && !(bitint_extended && abi_load_p) && !useless_type_conversion_p (atype, m_limb_type)) Jakub