llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.62k stars 11.83k forks source link

MIPS: P5600 should use nan2008, fp64, msa #91948

Open wzssyqa opened 5 months ago

wzssyqa commented 5 months ago
$ ./bin/clang --target=mips -march=p5600 -mmsa -S pp.c -v
clang version 19.0.0git (git@github.com:wzssyqa/llvm-project.git 5ca368501ae81ca364f66ee6053aa4f8104fdbdd)
Target: mips
Thread model: posix
InstalledDir: /data/syq/git-push/llvm-project.github/build-amd64/bin
Build config: +unoptimized, +assertions
 (in-process)
 "/data/syq/git-push/llvm-project.github/build-amd64/bin/clang-19" -cc1 -triple mips -S -disable-free -clear-ast-before-backend -main-file-name pp.c -mrelocation-model static -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -target-cpu p5600 -target-feature -noabicalls -target-feature +msa -target-feature +fp64 -target-abi o32 -mfloat-abi hard -debugger-tuning=gdb -fdebug-compilation-dir=/data/syq/git-push/llvm-project.github/build-amd64 -v -fcoverage-compilation-dir=/data/syq/git-push/llvm-project.github/build-amd64 -resource-dir /data/syq/git-push/llvm-project.github/build-amd64/lib/clang/19 -ferror-limit 19 -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fno-relaxed-template-template-args -fcolor-diagnostics -faddrsig -o pp.s -x c pp.c
error: '-mfp64' can only be used if the target supports the mfhc1 and mthc1 instructions

$ ./bin/clang --target=mips -march=p5600 -S pp.c -v
clang version 19.0.0git (git@github.com:wzssyqa/llvm-project.git 5ca368501ae81ca364f66ee6053aa4f8104fdbdd)
Target: mips
Thread model: posix
InstalledDir: /data/syq/git-push/llvm-project.github/build-amd64/bin
Build config: +unoptimized, +assertions
 (in-process)
 "/data/syq/git-push/llvm-project.github/build-amd64/bin/clang-19" -cc1 -triple mips -S -disable-free -clear-ast-before-backend -main-file-name pp.c -mrelocation-model static -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -target-cpu p5600 -target-feature -noabicalls -target-abi o32 -mfloat-abi hard -debugger-tuning=gdb -fdebug-compilation-dir=/data/syq/git-push/llvm-project.github/build-amd64 -v -fcoverage-compilation-dir=/data/syq/git-push/llvm-project.github/build-amd64 -resource-dir /data/syq/git-push/llvm-project.github/build-amd64/lib/clang/19 -ferror-limit 19 -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fno-relaxed-template-template-args -fcolor-diagnostics -faddrsig -o pp.s -x c pp.c
clang -cc1 version 19.0.0git based upon LLVM 19.0.0git default target x86_64-unknown-linux-gnu
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /data/syq/git-push/llvm-project.github/build-amd64/lib/clang/19/include
 /usr/include
End of search list.
llvmbot commented 5 months ago

@llvm/issue-subscribers-backend-mips

Author: YunQiang Su (wzssyqa)

``` $ ./bin/clang --target=mips -march=p5600 -mmsa -S pp.c -v clang version 19.0.0git (git@github.com:wzssyqa/llvm-project.git 5ca368501ae81ca364f66ee6053aa4f8104fdbdd) Target: mips Thread model: posix InstalledDir: /data/syq/git-push/llvm-project.github/build-amd64/bin Build config: +unoptimized, +assertions (in-process) "/data/syq/git-push/llvm-project.github/build-amd64/bin/clang-19" -cc1 -triple mips -S -disable-free -clear-ast-before-backend -main-file-name pp.c -mrelocation-model static -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -target-cpu p5600 -target-feature -noabicalls -target-feature +msa -target-feature +fp64 -target-abi o32 -mfloat-abi hard -debugger-tuning=gdb -fdebug-compilation-dir=/data/syq/git-push/llvm-project.github/build-amd64 -v -fcoverage-compilation-dir=/data/syq/git-push/llvm-project.github/build-amd64 -resource-dir /data/syq/git-push/llvm-project.github/build-amd64/lib/clang/19 -ferror-limit 19 -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fno-relaxed-template-template-args -fcolor-diagnostics -faddrsig -o pp.s -x c pp.c error: '-mfp64' can only be used if the target supports the mfhc1 and mthc1 instructions $ ./bin/clang --target=mips -march=p5600 -S pp.c -v clang version 19.0.0git (git@github.com:wzssyqa/llvm-project.git 5ca368501ae81ca364f66ee6053aa4f8104fdbdd) Target: mips Thread model: posix InstalledDir: /data/syq/git-push/llvm-project.github/build-amd64/bin Build config: +unoptimized, +assertions (in-process) "/data/syq/git-push/llvm-project.github/build-amd64/bin/clang-19" -cc1 -triple mips -S -disable-free -clear-ast-before-backend -main-file-name pp.c -mrelocation-model static -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -target-cpu p5600 -target-feature -noabicalls -target-abi o32 -mfloat-abi hard -debugger-tuning=gdb -fdebug-compilation-dir=/data/syq/git-push/llvm-project.github/build-amd64 -v -fcoverage-compilation-dir=/data/syq/git-push/llvm-project.github/build-amd64 -resource-dir /data/syq/git-push/llvm-project.github/build-amd64/lib/clang/19 -ferror-limit 19 -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fno-relaxed-template-template-args -fcolor-diagnostics -faddrsig -o pp.s -x c pp.c clang -cc1 version 19.0.0git based upon LLVM 19.0.0git default target x86_64-unknown-linux-gnu #include "..." search starts here: #include <...> search starts here: /usr/local/include /data/syq/git-push/llvm-project.github/build-amd64/lib/clang/19/include /usr/include End of search list. ```
yingopq commented 2 months ago

@wzssyqa NaN2008 is the default for P5600 althoufh -mnan=2008 is not setted?

yingopq commented 2 months ago

In the mips32r5 document,

The MIPS SIMD Architecture (MSA) module is introduced for all of these base architectures.
...
As of Release 5 of the Architecture, if floating point is implemented then FR=1 is required. I.e. the 64-bit FPU,
with the FR=1 64-bit FPU register model, is required. The FR=0 32-bit FPU register model continues to be
required.3

and in gcc, 20240816-172650

So I did not know if we should use nan2008.

yingopq commented 1 month ago

If we need open nan2008?