i386.md comparision pattern confusion / questions
John Wehle
john@feith.com
Thu May 21 23:46:00 GMT 1998
I'm slightly confused by the following pattern from i386.md:
(define_insn "cmpsi_1"
[(set (cc0)
(compare (match_operand:SI 0 "nonimmediate_operand" "mr,r")
(match_operand:SI 1 "general_operand" "ri,mr")))]
"GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM"
"*
{
if (CONSTANT_P (operands[0]) || GET_CODE (operands[1]) == MEM)
{
cc_status.flags |= CC_REVERSED;
return AS2 (cmp%L0,%0,%1);
}
return AS2 (cmp%L0,%1,%0);
}")
What I'm confused about is:
1) When will CONSTANT_P (operands[0]) ever be true? The predicate
requires a nonimmediate operand, doesn't this imply that operand
0 can't be a constant? I'm assuming here that CONSTANT_P is
only true if operand 0 is a constant.
2) Why is it neccessary to reverse the comparison if operand 1
refers to memory? My impression from the Intel Instruction Set
reference is that cmp will accept a memory operand for either
operand 0 or operand 1 when the other operand is a register.
-- John
-------------------------------------------------------------------------
| Feith Systems | Voice: 1-215-646-8000 | Email: john@feith.com |
| John Wehle | Fax: 1-215-540-5495 | |
-------------------------------------------------------------------------
More information about the Gcc-bugs
mailing list