OSDN Git Service

tcg: Split out swap_commutative as a subroutine
authorRichard Henderson <rth@twiddle.net>
Tue, 2 Oct 2012 18:32:21 +0000 (11:32 -0700)
committerAurelien Jarno <aurelien@aurel32.net>
Wed, 17 Oct 2012 15:30:40 +0000 (17:30 +0200)
commit24c9ae4eba5eec59256d0d0ace4d868a19f87528
tree8ce6c527eea2e7b0bb236c7fbc9014eae27a52a8
parent6f4d6b09088ee161ff4be0e4db4e4c0962c79070
tcg: Split out swap_commutative as a subroutine

Reduces code duplication and prefers

  movcond d, c1, c2, const, s
to
  movcond d, c1, c2, s, const

It also prefers

  add r, r, c
over
  add r, c, r

when both inputs are known constants.  This doesn't matter for true add, as
we will fully constant fold that.  But it matters for a follow-on patch using
this routine for add2 which may not be fully foldable.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
tcg/optimize.c