[PATCH] D155456: [RISCV] Support -m[no-]strict-align options

Kito Cheng via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 3 00:39:04 PDT 2023


kito-cheng accepted this revision.
kito-cheng added a comment.
This revision is now accepted and ready to land.

LGTM



================
Comment at: clang/test/Driver/riscv-features.c:41
+// DEFAULT: "-target-feature" "-unaligned-scalar-mem"
+// DEFAULT-NOT: "-target-feature" "+unaligned-scalar-mem"
+
----------------
wangpc wrote:
> arichardson wrote:
> > This looks a bit fragile, can we just check all -target-feature flags instead and add --implicit-check-not='-target-feature" to Filecheck?
> I'm so sorry that I may not get what you mean, can you tell me what kind of change I need to make?
I would suggest keep this check simple as it, because the `-target-feature` list for RISC-V is very loooooong, the list will increase when we add new extension, and add new extension is kind of relative frequently happened for RISC-V, check the full feature list will increase the maintenance burden for adding new extensions IMO.

e.g.

```
$ clang --target=riscv32-unknown-elf -### %s -march=rv32gv -mstrict-align ~/x.c
 "/scratch1/kitoc/llvm-workspace/build/bin/clang-18" "-cc1" "-triple" "riscv32-unknown-unknown-elf" "-emit-obj" "-mrelax-all" "-dumpdir" "a-" "-disable-free" "-clear-ast-before-backend" "-main-file-name" "x.c" "-mrelocation-model" "static" "-mframe-pointer=all" "-fmath-errno" "-ffp-contract=on" "-fno-rounding-math" "-mconstructor-aliases" "-nostdsysteminc" "-target-cpu" "generic-rv32" "-target-feature" "+m" "-target-feature" "+a" "-target-feature" "+f" "-target-feature" "+d" "-target-feature" "+v" "-target-feature" "+zicsr" "-target-feature" "+zifencei" "-target-feature" "+zve32f" "-target-feature" "+zve32x" "-target-feature" "+zve64d" "-target-feature" "+zve64f" "-target-feature" "+zve64x" "-target-feature" "+zvl128b" "-target-feature" "+zvl32b" "-target-feature" "+zvl64b" "-target-feature" "-c" "-target-feature" "-e" "-target-feature" "-h" "-target-feature" "-svinval" "-target-feature" "-svnapot" "-target-feature" "-svpbmt" "-target-feature" "-xcvalu" "-target-feature" "-xcvbi" "-target-feature" "-xcvbitmanip" "-target-feature" "-xcvmac" "-target-feature" "-xcvsimd" "-target-feature" "-xsfcie" "-target-feature" "-xsfvcp" "-target-feature" "-xtheadba" "-target-feature" "-xtheadbb" "-target-feature" "-xtheadbs" "-target-feature" "-xtheadcmo" "-target-feature" "-xtheadcondmov" "-target-feature" "-xtheadfmemidx" "-target-feature" "-xtheadmac" "-target-feature" "-xtheadmemidx" "-target-feature" "-xtheadmempair" "-target-feature" "-xtheadsync" "-target-feature" "-xtheadvdot" "-target-feature" "-xventanacondops" "-target-feature" "-zawrs" "-target-feature" "-zba" "-target-feature" "-zbb" "-target-feature" "-zbc" "-target-feature" "-zbkb" "-target-feature" "-zbkc" "-target-feature" "-zbkx" "-target-feature" "-zbs" "-target-feature" "-zca" "-target-feature" "-zcb" "-target-feature" "-zcd" "-target-feature" "-zce" "-target-feature" "-zcf" "-target-feature" "-zcmp" "-target-feature" "-zcmt" "-target-feature" "-zdinx" "-target-feature" "-zfh" "-target-feature" "-zfhmin" "-target-feature" "-zfinx" "-target-feature" "-zhinx" "-target-feature" "-zhinxmin" "-target-feature" "-zicbom" "-target-feature" "-zicbop" "-target-feature" "-zicboz" "-target-feature" "-zicntr" "-target-feature" "-zihintpause" "-target-feature" "-zihpm" "-target-feature" "-zk" "-target-feature" "-zkn" "-target-feature" "-zknd" "-target-feature" "-zkne" "-target-feature" "-zknh" "-target-feature" "-zkr" "-target-feature" "-zks" "-target-feature" "-zksed" "-target-feature" "-zksh" "-target-feature" "-zkt" "-target-feature" "-zmmul" "-target-feature" "-zvfh" "-target-feature" "-zvl1024b" "-target-feature" "-zvl16384b" "-target-feature" "-zvl2048b" "-target-feature" "-zvl256b" "-target-feature" "-zvl32768b" "-target-feature" "-zvl4096b" "-target-feature" "-zvl512b" "-target-feature" "-zvl65536b" "-target-feature" "-zvl8192b" "-target-feature" "-experimental-smaia" "-target-feature" "-experimental-ssaia" "-target-feature" "-experimental-zacas" "-target-feature" "-experimental-zfa" "-target-feature" "-experimental-zfbfmin" "-target-feature" "-experimental-zicond" "-target-feature" "-experimental-zihintntl" "-target-feature" "-experimental-ztso" "-target-feature" "-experimental-zvbb" "-target-feature" "-experimental-zvbc" "-target-feature" "-experimental-zvfbfmin" "-target-feature" "-experimental-zvfbfwma" "-target-feature" "-experimental-zvkg" "-target-feature" "-experimental-zvkn" "-target-feature" "-experimental-zvknc" "-target-feature" "-experimental-zvkned" "-target-feature" "-experimental-zvkng" "-target-feature" "-experimental-zvknha" "-target-feature" "-experimental-zvknhb" "-target-feature" "-experimental-zvks" "-target-feature" "-experimental-zvksc" "-target-feature" "-experimental-zvksed" "-target-feature" "-experimental-zvksg" "-target-feature" "-experimental-zvksh" "-target-feature" "-experimental-zvkt" "-target-feature" "+relax" "-target-feature" "-save-restore" "-target-abi" "ilp32d" "-msmall-data-limit" "8" "-debugger-tuning=gdb" "-fcoverage-compilation-dir=/home/kitoc/llvm-workspace/llvm-project/clang/test" "-resource-dir" "/scratch1/kitoc/llvm-workspace/build/lib/clang/18" "-internal-isystem" "/scratch1/kitoc/llvm-workspace/build/lib/clang/18/include" "-internal-isystem" "/scratch1/kitoc/llvm-workspace/build/bin/../lib/clang-runtimes/riscv32-unknown-elf/include" "-fdebug-compilation-dir=/home/kitoc/llvm-workspace/llvm-project/clang/test" "-ferror-limit" "19" "-fno-signed-char" "-fgnuc-version=4.2.1" "-fcolor-diagnostics" "-faddrsig" "-o" "/tmp/x-83967d.o" "-x" "c" "/home/kitoc/x.c"
 "/home/kitoc/llvm-workspace/build/bin/ld.lld" "/tmp/x-83967d.o" "-Bstatic" "-L/scratch1/kitoc/llvm-workspace/build/bin/../lib/clang-runtimes/riscv32-unknown-elf/lib" "-L/scratch1/kitoc/llvm-workspace/build/bin/../lib/clang-runtimes/riscv32-unknown-elf/lib" "-L/scratch1/kitoc/llvm-workspace/build/lib/clang/18/lib/baremetal" "-lc" "-lm" "-lclang_rt.builtins-riscv32" "-X" "-o" "a.out"

```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D155456/new/

https://reviews.llvm.org/D155456



More information about the cfe-commits mailing list