Hi!

On Fri, Jul 08, 2022 at 08:14:58AM +0100, Roger Sayle wrote:
> This patch adds support for x86's single-byte encoded stc (set carry flag)
> and clc (clear carry flag) instructions to i386.md.

Maybe add a test for clc as well?  Because:

> +(define_insn "x86_clc"
> +  [(set (reg:CCC FLAGS_REG) (const_int 0))]
> +  ""
> +  "stc"
> +  [(set_attr "length" "1")
> +   (set_attr "length_immediate" "0")
> +   (set_attr "modrm" "0")])

Spot the problem :-)

> +/* { dg-final { scan-assembler "stc" } } */

This checks if the substring "stc" occurs anywhere in the generated
assembler code.  More robust is to use scan-assembler-times, and to use
\mstc\M (same as \<stc\> in some other languages, or \bstc\b in Perl).


Segher

Reply via email to