On Fri, Oct 2, 2015 at 12:58 PM, Alex <alexinbeijing@gmail.com> wrote:
On Fri, Oct 2, 2015 at 12:19 PM, Rich Felker <dalias@libc.org> wrote:
On Fri, Oct 02, 2015 at 12:02:03PM +0200, Alex Dowad wrote:
> +# this does NOT exhaustively check for all possible instructions which could
> +# overwrite a register value inherited from the caller (just the common ones)
> +/mov.*,%r(ax|bx|cx|dx|si|di|bp|8|9|10|11|12|13|14|15)/  { trashed(get_reg2()) }
> +/(add|addl|sub|subl|and|or|xor|lea|sal|sar|shl|shr) %r(ax|bx|cx|dx|si|di|bp|8|9|10|11|12|13|14|15),/ {
> +  trashed(get_reg1())
> +}

This looks wrong but maybe it's already wrong in existing code. Why
are you marking the first operand as trashed rather than the second?

You're absolutely right! 

I'm pretty sure the reason I made this mistake was because of reading Intel's developer manuals, where they write the destination register as the first operand, and then absentmindedly applying the GNU syntax used by musl.