From 1c2871213e18fe5a0c1cf7e6c517adf9680e48b6 Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Mon, 21 Nov 2005 08:55:31 +0100 Subject: [PATCH] predicates.md (ax_reg_operand): New predicate. * config/i386/predicates.md (ax_reg_operand): New predicate. (memory_displacement_only_operand): New predicate. * config/i386/i386.md ("modrm" attribute): Return 0 if one operand is AX register and the other operand is memory operand with displacement only. From-SVN: r107283 --- gcc/ChangeLog | 8 ++++++++ gcc/config/i386/i386.md | 8 ++++++-- gcc/config/i386/predicates.md | 21 +++++++++++++++++++++ 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b4ff1f894458..c9e309ad0dd4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2005-11-21 Uros Bizjak + + * config/i386/predicates.md (ax_reg_operand): New predicate. + (memory_displacement_only_operand): New predicate. + * config/i386/i386.md ("modrm" attribute): Return 0 if one + operand is AX register and the other operand is memory operand + with displacement only. + 2005-11-21 Uros Bizjak * fold-const.c (fold_binary) : Optimize A / A to 1.0 diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index b739e5004971..00ba8293e2cc 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -314,8 +314,12 @@ (not (match_operand 0 "memory_operand" ""))) (const_int 0) (and (eq_attr "type" "imov") - (and (match_operand 0 "register_operand" "") - (match_operand 1 "immediate_operand" ""))) + (ior (and (match_operand 0 "register_operand" "") + (match_operand 1 "immediate_operand" "")) + (ior (and (match_operand 0 "ax_reg_operand" "") + (match_operand 1 "memory_displacement_only_operand" "")) + (and (match_operand 0 "memory_displacement_only_operand" "") + (match_operand 1 "ax_reg_operand" ""))))) (const_int 0) (and (eq_attr "type" "call") (match_operand 0 "constant_call_address_operand" "")) diff --git a/gcc/config/i386/predicates.md b/gcc/config/i386/predicates.md index b61d2d25bde8..4a7d88a7f5d3 100644 --- a/gcc/config/i386/predicates.md +++ b/gcc/config/i386/predicates.md @@ -75,6 +75,11 @@ return REGNO (op) > LAST_VIRTUAL_REGISTER || REGNO (op) < 4; }) +;; Return true if op is the AX register. +(define_predicate "ax_reg_operand" + (and (match_code "reg") + (match_test "REGNO (op) == 0"))) + ;; Return true if op is the flags register. (define_predicate "flags_reg_operand" (and (match_code "reg") @@ -741,6 +746,22 @@ return parts.disp != NULL_RTX; }) +;; Returns 1 if OP is memory operand with a displacement only. +(define_predicate "memory_displacement_only_operand" + (match_operand 0 "memory_operand") +{ + struct ix86_address parts; + int ok; + + ok = ix86_decompose_address (XEXP (op, 0), &parts); + gcc_assert (ok); + + if (parts.base || parts.index) + return 0; + + return parts.disp != NULL_RTX; +}) + ;; Returns 1 if OP is memory operand that cannot be represented ;; by the modRM array. (define_predicate "long_memory_operand" -- 2.47.2