]> git.ipfire.org Git - thirdparty/gcc.git/commit
LoongArch: Implement target attribute.
authorLulu Cheng <chenglulu@loongson.cn>
Tue, 7 Jan 2025 03:42:25 +0000 (11:42 +0800)
committerLulu Cheng <chenglulu@loongson.cn>
Tue, 21 Jan 2025 09:36:28 +0000 (17:36 +0800)
commitc01ad91886527f685e67037ab4d36a6b0cd07c08
treef260b8683a789850ef9dc0ac0e16bbd776db14b8
parentf3d884da1280e211f48be0619e5d2f1ee7eeee87
LoongArch: Implement target attribute.

Add function attributes support for LoongArch.

Currently, the following items are supported:

        __attribute__ ((target ("{no-}strict-align")))
        __attribute__ ((target ("cmodel=")))
        __attribute__ ((target ("arch=")))
        __attribute__ ((target ("tune=")))
        __attribute__ ((target ("{no-}lsx")))
        __attribute__ ((target ("{no-}lasx")))

This implementation is derived from AArch64.

gcc/ChangeLog:

* attr-urls.def: Regenerate.
* config.gcc: Add loongarch-target-attr.o to extra_objs.
* config/loongarch/loongarch-protos.h
(loongarch_option_valid_attribute_p): Function declaration.
(loongarch_option_override_internal): Likewise.
* config/loongarch/loongarch.cc
(loongarch_option_override_internal): Delete the modifications
to target_option_default_node and target_option_current_node.
(loongarch_set_current_function): Add annotation information.
(loongarch_option_override): add assignment operations to
target_option_default_node and target_option_current_node.
(TARGET_OPTION_VALID_ATTRIBUTE_P): Define.
* config/loongarch/t-loongarch: Add compilation of target file
loongarch-target-attr.o.
* doc/extend.texi: Add description information of LoongArch
Function Attributes.
* config/loongarch/loongarch-target-attr.cc: New file.

gcc/testsuite/ChangeLog:

* gcc.target/loongarch/arch-func-attr-1.c: New test.
* gcc.target/loongarch/cmodel-func-attr-1.c: New test.
* gcc.target/loongarch/lasx-func-attr-1.c: New test.
* gcc.target/loongarch/lasx-func-attr-2.c: New test.
* gcc.target/loongarch/lsx-func-attr-1.c: New test.
* gcc.target/loongarch/lsx-func-attr-2.c: New test.
* gcc.target/loongarch/strict_align-func-attr-1.c: New test.
* gcc.target/loongarch/strict_align-func-attr-2.c: New test.
* gcc.target/loongarch/vector-func-attr-1.c: New test.
* gcc.target/loongarch/attr-check-error-message.c: New test.
17 files changed:
gcc/attr-urls.def
gcc/config.gcc
gcc/config/loongarch/loongarch-protos.h
gcc/config/loongarch/loongarch-target-attr.cc [new file with mode: 0644]
gcc/config/loongarch/loongarch.cc
gcc/config/loongarch/t-loongarch
gcc/doc/extend.texi
gcc/testsuite/gcc.target/loongarch/arch-func-attr-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/loongarch/attr-check-error-message.c [new file with mode: 0644]
gcc/testsuite/gcc.target/loongarch/cmodel-func-attr-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/loongarch/lasx-func-attr-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/loongarch/lasx-func-attr-2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/loongarch/lsx-func-attr-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/loongarch/lsx-func-attr-2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/loongarch/strict_align-func-attr-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/loongarch/strict_align-func-attr-2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/loongarch/vector-func-attr-1.c [new file with mode: 0644]