diff options
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/config/i386/i386.md | 8 | ||||
-rw-r--r-- | gcc/config/i386/predicates.md | 21 |
3 files changed, 35 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b4ff1f8..c9e309a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,13 @@ 2005-11-21 Uros Bizjak <uros@kss-loka.si> + * 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 <uros@kss-loka.si> + * fold-const.c (fold_binary) <RDIV_EXPR>: Optimize A / A to 1.0 if we don't care about NaNs or Infinities. diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index b739e50..00ba829 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 b61d2d2..4a7d88a 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" |