stdarch icon indicating copy to clipboard operation
stdarch copied to clipboard

Change Status flags in EFLAGS(ZF)

Open minybot opened this issue 3 years ago • 3 comments

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?

minybot avatar Mar 03 '22 00:03 minybot

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.

bjorn3 avatar Mar 03 '22 07:03 bjorn3

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

minybot avatar Mar 04 '22 19:03 minybot

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

Amanieu avatar Mar 04 '22 23:03 Amanieu