[ Previous | Next | Contents | Home | Search ]
AIX Version 4.3 Assembler Language Reference

clf (Cache Line Flush) Instruction


Writes a line of modified data from the data cache to main memory, or invalidates cached instructions or unmodified data.

Note: The clf instruction is supported only in the POWER architecture.


clf RA,RB


The clf instruction calculates an effective address (EA) by adding the contents of general-purpose register (GPR) RA to the contents of GPR RB. If the RA field is 0, EA is the sum of the contents of RB and 0. If the RA field is not 0 and if the instruction does not cause a data storage interrupt, the result of the operation is placed back into GPR RA.

Consider the following when using the clf instruction:

The clf instruction has one syntax form and does not effect the Fixed-Point Exception register. If the Record (Rc) bit is set to 1, Condition Register Field 0 is undefined.


RA Specifies the source general-purpose register for EA calculation and, if RA is not GPR 0, the target general-purpose register for operation.
RB Specifies the source general-purpose register for EA calculation.


The processor is not required to keep instruction storage consistent with data storage. The following code executes storage synchronization instructions prior to executing an modified instruction:

# Assume that instruction A is assigned to storage location
# ox0033 0020.
# Assume that the storage location to which A is assigned
# contains 0x0000 0000.
# Assume that GPR 3 contains 0x0000 0020.
# Assume that GPR 4 contains 0x0033 0020.
# Assume that GPR 5 contains 0x5000 0020.
st      R5,R4,R3         # Store branch instruction in memory
clf     R4,R3            # Flush A from cache to main memory
dcs                      # Ensure clf is complete
ics                      # Discard prefetched instructions
b       0x0033 0020      # Go execute the new instructions

After the store, but prior to the execution of the clf, dcs, and ics instructions, the copy of A in the cache contains the branch instruction. However, it is possible that the copy of A in main memory still contains 0. The clf instruction copies the new instruction back to main memory and invalidates the cache line containing location A in both the instruction and data caches. The sequence of the dcs instruction followed by the ics instruction ensures that the new instruction is in main memory and that the copies of the location in the data and instruction caches are invalid before fetching the next instruction.

Related Information

The clcs (Cache Line Compute Size) instruction, cli (Cache Line Invalidate) instruction, dcbf (Data Cache Block Flush) instruction, dcbi (Data Cache Block Invalidate) instruction, dcbst (Data Cache Block Store) instruction, dcbt (Data Cache Block Touch) instruction, dcbtst (Data Cache Block Touch for Store) instruction, dcbz or dclz (Data Cache Block Set to Zero) instruction, dclst (Data Cache Line Store) instruction, icbi (Instruction Cache Block Invalidate) instruction, sync (Synchronize) or dcs (Data Cache Synchronize) instruction.

Processing and Storage: Overview.

[ Previous | Next | Contents | Home | Search ]