| Issue |
175206
|
| Summary |
[ARM] ARM926 "Test and Clean" D Cache operations not usable
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
jdeguire
|
Section 2.3.8 of the ARM926EJ-S Technical Reference Manual shows a special encoding of the MRC instruction that uses R15 as an operand. This provides a couple of special "Test and Clean" operations for the data cache that allow it to be cleaned more efficiently than just cleaning the whole thing. However, LLVM does not allow R15 to be used with MRC and so this encoding is not usable.
I see this on LLVM 21.1.5. Here's a Compiler Explorer link showing the issue on LLVM trunk: https://www.godbolt.org/z/E5bG17vqW
Here the relevant text from the ARM926EJ-S Technical Reference Manual:
> **Test and clean operations**
>
> The test and clean DCache instruction provides an efficient way to clean the entire
> DCache using a simple loop. The test and clean DCache instruction tests a number of
> lines in the DCache to determine if any of them are dirty. If any dirty lines are found,
> then one of those lines is cleaned. The test and clean DCache instruction also returns the
> status of the entire DCache in bit 30.
>
> **Note**
> The test and clean DCache instruction, MRC p15, 0, r15, c7, c10, 3, is a special
> encoding that uses r15 as a destination operand. However, the PC is not changed by
> using this instruction. This MRC instruction also sets the condition code flags.
>
> If the cache contains any dirty lines, bit 30 is set to 0. If the cache contains no dirty lines,
> bit 30 is set to 1. This means that you can use the following loop to clean the entire
> DCache:
>
> ```
> tc_loop: MRC p15, 0, r15, c7, c10, 3 ; test and clean
> BNE tc_loop
> ```
>
> The test, clean, and invalidate DCache instruction is the same as test and clean DCache,
> except that when the entire cache has been cleaned, it is invalidated. This means that
> you can use the following loop to clean and invalidate the entire DCache:
> tci_loop:
>
> ```
> tci_loop: MRC p15, 0, r15, c7, c14, 3 ; test clean and invalidate
> BNE tci_loop
> ```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs