aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Sayle <roger@nextmovesoftware.com>2022-08-15 17:43:02 +0100
committerRoger Sayle <roger@nextmovesoftware.com>2022-08-15 17:43:02 +0100
commit6f94923dea21bd92ba2fc40c4a3be509bb1b7f0c (patch)
tree633282879b2abf151ccebb0aba885d3cc9d36370
parent418b71c0d535bf91df78bad2e198c57934682eaa (diff)
downloadgcc-6f94923dea21bd92ba2fc40c4a3be509bb1b7f0c.zip
gcc-6f94923dea21bd92ba2fc40c4a3be509bb1b7f0c.tar.gz
gcc-6f94923dea21bd92ba2fc40c4a3be509bb1b7f0c.tar.bz2
Improved gain calculation for COMPARE to 0 or -1 in TImode STV on x86_64.
This patch tweaks timode_scalar_chain::compute_convert_gain to provide more accurate costs for converting TImode comparisons against zero or minus 1 to V1TImode equivalents. 2022-08-15 Roger Sayle <roger@nextmovesoftware.com> gcc/ChangeLog * config/i386/i386-features.cc (timode_scalar_chain::compute_convert_gain): Provide gains for comparisons against 0/-1, including "*testti" patterns.
-rw-r--r--gcc/config/i386/i386-features.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/config/i386/i386-features.cc b/gcc/config/i386/i386-features.cc
index effc2f2..28914de 100644
--- a/gcc/config/i386/i386-features.cc
+++ b/gcc/config/i386/i386-features.cc
@@ -1250,6 +1250,23 @@ timode_scalar_chain::compute_convert_gain ()
: COSTS_N_INSNS (1);
break;
+ case COMPARE:
+ if (XEXP (src, 1) == const0_rtx)
+ {
+ if (GET_CODE (XEXP (src, 0)) == AND)
+ /* and;and;or (9 bytes) vs. ptest (5 bytes). */
+ igain = optimize_insn_for_size_p() ? COSTS_N_BYTES (4)
+ : COSTS_N_INSNS (2);
+ /* or (3 bytes) vs. ptest (5 bytes). */
+ else if (optimize_insn_for_size_p ())
+ igain = -COSTS_N_BYTES (2);
+ }
+ else if (XEXP (src, 1) == const1_rtx)
+ /* and;cmp -1 (7 bytes) vs. pcmpeqd;pxor;ptest (13 bytes). */
+ igain = optimize_insn_for_size_p() ? -COSTS_N_BYTES (6)
+ : -COSTS_N_INSNS (1);
+ break;
+
default:
break;
}