This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Support -m[no-]strict-align options
ClosedPublic

Authored by wangpc on Jul 17 2023, 6:08 AM.

Details

Summary

To match GCC.

Options -m[no-]strict-align are aliases of -m[no-]unaligned-access
in clang, but there is no corresponding option in GCC.

Support of -m[no-]unaligned-access in GCC may be needed to align
Clang/GCC.

Diff Detail

Event Timeline

wangpc created this revision.Jul 17 2023, 6:08 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 17 2023, 6:08 AM
wangpc requested review of this revision.Jul 17 2023, 6:08 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 17 2023, 6:08 AM
wangpc updated this revision to Diff 540989.Jul 17 2023, 6:29 AM

Add +unaligned-vector-mem if V exists.

wangpc updated this revision to Diff 540994.Jul 17 2023, 6:34 AM

Remove includes.

Update ReleaseNotes?

wangpc updated this revision to Diff 541374.Jul 18 2023, 12:59 AM

Update ReleaseNotes.

arichardson added inline comments.Jul 18 2023, 11:00 PM
clang/test/Driver/riscv-features.c
43

This looks a bit fragile, can we just check all -target-feature flags instead and add --implicit-check-not='-target-feature" to Filecheck?

wangpc added inline comments.Jul 19 2023, 9:27 AM
clang/test/Driver/riscv-features.c
43

I'm so sorry that I may not get what you mean, can you tell me what kind of change I need to make?

kito-cheng accepted this revision.Aug 3 2023, 12:39 AM

LGTM

clang/test/Driver/riscv-features.c
43

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"
This revision is now accepted and ready to land.Aug 3 2023, 12:39 AM
wangpc updated this revision to Diff 546772.Aug 3 2023, 2:43 AM

Rebase since ReleaseNotes.rst is changed.

This revision was landed with ongoing or failed builds.Aug 3 2023, 3:13 AM
This revision was automatically updated to reflect the committed changes.