On Fri, Aug 09, 2024 at 03:50:50PM -0500, Peter Bergner wrote: > On 8/9/24 12:54 PM, Segher Boessenkool wrote: > >> --- a/gcc/config/rs6000/altivec.md > >> +++ b/gcc/config/rs6000/altivec.md > >> @@ -623,7 +623,7 @@ (define_insn "altivec_eqv1ti" > >> [(set (match_operand:V1TI 0 "altivec_register_operand" "=v") > >> (eq:V1TI (match_operand:V1TI 1 "altivec_register_operand" "v") > >> (match_operand:V1TI 2 "altivec_register_operand" "v")))] > >> - "TARGET_POWER10" > >> + "TARGET_P10_VECTOR" > >> "vcmpequq %0,%1,%2" > >> [(set_attr "type" "veccmpfx")]) > > > > This very first one is incorrect, already. This is a Vector insn > > (it needs MSR[VEC]=1), not a VSX insn (for which MSR[VSX]=1 is needed). > > > > We test TARGET_ALTIVEC for that, not TARGET_VSX. > > I guess you are correct that *_VECTOR is not specific enough because > yeah, we could have -mcpu=power10 -maltivec -mno-vsx so we'd need two > macros, TARGET_P10_ALTIVEC and TARGET_P10_VSX rather than one catch-all.
The instructions are part of the Vector Facility. Not the Vector-Scalar Extension Facility. There is a difference, and the two are gated by different MSR bits. This is *fundamental*. Yes, often both are enabled. Often *everything* is enabled. In the compiler we cannot rely on the happy case often. > > In general, we want to get rid of TARGET_Pxxx_VECTOR, not introduce new > > stuff like it! > > I'm fine with the TARGET_P10_* macro, since it's more readable than saying > TARGET_POWER10 && TARGET_ALTIVEC && TARGET_VSX, especially when we use the > negated version. It is not more readable *at all*. What does it even mean? Previous similar macros (TARGET_P8_VECTOR) meant that various VSX instructions new in ISA 2.07 were enabled, *or* that some vector insns (either VMX or VSX, it never was clear which) were enabled, and we were compiling for 2.07 or later. It meant the former, but was often understood as meaning the latter. It was a *mess*. We should not make a bigger mess. Convenience macros are fine, but it should be clear what they MEAN! Clear to the uninitiated. Obvious, self-explanatory. Not having two disparate meanings, both "obvious"! Segher