On Tue, Jan 25, 2022 at 02:24:34PM -0500, Jason Merrill wrote:
> > + machine_mode mode, fmode;
> > + if (TREE_CODE (type) == COMPLEX_TYPE)
> > + mode = TYPE_MODE (TREE_TYPE (type));
> > + else
> > + mode = TYPE_MODE (type);
> > + if (known_eq (GET_MODE_SIZE (mode), 16) && !MODE_COMPOSITE_P (mode))
> > + FOR_EACH_MODE_IN_CLASS (fmode, MODE_FLOAT)
> > + if (known_eq (GET_MODE_SIZE (fmode), 16)
> > + && MODE_COMPOSITE_P (fmode))
> > + {
> > + if (type == long_double_type_node)
> > + {
> > + if (float128_type_node
> > + && (TYPE_MODE (float128_type_node)
> > + == TYPE_MODE (type)))
> > + return float128_type_node;
> > + return NULL_TREE;
> > + }
> > + for (int i = 0; i < NUM_FLOATN_NX_TYPES; i++)
> > + if (COMPLEX_FLOATN_NX_TYPE_NODE (i) != NULL_TREE
> > + && (TYPE_MODE (COMPLEX_FLOATN_NX_TYPE_NODE (i))
> > + == TYPE_MODE (type)))
> > + return COMPLEX_FLOATN_NX_TYPE_NODE (i);
> > + }
>
> Do we really need this loop to determine if the target supports two
> different long doubles? This seems like a complicated way of saying
> "if this is IEEE 128-bit long double and the target also supports IBM double
> double", return _Float128."
The outermost if and FOR_EACH_MODE_IN_CLASS in it are checking if it is
essentially ppc64le-linux with -mabi=ieeelongdouble, i.e. whether long double
is non-composite 16-byte and the target supports at least one composite
16-byte mode.
The inner loop is because we don't have a complex_float128_type_node macro,
so it needs to be found by iteration or hardcoding which entry it is
(it iterates over those 6 entries for complex _Float{32,64,128}{,x}).
Jakub