diff options
author | Lulu Cheng <chenglulu@loongson.cn> | 2023-12-12 16:32:31 +0800 |
---|---|---|
committer | Lulu Cheng <chenglulu@loongson.cn> | 2024-01-02 09:33:27 +0800 |
commit | 3c20e6263abc361b5eec8a515388959ed4434776 (patch) | |
tree | ff26e4a55e8279d87cb6a59cb3d7a8bf1f2493b6 /gcc/testsuite/lib/target-supports.exp | |
parent | d3d6a96d45108d30395b6506fe4b3a91cd40f573 (diff) | |
download | gcc-3c20e6263abc361b5eec8a515388959ed4434776.zip gcc-3c20e6263abc361b5eec8a515388959ed4434776.tar.gz gcc-3c20e6263abc361b5eec8a515388959ed4434776.tar.bz2 |
LoongArch: Added TLS Le Relax support.
Check whether the assembler supports tls le relax. If it supports it, the assembly
instruction sequence of tls le relax will be generated by default.
The original way to obtain the tls le symbol address:
lu12i.w $rd, %le_hi20(sym)
ori $rd, $rd, %le_lo12(sym)
add.{w/d} $rd, $rd, $tp
If the assembler supports tls le relax, the following sequence is generated:
lu12i.w $rd, %le_hi20_r(sym)
add.{w/d} $rd,$rd,$tp,%le_add_r(sym)
addi.{w/d} $rd,$rd,%le_lo12_r(sym)
gcc/ChangeLog:
* config.in: Regenerate.
* config/loongarch/loongarch-opts.h (HAVE_AS_TLS_LE_RELAXATION): Define.
* config/loongarch/loongarch.cc (loongarch_legitimize_tls_address):
Added TLS Le Relax support.
(loongarch_print_operand_reloc): Add the output string of TLS Le Relax.
* config/loongarch/loongarch.md (@add_tls_le_relax<mode>): New template.
* configure: Regenerate.
* configure.ac: Check if binutils supports TLS le relax.
gcc/testsuite/ChangeLog:
* lib/target-supports.exp: Add a function to check whether binutil supports
TLS Le Relax.
* gcc.target/loongarch/tls-le-relax.c: New test.
Diffstat (limited to 'gcc/testsuite/lib/target-supports.exp')
-rw-r--r-- | gcc/testsuite/lib/target-supports.exp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 167e630..3aa761d 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -13249,6 +13249,18 @@ proc check_effective_target_loongarch_call36_support { } { } ""] } +# Returns 1 if binutils supports TLS le Relax, 0 otherwise. +proc check_effective_target_tls_le_relax { } { + if [check_effective_target_tls_native] { + return [check_no_compiler_messages loongarch_tls_le_relax object { + /* Assembly code */ + lu12i.w $r12, %le_hi20_r(a) + }] + } + + return 0; +} + # Appends necessary Python flags to extra-tool-flags if Python.h is supported. # Otherwise, modifies dg-do-what. proc dg-require-python-h { args } { |