brintos

brintos / llvm-project-archived public Read only

0
0
Text · 15.8 KiB · 6dc1cd1 Raw
321 lines · plain
1# REQUIRES: loongarch2# RUN: rm -rf %t && split-file %s %t3 4# RUN: llvm-mc --filetype=obj --triple=loongarch32 %t/a.s -o %t/a.la32.o5# RUN: llvm-mc --filetype=obj --triple=loongarch64 %t/a.s -o %t/a.la64.o6# RUN: llvm-mc --filetype=obj --triple=loongarch64 %t/extreme.s -o %t/extreme.o7 8# RUN: ld.lld %t/a.la32.o --image-base=0 --section-start=.rodata=0x11000 --section-start=.text=0x11ffc -o %t/case1.la329# RUN: ld.lld %t/a.la64.o --image-base=0 --section-start=.rodata=0x11000 --section-start=.text=0x11ffc -o %t/case1.la6410# RUN: llvm-objdump -d --no-show-raw-insn %t/case1.la32 | FileCheck %s --check-prefix=CASE111# RUN: llvm-objdump -d --no-show-raw-insn %t/case1.la64 | FileCheck %s --check-prefix=CASE112# CASE1:      pcalau12i $a0, 013# CASE1-NEXT: ld.w      $a0, $a0, 014 15# RUN: ld.lld %t/a.la32.o --image-base=0 --section-start=.rodata=0x11000 --section-start=.text=0x12000 -o %t/case2.la3216# RUN: ld.lld %t/a.la64.o --image-base=0 --section-start=.rodata=0x11000 --section-start=.text=0x12000 -o %t/case2.la6417# RUN: llvm-objdump -d --no-show-raw-insn %t/case2.la32 | FileCheck %s --check-prefix=CASE218# RUN: llvm-objdump -d --no-show-raw-insn %t/case2.la64 | FileCheck %s --check-prefix=CASE219# CASE2:      pcalau12i $a0, -120# CASE2-NEXT: ld.w      $a0, $a0, 021 22# RUN: ld.lld %t/a.la32.o --image-base=0 --section-start=.rodata=0x117ff --section-start=.text=0x12000 -o %t/case3.la3223# RUN: ld.lld %t/a.la64.o --image-base=0 --section-start=.rodata=0x117ff --section-start=.text=0x12000 -o %t/case3.la6424# RUN: llvm-objdump -d --no-show-raw-insn %t/case3.la32 | FileCheck %s --check-prefix=CASE325# RUN: llvm-objdump -d --no-show-raw-insn %t/case3.la64 | FileCheck %s --check-prefix=CASE326# CASE3:      pcalau12i $a0, -127# CASE3-NEXT: ld.w      $a0, $a0, 204728 29# RUN: ld.lld %t/a.la32.o --image-base=0 --section-start=.rodata=0x11800 --section-start=.text=0x12000 -o %t/case4.la3230# RUN: ld.lld %t/a.la64.o --image-base=0 --section-start=.rodata=0x11800 --section-start=.text=0x12000 -o %t/case4.la6431# RUN: llvm-objdump -d --no-show-raw-insn %t/case4.la32 | FileCheck %s --check-prefix=CASE432# RUN: llvm-objdump -d --no-show-raw-insn %t/case4.la64 | FileCheck %s --check-prefix=CASE433# CASE4:      pcalau12i $a0, 034# CASE4-NEXT: ld.w      $a0, $a0, -204835 36# RUN: ld.lld %t/a.la32.o --image-base=0 --section-start=.rodata=0x12004 --section-start=.text=0x11ffc -o %t/case5.la3237# RUN: ld.lld %t/a.la64.o --image-base=0 --section-start=.rodata=0x12004 --section-start=.text=0x11ffc -o %t/case5.la6438# RUN: llvm-objdump -d --no-show-raw-insn %t/case5.la32 | FileCheck %s --check-prefix=CASE539# RUN: llvm-objdump -d --no-show-raw-insn %t/case5.la64 | FileCheck %s --check-prefix=CASE540# CASE5:      pcalau12i $a0, 141# CASE5-NEXT: ld.w      $a0, $a0, 442 43# RUN: ld.lld %t/a.la32.o --image-base=0 --section-start=.rodata=0x12800 --section-start=.text=0x11ffc -o %t/case6.la3244# RUN: ld.lld %t/a.la64.o --image-base=0 --section-start=.rodata=0x12800 --section-start=.text=0x11ffc -o %t/case6.la6445# RUN: llvm-objdump -d --no-show-raw-insn %t/case6.la32 | FileCheck %s --check-prefix=CASE646# RUN: llvm-objdump -d --no-show-raw-insn %t/case6.la64 | FileCheck %s --check-prefix=CASE647# CASE6:      pcalau12i $a0, 248# CASE6-NEXT: ld.w      $a0, $a0, -204849 50# RUN: ld.lld %t/a.la32.o --image-base=0 --section-start=.rodata=0x7ffff123 --section-start=.text=0x0 -o %t/case7.la3251# RUN: ld.lld %t/a.la64.o --image-base=0 --section-start=.rodata=0x7ffff123 --section-start=.text=0x0 -o %t/case7.la6452# RUN: llvm-objdump -d --no-show-raw-insn %t/case7.la32 | FileCheck %s --check-prefix=CASE753# RUN: llvm-objdump -d --no-show-raw-insn %t/case7.la64 | FileCheck %s --check-prefix=CASE754# CASE7:      pcalau12i $a0, 52428755# CASE7-NEXT: ld.w      $a0, $a0, 29156 57# RUN: ld.lld %t/a.la32.o --image-base=0 --section-start=.rodata=0x7ffffabc --section-start=.text=0x0 -o %t/case8.la3258# RUN: ld.lld %t/a.la64.o --image-base=0 --section-start=.rodata=0x7ffffabc --section-start=.text=0x0 -o %t/case8.la6459# RUN: llvm-objdump -d --no-show-raw-insn %t/case8.la32 | FileCheck %s --check-prefix=CASE860# RUN: llvm-objdump -d --no-show-raw-insn %t/case8.la64 | FileCheck %s --check-prefix=CASE861# CASE8:      pcalau12i $a0, -52428862# CASE8-NEXT: ld.w      $a0, $a0, -134863 64# RUN: ld.lld %t/a.la32.o --image-base=0 --section-start=.rodata=0x10123 --section-start=.text=0x80010000 -o %t/case9.la3265# RUN: ld.lld %t/a.la64.o --image-base=0 --section-start=.rodata=0x10123 --section-start=.text=0x80010000 -o %t/case9.la6466# RUN: llvm-objdump -d --no-show-raw-insn %t/case9.la32 | FileCheck %s --check-prefix=CASE967# RUN: llvm-objdump -d --no-show-raw-insn %t/case9.la64 | FileCheck %s --check-prefix=CASE968# CASE9:      pcalau12i $a0, -52428869# CASE9-NEXT: ld.w      $a0, $a0, 29170 71## page delta = 0x4443333322222000, page offset = 0x11172## %pc_lo12   = 0x111 = 27373## %pc_hi20   = 0x22222 = 13981074## %pc64_lo20 = 0x33333 = 20971575## %pc64_hi12 = 0x444 = 109276# RUN: ld.lld %t/extreme.o --image-base=0 --section-start=.rodata=0x4443333334567111 --section-start=.text=0x0000000012345678 -o %t/extreme077# RUN: llvm-objdump -d --no-show-raw-insn %t/extreme0 | FileCheck %s --check-prefix=EXTREME078# EXTREME0:      pcalau12i $t1, 13981079# EXTREME0-NEXT: addi.d $t0, $zero, 27380# EXTREME0-NEXT: lu32i.d   $t0, 20971581# EXTREME0-NEXT: lu52i.d   $t0, $t0, 109282 83## page delta = 0x4443333222223000, page offset = 0x88884## %pc_lo12   = 0x888 = -191285## %pc_hi20   = 0x22223 = 13981186## %pc64_lo20 = 0x33332 = 20971487## %pc64_hi12 = 0x444 = 109288# RUN: ld.lld %t/extreme.o --image-base=0 --section-start=.rodata=0x4443333334567888 --section-start=.text=0x0000000012345678 -o %t/extreme189# RUN: llvm-objdump -d --no-show-raw-insn %t/extreme1 | FileCheck %s --check-prefix=EXTREME190# EXTREME1:      pcalau12i $t1, 13981191# EXTREME1-NEXT: addi.d $t0, $zero, -191292# EXTREME1-NEXT: lu32i.d   $t0, 20971493# EXTREME1-NEXT: lu52i.d   $t0, $t0, 109294 95## page delta = 0x4443333499999000, page offset = 0x11196## %pc_lo12   = 0x111 = 27397## %pc_hi20   = 0x99999 = -41943198## %pc64_lo20 = 0x33334 = 20971699## %pc64_hi12 = 0x444 = 1092100# RUN: ld.lld %t/extreme.o --image-base=0 --section-start=.rodata=0x44433333abcde111 --section-start=.text=0x0000000012345678 -o %t/extreme2101# RUN: llvm-objdump -d --no-show-raw-insn %t/extreme2 | FileCheck %s --check-prefix=EXTREME2102# EXTREME2:      pcalau12i $t1, -419431103# EXTREME2-NEXT: addi.d $t0, $zero, 273104# EXTREME2-NEXT: lu32i.d   $t0, 209716105# EXTREME2-NEXT: lu52i.d   $t0, $t0, 1092106 107## page delta = 0x444333339999a000, page offset = 0x888108## %pc_lo12   = 0x888 = -1912109## %pc_hi20   = 0x9999a = -419430110## %pc64_lo20 = 0x33333 = 209715111## %pc64_hi12 = 0x444 = 1092112# RUN: ld.lld %t/extreme.o --image-base=0 --section-start=.rodata=0x44433333abcde888 --section-start=.text=0x0000000012345678 -o %t/extreme3113# RUN: llvm-objdump -d --no-show-raw-insn %t/extreme3 | FileCheck %s --check-prefix=EXTREME3114# EXTREME3:      pcalau12i $t1, -419430115# EXTREME3-NEXT: addi.d $t0, $zero, -1912116# EXTREME3-NEXT: lu32i.d   $t0, 209715117# EXTREME3-NEXT: lu52i.d   $t0, $t0, 1092118 119## page delta = 0x444aaaaa22222000, page offset = 0x111120## %pc_lo12   = 0x111 = 273121## %pc_hi20   = 0x22222 = 139810122## %pc64_lo20 = 0xaaaaa = -349526123## %pc64_hi12 = 0x444 = 1092124# RUN: ld.lld %t/extreme.o --image-base=0 --section-start=.rodata=0x444aaaaa34567111 --section-start=.text=0x0000000012345678 -o %t/extreme4125# RUN: llvm-objdump -d --no-show-raw-insn %t/extreme4 | FileCheck %s --check-prefix=EXTREME4126# EXTREME4:      pcalau12i $t1, 139810127# EXTREME4-NEXT: addi.d $t0, $zero, 273128# EXTREME4-NEXT: lu32i.d   $t0, -349526129# EXTREME4-NEXT: lu52i.d   $t0, $t0, 1092130 131## page delta = 0x444aaaa922223000, page offset = 0x888132## %pc_lo12   = 0x888 = -1912133## %pc_hi20   = 0x22223 = 139811134## %pc64_lo20 = 0xaaaa9 = -349527135## %pc64_hi12 = 0x444 = 1092136# RUN: ld.lld %t/extreme.o --image-base=0 --section-start=.rodata=0x444aaaaa34567888 --section-start=.text=0x0000000012345678 -o %t/extreme5137# RUN: llvm-objdump -d --no-show-raw-insn %t/extreme5 | FileCheck %s --check-prefix=EXTREME5138# EXTREME5:      pcalau12i $t1, 139811139# EXTREME5-NEXT: addi.d $t0, $zero, -1912140# EXTREME5-NEXT: lu32i.d   $t0, -349527141# EXTREME5-NEXT: lu52i.d   $t0, $t0, 1092142 143## page delta = 0x444aaaab99999000, page offset = 0x111144## %pc_lo12   = 0x111 = 273145## %pc_hi20   = 0x99999 = -419431146## %pc64_lo20 = 0xaaaab = -349525147## %pc64_hi12 = 0x444 = 1092148# RUN: ld.lld %t/extreme.o --image-base=0 --section-start=.rodata=0x444aaaaaabcde111 --section-start=.text=0x0000000012345678 -o %t/extreme6149# RUN: llvm-objdump -d --no-show-raw-insn %t/extreme6 | FileCheck %s --check-prefix=EXTREME6150# EXTREME6:      pcalau12i $t1, -419431151# EXTREME6-NEXT: addi.d $t0, $zero, 273152# EXTREME6-NEXT: lu32i.d   $t0, -349525153# EXTREME6-NEXT: lu52i.d   $t0, $t0, 1092154 155## page delta = 0x444aaaaa9999a000, page offset = 0x888156## %pc_lo12   = 0x888 = -1912157## %pc_hi20   = 0x9999a = -419430158## %pc64_lo20 = 0xaaaaa = -349526159## %pc64_hi12 = 0x444 = 1092160# RUN: ld.lld %t/extreme.o --image-base=0 --section-start=.rodata=0x444aaaaaabcde888 --section-start=.text=0x0000000012345678 -o %t/extreme7161# RUN: llvm-objdump -d --no-show-raw-insn %t/extreme7 | FileCheck %s --check-prefix=EXTREME7162# EXTREME7:      pcalau12i $t1, -419430163# EXTREME7-NEXT: addi.d $t0, $zero, -1912164# EXTREME7-NEXT: lu32i.d   $t0, -349526165# EXTREME7-NEXT: lu52i.d   $t0, $t0, 1092166 167## page delta = 0xbbb3333322222000, page offset = 0x111168## %pc_lo12   = 0x111 = 273169## %pc_hi20   = 0x22222 = 139810170## %pc64_lo20 = 0x33333 = 209715171## %pc64_hi12 = 0xbbb = -1093172# RUN: ld.lld %t/extreme.o --image-base=0 --section-start=.rodata=0xbbb3333334567111 --section-start=.text=0x0000000012345678 -o %t/extreme8173# RUN: llvm-objdump -d --no-show-raw-insn %t/extreme8 | FileCheck %s --check-prefix=EXTREME8174# EXTREME8:      pcalau12i $t1, 139810175# EXTREME8-NEXT: addi.d $t0, $zero, 273176# EXTREME8-NEXT: lu32i.d   $t0, 209715177# EXTREME8-NEXT: lu52i.d   $t0, $t0, -1093178 179## page delta = 0xbbb3333222223000, page offset = 0x888180## %pc_lo12   = 0x888 = -1912181## %pc_hi20   = 0x22223 = 139811182## %pc64_lo20 = 0x33332 = 209714183## %pc64_hi12 = 0xbbb = -1093184# RUN: ld.lld %t/extreme.o --image-base=0 --section-start=.rodata=0xbbb3333334567888 --section-start=.text=0x0000000012345678 -o %t/extreme9185# RUN: llvm-objdump -d --no-show-raw-insn %t/extreme9 | FileCheck %s --check-prefix=EXTREME9186# EXTREME9:      pcalau12i $t1, 139811187# EXTREME9-NEXT: addi.d $t0, $zero, -1912188# EXTREME9-NEXT: lu32i.d   $t0, 209714189# EXTREME9-NEXT: lu52i.d   $t0, $t0, -1093190 191## page delta = 0xbbb3333499999000, page offset = 0x111192## %pc_lo12   = 0x111 = 273193## %pc_hi20   = 0x99999 = -419431194## %pc64_lo20 = 0x33334 = 209716195## %pc64_hi12 = 0xbbb = -1093196# RUN: ld.lld %t/extreme.o --image-base=0 --section-start=.rodata=0xbbb33333abcde111 --section-start=.text=0x0000000012345678 -o %t/extreme10197# RUN: llvm-objdump -d --no-show-raw-insn %t/extreme10 | FileCheck %s --check-prefix=EXTREME10198# EXTREME10:      pcalau12i $t1, -419431199# EXTREME10-NEXT: addi.d $t0, $zero, 273200# EXTREME10-NEXT: lu32i.d   $t0, 209716201# EXTREME10-NEXT: lu52i.d   $t0, $t0, -1093202 203## page delta = 0xbbb333339999a000, page offset = 0x888204## %pc_lo12   = 0x888 = -1912205## %pc_hi20   = 0x9999a = -419430206## %pc64_lo20 = 0x33333 = 209715207## %pc64_hi12 = 0xbbb = -1093208# RUN: ld.lld %t/extreme.o --image-base=0 --section-start=.rodata=0xbbb33333abcde888 --section-start=.text=0x0000000012345678 -o %t/extreme11209# RUN: llvm-objdump -d --no-show-raw-insn %t/extreme11 | FileCheck %s --check-prefix=EXTREME11210# EXTREME11:      pcalau12i $t1, -419430211# EXTREME11-NEXT: addi.d $t0, $zero, -1912212# EXTREME11-NEXT: lu32i.d   $t0, 209715213# EXTREME11-NEXT: lu52i.d   $t0, $t0, -1093214 215## page delta = 0xbbbaaaaa22222000, page offset = 0x111216## %pc_lo12   = 0x111 = 273217## %pc_hi20   = 0x22222 = 139810218## %pc64_lo20 = 0xaaaaa = -349526219## %pc64_hi12 = 0xbbb = -1093220# RUN: ld.lld %t/extreme.o --image-base=0 --section-start=.rodata=0xbbbaaaaa34567111 --section-start=.text=0x0000000012345678 -o %t/extreme12221# RUN: llvm-objdump -d --no-show-raw-insn %t/extreme12 | FileCheck %s --check-prefix=EXTREME12222# EXTREME12:      pcalau12i $t1, 139810223# EXTREME12-NEXT: addi.d $t0, $zero, 273224# EXTREME12-NEXT: lu32i.d   $t0, -349526225# EXTREME12-NEXT: lu52i.d   $t0, $t0, -1093226 227## page delta = 0xbbbaaaa922223000, page offset = 0x888228## %pc_lo12   = 0x888 = -1912229## %pc_hi20   = 0x22223 = 139811230## %pc64_lo20 = 0xaaaa9 = -349527231## %pc64_hi12 = 0xbbb = -1093232# RUN: ld.lld %t/extreme.o --image-base=0 --section-start=.rodata=0xbbbaaaaa34567888 --section-start=.text=0x0000000012345678 -o %t/extreme13233# RUN: llvm-objdump -d --no-show-raw-insn %t/extreme13 | FileCheck %s --check-prefix=EXTREME13234# EXTREME13:      pcalau12i $t1, 139811235# EXTREME13-NEXT: addi.d $t0, $zero, -1912236# EXTREME13-NEXT: lu32i.d   $t0, -349527237# EXTREME13-NEXT: lu52i.d   $t0, $t0, -1093238 239## page delta = 0xbbbaaaab99999000, page offset = 0x111240## %pc_lo12   = 0x111 = 273241## %pc_hi20   = 0x99999 = -419431242## %pc64_lo20 = 0xaaaab = -349525243## %pc64_hi12 = 0xbbb = -1093244# RUN: ld.lld %t/extreme.o --image-base=0 --section-start=.rodata=0xbbbaaaaaabcde111 --section-start=.text=0x0000000012345678 -o %t/extreme14245# RUN: llvm-objdump -d --no-show-raw-insn %t/extreme14 | FileCheck %s --check-prefix=EXTREME14246# EXTREME14:      pcalau12i $t1, -419431247# EXTREME14-NEXT: addi.d $t0, $zero, 273248# EXTREME14-NEXT: lu32i.d   $t0, -349525249# EXTREME14-NEXT: lu52i.d   $t0, $t0, -1093250 251## page delta = 0xbbbaaaaa9999a000, page offset = 0x888252## %pc_lo12   = 0x888 = -1912253## %pc_hi20   = 0x9999a = -419430254## %pc64_lo20 = 0xaaaaa = -349526255## %pc64_hi12 = 0xbbb = -1093256# RUN: ld.lld %t/extreme.o --image-base=0 --section-start=.rodata=0xbbbaaaaaabcde888 --section-start=.text=0x0000000012345678 -o %t/extreme15257# RUN: llvm-objdump -d --no-show-raw-insn %t/extreme15 | FileCheck %s --check-prefix=EXTREME15258# EXTREME15:      pcalau12i $t1, -419430259# EXTREME15-NEXT: addi.d $t0, $zero, -1912260# EXTREME15-NEXT: lu32i.d   $t0, -349526261# EXTREME15-NEXT: lu52i.d   $t0, $t0, -1093262 263## page delta = 0xffffffff00000000, page offset = 0x888264## %pc_lo12   = 0x888 = -1912265## %pc_hi20   = 0x00000 = 0266## %pc64_lo20 = 0xfffff = -1267## %pc64_hi12 = 0xfff = -1268# RUN: ld.lld %t/extreme.o --image-base=0 --section-start=.rodata=0x0000000012344888 --section-start=.text=0x0000000012345678 -o %t/extreme16269# RUN: llvm-objdump -d --no-show-raw-insn %t/extreme16 | FileCheck %s --check-prefix=EXTREME16270# EXTREME16:      pcalau12i $t1, 0271# EXTREME16-NEXT: addi.d $t0, $zero, -1912272# EXTREME16-NEXT: lu32i.d   $t0, -1273# EXTREME16-NEXT: lu52i.d   $t0, $t0, -1274 275## page delta = 0x0000000080000000, page offset = 0x888276## %pc_lo12   = 0x888 = -1912277## %pc_hi20   = 0x80000 = -524288278## %pc64_lo20 = 0xfffff = 0279## %pc64_hi12 = 0xfff = 0280# RUN: ld.lld %t/extreme.o --image-base=0 --section-start=.rodata=0x000071238ffff888 --section-start=.text=0x0000712310000678 -o %t/extreme17281# RUN: llvm-objdump -d --no-show-raw-insn %t/extreme17 | FileCheck %s --check-prefix=EXTREME17282# EXTREME17:      pcalau12i $t1, -524288283# EXTREME17-NEXT: addi.d $t0, $zero, -1912284# EXTREME17-NEXT: lu32i.d   $t0, 0285# EXTREME17-NEXT: lu52i.d   $t0, $t0, 0286 287## A case that pcalau12i, lu32i.d and lu52i.d are in different pages.288## page delta = 0x0000000080000000, page offset = 0x123289## %pc_lo12   = 0x111 = 273290## %pc_hi20   = 0x80000 = -524288291## %pc64_lo20 = 0x00001 = 1292## %pc64_hi12 = 0x000 = 0293# RUN: ld.lld %t/extreme.o --image-base=0 --section-start=.rodata=0x80000111 --section-start=.text=0xff8 -o %t/extreme18294# RUN: llvm-objdump -d --no-show-raw-insn %t/extreme18 | FileCheck %s --check-prefix=EXTREME18295# EXTREME18:      pcalau12i $t1, -524288296# EXTREME18-NEXT: addi.d $t0, $zero, 273297# EXTREME18-NEXT: lu32i.d   $t0, 1298# EXTREME18-NEXT: lu52i.d   $t0, $t0, 0299 300#--- a.s301.rodata302x:303.word 10304.text305.global _start306_start:307    pcalau12i $a0, %pc_hi20(x)308    ld.w      $a0, $a0, %pc_lo12(x)309 310#--- extreme.s311.rodata312x:313.word 10314.text315.global _start316_start:317    pcalau12i $t1, %pc_hi20(x)318    addi.d    $t0, $zero, %pc_lo12(x)319    lu32i.d   $t0, %pc64_lo20(x)320    lu52i.d   $t0, $t0, %pc64_hi12(x)321