Closed saitouena closed 5 years ago
Thanks for filing this issue! I actually don't think %ecx
needs to be zeroed out here. We need to zero out the upper bytes of %eax
because it is holds the final result of the AND
expression, which will be used later in the program - for example, it might be a function's return value, or might be saved in a variable.
However, our compiler only uses %ecx
to store intermediate results, so we know the value currently stored in %cl
isn't ever examined again - it's only used in the final andb
instruction, which doesn't look at the upper bytes. Therefore, those bytes don't need to be zeroed out.
Please feel free to reopen this issue if you have more questions or if I've misunderstood you.
I mistook. You are right.
it's only used in the final andb instruction, which doesn't look at the upper bytes.
I didn't know this.
In code generation phase of Logical AND, this code:
should be:
I think
movl $0, %ecx
shoud be.