Skip to content

Commit f72586e

Browse files
xry111chenglulu326
authored andcommitted
LoongArch: Don't split the instructions containing relocs for extreme code model.
The ABI mandates the pcalau12i/addi.d/lu32i.d/lu52i.d instructions for addressing a symbol to be adjacent. So model them as "one large instruction", i.e. define_insn, with two output registers. The real address is the sum of these two registers. The advantage of this approach is the RTL passes can still use ldx/stx instructions to skip an addi.d instruction. gcc/ChangeLog: * config/loongarch/loongarch.md (unspec): Add UNSPEC_LA_PCREL_64_PART1 and UNSPEC_LA_PCREL_64_PART2. (la_pcrel64_two_parts): New define_insn. * config/loongarch/loongarch.cc (loongarch_tls_symbol): Fix a typo in the comment. (loongarch_call_tls_get_addr): If -mcmodel=extreme -mexplicit-relocs={always,auto}, use la_pcrel64_two_parts for addressing the TLS symbol and __tls_get_addr. Emit an REG_EQUAL note to allow CSE addressing __tls_get_addr. (loongarch_legitimize_tls_address): If -mcmodel=extreme -mexplicit-relocs={always,auto}, address TLS IE symbols with la_pcrel64_two_parts. (loongarch_split_symbol): If -mcmodel=extreme -mexplicit-relocs={always,auto}, address symbols with la_pcrel64_two_parts. (loongarch_output_mi_thunk): Clean up unreachable code. If -mcmodel=extreme -mexplicit-relocs={always,auto}, address the MI thunks with la_pcrel64_two_parts. gcc/testsuite/ChangeLog: * gcc.target/loongarch/func-call-extreme-1.c (dg-options): Use -O2 instead of -O0 to ensure the pcalau12i/addi/lu32i/lu52i instruction sequences are not reordered by the compiler. (NOIPA): Disallow interprocedural optimizations. * gcc.target/loongarch/func-call-extreme-2.c: Remove the content duplicated from func-call-extreme-1.c, include it instead. (dg-options): Likewise. * gcc.target/loongarch/func-call-extreme-3.c (dg-options): Likewise. * gcc.target/loongarch/func-call-extreme-4.c (dg-options): Likewise. * gcc.target/loongarch/cmodel-extreme-1.c: New test. * gcc.target/loongarch/cmodel-extreme-2.c: New test. * g++.target/loongarch/cmodel-extreme-mi-thunk-1.C: New test. * g++.target/loongarch/cmodel-extreme-mi-thunk-2.C: New test. * g++.target/loongarch/cmodel-extreme-mi-thunk-3.C: New test.
1 parent 3932899 commit f72586e

11 files changed

+154
-92
lines changed

gcc/config/loongarch/loongarch.cc

+74-57
Original file line numberDiff line numberDiff line change
@@ -2737,7 +2737,7 @@ loongarch_add_offset (rtx temp, rtx reg, HOST_WIDE_INT offset)
27372737
return plus_constant (Pmode, reg, offset);
27382738
}
27392739

2740-
/* The __tls_get_attr symbol. */
2740+
/* The __tls_get_addr symbol. */
27412741
static GTY (()) rtx loongarch_tls_symbol;
27422742

27432743
/* Load an entry for a TLS access. */
@@ -2777,20 +2777,22 @@ loongarch_call_tls_get_addr (rtx sym, enum loongarch_symbol_type type, rtx v0)
27772777

