From: Eric Botcazou Date: Fri, 9 Feb 2018 12:33:40 +0000 (+0000) Subject: optabs.c (prepare_cmp_insn): Try harder to emit a direct comparison instead of a... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=183187053d0222477cff678be5360597a57ccc6f;p=gcc.git optabs.c (prepare_cmp_insn): Try harder to emit a direct comparison instead of a libcall for UNORDERED. * optabs.c (prepare_cmp_insn): Try harder to emit a direct comparison instead of a libcall for UNORDERED. From-SVN: r257525 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b112b8105c7..858ad9dd9db 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2018-02-09 Eric Botcazou + + * optabs.c (prepare_cmp_insn): Try harder to emit a direct comparison + instead of a libcall for UNORDERED. + 2018-02-09 Tamar Christina PR target/82641 diff --git a/gcc/optabs.c b/gcc/optabs.c index daac5457223..5f61e4e9521 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -3935,7 +3935,20 @@ prepare_cmp_insn (rtx x, rtx y, enum rtx_code comparison, rtx size, if (methods != OPTAB_LIB_WIDEN) goto fail; - if (!SCALAR_FLOAT_MODE_P (mode)) + if (SCALAR_FLOAT_MODE_P (mode)) + { + /* Small trick if UNORDERED isn't implemented by the hardware. */ + if (comparison == UNORDERED && rtx_equal_p (x, y)) + { + prepare_cmp_insn (x, y, UNLT, NULL_RTX, unsignedp, OPTAB_WIDEN, + ptest, pmode); + if (*ptest) + return; + } + + prepare_float_lib_cmp (x, y, comparison, ptest, pmode); + } + else { rtx result; machine_mode ret_mode; @@ -3982,8 +3995,6 @@ prepare_cmp_insn (rtx x, rtx y, enum rtx_code comparison, rtx size, prepare_cmp_insn (x, y, comparison, NULL_RTX, unsignedp, methods, ptest, pmode); } - else - prepare_float_lib_cmp (x, y, comparison, ptest, pmode); return;