[Mlir-commits] [mlir] [mlir][ptr] Add nontemporal field to ptr.masked_load (PR #204987)

lonely eagle llvmlistbot at llvm.org
Fri Jul 17 01:07:42 PDT 2026


linuxlonelyeagle wrote:

> This is indeed a bit confusing. The nontemporal flag is just metadata so nothing prevents us from adding it to masked loads / stores. However, it is indeed a good question if this is something that the LLVM backends take into account?
> 
> I see some SVE tests that use nontemporal metadata but it is unclear to me if that is intentional or just a random artifact of these tests.
> 
> @linuxlonelyeagle do you have a concrete use case for this? Do you know of a backend that uses the metadata?


```
define void @test_x86_store_nontemporal(<4 x float>* %dst, <4 x float> %val) {
  store <4 x float> %val, <4 x float>* %dst, align 16, !nontemporal !0
  ret void
}

!0 = !{i32 1}
```
we use opt, it will be 
```
test_x86_store_nontemporal:             # @test_x86_store_nontemporal
        vmovntps        xmmword ptr [rdi], xmm0
        ret
```

```
define void @test_x86_store(<4 x float>* %dst, <4 x float> %val) {
  store <4 x float> %val, <4 x float>* %dst, align 16
  ret void
}

!0 = !{i32 1}
```
it will be
```
test_x86_store:                         # @test_x86_store
        vmovaps xmmword ptr [rdi], xmm0
        ret
```
You can see https://www.felixcloutier.com/x86/movntps.

For the record, the successful test case was an unmasked store. I was unable to generate any non-temporal instructions for the masked counterpart, even with strict alignment requirements.
My understanding is that this behavior is highly target-dependent. If the target ISA supports the masked non-temporal instruction and the LLVM backend has the matching pattern implemented, it will be generated. Otherwise, the nontemporal metadata is simply ignored.


https://github.com/llvm/llvm-project/pull/204987


More information about the Mlir-commits mailing list