llvm / llvm/llvm-project

__arithmetic_fence reject sizeless SVE vector type

Open
#223,145 1 comment 0 reactions 0 assignees View on GitHub
clang:frontend
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

https://gcc.godbolt.org/z/PEvq1qnfo

```c++
// similar builtin in gcc accept sizeless sve
svfloat64_t test(svfloat64_t x) {
return __builtin_assoc_barrier(x);
}
```

```c++
// clang++ support fixed size vector
using fixed_t =
svfloat64_t __attribute__((arm_sve_vector_bits(256)));

fixed_t test(fixed_t x) {
return __arithmetic_fence(x);
}
```

```c++
// clang++ reject sizeless vector type
static_assert(__has_builtin(__arithmetic_fence));

svfloat64_t test(svfloat64_t x) {
return __arithmetic_fence(x);
}
```

error message:

```text
:30:32: error: invalid operand of type 'svfloat64_t' (aka '__SVFloat64_t') where floating, complex or a vector of such types is required
30 | return __arithmetic_fence(x);
| ^
1 error generated.
Compiler returned: 1
```

Contributor guide

Open the contributing guide

Research direction

No repository file or test entry point is named. Start by reproducing the Godbolt examples and trace the __arithmetic_fence operand validation, comparing its handling with __builtin_assoc_barrier and fixed-size SVE vectors. Done means sizeless SVE vector operands are rejected with the intended diagnostic while supported fixed-size vectors continue to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.