Hi Segher,
On 8/10/21 1:38 PM, Segher Boessenkool wrote:
On Thu, Jul 29, 2021 at 08:30:52AM -0500, Bill Schmidt wrote:
* config/rs6000/rs6000-builtin-new.def: Add always, power5, and
power6 stanzas.
+ unsigned long __builtin_ppc_mftb ();
+ MFTB rs6000_mftb_di {32bit}
I'm not sure what {32bit} means... The builtin exists on both 32-bit
and on 64-bit, and returns what is a "long" in both cases. The point
is that it is just a single "mfspr 268" always, which is fast, and
importantly has fixed and low latency.
Right. The implementation of this thing is that we have two different
patterns in the machine description that get invoked depending on
whether the target is 32-bit or 64-bit. The syntax in the built-ins
file only allows for one pattern. So the {32bit} flag allows us to
perform special processing for TARGET_32BIT, in this case to override
the pattern. Later in the patch series you'll find:
if (bif_is_32bit (*bifaddr) && TARGET_32BIT)
{
if (fcode == RS6000_BIF_MFTB)
icode = CODE_FOR_rs6000_mftb_si;
else
gcc_unreachable ();
}
This is the only {32bit} built-in for now, and probably ever...
I'm sure there's a better way of dealing with the mode dependency on
TARGET_32BIT, but for now this matches the old behavior as closely as
possible. I'm happy to take suggestions on this.
Thanks for the review!
Bill
Modulo perhaps that, okay for trunk. Thanks!
Segher