[ruby-cvs:62679] naruse:r55515 (trunk): * insns.def (opt_plus): use `- 1` instead of `& (~1)` to allow

naruse at ruby-lang.org naruse at ruby-lang.org
Tue Jun 28 03:30:14 JST 2016

naruse	2016-06-28 03:30:12 +0900 (Tue, 28 Jun 2016)

  New Revision: 55515


    * insns.def (opt_plus): use `- 1` instead of `& (~1)` to allow
      compilers to use x86 LEA instruction (3 operand).
      Even if 3 operand LEA's latency is 3 cycle after SandyBridge,
      it reduces code size and can be faster because of super scalar.
    * insns.def (opt_plus): calculate and use rb_int2big.
      On positive Fixnum overflow, `recv - 1 + obj` doesn't carry
      because recv's msb and obj's msb are 0, and resulted msb is 1.
      Therefore simply rshift and cast as signed long works fine.
      On negative Fixnum overflow, it will carry because both arguments'
      msb are 1, and resulted msb is also 1.
      In this case it needs to restore carried sign bit after rshift.

  Modified files:

More information about the ruby-cvs mailing list