[llvm-dev] EFLAGS

Craig Topper via llvm-dev llvm-dev at lists.llvm.org
Wed Jan 20 11:25:47 PST 2021


There can only be one "set" operator per pattern list. I think we usually
do "(implicit EFLAGS)" after the set, but I don't think it is required. I
think it allows tablegen to infer Defs = [EFLAGS] from the (implicit
EFLAGS), but I don't know of any place that doesn't just list the Defs
explicitly.

~Craig


On Wed, Jan 20, 2021 at 11:14 AM Chris Sears via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> What is the difference between
>
>     Uses = [EFLAGS] + Defs = [EFLAGS]
>
> and their mention in selection patterns?
>
>     [(set GR64:$dst, EFLAGS, (X86smul_flag GR64:$src1, GR64:$src2))]
>
> Basically, my problem is that I have weird instructions which undef the
> EFLAGS register, leaving EFLAGS in an unknown state. For example:
>
>     cmp x, y
>     beq z           ; this is good because EFLAGS is defined
>
>     cmp x, y
>     weird_inst.   ; undefs EFLAGS, leaves EFLAGS in a undefined state
>     beq z           ; this is bad because EFLAGS is undefined
>
> Is it enough to just say Defs = [EFLAGS] for the Instruction def of
> weird_inst? Or is it necessary for the pattern to say something like
> [(set EFLAGS, undef)] as well?
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210120/f101364a/attachment.html>


More information about the llvm-dev mailing list