On 18/11/13 17:09, Peter Bergner wrote:
> On Mon, 2013-11-18 at 10:05 +0100, Andreas Krebbel wrote:
>> With the patch the htm-nofloat-2 testcase fails.  Due to the
>> "returns_twice" flag on tbegin the optimizers fail to fold the
>> compares of the condition code and the s390_optimize_nonescaping_tx
>> routine in turn fails to optimize the simple transactions.  This will
>> hopefully be fixed with a follow-on patch.
> 
> Hi Andreas,
> 
> I assume you're using the returns_twice attribute on your tbegin builtin
> so that the compiler will help you with the handling of the floating
> point registers since they are not restored on the s390's transaction
> failure?  We don't have that attribute set on POWER's tbegin builtin
> and I don't think we should since all of our registers are restored
> on a transaction failure, but I'd like to know if you added that
> attribute for any other reason such that POWER should have it too?

Hi Peter,

right. I did this because of the FPR trouble we have with our tbegin. The 
backend forces the
compiler to generate save/restore instructions around a tbegin by adding 
clobbers for the FPRs.  But
this only helps with the RTL level passes. On tree level the incomplete control 
flow modeling leads
to examples like this being misoptimized (f = 77.0f is propagated into the f != 
88.0f) comparison:

int foo ()
{
  float f = 77.0f;
  if (__builtin_tbegin (0) == 0)
    {
      f = 88.0f;
      __builtin_tabort (256);
      return 2;
    }
  if (f != 88.0f)
    return 3;
  return 4;
}

I agree with you that it should not be needed if the tbegin saves and restores 
all the registers.
And I really cannot recommend it. The flag prevents quite some optimizations 
what currently makes
the generated code quite ugly.

Bye,

-Andreas-

Reply via email to