[LLVMdev] Intrinsics __readeflags and __writeeflags

Alexey Volkov avolkov.intel at gmail.com
Tue Dec 17 01:02:43 PST 2013


Hello all,

I am trying to implement intrinsics __readeflags and __writeeflags reading
and writing EFLAGS register on x86.
These intrinsics expand to two instructions popf and push to register for
__readeflags and pushf and pop to register for __writeeflags.
These instructions are not connected explicitly so I can't use patterns in
.td file to match intrinsics.

I tried to implement custom expansion making COPY DAG node with copy from
EFLAGS to register.
But this solution works only at -O0 level and failed at -O1 and higher: the
problem is that Post-RA pseudo instruction expansion pass seems to be
called only at -O0.

Another way is to expand intrinsics to DAG nodes for each PUSH, POP, PUSHF
and POPF instructions.
This will add 4 new X86ISD types for DAG nodes for these instructions.

What is the proper way to expand these intrinsics?

-- 
Alexey Volkov
Intel Corporation
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131217/3c834895/attachment.html>


More information about the llvm-dev mailing list