Extensions
Mnemonics
CTESTO, CTESTNO, CTESTB, CTESTC, CTESTNAE, CTESTNB, CTESTNC, CTESTAE, CTESTZ, CTESTE, CTESTNZ, CTESTNE, CTESTBE, CTESTNA, CTESTNBE, CTESTA, CTESTS, CTESTNS, CTESTT, CTESTF, CTESTL, CTESTNGE, CTESTNL, CTESTGE, CTESTLE, CTESTNG, CTESTNLE, CTESTG
Forms
8 (8 EVEX)
Data
Intel XED v2026.08.23

CTESTscc is a TEST that runs only if a condition on the current flags holds. It lets a compiler join a == 1 && (b & c) without a branch: one flag-setting compare, then a test that either updates the flags from its operands or, when the first half has already failed, loads them with a value that gives the answer. It is CCMPscc with TEST in place of CMP, and it writes no register.

The source condition uses the usual condition codes, with two changes: codes 1010b and 1011b, parity elsewhere, mean always true and always false, so PF cannot be tested. CTESTT is then a plain TEST, and CTESTF just writes the flags.

  • If the condition holds, the flags come from src1 & src2 as for TEST: OF and CF cleared, SF, ZF and PF from the result, AF undefined.
  • If not, OF, SF, ZF and CF take the four-bit default flags value (dfv) in the instruction. PF copies its CF bit and AF is cleared.

The forms match TEST’s: a register or memory operand of 8, 16, 32 or 64 bits with a register or an immediate, which is at most 32 bits and sign-extended at 64. A memory operand is read whatever the condition says, so it can fault; only CFCMOVcc suppresses faults this way.

In our builds

Clang 23 at -O2 with -mapxf compiled a == 1 && (b & c) to cmp edi, 1, cteste {dfv=zf} edx, esi and setzune al. If a is 1 the test runs; otherwise dfv sets ZF, which SETNE then reads as false. a > 3 || (b & c) became cmp edi, 4 and ctestl {dfv=}, with every default flag clear, so that SETNE reads true when the first half has decided it. With a load, a == 1 && (*m & 8), Clang kept a branch, which fits the rule above. GCC 14 accepts -mapxf but used no CTESTscc in any of these.

The condition instructions need APX_NCI_NDD_NF as well as APX_F, as the APX page explains.

Forms

Every encoding of CTESTscc that Intel XED knows, one row per XED instruction form (iform). How to read the notation.
InstructionEncodingRequires
CTESTscc {dfv} r8, r8 CTESTscc_GPR8i8_GPR8i8_DFV_APX_N3EVEX.LLZ.NP.MAP4.WIG 84 /r SC=sccAPX_F + APX_NCI_NDD_NF
CTESTscc {dfv} m8, r8 CTESTscc_MEMi8_GPR8i8_DFV_APX_N3EVEX.LLZ.NP.MAP4.WIG 84 /r SC=sccAPX_F + APX_NCI_NDD_NF
CTESTscc {dfv} r16/32/64, r16/32/64 CTESTscc_GPRv_GPRv_DFV_APX_N3EVEX.LLZ.NP.MAP4.SCALABLE 85 /r SC=sccAPX_F + APX_NCI_NDD_NF
CTESTscc {dfv} m16/32/64, r16/32/64 CTESTscc_MEMv_GPRv_DFV_APX_N3EVEX.LLZ.NP.MAP4.SCALABLE 85 /r SC=sccAPX_F + APX_NCI_NDD_NF
CTESTscc {dfv} r8, imm8 CTESTscc_GPR8i8_IMM8_DFV_APX_N3EVEX.LLZ.NP.MAP4.WIG F6 /0 ib SC=scc
EVEX.LLZ.NP.MAP4.WIG F6 /1 ib SC=scc
APX_F + APX_NCI_NDD_NF
CTESTscc {dfv} m8, imm8 CTESTscc_MEMi8_IMM8_DFV_APX_N3EVEX.LLZ.NP.MAP4.WIG F6 /0 ib SC=scc
EVEX.LLZ.NP.MAP4.WIG F6 /1 ib SC=scc
APX_F + APX_NCI_NDD_NF
CTESTscc {dfv} r16/32/64, imm16/32 CTESTscc_GPRv_IMMz_DFV_APX_N3EVEX.LLZ.NP.MAP4.SCALABLE F7 /0 iw/id SC=scc
EVEX.LLZ.NP.MAP4.SCALABLE F7 /1 iw/id SC=scc
APX_F + APX_NCI_NDD_NF
CTESTscc {dfv} m16/32/64, imm16/32 CTESTscc_MEMv_IMMz_DFV_APX_N3EVEX.LLZ.NP.MAP4.SCALABLE F7 /0 iw/id SC=scc
EVEX.LLZ.NP.MAP4.SCALABLE F7 /1 iw/id SC=scc
APX_F + APX_NCI_NDD_NF

Operation

What the forms do, in pseudocode that our tests run against results recorded on real processors. How to read.

r = src1 & sext(src2)            # memory is read, and can fault, even
                                 # when the condition is false
if cond(CC):
    of = cf = 0                  # as TEST src1, src2
    sf = msb(r)
    zf = r == 0
    pf = parity(r)
    af = UNDEFINED
else:
    of = dfv >> 3 & 1            # the flags of {dfv}
    sf = dfv >> 2 & 1
    zf = dfv >> 1 & 1
    cf = dfv & 1
    pf = dfv & 1                 # PF as CF
    af = 0

Not run on a processor: none of these processors has APX.

Operands

What each form reads and writes, as Intel XED records it: the operands of its syntax, in order, and the implicit ones that the syntax does not name. How to read.
OperandKindAction
CTESTscc {dfv} r/m8, r8 CTESTscc {dfv} r/m16/32/64, r16/32/64
r/m8/16/32/64explicitread
r8/16/32/64explicitread
RFLAGSimplicitwrite
CTESTscc {dfv} r/m8, imm8 CTESTscc {dfv} r/m16/32/64, imm16/32
r/m8/16/32/64explicitread
imm8/16/32explicitread
RFLAGSimplicitwrite

Flags

M modified, 0 cleared, U undefined; blank: not affected. How to read.
OFSFZFAFPFCF
All forms
0MMUM0

Exceptions

The exception class is XED's name for the set of exception conditions that a form follows. How to read.

All forms
APX-EVEX-CCMP

CPUID and processors

Each form belongs to an XED ISA set. A form can be used when the processor reports every CPUID bit of one of its ISA set's alternatives.

CPUID requirements and processors of the XED ISA sets above. Alternatives are separated by “or”; processors follow XED’s chip model, whose AMD processors end with Zen 2, and the CPU data of this site for Zen 3 to Zen 6.
ISA setCPUIDProcessors
APX_F_N3

APX_F + APX_NCI_NDD_NF
CPUID.(EAX=07H,ECX=1):EDX[21] APX_F
CPUID.(EAX=29H,ECX=0):EBX[0] APX_NCI_NDD_NF

Nova Lake, Diamond Rapids

More APX instructions

All 88 APX instructions

Sources

  1. Intel XED v2026.08.23 (commit 0bcb6237345c): forms, encodings, operands, flags, exception classes, attributes, ISA sets, CPUID bits and chip model.
  2. Intel Advanced Performance Extensions (Intel APX) Architecture Specification, revision 9.0 (355828-009, August 2026)

The tables are derived from Intel XED, Copyright Intel Corporation, licensed under the Apache License 2.0; x86-64.net converted and reformatted them. The text is our own.