27782778
if (loongarch_explicit_relocs_p (type))
27792779
{
2780-
/* Split tls symbol to high and low. */
2781-
rtx high = gen_rtx_HIGH (Pmode, copy_rtx (loc));
2782-
high = loongarch_force_temporary (tmp, high);
2783-
27842780
if (TARGET_CMODEL_EXTREME)
27852781
{
2786-
rtx tmp1 = gen_reg_rtx (Pmode);
2787-
emit_insn (gen_tls_low (Pmode, tmp1, gen_rtx_REG (Pmode, 0), loc));
2788-
emit_insn (gen_lui_h_lo20 (tmp1, tmp1, loc));
2789-
emit_insn (gen_lui_h_hi12 (tmp1, tmp1, loc));
2790-
emit_move_insn (a0, gen_rtx_PLUS (Pmode, high, tmp1));
2782+
rtx part1 = gen_reg_rtx (Pmode);
2783+
rtx part2 = gen_reg_rtx (Pmode);
2784+
2785+
emit_insn (gen_la_pcrel64_two_parts (part1, part2, loc));
2786+
emit_move_insn (a0, gen_rtx_PLUS (Pmode, part1, part2));
27912787
}
27922788
else
2793-
emit_insn (gen_tls_low (Pmode, a0, high, loc));
2789+
{
2790+
/* Split tls symbol to high and low. */
2791+
rtx high = gen_rtx_HIGH (Pmode, copy_rtx (loc));
2792+
2793+
high = loongarch_force_temporary (tmp, high);
2794+
emit_insn (gen_tls_low (Pmode, a0, high, loc));
2795+
}
27942796
}
27952797
else
27962798
emit_insn (loongarch_load_tls (a0, loc, type));
@@ -2872,22 +2874,28 @@ loongarch_call_tls_get_addr (rtx sym, enum loongarch_symbol_type type, rtx v0)
28722874
{
28732875
if (loongarch_explicit_relocs_p (SYMBOL_GOT_DISP))
28742876
{
2875-
rtx tmp1 = gen_reg_rtx (Pmode);
2876-
rtx high = gen_reg_rtx (Pmode);
2877+
gcc_assert (la_opt_explicit_relocs != EXPLICIT_RELOCS_NONE);
28772878

2878-
loongarch_emit_move (high,
2879-
gen_rtx_HIGH (Pmode,
2880-
loongarch_tls_symbol));
2881-
loongarch_emit_move (tmp1,
2882-
gen_rtx_LO_SUM (Pmode,
2883-
gen_rtx_REG (Pmode, 0),
2879+
rtx part1 = gen_reg_rtx (Pmode);
2880+
rtx part2 = gen_reg_rtx (Pmode);
2881+
2882+
emit_insn (gen_la_pcrel64_two_parts (part1, part2,
28842883
loongarch_tls_symbol));
2885-
emit_insn (gen_lui_h_lo20 (tmp1, tmp1, loongarch_tls_symbol));
2886-
emit_insn (gen_lui_h_hi12 (tmp1, tmp1, loongarch_tls_symbol));
2887-
loongarch_emit_move (dest,
2888-
gen_rtx_MEM (Pmode,
2889-
gen_rtx_PLUS (Pmode,
2890-
high, tmp1)));
2884+
loongarch_emit_move (
2885+
dest,
2886+
gen_rtx_MEM (Pmode, gen_rtx_PLUS (Pmode,
2887+
part1,
2888+
part2)));
2889+
2890+
/* Put an REG_EQUAL note here to allow CSE (storing
2891+
part1 + part2, i.e. the address of tls_get_addr into
2892+
a saved register and use it for multiple TLS
2893+
accesses). */
2894+
rtx sum = gen_rtx_UNSPEC (
2895+
Pmode, gen_rtvec (1, loongarch_tls_symbol),
2896+
UNSPEC_ADDRESS_FIRST
2897+
+ loongarch_classify_symbol (loongarch_tls_symbol));
2898+
set_unique_reg_note (get_last_insn (), REG_EQUAL, sum);
28912899
}
28922900
else
28932901
emit_insn (gen_movdi_symbolic_off64 (dest, loongarch_tls_symbol,
@@ -2950,24 +2958,30 @@ loongarch_legitimize_tls_address (rtx loc)
29502958
dest = gen_reg_rtx (Pmode);
29512959
if (loongarch_explicit_relocs_p (SYMBOL_TLS_IE))
29522960
{
2953-
tmp3 = gen_reg_rtx (Pmode);
2954-
rtx high = gen_rtx_HIGH (Pmode, copy_rtx (tmp2));
2955-
high = loongarch_force_temporary (tmp3, high);
2956-
29572961
if (TARGET_CMODEL_EXTREME)
29582962
{
2959-
rtx tmp3 = gen_reg_rtx (Pmode);
2960-
emit_insn (gen_tls_low (Pmode, tmp3,
2961-
gen_rtx_REG (Pmode, 0), tmp2));
2962-
emit_insn (gen_lui_h_lo20 (tmp3, tmp3, tmp2));
2963-
emit_insn (gen_lui_h_hi12 (tmp3, tmp3, tmp2));
2963+
gcc_assert (la_opt_explicit_relocs
2964+
!= EXPLICIT_RELOCS_NONE);
2965+
2966+
rtx part1 = gen_reg_rtx (Pmode);
2967+
rtx part2 = gen_reg_rtx (Pmode);
2968+
2969+
emit_insn (gen_la_pcrel64_two_parts (part1, part2,
2970+
tmp2));
29642971
emit_move_insn (tmp1,
29652972
gen_rtx_MEM (Pmode,
29662973
gen_rtx_PLUS (Pmode,
2967-
high, tmp3)));
2974+
part1,
2975+
part2)));
29682976
}
29692977
else
2970-
emit_insn (gen_ld_from_got (Pmode, tmp1, high, tmp2));
2978+
{
2979+
tmp3 = gen_reg_rtx (Pmode);
2980+
rtx high = gen_rtx_HIGH (Pmode, copy_rtx (tmp2));
2981+
2982+
high = loongarch_force_temporary (tmp3, high);
2983+
emit_insn (gen_ld_from_got (Pmode, tmp1, high, tmp2));
2984+
}
29712985
}
29722986
else
29732987
emit_insn (loongarch_load_tls (tmp1, tmp2, SYMBOL_TLS_IE));
@@ -3146,24 +3160,23 @@ loongarch_split_symbol (rtx temp, rtx addr, machine_mode mode, rtx *low_out)
31463160
|| !loongarch_split_symbol_type (symbol_type))
31473161
return false;
31483162

3149-
rtx high, temp1 = NULL;
3163+
rtx high;
31503164

31513165
if (temp == NULL)
31523166
temp = gen_reg_rtx (Pmode);
31533167

3154-
/* Get the 12-31 bits of the address. */
3155-
high = gen_rtx_HIGH (Pmode, copy_rtx (addr));
3156-
high = loongarch_force_temporary (temp, high);
3157-
31583168
if (loongarch_symbol_extreme_p (symbol_type) && can_create_pseudo_p ())
31593169
{
31603170
gcc_assert (la_opt_explicit_relocs != EXPLICIT_RELOCS_NONE);
31613171

3162-
temp1 = gen_reg_rtx (Pmode);
3163-
emit_move_insn (temp1, gen_rtx_LO_SUM (Pmode, gen_rtx_REG (Pmode, 0),
3164-
addr));
3165-
emit_insn (gen_lui_h_lo20 (temp1, temp1, addr));
3166-
emit_insn (gen_lui_h_hi12 (temp1, temp1, addr));
3172+
high = gen_reg_rtx (Pmode);
3173+
emit_insn (gen_la_pcrel64_two_parts (high, temp, addr));
3174+
}
3175+
else
3176+
{
3177+
/* Get the 12-31 bits of the address. */
3178+
high = gen_rtx_HIGH (Pmode, copy_rtx (addr));
3179+
high = loongarch_force_temporary (temp, high);
31673180
}
31683181

31693182
if (low_out)
@@ -3172,7 +3185,7 @@ loongarch_split_symbol (rtx temp, rtx addr, machine_mode mode, rtx *low_out)
31723185
case SYMBOL_PCREL64:
31733186
if (can_create_pseudo_p ())
31743187
{
3175-
*low_out = gen_rtx_PLUS (Pmode, high, temp1);
3188+
*low_out = gen_rtx_PLUS (Pmode, high, temp);
31763189
break;
31773190
}
31783191
/* fall through */
@@ -3184,7 +3197,8 @@ loongarch_split_symbol (rtx temp, rtx addr, machine_mode mode, rtx *low_out)
31843197
/* SYMBOL_GOT_DISP symbols are loaded from the GOT. */
31853198
{
31863199
if (TARGET_CMODEL_EXTREME && can_create_pseudo_p ())
3187-
*low_out = gen_rtx_MEM (Pmode, gen_rtx_PLUS (Pmode, high, temp1));
3200+
*low_out = gen_rtx_MEM (Pmode, gen_rtx_PLUS (Pmode, high,
3201+
temp));
31883202
else
31893203
{
31903204
rtx low = gen_rtx_LO_SUM (Pmode, high, addr);
@@ -7497,21 +7511,24 @@ loongarch_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,
74977511
allowed, otherwise load the address into a register first. */
74987512
if (use_sibcall_p)
74997513
{
7500-
if (TARGET_CMODEL_EXTREME)
7501-
{
7502-
emit_insn (gen_movdi_symbolic_off64 (temp1, fnaddr, temp2));
7503-
insn = emit_call_insn (gen_sibcall_internal (temp1, const0_rtx));
7504-
}
7505-
else
7506-
insn = emit_call_insn (gen_sibcall_internal (fnaddr, const0_rtx));
7514+
/* If TARGET_CMODEL_EXTREME, we cannot do a direct jump at all
7515+
and const_call_insn_operand should have returned false. */
7516+
gcc_assert (!TARGET_CMODEL_EXTREME);
7517+
7518+
insn = emit_call_insn (gen_sibcall_internal (fnaddr, const0_rtx));
75077519
SIBLING_CALL_P (insn) = 1;
75087520
}
75097521
else
75107522
{
7511-
if (TARGET_CMODEL_EXTREME)
7523+
if (!TARGET_CMODEL_EXTREME)
7524+
loongarch_emit_move (temp1, fnaddr);
7525+
else if (la_opt_explicit_relocs == EXPLICIT_RELOCS_NONE)
75127526
emit_insn (gen_movdi_symbolic_off64 (temp1, fnaddr, temp2));
75137527
else
7514-
loongarch_emit_move (temp1, fnaddr);
7528+
{
7529+
emit_insn (gen_la_pcrel64_two_parts (temp1, temp2, fnaddr));
7530+
emit_move_insn (temp1, gen_rtx_PLUS (Pmode, temp1, temp2));
7531+
}
75157532

75167533
emit_jump_insn (gen_indirect_jump (temp1));
75177534
}

gcc/config/loongarch/loongarch.md

+20
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@
8484
UNSPEC_CALL_VALUE_MULTIPLE_INTERNAL_1
8585

8686
UNSPEC_LOAD_SYMBOL_OFFSET64
87+
UNSPEC_LA_PCREL_64_PART1
88+
UNSPEC_LA_PCREL_64_PART2
8789
])
8890

8991
(define_c_enum "unspecv" [
@@ -2224,6 +2226,24 @@
22242226
[(set_attr "mode" "DI")
22252227
(set_attr "insn_count" "5")])
22262228

2229+
;; The 64-bit PC-relative part of address loading.
2230+
;; Note that the psABI does not allow splitting it.
2231+
(define_insn "la_pcrel64_two_parts"
2232+
[(set (match_operand:DI 0 "register_operand" "=r")
2233+
(unspec:DI [(match_operand:DI 2 "") (pc)] UNSPEC_LA_PCREL_64_PART1))
2234+
(set (match_operand:DI 1 "register_operand" "=r")
2235+
(unspec:DI [(match_dup 2) (pc)] UNSPEC_LA_PCREL_64_PART2))]
2236+
"TARGET_ABI_LP64 && la_opt_explicit_relocs != EXPLICIT_RELOCS_NONE"
2237+
{
2238+
return "pcalau12i\t%0,%r2\n\t"
2239+
"addi.d\t%1,$r0,%L2\n\t"
2240+
"lu32i.d\t%1,%R2\n\t"
2241+
"lu52i.d\t%1,%1,%H2";
2242+
}
2243+
[(set_attr "move_type" "move")
2244+
(set_attr "mode" "DI")
2245+
(set_attr "length" "16")])
2246+
22272247
;; 32-bit Integer moves
22282248

22292249
(define_expand "movsi"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/* { dg-do compile } */
2+
/* { dg-options "-O2 -fno-inline -march=loongarch64 -mabi=lp64d -O2 -mcmodel=extreme -fno-plt -mexplicit-relocs=always -mdirect-extern-access" } */
3+
4+
struct A {
5+
virtual ~A();
6+
};
7+
8+
struct B : virtual A {};
9+
void var() { B(); }
10+
11+
/* { dg-final { scan-assembler "pcalau12i\t\[^\n\]*%pc_hi20\\(\\.LTHUNK0\\)\n\taddi\\.d\t\[^\n\]*%pc_lo12\\(\\\.LTHUNK0\\)\n\tlu32i\\.d\t\[^\n\]*%pc64_lo20\\(\\.LTHUNK0\\)\n\tlu52i\\.d\t\[^\n\]*%pc64_hi12\\(\\.LTHUNK0\\)" } } */
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/* { dg-do compile } */
2+
/* { dg-options "-O2 -fno-inline -march=loongarch64 -mabi=lp64d -O2 -mcmodel=extreme -fno-plt -mexplicit-relocs=auto -mdirect-extern-access" } */
3+
4+
#include "cmodel-extreme-mi-thunk-1.C"
5+
6+
/* { dg-final { scan-assembler "pcalau12i\t\[^\n\]*%pc_hi20\\(\\.LTHUNK0\\)\n\taddi\\.d\t\[^\n\]*%pc_lo12\\(\\\.LTHUNK0\\)\n\tlu32i\\.d\t\[^\n\]*%pc64_lo20\\(\\.LTHUNK0\\)\n\tlu52i\\.d\t\[^\n\]*%pc64_hi12\\(\\.LTHUNK0\\)" } } */
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/* { dg-do compile } */
2+
/* { dg-options "-O2 -fno-inline -march=loongarch64 -mabi=lp64d -O2 -mcmodel=extreme -fno-plt -mexplicit-relocs=none -mdirect-extern-access" } */
3+
4+
#include "cmodel-extreme-mi-thunk-1.C"
5+
6+
/* { dg-final { scan-assembler "la.local\t\[^\n\]*\\.LTHUNK0" } } */
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/* { dg-do compile } */
2+
/* { dg-options "-march=loongarch64 -mabi=lp64d -O2 -mcmodel=extreme -fno-plt -mexplicit-relocs=always -fdump-rtl-final" } */
3+
4+
int a;
5+
extern int b;
6+
__thread int c __attribute__ ((tls_model ("local-exec")));
7+
__thread int d __attribute__ ((tls_model ("initial-exec")));
8+
__thread int e __attribute__ ((tls_model ("local-dynamic")));
9+
__thread int f __attribute__ ((tls_model ("global-dynamic")));
10+
11+
void
12+
test (void)
13+
{
14+
a = b + c + d + e + f;
15+
}
16+
17+
/* a, b, d, e, f, and __tls_get_addr. */
18+
/* { dg-final { scan-rtl-dump-times "la_pcrel64_two_parts" 6 "final" } } */
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/* { dg-do compile } */
2+
/* { dg-options "-march=loongarch64 -mabi=lp64d -O2 -mcmodel=extreme -fno-plt -mexplicit-relocs=auto -fdump-rtl-final" } */
3+
4+
#include "cmodel-extreme-1.c"
5+
6+
/* a, b, d, e, f, and __tls_get_addr. */
7+
/* { dg-final { scan-rtl-dump-times "la_pcrel64_two_parts" 6 "final" } } */

gcc/testsuite/gcc.target/loongarch/func-call-extreme-1.c

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,33 @@
11
/* { dg-do compile } */
2-
/* { dg-options "-mabi=lp64d -O0 -fno-pic -fno-plt -mexplicit-relocs -mcmodel=extreme" } */
2+
/* { dg-options "-mabi=lp64d -O2 -fno-pic -fno-plt -mexplicit-relocs -mcmodel=extreme" } */
33
/* { dg-final { scan-assembler "test:.*pcalau12i.*%got_pc_hi20.*\n\taddi\.d.*%got_pc_lo12.*\n\tlu32i\.d.*%got64_pc_lo20.*\n\tlu52i\.d.*%got64_pc_hi12.*\n\tldx\.d" } } */
44
/* { dg-final { scan-assembler "test1:.*pcalau12i.*%pc_hi20.*\n\taddi\.d.*%pc_lo12.*\n\tlu32i\.d.*%pc64_lo20.*\n\tlu52i\.d.*pc64_hi12.*\n\tadd\.d" } } */
55
/* { dg-final { scan-assembler "test2:.*pcalau12i.*%pc_hi20.*\n\taddi\.d.*%pc_lo12.*\n\tlu32i\.d.*%pc64_lo20.*\n\tlu52i\.d.*pc64_hi12.*\n\tadd\.d" } } */
66

7+
#define NOIPA __attribute__ ((noipa))
8+
79
extern void g (void);
8-
void
10+
NOIPA void
911
f (void)
1012
{}
1113

12-
static void
14+
NOIPA static void
1315
l (void)
1416
{}
1517

16-
void
18+
NOIPA void
1719
test (void)
1820
{
1921
g ();
2022
}
2123

22-
void
24+
NOIPA void
2325
test1 (void)
2426
{
2527
f ();
2628
}
2729

28-
void
30+
NOIPA void
2931
test2 (void)
3032
{
3133
l ();
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,7 @@
11
/* { dg-do compile } */
2-
/* { dg-options "-mabi=lp64d -O0 -fpic -fno-plt -mexplicit-relocs -mcmodel=extreme" } */
2+
/* { dg-options "-mabi=lp64d -O2 -fpic -fno-plt -mexplicit-relocs -mcmodel=extreme" } */
33
/* { dg-final { scan-assembler "test:.*pcalau12i.*%got_pc_hi20.*\n\taddi\.d.*%got_pc_lo12.*\n\tlu32i\.d.*%got64_pc_lo20.*\n\tlu52i\.d.*%got64_pc_hi12.*\n\tldx\.d" } } */
44
/* { dg-final { scan-assembler "test1:.*pcalau12i.*%got_pc_hi20.*\n\taddi\.d.*%got_pc_lo12.*\n\tlu32i\.d.*%got64_pc_lo20.*\n\tlu52i\.d.*%got64_pc_hi12.*\n\tldx\.d" } } */
55
/* { dg-final { scan-assembler "test2:.*pcalau12i.*%pc_hi20.*\n\taddi\.d.*%pc_lo12.*\n\tlu32i\.d.*%pc64_lo20.*\n\tlu52i\.d.*pc64_hi12.*\n\tadd\.d" } } */
66

7-
extern void g (void);
8-
void
9-
f (void)
10-
{}
11-
12-
static void
13-
l (void)
14-
{}
15-
16-
void
17-
test (void)
18-
{
19-
g ();
20-
}
21-
22-
void
23-
test1 (void)
24-
{
25-
f ();
26-
}
27-
28-
void
29-
test2 (void)
30-
{
31-
l ();
32-
}
7+
#include "func-call-extreme-1.c"

gcc/testsuite/gcc.target/loongarch/func-call-extreme-3.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* { dg-do compile } */
2-
/* { dg-options "-mabi=lp64d -O0 -fno-pic -fno-plt -mexplicit-relocs=auto -mcmodel=extreme" } */
2+
/* { dg-options "-mabi=lp64d -O2 -fno-pic -fno-plt -mexplicit-relocs=auto -mcmodel=extreme" } */
33
/* { dg-final { scan-assembler "test:.*pcalau12i.*%got_pc_hi20.*\n\taddi\.d.*%got_pc_lo12.*\n\tlu32i\.d.*%got64_pc_lo20.*\n\tlu52i\.d.*%got64_pc_hi12.*\n\tldx\.d" } } */
44
/* { dg-final { scan-assembler "test1:.*pcalau12i.*%pc_hi20.*\n\taddi\.d.*%pc_lo12.*\n\tlu32i\.d.*%pc64_lo20.*\n\tlu52i\.d.*pc64_hi12.*\n\tadd\.d" } } */
55
/* { dg-final { scan-assembler "test2:.*pcalau12i.*%pc_hi20.*\n\taddi\.d.*%pc_lo12.*\n\tlu32i\.d.*%pc64_lo20.*\n\tlu52i\.d.*pc64_hi12.*\n\tadd\.d" } } */

gcc/testsuite/gcc.target/loongarch/func-call-extreme-4.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* { dg-do compile } */
2-
/* { dg-options "-mabi=lp64d -O0 -fpic -fno-plt -mexplicit-relocs=auto -mcmodel=extreme" } */
2+
/* { dg-options "-mabi=lp64d -O2 -fpic -fno-plt -mexplicit-relocs=auto -mcmodel=extreme" } */
33
/* { dg-final { scan-assembler "test:.*pcalau12i.*%got_pc_hi20.*\n\taddi\.d.*%got_pc_lo12.*\n\tlu32i\.d.*%got64_pc_lo20.*\n\tlu52i\.d.*%got64_pc_hi12.*\n\tldx\.d" } } */
44
/* { dg-final { scan-assembler "test1:.*pcalau12i.*%got_pc_hi20.*\n\taddi\.d.*%got_pc_lo12.*\n\tlu32i\.d.*%got64_pc_lo20.*\n\tlu52i\.d.*%got64_pc_hi12.*\n\tldx\.d" } } */
55
/* { dg-final { scan-assembler "test2:.*pcalau12i.*%pc_hi20.*\n\taddi\.d.*%pc_lo12.*\n\tlu32i\.d.*%pc64_lo20.*\n\tlu52i\.d.*pc64_hi12.*\n\tadd\.d" } } */

0 commit comments

Comments
 (0)