From bbe8497f5ef17013e6bafb96d6666c536d8bdf2d Mon Sep 17 00:00:00 2001 From: John Wehle Date: Thu, 18 Jun 1998 19:13:01 -0600 Subject: [PATCH] i386.md (movsfcc, [...]): Use emit_store_flag to support LT, LE, GE, and GT signed integer comparisons. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit � * i386.md (movsfcc, movdfcc, movxfcc): Use emit_store_flag to support LT, LE, GE, and GT signed integer comparisons. (movsfcc+1, movsfcc+2, movdfcc+1, movdfcc+2, movxfcc+1, movxfcc+2): Pattern doesn't match if the comparison is LT, LE, GE, or GT. (movdicc): Remove code resulting from an earlier patch which didn't apply correctly. From-SVN: r20574 --- gcc/config/i386/i386.md | 113 ++++++++++++++++++++++++++-------------- 1 file changed, 73 insertions(+), 40 deletions(-) diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index cb1a42affc6..e3dbea9ab3b 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -7368,12 +7368,36 @@ byte_xor_operation: "TARGET_CMOVE" " { + rtx temp; + if (GET_MODE_CLASS (GET_MODE (i386_compare_op0)) != MODE_INT) FAIL; - operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]), + /* The floating point conditional move instructions don't directly + support conditions resulting from a signed integer comparison. */ + + switch (GET_CODE (operands[1])) + { + case LT: + case LE: + case GE: + case GT: + temp = emit_store_flag (gen_reg_rtx (QImode), + GET_CODE (operands[1]), i386_compare_op0, i386_compare_op1, + VOIDmode, 0, 0); + + if (!temp) + FAIL; + + operands[1] = gen_rtx_fmt_ee (NE, QImode, temp, const0_rtx); + break; + + default: + operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]), GET_MODE (i386_compare_op0), i386_compare_op0, i386_compare_op1); + break; + } }") (define_insn "" @@ -7383,7 +7407,9 @@ byte_xor_operation: (match_operand:QI 3 "general_operand" "qmn,qn,qmn,qn,qmn,qn")]) (match_operand:SF 4 "register_operand" "f,f,0,0,f,f") (match_operand:SF 5 "register_operand" "0,0,f,f,f,f")))] - "TARGET_CMOVE" + "TARGET_CMOVE + && GET_CODE (operands[1]) != LT && GET_CODE (operands[1]) != LE + && GET_CODE (operands[1]) != GE && GET_CODE (operands[1]) != GT" "#") (define_insn "" @@ -7393,7 +7419,9 @@ byte_xor_operation: (match_operand 3 "general_operand" "rmi,ri,rmi,ri,rmi,ri")]) (match_operand:SF 4 "register_operand" "f,f,0,0,f,f") (match_operand:SF 5 "register_operand" "0,0,f,f,f,f")))] - "TARGET_CMOVE && GET_MODE_CLASS (GET_MODE (operands[2])) == MODE_INT" + "TARGET_CMOVE && GET_MODE_CLASS (GET_MODE (operands[2])) == MODE_INT + && GET_CODE (operands[1]) != LT && GET_CODE (operands[1]) != LE + && GET_CODE (operands[1]) != GE && GET_CODE (operands[1]) != GT" "#") (define_split @@ -7442,11 +7470,13 @@ byte_xor_operation: "TARGET_CMOVE" " { + rtx temp; + if (GET_MODE_CLASS (GET_MODE (i386_compare_op0)) != MODE_INT) FAIL; - /* The floating point conditional move instructions don't support - signed integer comparisons. */ + /* The floating point conditional move instructions don't directly + support conditions resulting from a signed integer comparison. */ switch (GET_CODE (operands[1])) { @@ -7454,17 +7484,22 @@ byte_xor_operation: case LE: case GE: case GT: - FAIL; - /* NOTREACHED */ + temp = emit_store_flag (gen_reg_rtx (QImode), + GET_CODE (operands[1]), i386_compare_op0, i386_compare_op1, + VOIDmode, 0, 0); + + if (!temp) + FAIL; + + operands[1] = gen_rtx_fmt_ee (NE, QImode, temp, const0_rtx); break; default: - break; - } - - operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]), + operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]), GET_MODE (i386_compare_op0), i386_compare_op0, i386_compare_op1); + break; + } }") (define_insn "" @@ -7474,7 +7509,9 @@ byte_xor_operation: (match_operand:QI 3 "general_operand" "qmn,qn,qmn,qn,qmn,qn")]) (match_operand:DF 4 "register_operand" "f,f,0,0,f,f") (match_operand:DF 5 "register_operand" "0,0,f,f,f,f")))] - "TARGET_CMOVE" + "TARGET_CMOVE + && GET_CODE (operands[1]) != LT && GET_CODE (operands[1]) != LE + && GET_CODE (operands[1]) != GE && GET_CODE (operands[1]) != GT" "#") (define_insn "" @@ -7484,7 +7521,9 @@ byte_xor_operation: (match_operand 3 "general_operand" "rmi,ri,rmi,ri,rmi,ri")]) (match_operand:DF 4 "register_operand" "f,f,0,0,f,f") (match_operand:DF 5 "register_operand" "0,0,f,f,f,f")))] - "TARGET_CMOVE && GET_MODE_CLASS (GET_MODE (operands[2])) == MODE_INT" + "TARGET_CMOVE && GET_MODE_CLASS (GET_MODE (operands[2])) == MODE_INT + && GET_CODE (operands[1]) != LT && GET_CODE (operands[1]) != LE + && GET_CODE (operands[1]) != GE && GET_CODE (operands[1]) != GT" "#") (define_split @@ -7533,11 +7572,13 @@ byte_xor_operation: "TARGET_CMOVE" " { + rtx temp; + if (GET_MODE_CLASS (GET_MODE (i386_compare_op0)) != MODE_INT) FAIL; - /* The floating point conditional move instructions don't support - signed integer comparisons. */ + /* The floating point conditional move instructions don't directly + support conditions resulting from a signed integer comparison. */ switch (GET_CODE (operands[1])) { @@ -7545,17 +7586,22 @@ byte_xor_operation: case LE: case GE: case GT: - FAIL; - /* NOTREACHED */ + temp = emit_store_flag (gen_reg_rtx (QImode), + GET_CODE (operands[1]), i386_compare_op0, i386_compare_op1, + VOIDmode, 0, 0); + + if (!temp) + FAIL; + + operands[1] = gen_rtx_fmt_ee (NE, QImode, temp, const0_rtx); break; default: - break; - } - - operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]), + operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]), GET_MODE (i386_compare_op0), i386_compare_op0, i386_compare_op1); + break; + } }") (define_insn "" @@ -7565,7 +7611,9 @@ byte_xor_operation: (match_operand:QI 3 "general_operand" "qmn,qn,qmn,qn,qmn,qn")]) (match_operand:XF 4 "register_operand" "f,f,0,0,f,f") (match_operand:XF 5 "register_operand" "0,0,f,f,f,f")))] - "TARGET_CMOVE" + "TARGET_CMOVE + && GET_CODE (operands[1]) != LT && GET_CODE (operands[1]) != LE + && GET_CODE (operands[1]) != GE && GET_CODE (operands[1]) != GT" "#") (define_insn "" @@ -7575,7 +7623,9 @@ byte_xor_operation: (match_operand 3 "general_operand" "rmi,ri,rmi,ri,rmi,ri")]) (match_operand:XF 4 "register_operand" "f,f,0,0,f,f") (match_operand:XF 5 "register_operand" "0,0,f,f,f,f")))] - "TARGET_CMOVE && GET_MODE_CLASS (GET_MODE (operands[2])) == MODE_INT" + "TARGET_CMOVE && GET_MODE_CLASS (GET_MODE (operands[2])) == MODE_INT + && GET_CODE (operands[1]) != LT && GET_CODE (operands[1]) != LE + && GET_CODE (operands[1]) != GE && GET_CODE (operands[1]) != GT" "#") (define_split @@ -7627,23 +7677,6 @@ byte_xor_operation: if (GET_MODE_CLASS (GET_MODE (i386_compare_op0)) != MODE_INT) FAIL; - /* The floating point conditional move instructions don't support - signed integer comparisons. */ - - switch (GET_CODE (operands[1])) - { - case LT: - case LE: - case GE: - case GT: - FAIL; - /* NOTREACHED */ - break; - - default: - break; - } - operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]), GET_MODE (i386_compare_op0), i386_compare_op0, i386_compare_op1);