Commit b222082e by Jan Hubicka Committed by Jeff Law

i386.md (notsi, [...]): Call memory_address_displacement_length instead of memory_address_length.

        * i386.md (notsi, nothi, xorsi, xorhi, and xorqi patterns): Call
        memory_address_displacement_length instead of memory_address_length.
        * i386.c (memory_address_info): Renamed from memory_address_length.
        Accept new argument DISP_LENGTH.  All callers changed.  If DISP_LENGTH,
        then return the displacement length.  Else return length of the
        entire memory address.  Handle MULT case correctly.
        * i386.h (memory_address_info): Update declaration.
        * i386.md (memory_bit_test): Fix paren error.

Co-Authored-By: Jeffrey A Law <law@cygnus.com>

From-SVN: r26465
parent a3e924fc
Thu Apr 15 01:03:21 1999 Jan Hubicka <hubicka@freesoft.cz>
Jeff Law <law@cygnus.com>
* i386.md (notsi, nothi, xorsi, xorhi, and xorqi patterns): Call
memory_address_displacement_length instead of memory_address_length.
* i386.c (memory_address_info): Renamed from memory_address_length.
Accept new argument DISP_LENGTH. All callers changed. If DISP_LENGTH,
then return the displacement length. Else return length of the
entire memory address. Handle MULT case correctly.
* i386.h (memory_address_info): Update declaration.
* i386.md (memory_bit_test): Fix paren error.
Wed Apr 14 21:29:18 1999 Andrew Haley <aph@cygnus.com> Wed Apr 14 21:29:18 1999 Andrew Haley <aph@cygnus.com>
* flow.c: (make_edges): Always make edges from a basic block * flow.c: (make_edges): Always make edges from a basic block
......
...@@ -5610,12 +5610,16 @@ output_ashlsi3 (operands) ...@@ -5610,12 +5610,16 @@ output_ashlsi3 (operands)
return AS2 (sal%L0,%2,%0); return AS2 (sal%L0,%2,%0);
} }
/* Calculate the length of the memory address in the instruction /* Given the memory address ADDR, calculate the length of the address or
encoding. Does not include the one-byte modrm, opcode, or prefix. */ the length of just the displacement (controlled by DISP_LENGTH).
The length returned does not include the one-byte modrm, opcode,
or prefix. */
int int
memory_address_length (addr) memory_address_info (addr, disp_length)
rtx addr; rtx addr;
int disp_length;
{ {
rtx base, index, disp, scale; rtx base, index, disp, scale;
rtx op0, op1; rtx op0, op1;
...@@ -5709,6 +5713,11 @@ memory_address_length (addr) ...@@ -5709,6 +5713,11 @@ memory_address_length (addr)
if (base == frame_pointer_rtx && !disp) if (base == frame_pointer_rtx && !disp)
disp = const0_rtx; disp = const0_rtx;
/* Scaling can not be encoded without base or displacement.
Except for scale == 1 where we can encode reg + reg instead of reg * 2. */
if (!base && index && scale != 1)
disp = const0_rtx;
/* Find the length of the displacement constant. */ /* Find the length of the displacement constant. */
len = 0; len = 0;
if (disp) if (disp)
...@@ -5720,8 +5729,9 @@ memory_address_length (addr) ...@@ -5720,8 +5729,9 @@ memory_address_length (addr)
len = 4; len = 4;
} }
/* An index requires the two-byte modrm form. */ /* An index requires the two-byte modrm form. Not important
if (index) if we are computing just length of the displacement. */
if (index && ! disp_length)
len += 1; len += 1;
return len; return len;
......
...@@ -2766,7 +2766,7 @@ extern char *output_fp_conditional_move (); ...@@ -2766,7 +2766,7 @@ extern char *output_fp_conditional_move ();
extern int ix86_can_use_return_insn_p (); extern int ix86_can_use_return_insn_p ();
extern int small_shift_operand (); extern int small_shift_operand ();
extern char *output_ashlsi3 (); extern char *output_ashlsi3 ();
extern int memory_address_length (); extern int memory_address_info ();
#ifdef NOTYET #ifdef NOTYET
extern struct rtx_def *copy_all_rtx (); extern struct rtx_def *copy_all_rtx ();
......
...@@ -4497,7 +4497,7 @@ byte_xor_operation: ...@@ -4497,7 +4497,7 @@ byte_xor_operation:
if (intval == 0xff if (intval == 0xff
&& (!TARGET_PENTIUM || optimize_size && (!TARGET_PENTIUM || optimize_size
|| (GET_CODE (operands[0]) == MEM || (GET_CODE (operands[0]) == MEM
&& memory_address_length (XEXP (operands[0], 0)) != 0))) && memory_address_info (XEXP (operands[0], 0), 1))))
return AS1 (not%B0,%b0); return AS1 (not%B0,%b0);
if (intval != INTVAL (operands[2])) if (intval != INTVAL (operands[2]))
...@@ -4516,7 +4516,7 @@ byte_xor_operation: ...@@ -4516,7 +4516,7 @@ byte_xor_operation:
if (intval == 0xff if (intval == 0xff
&& (!TARGET_PENTIUM || optimize_size && (!TARGET_PENTIUM || optimize_size
|| (GET_CODE (operands[0]) == MEM || (GET_CODE (operands[0]) == MEM
&& memory_address_length (XEXP (operands[0], 0)) != 0))) && memory_address_info (XEXP (operands[0], 0), 1))))
return AS1 (not%B0,%h0); return AS1 (not%B0,%h0);
operands[2] = GEN_INT (intval); operands[2] = GEN_INT (intval);
...@@ -4576,7 +4576,7 @@ byte_xor_operation: ...@@ -4576,7 +4576,7 @@ byte_xor_operation:
if (INTVAL (operands[2]) == 0xff if (INTVAL (operands[2]) == 0xff
&& (!TARGET_PENTIUM || optimize_size && (!TARGET_PENTIUM || optimize_size
|| (GET_CODE (operands[0]) == MEM || (GET_CODE (operands[0]) == MEM
&& memory_address_length (XEXP (operands[0], 0)) != 0))) && memory_address_info (XEXP (operands[0], 0), 1))))
return AS1 (not%B0,%b0); return AS1 (not%B0,%b0);
return AS2 (xor%B0,%2,%b0); return AS2 (xor%B0,%2,%b0);
...@@ -4593,7 +4593,7 @@ byte_xor_operation: ...@@ -4593,7 +4593,7 @@ byte_xor_operation:
if (INTVAL (operands[2]) == 0xff if (INTVAL (operands[2]) == 0xff
&& (!TARGET_PENTIUM || optimize_size && (!TARGET_PENTIUM || optimize_size
|| (GET_CODE (operands[0]) == MEM || (GET_CODE (operands[0]) == MEM
&& memory_address_length (XEXP (operands[0], 0)) != 0))) && memory_address_info (XEXP (operands[0], 0), 1))))
return AS1 (not%B0,%h0); return AS1 (not%B0,%h0);
return AS2 (xor%B0,%2,%h0); return AS2 (xor%B0,%2,%h0);
...@@ -4881,13 +4881,14 @@ byte_xor_operation: ...@@ -4881,13 +4881,14 @@ byte_xor_operation:
(not:SI (match_operand:SI 1 "nonimmediate_operand" "0")))] (not:SI (match_operand:SI 1 "nonimmediate_operand" "0")))]
"" ""
"* "*
/* A Pentium NOT is not pariable. Output it only in case of complex {
/* A Pentium NOT is not pariable. Output it only in case of complex
memory address, because XOR will be inpariable anyway because memory address, because XOR will be inpariable anyway because
of immediate/displacement rule. */ of immediate/displacement rule. */
if (TARGET_PENTIUM && !optimize_size if (TARGET_PENTIUM && !optimize_size
&& (GET_CODE (operands[0]) != MEM && (GET_CODE (operands[0]) != MEM
|| memory_address_length (XEXP (operands[0], 0)) == 0)) || memory_address_info (XEXP (operands[0], 0), 1) == 0))
{ {
rtx xops[2]; rtx xops[2];
xops[0] = operands[0]; xops[0] = operands[0];
...@@ -4895,21 +4896,23 @@ if (TARGET_PENTIUM && !optimize_size ...@@ -4895,21 +4896,23 @@ if (TARGET_PENTIUM && !optimize_size
output_asm_insn (AS2 (xor%L0,%1,%0), xops); output_asm_insn (AS2 (xor%L0,%1,%0), xops);
RET; RET;
} }
else else
return AS1 (not%L0,%0);") return AS1 (not%L0,%0);
}")
(define_insn "one_cmplhi2" (define_insn "one_cmplhi2"
[(set (match_operand:HI 0 "nonimmediate_operand" "=rm") [(set (match_operand:HI 0 "nonimmediate_operand" "=rm")
(not:HI (match_operand:HI 1 "nonimmediate_operand" "0")))] (not:HI (match_operand:HI 1 "nonimmediate_operand" "0")))]
"" ""
"* "*
/* A Pentium NOT is not pariable. Output it only in case of complex {
/* A Pentium NOT is not pariable. Output it only in case of complex
memory address, because XOR will be inpariable anyway because memory address, because XOR will be inpariable anyway because
of immediate/displacement rule. */ of immediate/displacement rule. */
if (TARGET_PENTIUM && !optimize_size if (TARGET_PENTIUM && !optimize_size
&& (GET_CODE (operands[0]) != MEM && (GET_CODE (operands[0]) != MEM
|| memory_address_length (XEXP (operands[0], 0)) == 0)) || memory_address_info (XEXP (operands[0], 0), 1) == 0))
{ {
rtx xops[2]; rtx xops[2];
xops[0] = operands[0]; xops[0] = operands[0];
...@@ -4924,7 +4927,7 @@ if (TARGET_PENTIUM && !optimize_size ...@@ -4924,7 +4927,7 @@ if (TARGET_PENTIUM && !optimize_size
output_asm_insn (AS2 (xor%W0,%1,%0), xops); output_asm_insn (AS2 (xor%W0,%1,%0), xops);
RET; RET;
} }
else else
{ {
if (REG_P (operands[0]) if (REG_P (operands[0])
&& i386_cc_probably_useless_p (insn)) && i386_cc_probably_useless_p (insn))
...@@ -4933,20 +4936,22 @@ else ...@@ -4933,20 +4936,22 @@ else
return AS1 (not%L0,%k0); return AS1 (not%L0,%k0);
} }
return AS1 (not%W0,%0); return AS1 (not%W0,%0);
}") }
}")
(define_insn "one_cmplqi2" (define_insn "one_cmplqi2"
[(set (match_operand:QI 0 "nonimmediate_operand" "=qm") [(set (match_operand:QI 0 "nonimmediate_operand" "=qm")
(not:QI (match_operand:QI 1 "nonimmediate_operand" "0")))] (not:QI (match_operand:QI 1 "nonimmediate_operand" "0")))]
"" ""
"* "*
/* A Pentium NOT is not pariable. Output it only in case of complex {
/* A Pentium NOT is not pariable. Output it only in case of complex
memory address, because XOR will be inpariable anyway because memory address, because XOR will be inpariable anyway because
of immediate/displacement rule. */ of immediate/displacement rule. */
if (TARGET_PENTIUM && !optimize_size if (TARGET_PENTIUM && !optimize_size
&& (GET_CODE (operands[0]) != MEM && (GET_CODE (operands[0]) != MEM
|| memory_address_length (XEXP (operands[0], 0)) == 0)) || memory_address_info (XEXP (operands[0], 0), 1) == 0))
{ {
rtx xops[2]; rtx xops[2];
xops[0] = operands[0]; xops[0] = operands[0];
...@@ -4954,8 +4959,9 @@ if (TARGET_PENTIUM && !optimize_size ...@@ -4954,8 +4959,9 @@ if (TARGET_PENTIUM && !optimize_size
output_asm_insn (AS2 (xor%B0,%1,%0), xops); output_asm_insn (AS2 (xor%B0,%1,%0), xops);
RET; RET;
} }
else else
return AS1 (not%B0,%0);") return AS1 (not%B0,%0);
}")
;;- arithmetic shift instructions ;;- arithmetic shift instructions
...@@ -5729,7 +5735,7 @@ else ...@@ -5729,7 +5735,7 @@ else
mask = ((1 << INTVAL (operands[1])) - 1) << INTVAL (operands[2]); mask = ((1 << INTVAL (operands[1])) - 1) << INTVAL (operands[2]);
operands[1] = GEN_INT (mask); operands[1] = GEN_INT (mask);
if (! REG_P (operands[0]) || QI_REG_P (operands[0]) if ((! REG_P (operands[0]) || QI_REG_P (operands[0]))
/* A Pentium test is pairable only with eax. Not with ah or al. */ /* A Pentium test is pairable only with eax. Not with ah or al. */
&& (! REG_P (operands[0]) || REGNO (operands[0]) || !TARGET_PENTIUM && (! REG_P (operands[0]) || REGNO (operands[0]) || !TARGET_PENTIUM
|| optimize_size)) || optimize_size))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment