Skip to content

Commit 3dc3bd3

Browse files
committed
[LoongArch] Reimplement the expansion of PseudoLA*_LARGE instructions
According to the description of the psABI v2.30: https://github.com/loongson/la-abi-specs/releases/tag/v2.30, moved the expansion of relevant pseudo-instructions from `LoongArchPreRAExpandPseudo` pass to `LoongArchExpandPseudo` pass, to ensure that the code sequences of `PseudoLA*_LARGE` instructions and Medium code model's function call are not scheduled.
1 parent 83049f5 commit 3dc3bd3

File tree

9 files changed

+488
-384
lines changed

9 files changed

+488
-384
lines changed

llvm/lib/Target/LoongArch/LoongArchExpandPseudoInsts.cpp

Lines changed: 264 additions & 255 deletions
Large diffs are not rendered by default.

llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3381,8 +3381,12 @@ const char *LoongArchTargetLowering::getTargetNodeName(unsigned Opcode) const {
33813381

33823382
// TODO: Add more target-dependent nodes later.
33833383
NODE_NAME_CASE(CALL)
3384+
NODE_NAME_CASE(CALL_MEDIUM)
3385+
NODE_NAME_CASE(CALL_LARGE)
33843386
NODE_NAME_CASE(RET)
33853387
NODE_NAME_CASE(TAIL)
3388+
NODE_NAME_CASE(TAIL_MEDIUM)
3389+
NODE_NAME_CASE(TAIL_LARGE)
33863390
NODE_NAME_CASE(SLL_W)
33873391
NODE_NAME_CASE(SRA_W)
33883392
NODE_NAME_CASE(SRL_W)
@@ -4240,15 +4244,31 @@ LoongArchTargetLowering::LowerCall(CallLoweringInfo &CLI,
42404244

42414245
// Emit the call.
42424246
SDVTList NodeTys = DAG.getVTList(MVT::Other, MVT::Glue);
4247+
unsigned Op;
4248+
switch (DAG.getTarget().getCodeModel()) {
4249+
default:
4250+
report_fatal_error("Unsupported code model");
4251+
case CodeModel::Small:
4252+
Op = IsTailCall ? LoongArchISD::TAIL : LoongArchISD::CALL;
4253+
break;
4254+
case CodeModel::Medium:
4255+
assert(Subtarget.is64Bit() && "Medium code model requires LA64");
4256+
Op = IsTailCall ? LoongArchISD::TAIL_MEDIUM : LoongArchISD::CALL_MEDIUM;
4257+
break;
4258+
case CodeModel::Large:
4259+
assert(Subtarget.is64Bit() && "Large code model requires LA64");
4260+
Op = IsTailCall ? LoongArchISD::TAIL_LARGE : LoongArchISD::CALL_LARGE;
4261+
break;
4262+
}
42434263

42444264
if (IsTailCall) {
42454265
MF.getFrameInfo().setHasTailCall();
4246-
SDValue Ret = DAG.getNode(LoongArchISD::TAIL, DL, NodeTys, Ops);
4266+
SDValue Ret = DAG.getNode(Op, DL, NodeTys, Ops);
42474267
DAG.addNoMergeSiteInfo(Ret.getNode(), CLI.NoMerge);
42484268
return Ret;
42494269
}
42504270

4251-
Chain = DAG.getNode(LoongArchISD::CALL, DL, NodeTys, Ops);
4271+
Chain = DAG.getNode(Op, DL, NodeTys, Ops);
42524272
DAG.addNoMergeSiteInfo(Chain.getNode(), CLI.NoMerge);
42534273
Glue = Chain.getValue(1);
42544274

llvm/lib/Target/LoongArch/LoongArchISelLowering.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,12 @@ enum NodeType : unsigned {
2727

2828
// TODO: add more LoongArchISDs
2929
CALL,
30+
CALL_MEDIUM,
31+
CALL_LARGE,
3032
RET,
3133
TAIL,
34+
TAIL_MEDIUM,
35+
TAIL_LARGE,
3236

3337
// 32-bit shifts, directly matching the semantics of the named LoongArch
3438
// instructions.

llvm/lib/Target/LoongArch/LoongArchInstrInfo.td

Lines changed: 77 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,18 @@ def loongarch_ret : SDNode<"LoongArchISD::RET", SDTNone,
6969
def loongarch_tail : SDNode<"LoongArchISD::TAIL", SDT_LoongArchCall,
7070
[SDNPHasChain, SDNPOptInGlue, SDNPOutGlue,
7171
SDNPVariadic]>;
72+
def loongarch_call_medium : SDNode<"LoongArchISD::CALL_MEDIUM", SDT_LoongArchCall,
73+
[SDNPHasChain, SDNPOptInGlue, SDNPOutGlue,
74+
SDNPVariadic]>;
75+
def loongarch_tail_medium : SDNode<"LoongArchISD::TAIL_MEDIUM", SDT_LoongArchCall,
76+
[SDNPHasChain, SDNPOptInGlue, SDNPOutGlue,
77+
SDNPVariadic]>;
78+
def loongarch_call_large : SDNode<"LoongArchISD::CALL_LARGE", SDT_LoongArchCall,
79+
[SDNPHasChain, SDNPOptInGlue, SDNPOutGlue,
80+
SDNPVariadic]>;
81+
def loongarch_tail_large : SDNode<"LoongArchISD::TAIL_LARGE", SDT_LoongArchCall,
82+
[SDNPHasChain, SDNPOptInGlue, SDNPOutGlue,
83+
SDNPVariadic]>;
7284
def loongarch_sll_w : SDNode<"LoongArchISD::SLL_W", SDT_LoongArchIntBinOpW>;
7385
def loongarch_sra_w : SDNode<"LoongArchISD::SRA_W", SDT_LoongArchIntBinOpW>;
7486
def loongarch_srl_w : SDNode<"LoongArchISD::SRL_W", SDT_LoongArchIntBinOpW>;
@@ -1399,16 +1411,43 @@ def : Pat<(brind GPR:$rj), (PseudoBRIND GPR:$rj, 0)>;
13991411
def : Pat<(brind (add GPR:$rj, simm16_lsl2:$imm16)),
14001412
(PseudoBRIND GPR:$rj, simm16_lsl2:$imm16)>;
14011413

1414+
// Function call with 'Small' code model.
14021415
let isCall = 1, Defs = [R1] in
14031416
def PseudoCALL : Pseudo<(outs), (ins bare_symbol:$func)>;
14041417

14051418
def : Pat<(loongarch_call tglobaladdr:$func), (PseudoCALL tglobaladdr:$func)>;
14061419
def : Pat<(loongarch_call texternalsym:$func), (PseudoCALL texternalsym:$func)>;
14071420

1421+
// Function call with 'Medium' code model.
1422+
let isCall = 1, Defs = [R1, R20], Size = 8 in
1423+
def PseudoCALL_MEDIUM : Pseudo<(outs), (ins bare_symbol:$func)>;
1424+
1425+
let Predicates = [IsLA64] in {
1426+
def : Pat<(loongarch_call_medium tglobaladdr:$func),
1427+
(PseudoCALL_MEDIUM tglobaladdr:$func)>;
1428+
def : Pat<(loongarch_call_medium texternalsym:$func),
1429+
(PseudoCALL_MEDIUM texternalsym:$func)>;
1430+
} // Predicates = [IsLA64]
1431+
1432+
// Function call with 'Large' code model.
1433+
let isCall = 1, Defs = [R1, R20], Size = 24 in
1434+
def PseudoCALL_LARGE: Pseudo<(outs), (ins bare_symbol:$func)>;
1435+
1436+
let Predicates = [IsLA64] in {
1437+
def : Pat<(loongarch_call_large tglobaladdr:$func),
1438+
(PseudoCALL_LARGE tglobaladdr:$func)>;
1439+
def : Pat<(loongarch_call_large texternalsym:$func),
1440+
(PseudoCALL_LARGE texternalsym:$func)>;
1441+
} // Predicates = [IsLA64]
1442+
14081443
let isCall = 1, Defs = [R1] in
14091444
def PseudoCALLIndirect : Pseudo<(outs), (ins GPR:$rj),
14101445
[(loongarch_call GPR:$rj)]>,
14111446
PseudoInstExpansion<(JIRL R1, GPR:$rj, 0)>;
1447+
let Predicates = [IsLA64] in {
1448+
def : Pat<(loongarch_call_medium GPR:$rj), (PseudoCALLIndirect GPR:$rj)>;
1449+
def : Pat<(loongarch_call_large GPR:$rj), (PseudoCALLIndirect GPR:$rj)>;
1450+
}
14121451

14131452
let isCall = 1, hasSideEffects = 0, mayStore = 0, mayLoad = 0, Defs = [R1] in
14141453
def PseudoJIRL_CALL : Pseudo<(outs), (ins GPR:$rj, simm16_lsl2:$imm16)>,
@@ -1419,6 +1458,7 @@ let isBarrier = 1, isReturn = 1, isTerminator = 1 in
14191458
def PseudoRET : Pseudo<(outs), (ins), [(loongarch_ret)]>,
14201459
PseudoInstExpansion<(JIRL R0, R1, 0)>;
14211460

1461+
// Tail call with 'Small' code model.
14221462
let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1, Uses = [R3] in
14231463
def PseudoTAIL : Pseudo<(outs), (ins bare_symbol:$dst)>;
14241464

@@ -1427,10 +1467,38 @@ def : Pat<(loongarch_tail (iPTR tglobaladdr:$dst)),
14271467
def : Pat<(loongarch_tail (iPTR texternalsym:$dst)),
14281468
(PseudoTAIL texternalsym:$dst)>;
14291469

1470+
// Tail call with 'Medium' code model.
1471+
let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1,
1472+
Uses = [R3], Defs = [R20], Size = 8 in
1473+
def PseudoTAIL_MEDIUM : Pseudo<(outs), (ins bare_symbol:$dst)>;
1474+
1475+
let Predicates = [IsLA64] in {
1476+
def : Pat<(loongarch_tail_medium (iPTR tglobaladdr:$dst)),
1477+
(PseudoTAIL_MEDIUM tglobaladdr:$dst)>;
1478+
def : Pat<(loongarch_tail_medium (iPTR texternalsym:$dst)),
1479+
(PseudoTAIL_MEDIUM texternalsym:$dst)>;
1480+
} // Predicates = [IsLA64]
1481+
1482+
// Tail call with 'Large' code model.
1483+
let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1,
1484+
Uses = [R3], Defs = [R19, R20], Size = 24 in
1485+
def PseudoTAIL_LARGE : Pseudo<(outs), (ins bare_symbol:$dst)>;
1486+
1487+
let Predicates = [IsLA64] in {
1488+
def : Pat<(loongarch_tail_large (iPTR tglobaladdr:$dst)),
1489+
(PseudoTAIL_LARGE tglobaladdr:$dst)>;
1490+
def : Pat<(loongarch_tail_large (iPTR texternalsym:$dst)),
1491+
(PseudoTAIL_LARGE texternalsym:$dst)>;
1492+
} // Predicates = [IsLA64]
1493+
14301494
let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1, Uses = [R3] in
14311495
def PseudoTAILIndirect : Pseudo<(outs), (ins GPRT:$rj),
14321496
[(loongarch_tail GPRT:$rj)]>,
14331497
PseudoInstExpansion<(JIRL R0, GPR:$rj, 0)>;
1498+
let Predicates = [IsLA64] in {
1499+
def : Pat<(loongarch_tail_medium GPR:$rj), (PseudoTAILIndirect GPR:$rj)>;
1500+
def : Pat<(loongarch_tail_large GPR:$rj), (PseudoTAILIndirect GPR:$rj)>;
1501+
}
14341502

14351503
let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1,
14361504
hasSideEffects = 0, mayStore = 0, mayLoad = 0, Uses = [R3] in
@@ -1468,6 +1536,7 @@ def PseudoLA_ABS_LARGE : Pseudo<(outs GPR:$dst),
14681536
"la.abs", "$dst, $src">;
14691537
def PseudoLA_PCREL : Pseudo<(outs GPR:$dst), (ins bare_symbol:$src), [],
14701538
"la.pcrel", "$dst, $src">;
1539+
let Defs = [R20], Size = 20 in
14711540
def PseudoLA_PCREL_LARGE : Pseudo<(outs GPR:$dst),
14721541
(ins GPR:$tmp, bare_symbol:$src), [],
14731542
"la.pcrel", "$dst, $tmp, $src">,
@@ -1479,28 +1548,30 @@ let hasSideEffects = 0, mayLoad = 1, mayStore = 0, isCodeGenOnly = 0,
14791548
isAsmParserOnly = 1 in {
14801549
def PseudoLA_GOT : Pseudo<(outs GPR:$dst), (ins bare_symbol:$src), [],
14811550
"la.got", "$dst, $src">;
1551+
def PseudoLA_TLS_IE : Pseudo<(outs GPR:$dst), (ins bare_symbol:$src), [],
1552+
"la.tls.ie", "$dst, $src">;
1553+
def PseudoLA_TLS_LD : Pseudo<(outs GPR:$dst), (ins bare_symbol:$src), [],
1554+
"la.tls.ld", "$dst, $src">;
1555+
def PseudoLA_TLS_GD : Pseudo<(outs GPR:$dst), (ins bare_symbol:$src), [],
1556+
"la.tls.gd", "$dst, $src">;
1557+
let Defs = [R20], Size = 20 in {
14821558
def PseudoLA_GOT_LARGE : Pseudo<(outs GPR:$dst),
14831559
(ins GPR:$tmp, bare_symbol:$src), [],
14841560
"la.got", "$dst, $tmp, $src">,
14851561
Requires<[IsLA64]>;
1486-
def PseudoLA_TLS_IE : Pseudo<(outs GPR:$dst), (ins bare_symbol:$src), [],
1487-
"la.tls.ie", "$dst, $src">;
14881562
def PseudoLA_TLS_IE_LARGE : Pseudo<(outs GPR:$dst),
14891563
(ins GPR:$tmp, bare_symbol:$src), [],
14901564
"la.tls.ie", "$dst, $tmp, $src">,
14911565
Requires<[IsLA64]>;
1492-
def PseudoLA_TLS_LD : Pseudo<(outs GPR:$dst), (ins bare_symbol:$src), [],
1493-
"la.tls.ld", "$dst, $src">;
14941566
def PseudoLA_TLS_LD_LARGE : Pseudo<(outs GPR:$dst),
14951567
(ins GPR:$tmp, bare_symbol:$src), [],
14961568
"la.tls.ld", "$dst, $tmp, $src">,
14971569
Requires<[IsLA64]>;
1498-
def PseudoLA_TLS_GD : Pseudo<(outs GPR:$dst), (ins bare_symbol:$src), [],
1499-
"la.tls.gd", "$dst, $src">;
15001570
def PseudoLA_TLS_GD_LARGE : Pseudo<(outs GPR:$dst),
15011571
(ins GPR:$tmp, bare_symbol:$src), [],
15021572
"la.tls.gd", "$dst, $tmp, $src">,
15031573
Requires<[IsLA64]>;
1574+
} // Defs = [R20], Size = 20
15041575
}
15051576

15061577
// Load address inst alias: "la", "la.global" and "la.local".

llvm/test/CodeGen/LoongArch/code-models.ll

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ define i32 @call_globaladdress(i32 %a) nounwind {
3333
; LARGE: # %bb.0:
3434
; LARGE-NEXT: addi.d $sp, $sp, -16
3535
; LARGE-NEXT: st.d $ra, $sp, 8 # 8-byte Folded Spill
36-
; LARGE-NEXT: pcalau12i $a1, %got_pc_hi20(callee)
37-
; LARGE-NEXT: addi.d $ra, $zero, %got_pc_lo12(callee)
38-
; LARGE-NEXT: lu32i.d $ra, %got64_pc_lo20(callee)
39-
; LARGE-NEXT: lu52i.d $ra, $ra, %got64_pc_hi12(callee)
40-
; LARGE-NEXT: ldx.d $ra, $ra, $a1
36+
; LARGE-NEXT: pcalau12i $ra, %got_pc_hi20(callee)
37+
; LARGE-NEXT: addi.d $t8, $zero, %got_pc_lo12(callee)
38+
; LARGE-NEXT: lu32i.d $t8, %got64_pc_lo20(callee)
39+
; LARGE-NEXT: lu52i.d $t8, $t8, %got64_pc_hi12(callee)
40+
; LARGE-NEXT: ldx.d $ra, $t8, $ra
4141
; LARGE-NEXT: jirl $ra, $ra, 0
4242
; LARGE-NEXT: ld.d $ra, $sp, 8 # 8-byte Folded Reload
4343
; LARGE-NEXT: addi.d $sp, $sp, 16
@@ -82,11 +82,11 @@ define void @call_external_sym(ptr %dst) {
8282
; LARGE-NEXT: .cfi_offset 1, -8
8383
; LARGE-NEXT: ori $a2, $zero, 1000
8484
; LARGE-NEXT: move $a1, $zero
85-
; LARGE-NEXT: pcalau12i $a3, %pc_hi20(memset)
86-
; LARGE-NEXT: addi.d $ra, $zero, %pc_lo12(memset)
87-
; LARGE-NEXT: lu32i.d $ra, %pc64_lo20(memset)
88-
; LARGE-NEXT: lu52i.d $ra, $ra, %pc64_hi12(memset)
89-
; LARGE-NEXT: add.d $ra, $ra, $a3
85+
; LARGE-NEXT: pcalau12i $ra, %pc_hi20(memset)
86+
; LARGE-NEXT: addi.d $t8, $zero, %pc_lo12(memset)
87+
; LARGE-NEXT: lu32i.d $t8, %pc64_lo20(memset)
88+
; LARGE-NEXT: lu52i.d $t8, $t8, %pc64_hi12(memset)
89+
; LARGE-NEXT: add.d $ra, $t8, $ra
9090
; LARGE-NEXT: jirl $ra, $ra, 0
9191
; LARGE-NEXT: ld.d $ra, $sp, 8 # 8-byte Folded Reload
9292
; LARGE-NEXT: addi.d $sp, $sp, 16
@@ -105,17 +105,17 @@ define i32 @caller_tail(i32 %i) nounwind {
105105
;
106106
; MEDIUM-LABEL: caller_tail:
107107
; MEDIUM: # %bb.0: # %entry
108-
; MEDIUM-NEXT: pcaddu18i $a1, %call36(callee_tail)
109-
; MEDIUM-NEXT: jr $a1
108+
; MEDIUM-NEXT: pcaddu18i $t8, %call36(callee_tail)
109+
; MEDIUM-NEXT: jr $t8
110110
;
111111
; LARGE-LABEL: caller_tail:
112112
; LARGE: # %bb.0: # %entry
113-
; LARGE-NEXT: pcalau12i $a1, %got_pc_hi20(callee_tail)
114-
; LARGE-NEXT: addi.d $a2, $zero, %got_pc_lo12(callee_tail)
115-
; LARGE-NEXT: lu32i.d $a2, %got64_pc_lo20(callee_tail)
116-
; LARGE-NEXT: lu52i.d $a2, $a2, %got64_pc_hi12(callee_tail)
117-
; LARGE-NEXT: ldx.d $a1, $a2, $a1
118-
; LARGE-NEXT: jr $a1
113+
; LARGE-NEXT: pcalau12i $t7, %got_pc_hi20(callee_tail)
114+
; LARGE-NEXT: addi.d $t8, $zero, %got_pc_lo12(callee_tail)
115+
; LARGE-NEXT: lu32i.d $t8, %got64_pc_lo20(callee_tail)
116+
; LARGE-NEXT: lu52i.d $t8, $t8, %got64_pc_hi12(callee_tail)
117+
; LARGE-NEXT: ldx.d $t7, $t8, $t7
118+
; LARGE-NEXT: jr $t7
119119
entry:
120120
%r = tail call i32 @callee_tail(i32 %i)
121121
ret i32 %r

llvm/test/CodeGen/LoongArch/expand-call.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
; RUN: llc --mtriple=loongarch64 --stop-before loongarch-prera-expand-pseudo \
22
; RUN: --verify-machineinstrs < %s | FileCheck %s --check-prefix=NOEXPAND
3-
; RUN: llc --mtriple=loongarch64 --stop-after loongarch-prera-expand-pseudo \
3+
; RUN: llc --mtriple=loongarch64 --stop-before machine-opt-remark-emitter \
44
; RUN: --verify-machineinstrs < %s | FileCheck %s --check-prefix=EXPAND
55

66
declare void @callee()

llvm/test/CodeGen/LoongArch/global-address.ll

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -53,32 +53,32 @@ define void @foo() nounwind {
5353
; LA64LARGENOPIC-LABEL: foo:
5454
; LA64LARGENOPIC: # %bb.0:
5555
; LA64LARGENOPIC-NEXT: pcalau12i $a0, %got_pc_hi20(G)
56-
; LA64LARGENOPIC-NEXT: addi.d $a1, $zero, %got_pc_lo12(G)
57-
; LA64LARGENOPIC-NEXT: lu32i.d $a1, %got64_pc_lo20(G)
58-
; LA64LARGENOPIC-NEXT: lu52i.d $a1, $a1, %got64_pc_hi12(G)
59-
; LA64LARGENOPIC-NEXT: ldx.d $a0, $a1, $a0
56+
; LA64LARGENOPIC-NEXT: addi.d $t8, $zero, %got_pc_lo12(G)
57+
; LA64LARGENOPIC-NEXT: lu32i.d $t8, %got64_pc_lo20(G)
58+
; LA64LARGENOPIC-NEXT: lu52i.d $t8, $t8, %got64_pc_hi12(G)
59+
; LA64LARGENOPIC-NEXT: ldx.d $a0, $t8, $a0
6060
; LA64LARGENOPIC-NEXT: ld.w $a0, $a0, 0
6161
; LA64LARGENOPIC-NEXT: pcalau12i $a0, %pc_hi20(g)
62-
; LA64LARGENOPIC-NEXT: addi.d $a1, $zero, %pc_lo12(g)
63-
; LA64LARGENOPIC-NEXT: lu32i.d $a1, %pc64_lo20(g)
64-
; LA64LARGENOPIC-NEXT: lu52i.d $a1, $a1, %pc64_hi12(g)
65-
; LA64LARGENOPIC-NEXT: add.d $a0, $a1, $a0
62+
; LA64LARGENOPIC-NEXT: addi.d $t8, $zero, %pc_lo12(g)
63+
; LA64LARGENOPIC-NEXT: lu32i.d $t8, %pc64_lo20(g)
64+
; LA64LARGENOPIC-NEXT: lu52i.d $t8, $t8, %pc64_hi12(g)
65+
; LA64LARGENOPIC-NEXT: add.d $a0, $t8, $a0
6666
; LA64LARGENOPIC-NEXT: ld.w $a0, $a0, 0
6767
; LA64LARGENOPIC-NEXT: ret
6868
;
6969
; LA64LARGEPIC-LABEL: foo:
7070
; LA64LARGEPIC: # %bb.0:
7171
; LA64LARGEPIC-NEXT: pcalau12i $a0, %got_pc_hi20(G)
72-
; LA64LARGEPIC-NEXT: addi.d $a1, $zero, %got_pc_lo12(G)
73-
; LA64LARGEPIC-NEXT: lu32i.d $a1, %got64_pc_lo20(G)
74-
; LA64LARGEPIC-NEXT: lu52i.d $a1, $a1, %got64_pc_hi12(G)
75-
; LA64LARGEPIC-NEXT: ldx.d $a0, $a1, $a0
72+
; LA64LARGEPIC-NEXT: addi.d $t8, $zero, %got_pc_lo12(G)
73+
; LA64LARGEPIC-NEXT: lu32i.d $t8, %got64_pc_lo20(G)
74+
; LA64LARGEPIC-NEXT: lu52i.d $t8, $t8, %got64_pc_hi12(G)
75+
; LA64LARGEPIC-NEXT: ldx.d $a0, $t8, $a0
7676
; LA64LARGEPIC-NEXT: ld.w $a0, $a0, 0
7777
; LA64LARGEPIC-NEXT: pcalau12i $a0, %pc_hi20(.Lg$local)
78-
; LA64LARGEPIC-NEXT: addi.d $a1, $zero, %pc_lo12(.Lg$local)
79-
; LA64LARGEPIC-NEXT: lu32i.d $a1, %pc64_lo20(.Lg$local)
80-
; LA64LARGEPIC-NEXT: lu52i.d $a1, $a1, %pc64_hi12(.Lg$local)
81-
; LA64LARGEPIC-NEXT: add.d $a0, $a1, $a0
78+
; LA64LARGEPIC-NEXT: addi.d $t8, $zero, %pc_lo12(.Lg$local)
79+
; LA64LARGEPIC-NEXT: lu32i.d $t8, %pc64_lo20(.Lg$local)
80+
; LA64LARGEPIC-NEXT: lu52i.d $t8, $t8, %pc64_hi12(.Lg$local)
81+
; LA64LARGEPIC-NEXT: add.d $a0, $t8, $a0
8282
; LA64LARGEPIC-NEXT: ld.w $a0, $a0, 0
8383
; LA64LARGEPIC-NEXT: ret
8484
%V = load volatile i32, ptr @G

0 commit comments

Comments
 (0)