Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change Status flags in EFLAGS(ZF) #1287

Open
minybot opened this issue Mar 3, 2022 · 3 comments
Open

Change Status flags in EFLAGS(ZF) #1287

minybot opened this issue Mar 3, 2022 · 3 comments

Comments

@minybot
Copy link
Contributor

minybot commented Mar 3, 2022

Is it possible to change ZF flag using asm!?

For intrinsics _mm512_kortestc:

Description
Performs bitwise OR between k1 and k2, storing the result in dst. CF flag is set if dst consists of all 1's.

Operation
dst[15:0] := k1[15:0] | k2[15:0]
IF PopCount(dst[15:0]) == 16
SetCF()
FI

Is this doable in the nightly version?

@bjorn3
Copy link
Member

bjorn3 commented Mar 3, 2022

You may change it within the asm block if you haven't used the preserves_flags option. There is no guarantee that it will remain set after the asm block ends AFAIK. You should put the kortestc and the instruction using the flag in the same asm block to prevent any instruction clobbering it to get in between.

@minybot
Copy link
Contributor Author

minybot commented Mar 4, 2022

Could you give me some hints how to modify EFLAGS?
EFlags register: Bit #6 - zero flag
It's like %eflags[5]?

@Amanieu
Copy link
Member

Amanieu commented Mar 4, 2022

You can read the value of the zero flag by using the setz or setnz instructions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants