compiler-explorer / compiler-explorer/compiler-explorer
[BUG]: clang RISC-V `-mcpu` effectively ignored due to default `-march=rv64gc`
- Dominant language
- TypeScript
- Stars
- 19.1k
- Forks
- 2.1k
- Avg merge
- 3d 15h
- Merged PRs (30d)
- 67
Description
### Describe the bug
For "RISC-V rv64gc clang (...)" compilers, using flags such as `-O3 -mcpu=sifive-p670` doesn't result in enabling the given CPU architecture, due to the default `-march=rv64gc` flag.
### Steps to reproduce
See reproduction link
### Expected behavior
The clang compiler sees `clzw` / vector use as gcc does. Can also see the desired behavior in an x86-64 clang compiler manually overridden to do RISC-V via `--target=riscv64-linux-gnu -O3 -mcpu=sifive-p670`.
A potential fix would be to not automatically add the default `-march=rv64gc` flag if `-mcpu` is present. (or perhaps not add the `-march` at all? Pretty sure it's the default anyways)
### Reproduction link
https://riscvc.godbolt.org/z/sWoWxKEn4
### Screenshots
Not applicable
### Operating System
_No response_
### Browser version
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.