+2020-02-24 Kito Cheng <kito.cheng@sifive.com>
+
+ * config/riscv/riscv.c (riscv_emit_float_compare): Change the code gen
+ for LTGT.
+ (riscv_rtx_costs): Update cost model for LTGT.
+
2020-02-23 Vladimir Makarov <vmakarov@redhat.com>
PR rtl-optimization/93564
return false;
case UNEQ:
- case LTGT:
/* (FEQ(A, A) & FEQ(B, B)) compared against FEQ(A, B). */
mode = GET_MODE (XEXP (x, 0));
*total = tune_info->fp_add[mode == DFmode] + COSTS_N_INSNS (3);
return false;
+ case LTGT:
+ /* (FLT(A, A) || FGT(B, B)). */
+ mode = GET_MODE (XEXP (x, 0));
+ *total = tune_info->fp_add[mode == DFmode] + COSTS_N_INSNS (2);
+ return false;
+
case UNGE:
case UNGT:
case UNLE:
break;
case UNEQ:
- case LTGT:
/* ordered(a, b) > (a == b) */
- *code = fp_code == LTGT ? GTU : EQ;
+ *code = EQ;
tmp0 = riscv_force_binary (word_mode, EQ, cmp_op0, cmp_op0);
tmp1 = riscv_force_binary (word_mode, EQ, cmp_op1, cmp_op1);
*op0 = riscv_force_binary (word_mode, AND, tmp0, tmp1);
*op1 = const0_rtx;
break;
+ case LTGT:
+ /* (a < b) | (a > b) */
+ *code = IOR;
+ *op0 = riscv_force_binary (word_mode, LT, cmp_op0, cmp_op1);
+ *op1 = riscv_force_binary (word_mode, GT, cmp_op0, cmp_op1);
+ break;
+
default:
gcc_unreachable ();
}