aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/i386
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/config/i386')
-rw-r--r--gcc/config/i386/i386-expand.cc9
-rw-r--r--gcc/config/i386/i386.cc15
-rw-r--r--gcc/config/i386/sse.md3
3 files changed, 23 insertions, 4 deletions
diff --git a/gcc/config/i386/i386-expand.cc b/gcc/config/i386/i386-expand.cc
index fd9bcaa..438fa4e 100644
--- a/gcc/config/i386/i386-expand.cc
+++ b/gcc/config/i386/i386-expand.cc
@@ -4159,12 +4159,18 @@ static bool
ix86_expand_sse_fp_minmax (rtx dest, enum rtx_code code, rtx cmp_op0,
rtx cmp_op1, rtx if_true, rtx if_false)
{
- machine_mode mode;
+ machine_mode mode = GET_MODE (dest);
bool is_min;
rtx tmp;
if (code == LT)
;
+ else if (code == LE && !HONOR_NANS (mode))
+ {
+ /* We can swap LE to GE and then invert to LT. */
+ std::swap (cmp_op0, cmp_op1);
+ std::swap (if_true, if_false);
+ }
else if (code == UNGE)
std::swap (if_true, if_false);
else
@@ -4177,7 +4183,6 @@ ix86_expand_sse_fp_minmax (rtx dest, enum rtx_code code, rtx cmp_op0,
else
return false;
- mode = GET_MODE (dest);
if (immediate_operand (if_false, mode))
if_false = force_reg (mode, if_false);
if (immediate_operand (if_true, mode))
diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
index db43045..75a9cb6 100644
--- a/gcc/config/i386/i386.cc
+++ b/gcc/config/i386/i386.cc
@@ -26397,7 +26397,20 @@ ix86_vector_costs::add_stmt_cost (int count, vect_cost_for_stmt kind,
(TREE_OPERAND (gimple_assign_rhs1 (def), 0))))))
{
if (fp)
- m_num_sse_needed[where]++;
+ {
+ /* Scalar FP values residing in x87 registers need to be
+ spilled and reloaded. */
+ auto mode2 = TYPE_MODE (TREE_TYPE (op));
+ if (IS_STACK_MODE (mode2))
+ {
+ int cost
+ = (ix86_cost->hard_register.fp_store[mode2 == SFmode
+ ? 0 : 1]
+ + ix86_cost->sse_load[sse_store_index (mode2)]);
+ stmt_cost += COSTS_N_INSNS (cost) / 2;
+ }
+ m_num_sse_needed[where]++;
+ }
else
{
m_num_gpr_needed[where]++;
diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md
index 0be898c..fb79b2e 100644
--- a/gcc/config/i386/sse.md
+++ b/gcc/config/i386/sse.md
@@ -4900,7 +4900,8 @@
(match_operand:SI 3 "<cmp_imm_predicate>")]
UNSPEC_PCMP_ITER))]
"TARGET_AVX512F && ix86_pre_reload_split ()
- && rtx_equal_p (operands[1], operands[2])"
+ && rtx_equal_p (operands[1], operands[2])
+ && (!MEM_P (operands[1]) || !MEM_VOLATILE_P (operands[1]))"
"#"
"&& 1"
[(set (match_dup 0) (match_dup 4))]