[llvm-branch-commits] [lld] [lld][LoongArch] GOT indirection to PC relative optimization (PR #123743)

2025-05-13 Thread Zhaoxin Yang via llvm-branch-commits
https://github.com/ylzsx updated https://github.com/llvm/llvm-project/pull/123743 Rate limit · GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-ser

[llvm-branch-commits] [lld] [lld][LoongArch] Support relaxation during TLSDESC GD/LD to IE/LE conversion (PR #123730)

2025-05-13 Thread Zhaoxin Yang via llvm-branch-commits
https://github.com/ylzsx updated https://github.com/llvm/llvm-project/pull/123730 Rate limit · GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-ser

[llvm-branch-commits] [lld] [lld][LoongArch] Convert TLS IE to LE in the normal or medium code model (PR #123680)

2025-04-05 Thread Zhaoxin Yang via llvm-branch-commits
https://github.com/ylzsx updated https://github.com/llvm/llvm-project/pull/123680 >From 0f580567169ffbf1546a5389ab4b9f7d1fc07c71 Mon Sep 17 00:00:00 2001 From: yangzhaoxin Date: Thu, 2 Jan 2025 20:58:56 +0800 Subject: [PATCH 1/6] Convert TLS IE to LE in the normal or medium code model. Origina

[llvm-branch-commits] [lld] [lld][LoongArch] Convert TLS IE to LE in the normal or medium code model (PR #123680)

2025-03-25 Thread Zhaoxin Yang via llvm-branch-commits
@@ -1375,14 +1375,20 @@ unsigned RelocationScanner::handleTlsRelocation(RelExpr expr, RelType type, return 1; } + // LoongArch support IE to LE optimization in non-extreme code model. + bool execOptimizeInLoongArch = + ctx.arg.emachine == EM_LOONGARCH && + (

[llvm-branch-commits] [lld] [lld][LoongArch] Convert TLS IE to LE in the normal or medium code model (PR #123680)

2025-03-23 Thread Zhaoxin Yang via llvm-branch-commits
ylzsx wrote: @MaskRay @xen0n Could you help me review the code? https://github.com/llvm/llvm-project/pull/123680 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commit

[llvm-branch-commits] [lld] [lld][LoongArch] Convert TLS IE to LE in the normal or medium code model (PR #123680)

2025-03-20 Thread Zhaoxin Yang via llvm-branch-commits
https://github.com/ylzsx updated https://github.com/llvm/llvm-project/pull/123680 >From 0f580567169ffbf1546a5389ab4b9f7d1fc07c71 Mon Sep 17 00:00:00 2001 From: yangzhaoxin Date: Thu, 2 Jan 2025 20:58:56 +0800 Subject: [PATCH 1/8] Convert TLS IE to LE in the normal or medium code model. Origina

[llvm-branch-commits] [lld] [lld][LoongArch] Convert TLS IE to LE in the normal or medium code model (PR #123680)

2025-03-20 Thread Zhaoxin Yang via llvm-branch-commits
@@ -1002,6 +1008,87 @@ static bool relax(Ctx &ctx, InputSection &sec) { return changed; } +// Convert TLS IE to LE in the normal or medium code model. +// Original code sequence: +// * pcalau12i $a0, %ie_pc_hi20(sym) +// * ld.d $a0, $a0, %ie_pc_lo12(sym) +// +// The c

[llvm-branch-commits] [lld] [lld][LoongArch] Convert TLS IE to LE in the normal or medium code model (PR #123680)

2025-03-11 Thread Zhaoxin Yang via llvm-branch-commits
https://github.com/ylzsx updated https://github.com/llvm/llvm-project/pull/123680 >From 0f580567169ffbf1546a5389ab4b9f7d1fc07c71 Mon Sep 17 00:00:00 2001 From: yangzhaoxin Date: Thu, 2 Jan 2025 20:58:56 +0800 Subject: [PATCH 1/5] Convert TLS IE to LE in the normal or medium code model. Origina

[llvm-branch-commits] [lld] [lld][LoongArch] Relax TLS LE/GD/LD (PR #123600)

2025-02-16 Thread Zhaoxin Yang via llvm-branch-commits
https://github.com/ylzsx updated https://github.com/llvm/llvm-project/pull/123600 >From 7993434e2973437b010034051003f8c03d8eff71 Mon Sep 17 00:00:00 2001 From: yangzhaoxin Date: Fri, 27 Dec 2024 19:29:32 +0800 Subject: [PATCH 1/8] Relax TLS LE/GD/LD. In local-exec form, the code sequence is co

[llvm-branch-commits] [lld] [lld][LoongArch] Relax TLS LE/GD/LD (PR #123600)

2025-02-16 Thread Zhaoxin Yang via llvm-branch-commits
@@ -1015,8 +1063,20 @@ void LoongArch::finalizeRelax(int passes) const { r.expr = r.sym->hasFlag(NEEDS_PLT) ? R_PLT_PC : R_PC; break; case R_LARCH_B26: + case R_LARCH_TLS_LE_LO12_R: +skip = 4; +write32le(p, aux.

[llvm-branch-commits] [lld] [lld][LoongArch] Relax call36/tail36: R_LARCH_CALL36 (PR #123576)

2025-02-13 Thread Zhaoxin Yang via llvm-branch-commits
https://github.com/ylzsx updated https://github.com/llvm/llvm-project/pull/123576 >From f1f995b5fc8e90126b5825d52b9c75cd45d27cfc Mon Sep 17 00:00:00 2001 From: yangzhaoxin Date: Thu, 26 Dec 2024 11:32:33 +0800 Subject: [PATCH 1/6] Relax call36/tail36. Instructions with relocation `R_LARCH_CALL

[llvm-branch-commits] [lld] [lld][LoongArch] Relax TLS LE/GD/LD (PR #123600)

2025-02-13 Thread Zhaoxin Yang via llvm-branch-commits
https://github.com/ylzsx updated https://github.com/llvm/llvm-project/pull/123600 >From 7993434e2973437b010034051003f8c03d8eff71 Mon Sep 17 00:00:00 2001 From: yangzhaoxin Date: Fri, 27 Dec 2024 19:29:32 +0800 Subject: [PATCH 1/7] Relax TLS LE/GD/LD. In local-exec form, the code sequence is co

[llvm-branch-commits] [lld] [lld][LoongArch] Relax TLS LE/GD/LD (PR #123600)

2025-02-13 Thread Zhaoxin Yang via llvm-branch-commits
https://github.com/ylzsx updated https://github.com/llvm/llvm-project/pull/123600 >From 7993434e2973437b010034051003f8c03d8eff71 Mon Sep 17 00:00:00 2001 From: yangzhaoxin Date: Fri, 27 Dec 2024 19:29:32 +0800 Subject: [PATCH 1/6] Relax TLS LE/GD/LD. In local-exec form, the code sequence is co

[llvm-branch-commits] [lld] [lld][LoongArch] Relax call36/tail36: R_LARCH_CALL36 (PR #123576)

2025-02-13 Thread Zhaoxin Yang via llvm-branch-commits
https://github.com/ylzsx updated https://github.com/llvm/llvm-project/pull/123576 >From f1f995b5fc8e90126b5825d52b9c75cd45d27cfc Mon Sep 17 00:00:00 2001 From: yangzhaoxin Date: Thu, 26 Dec 2024 11:32:33 +0800 Subject: [PATCH 1/5] Relax call36/tail36. Instructions with relocation `R_LARCH_CALL

[llvm-branch-commits] [lld] [lld][LoongArch] Relax call36/tail36: R_LARCH_CALL36 (PR #123576)

2025-02-13 Thread Zhaoxin Yang via llvm-branch-commits
https://github.com/ylzsx updated https://github.com/llvm/llvm-project/pull/123576 >From f1f995b5fc8e90126b5825d52b9c75cd45d27cfc Mon Sep 17 00:00:00 2001 From: yangzhaoxin Date: Thu, 26 Dec 2024 11:32:33 +0800 Subject: [PATCH 1/5] Relax call36/tail36. Instructions with relocation `R_LARCH_CALL

[llvm-branch-commits] [lld] [lld][LoongArch] Relax TLSDESC code sequence (PR #123677)

2025-01-21 Thread Zhaoxin Yang via llvm-branch-commits
https://github.com/ylzsx edited https://github.com/llvm/llvm-project/pull/123677 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

[llvm-branch-commits] [lld] [lld][LoongArch] GOT indirection to PC relative optimization (PR #123743)

2025-01-21 Thread Zhaoxin Yang via llvm-branch-commits
https://github.com/ylzsx edited https://github.com/llvm/llvm-project/pull/123743 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

[llvm-branch-commits] [lld] [lld][LoongArch] Relax TLS LE/GD/LD (PR #123600)

2025-01-21 Thread Zhaoxin Yang via llvm-branch-commits
https://github.com/ylzsx edited https://github.com/llvm/llvm-project/pull/123600 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

[llvm-branch-commits] [lld] [lld][LoongArch] Convert TLS IE to LE in the normal or medium code model (PR #123680)

2025-01-21 Thread Zhaoxin Yang via llvm-branch-commits
https://github.com/ylzsx edited https://github.com/llvm/llvm-project/pull/123680 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

[llvm-branch-commits] [lld] [lld][LoongArch] Support relaxation during IE to LE conversion (PR #123702)

2025-01-21 Thread Zhaoxin Yang via llvm-branch-commits
https://github.com/ylzsx edited https://github.com/llvm/llvm-project/pull/123702 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

[llvm-branch-commits] [lld] [lld][LoongArch] Support TLSDESC GD/LD to IE/LE (PR #123715)

2025-01-21 Thread Zhaoxin Yang via llvm-branch-commits
https://github.com/ylzsx edited https://github.com/llvm/llvm-project/pull/123715 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

[llvm-branch-commits] [lld] [lld][LoongArch] Support relaxation during TLSDESC GD/LD to IE/LE conversion (PR #123730)

2025-01-21 Thread Zhaoxin Yang via llvm-branch-commits
https://github.com/ylzsx edited https://github.com/llvm/llvm-project/pull/123730 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

[llvm-branch-commits] [lld] [lld][LoongArch] GOT indirection to PC relative optimization. (PR #123743)

2025-01-21 Thread Zhaoxin Yang via llvm-branch-commits
@@ -1150,6 +1152,58 @@ void LoongArch::tlsdescToLe(uint8_t *loc, const Relocation &rel, } } +// Try GOT indirection to PC relative optimization when relaxation is enabled. +// From: +// * pcalau12i $a0, %got_pc_hi20(sym_got) +// * ld.w/d$a0, $a0, %got_pc_lo12(sym_got)

[llvm-branch-commits] [lld] [lld][LoongArch] GOT indirection to PC relative optimization. (PR #123743)

2025-01-21 Thread Zhaoxin Yang via llvm-branch-commits
@@ -1150,6 +1152,58 @@ void LoongArch::tlsdescToLe(uint8_t *loc, const Relocation &rel, } } +// Try GOT indirection to PC relative optimization when relaxation is enabled. +// From: +// * pcalau12i $a0, %got_pc_hi20(sym_got) +// * ld.w/d$a0, $a0, %got_pc_lo12(sym_got)

[llvm-branch-commits] [lld] [lld][LoongArch] Support TLSDESC GD/LD to IE/LE. (PR #123715)

2025-01-21 Thread Zhaoxin Yang via llvm-branch-commits
https://github.com/ylzsx updated https://github.com/llvm/llvm-project/pull/123715 >From dff3031fdb2ca3755b73e3b81e56f8008a409470 Mon Sep 17 00:00:00 2001 From: yangzhaoxin Date: Fri, 3 Jan 2025 14:29:17 +0800 Subject: [PATCH 1/7] [lld][LoongArch] Implement TLSDESC GD/LD to IE/LE. Support TLSDE

[llvm-branch-commits] [lld] [lld][LoongArch] GOT indirection to PC relative optimization. (PR #123743)

2025-01-21 Thread Zhaoxin Yang via llvm-branch-commits
ylzsx wrote: I have submitted all the patches related to relaxation in lld for LoongArch. Below is a list for peer review: * users/ylzsx/r-got-to-pcrel │ https://github.com/llvm/llvm-project/pull/123743 │ * users/ylzsx/r-tlsdesc-to-iele-relax │ https://github.com/llvm/llvm-project/pull

[llvm-branch-commits] [lld] [lld][LoongArch] GOT indirection to PC relative optimization. (PR #123743)

2025-01-21 Thread Zhaoxin Yang via llvm-branch-commits
https://github.com/ylzsx created https://github.com/llvm/llvm-project/pull/123743 In LoongArch, this optimization is only supported when relaxation is enabled. From: * pcalau12i $a0, %got_pc_hi20(sym_got) * ld.w/d $a0, $a0, %got_pc_lo12(sym_got) To: * pcalau12i $a0, %pc_hi20(sym) * addi.w/d $a0,

[llvm-branch-commits] [lld] [lld][LoongArch] Support relaxation during TLSDESC GD/LD to IE/LE conversion. (PR #123730)

2025-01-21 Thread Zhaoxin Yang via llvm-branch-commits
https://github.com/ylzsx updated https://github.com/llvm/llvm-project/pull/123730 >From 187759562d861034a79cd8c4ee4ab063bba5f4ff Mon Sep 17 00:00:00 2001 From: yangzhaoxin Date: Sat, 4 Jan 2025 15:03:47 +0800 Subject: [PATCH 1/2] Support relaxation during TLSDESC GD/LD to IE/LE conversion. Co

[llvm-branch-commits] [lld] [lld][LoongArch] Support TLSDESC GD/LD to IE/LE. (PR #123715)

2025-01-21 Thread Zhaoxin Yang via llvm-branch-commits
https://github.com/ylzsx updated https://github.com/llvm/llvm-project/pull/123715 >From dff3031fdb2ca3755b73e3b81e56f8008a409470 Mon Sep 17 00:00:00 2001 From: yangzhaoxin Date: Fri, 3 Jan 2025 14:29:17 +0800 Subject: [PATCH 1/6] [lld][LoongArch] Implement TLSDESC GD/LD to IE/LE. Support TLSDE

[llvm-branch-commits] [lld] [lld][LoongArch] Support relaxation during TLSDESC GD/LD to IE/LE conversion. (PR #123730)

2025-01-21 Thread Zhaoxin Yang via llvm-branch-commits
https://github.com/ylzsx created https://github.com/llvm/llvm-project/pull/123730 Complement https://github.com/llvm/llvm-project/pull/123715. When relaxation enable, remove redundant NOPs. >From ddb64ee49845b302df8ea50546164cceb87cf288 Mon Sep 17 00:00:00 2001 From: yangzhaoxin Date: Sat, 4

[llvm-branch-commits] [lld] [lld][LoongArch] Support TLSDESC GD/LD to IE/LE. (PR #123715)

2025-01-21 Thread Zhaoxin Yang via llvm-branch-commits
https://github.com/ylzsx updated https://github.com/llvm/llvm-project/pull/123715 >From dff3031fdb2ca3755b73e3b81e56f8008a409470 Mon Sep 17 00:00:00 2001 From: yangzhaoxin Date: Fri, 3 Jan 2025 14:29:17 +0800 Subject: [PATCH 1/5] [lld][LoongArch] Implement TLSDESC GD/LD to IE/LE. Support TLSDE

[llvm-branch-commits] [lld] [lld][LoongArch] Support TLSDESC GD/LD to IE/LE. (PR #123715)

2025-01-21 Thread Zhaoxin Yang via llvm-branch-commits
https://github.com/ylzsx created https://github.com/llvm/llvm-project/pull/123715 Support TLSDESC to initial-exec or local-exec optimizations. Introduce a new hook RE_LOONGARCH_RELAX_TLS_GD_TO_IE_PAGE_PC and use existing R_RELAX_TLS_GD_TO_IE_ABS to support TLSDESC => IE, while use existing R_

[llvm-branch-commits] [lld] [lld][LoongArch] Support relaxation during IE to LE conversion. (PR #123702)

2025-01-20 Thread Zhaoxin Yang via llvm-branch-commits
https://github.com/ylzsx created https://github.com/llvm/llvm-project/pull/123702 Complement https://github.com/llvm/llvm-project/pull/123680. When relaxation enable, remove redundant NOPs. >From 83d8b7e00b16c97b11f3c19ed45bb70eeae95428 Mon Sep 17 00:00:00 2001 From: yangzhaoxin Date: Fri, 3

[llvm-branch-commits] [lld] [lld][LoongArch] Convert TLS IE to LE in the normal or medium code model. (PR #123680)

2025-01-20 Thread Zhaoxin Yang via llvm-branch-commits
https://github.com/ylzsx ready_for_review https://github.com/llvm/llvm-project/pull/123680 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

[llvm-branch-commits] [lld] [lld][LoongArch] Convert TLS IE to LE in the normal or medium code model. (PR #123680)

2025-01-20 Thread Zhaoxin Yang via llvm-branch-commits
https://github.com/ylzsx updated https://github.com/llvm/llvm-project/pull/123680 >From a39c190e5c8351227178b6e5041bbd97fc6926a9 Mon Sep 17 00:00:00 2001 From: yangzhaoxin Date: Thu, 2 Jan 2025 20:58:56 +0800 Subject: [PATCH 1/5] Convert TLS IE to LE in the normal or medium code model. Origina

[llvm-branch-commits] [lld] [lld][LoongArch] Convert TLS IE to LE in the normal or medium code model. (PR #123680)

2025-01-20 Thread Zhaoxin Yang via llvm-branch-commits
https://github.com/ylzsx converted_to_draft https://github.com/llvm/llvm-project/pull/123680 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

[llvm-branch-commits] [lld] [lld][LoongArch] Convert TLS IE to LE in the normal or medium code model. (PR #123680)

2025-01-20 Thread Zhaoxin Yang via llvm-branch-commits
https://github.com/ylzsx created https://github.com/llvm/llvm-project/pull/123680 Original code sequence: * pcalau12i $a0, %ie_pc_hi20(sym) * ld.d $a0, $a0, %ie_pc_lo12(sym) The code sequence converted is as follows: * lu12i.w $a0, %ie_pc_hi20(sym) # le_hi20 != 0, otherwise NOP * or

[llvm-branch-commits] [lld] [lld][LoongArch] Relax TLSDESC code sequence. (PR #123677)

2025-01-20 Thread Zhaoxin Yang via llvm-branch-commits
https://github.com/ylzsx created https://github.com/llvm/llvm-project/pull/123677 Relax TLSDESC code sequence. Original code sequence: * pcalau12i $a0, %desc_pc_hi20(sym_desc) * addi.d $a0, $a0, %desc_pc_lo12(sym_desc) * ld.d $ra, $a0, %desc_ld(sym_desc) * jirl $ra, $ra

[llvm-branch-commits] [lld] [lld][LoongArch] Relax TLS LE/GD/LD. (PR #123600)

2025-01-20 Thread Zhaoxin Yang via llvm-branch-commits
https://github.com/ylzsx created https://github.com/llvm/llvm-project/pull/123600 In local-exec form, the code sequence is converted as follows: ``` From: lu12i.w $rd, %le_hi20_r(sym) R_LARCH_TLS_LE_HI20_R, R_LARCH_RELAX add.w/d $rd, $rd, $tp, %le_add_r(sym) R_LARCH_TLS_LE_ADD_R, R_L

[llvm-branch-commits] [lld] [lld][LoongArch] Relax call36/tail36: R_LARCH_CALL36 (PR #123576)

2025-01-20 Thread Zhaoxin Yang via llvm-branch-commits
https://github.com/ylzsx created https://github.com/llvm/llvm-project/pull/123576 Instructions with relocation `R_LARCH_CALL36` may be relax as follows: ``` From: pcaddu18i $dest, %call36(foo) R_LARCH_CALL36, R_LARCH_RELAX jirl $r, $dest, 0 To: b/bl foo # bl if r=$ra, b if r=$zero

[llvm-branch-commits] [llvm] [LoongArch] Avoid scheduling relaxable code sequence and attach relax relocs (PR #121330)

2025-01-08 Thread Zhaoxin Yang via llvm-branch-commits
@@ -443,6 +443,89 @@ bool LoongArchInstrInfo::isSchedulingBoundary(const MachineInstr &MI, break; } + const auto &STI = MF.getSubtarget(); + if (STI.hasFeature(LoongArch::FeatureRelax)) { +// When linker relaxation enabled, the following instruction patterns are +

[llvm-branch-commits] [lld] [lld][LoongArch] Implement TLSDESC GD/LD to IE/LE. (PR #121120)

2024-12-30 Thread Zhaoxin Yang via llvm-branch-commits
https://github.com/ylzsx closed https://github.com/llvm/llvm-project/pull/121120 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

[llvm-branch-commits] [lld] [lld][LoongArch] Implement TLSDESC GD/LD to IE/LE. (PR #121120)

2024-12-30 Thread Zhaoxin Yang via llvm-branch-commits
https://github.com/ylzsx converted_to_draft https://github.com/llvm/llvm-project/pull/121120 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

[llvm-branch-commits] [lld] [lld][LoongArch] Implement TLSDESC GD/LD to IE/LE. (PR #121120)

2024-12-25 Thread Zhaoxin Yang via llvm-branch-commits
https://github.com/ylzsx created https://github.com/llvm/llvm-project/pull/121120 Support TLSDESC to initial-exec or local-exec optimizations. Introduce a new hook RE_LOONGARCH_RELAX_TLS_GD_TO_IE_PAGE_PC and use existing R_RELAX_TLS_GD_TO_IE_ABS to support TLSDESC => IE, while use existing R