llvm-project/clang/test/CodeGen/X86/prefetchi-error.c
Timothy Herchen e644f5fd9e
[clang] [Sema] Check argument range for prefetchi* intrinsics (#149745)
Fixes https://github.com/llvm/llvm-project/issues/144857 . I can create
a test if desired, but I think the fix is trivial enough.

<img width="805" height="105" alt="image"
src="https://github.com/user-attachments/assets/aaee8e5f-6e65-4f04-b8b9-e4ae1434d958"
/>
2025-07-22 15:25:17 +08:00

8 lines
291 B
C

// RUN: %clang_cc1 %s -ffreestanding -triple=x86_64-unknown-unknown -target-feature +prefetchi -fsyntax-only -verify
#include <immintrin.h>
void test_invalid_prefetchi(void* p) {
__builtin_ia32_prefetchi(p, 1); // expected-error {{argument value 1 is outside the valid range [2, 3]}}
}