diff options
author | Uros Bizjak <uros@gcc.gnu.org> | 2016-07-11 21:41:17 +0200 |
---|---|---|
committer | Uros Bizjak <uros@gcc.gnu.org> | 2016-07-11 21:41:17 +0200 |
commit | 4368a420fb0679a0ef78fd0806dbdf7917cd948d (patch) | |
tree | a7d83f37b37fec412fab672c17d78e607013819e /gcc/config | |
parent | 7f0d7d6155b6ef87b9a8e404a556222d22f844f8 (diff) | |
download | gcc-4368a420fb0679a0ef78fd0806dbdf7917cd948d.zip gcc-4368a420fb0679a0ef78fd0806dbdf7917cd948d.tar.gz gcc-4368a420fb0679a0ef78fd0806dbdf7917cd948d.tar.bz2 |
predicates.md (x86_64_immediate_operand): Hoist common subexpressions.
* config/i386/predicates.md (x86_64_immediate_operand) <case CONST>:
Hoist common subexpressions.
(x86_64_zext_immediate_operand) <case CONST>: Ditto.
From-SVN: r238224
Diffstat (limited to 'gcc/config')
-rw-r--r-- | gcc/config/i386/predicates.md | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/gcc/config/i386/predicates.md b/gcc/config/i386/predicates.md index 2c4cfe6..6854c37 100644 --- a/gcc/config/i386/predicates.md +++ b/gcc/config/i386/predicates.md @@ -205,7 +205,11 @@ return false; if (!CONST_INT_P (op2)) return false; + offset = trunc_int_for_mode (INTVAL (op2), DImode); + if (trunc_int_for_mode (offset, SImode) != offset) + return false; + switch (GET_CODE (op1)) { case SYMBOL_REF: @@ -224,16 +228,14 @@ if ((ix86_cmodel == CM_SMALL || (ix86_cmodel == CM_MEDIUM && !SYMBOL_REF_FAR_ADDR_P (op1))) - && offset < 16*1024*1024 - && trunc_int_for_mode (offset, SImode) == offset) + && offset < 16*1024*1024) return true; /* For CM_KERNEL we know that all object resist in the negative half of 32bits address space. We may not accept negative offsets, since they may be just off and we may accept pretty large positive ones. */ if (ix86_cmodel == CM_KERNEL - && offset > 0 - && trunc_int_for_mode (offset, SImode) == offset) + && offset > 0) return true; break; @@ -241,12 +243,10 @@ /* These conditions are similar to SYMBOL_REF ones, just the constraints for code models differ. */ if ((ix86_cmodel == CM_SMALL || ix86_cmodel == CM_MEDIUM) - && offset < 16*1024*1024 - && trunc_int_for_mode (offset, SImode) == offset) + && offset < 16*1024*1024) return true; if (ix86_cmodel == CM_KERNEL - && offset > 0 - && trunc_int_for_mode (offset, SImode) == offset) + && offset > 0) return true; break; @@ -255,8 +255,7 @@ { case UNSPEC_DTPOFF: case UNSPEC_NTPOFF: - if (trunc_int_for_mode (offset, SImode) == offset) - return true; + return true; } break; @@ -307,9 +306,17 @@ { rtx op1 = XEXP (XEXP (op, 0), 0); rtx op2 = XEXP (XEXP (op, 0), 1); + HOST_WIDE_INT offset; if (ix86_cmodel == CM_LARGE) return false; + if (!CONST_INT_P (op2)) + return false; + + offset = trunc_int_for_mode (INTVAL (op2), DImode); + if (trunc_int_for_mode (offset, SImode) != offset) + return false; + switch (GET_CODE (op1)) { case SYMBOL_REF: @@ -328,9 +335,7 @@ if ((ix86_cmodel == CM_SMALL || (ix86_cmodel == CM_MEDIUM && !SYMBOL_REF_FAR_ADDR_P (op1))) - && CONST_INT_P (op2) - && trunc_int_for_mode (INTVAL (op2), DImode) > -0x10000 - && trunc_int_for_mode (INTVAL (op2), SImode) == INTVAL (op2)) + && offset > -0x10000) return true; /* ??? For the kernel, we may accept adjustment of -0x10000000, since we know that it will just convert @@ -342,9 +347,7 @@ /* These conditions are similar to SYMBOL_REF ones, just the constraints for code models differ. */ if ((ix86_cmodel == CM_SMALL || ix86_cmodel == CM_MEDIUM) - && CONST_INT_P (op2) - && trunc_int_for_mode (INTVAL (op2), DImode) > -0x10000 - && trunc_int_for_mode (INTVAL (op2), SImode) == INTVAL (op2)) + && offset > -0x10000) return true; break; |