diff --git a/lib/Target/RISCV/RISCVLDBackend.cpp b/lib/Target/RISCV/RISCVLDBackend.cpp index 7fc3f7b22..8186164c4 100644 --- a/lib/Target/RISCV/RISCVLDBackend.cpp +++ b/lib/Target/RISCV/RISCVLDBackend.cpp @@ -546,11 +546,12 @@ bool RISCVLDBackend::doRelaxationLui(Relocation *reloc, Relocator::DWord G) { } bool RISCVLDBackend::doRelaxationQCLi(Relocation *reloc, Relocator::DWord G) { - /* Three similar relaxations can be applied here, in order of preference: + /* Several similar relaxations can be applied here, in order of preference: * -- qc.e.li -> c.lui (saves 4 bytes) * -- qc.li -> c.lui (saves 2 bytes) * -- qc.e.li -> qc.li (saves 2 bytes) * -- qc.e.li -> addi (GP-relative) (saves 2 bytes, not available for PIC) + * -- qc.e.li -> lui (saves 2 bytes) */ Fragment *frag = reloc->targetRef()->frag(); @@ -615,6 +616,9 @@ bool RISCVLDBackend::doRelaxationQCLi(Relocation *reloc, Relocator::DWord G) { !config().isCodeIndep() && G != 0 && S != 0 && fitsInGP(G, Value, frag, reloc->targetSection(), SymbolSize); + bool canRelaxLUI = + canRelaxXqci && isQC_E_LI && llvm::isShiftedInt<20, 12>(Value); + const char *msg = isQC_E_LI ? "RISCV_QC_E_LI_C_LUI" : "RISCV_QC_LI_C_LUI"; if (canRelaxCLui) { uint16_t c_lui = 0x6001u | rd << 7; @@ -668,6 +672,21 @@ bool RISCVLDBackend::doRelaxationQCLi(Relocation *reloc, Relocator::DWord G) { return true; } + if (canRelaxLUI) { + const char *msg = "RISCV_QC_E_LI_LUI"; + uint32_t lui = 0x00000037u | (rd << 7); + + region->replaceInstruction(offset, reloc, lui, 4); + reloc->setTargetData(lui); + reloc->setType(llvm::ELF::R_RISCV_HI20); + relaxDeleteBytes(msg, *region, offset + 4, 2, reloc->symInfo()->name()); + + // Report missed relaxation as C.LUI would have been smaller + reportMissedRelaxation("RISCV_QC_E_LI_C_LUI", *region, offset, 2, + reloc->symInfo()->name()); + return true; + } + if (canRelaxXqci) reportMissedRelaxation(msg, *region, offset, isQC_E_LI ? 4 : 2, reloc->symInfo()->name()); diff --git a/test/RISCV/standalone/Relaxation/QC_E_LI_QC_LI/Inputs/x.s b/test/RISCV/standalone/Relaxation/QC_E_LI_QC_LI/Inputs/x.s index e2fcbd72d..e39e345bf 100644 --- a/test/RISCV/standalone/Relaxation/QC_E_LI_QC_LI/Inputs/x.s +++ b/test/RISCV/standalone/Relaxation/QC_E_LI_QC_LI/Inputs/x.s @@ -12,16 +12,17 @@ main: qc.li a0, %qc.abs20(can_c_lui) qc.li a0, %qc.abs20(cannot_c_lui) - qc.li a0, %qc.abs20(can_qc_li) - qc.li x2, %qc.abs20(can_c_lui) # Cannot due to rd=x2 + qc.li a0, %qc.abs20(can_qc_li) qc.e.li a0, can_c_lui qc.e.li a0, cannot_c_lui + qc.e.li x2, can_c_lui # Cannot due to rd=x2 qc.e.li a0, can_qc_li qc.e.li a0, cannot_qc_li qc.e.li a0, can_addi_gprel qc.e.li a0, cannot_addi_gprel - + qc.e.li a0, can_lui + qc.e.li a0, cannot_lui .size main, .-main diff --git a/test/RISCV/standalone/Relaxation/QC_E_LI_QC_LI/Inputs/x.t b/test/RISCV/standalone/Relaxation/QC_E_LI_QC_LI/Inputs/x.t index f7697ab7c..f1641d13e 100644 --- a/test/RISCV/standalone/Relaxation/QC_E_LI_QC_LI/Inputs/x.t +++ b/test/RISCV/standalone/Relaxation/QC_E_LI_QC_LI/Inputs/x.t @@ -3,13 +3,16 @@ __global_pointer$ = 0x01000000; can_c_lui = 0x0001f000; -cannot_c_lui = 0x00000800; +cannot_c_lui = 0x00000801; can_qc_li = 0x00040000; -cannot_qc_li = 0x00080000; +cannot_qc_li = 0x00080001; can_addi_gprel = 0x01000020; -cannot_addi_gprel = 0x01002000; +cannot_addi_gprel = 0x01002001; + +can_lui = 0x1100f000; +cannot_lui = 0x1100f001; SECTIONS { .text : { diff --git a/test/RISCV/standalone/Relaxation/QC_E_LI_QC_LI/QC_E_LI_QC_LI.test b/test/RISCV/standalone/Relaxation/QC_E_LI_QC_LI/QC_E_LI_QC_LI.test index 66a8b9aa7..605decb10 100644 --- a/test/RISCV/standalone/Relaxation/QC_E_LI_QC_LI/QC_E_LI_QC_LI.test +++ b/test/RISCV/standalone/Relaxation/QC_E_LI_QC_LI/QC_E_LI_QC_LI.test @@ -12,88 +12,104 @@ RUN: %link %linkopts --relax-xqci -MapStyle txt -Map %t.1.map --verbose %t.o -o VERBOSE: RISCV_QC_LI_C_LUI : Deleting 2 bytes for symbol 'can_c_lui' in section .text+0x2 file {{.*}}.o VERBOSE: RISCV_QC_LI_C_LUI : relaxing instruction 0x0000051b to compressed instruction 0x6501 for symbol can_c_lui in section .text+0x0 file {{.*}}.o VERBOSE: RISCV_QC_LI_C_LUI : Cannot relax 2 bytes for symbol 'cannot_c_lui' in section .text+0x2 file {{.*}}.o -VERBOSE: RISCV_QC_LI_C_LUI : Cannot relax 2 bytes for symbol 'can_qc_li' in section .text+0x6 file {{.*}}.o -VERBOSE: RISCV_QC_LI_C_LUI : Cannot relax 2 bytes for symbol 'can_c_lui' in section .text+0xa file {{.*}}.o +VERBOSE: RISCV_QC_LI_C_LUI : Cannot relax 2 bytes for symbol 'can_c_lui' in section .text+0x6 file {{.*}}.o +VERBOSE: RISCV_QC_LI_C_LUI : Cannot relax 2 bytes for symbol 'can_qc_li' in section .text+0xa file {{.*}}.o VERBOSE: RISCV_QC_E_LI_C_LUI : Deleting 4 bytes for symbol 'can_c_lui' in section .text+0x10 file {{.*}}.o VERBOSE: RISCV_QC_E_LI_C_LUI : relaxing instruction 0x00000000051f to compressed instruction 0x6501 for symbol can_c_lui in section .text+0xe file {{.*}}.o VERBOSE: RISCV_QC_E_LI_QC_LI : Deleting 2 bytes for symbol 'cannot_c_lui' in section .text+0x14 file {{.*}}.o VERBOSE: RISCV_QC_E_LI_C_LUI : Cannot relax 2 bytes for symbol 'cannot_c_lui' in section .text+0x10 file {{.*}}.o -VERBOSE: RISCV_QC_E_LI_QC_LI : Deleting 2 bytes for symbol 'can_qc_li' in section .text+0x18 file {{.*}}.o -VERBOSE: RISCV_QC_E_LI_C_LUI : Cannot relax 2 bytes for symbol 'can_qc_li' in section .text+0x14 file {{.*}}.o -VERBOSE: RISCV_QC_E_LI_C_LUI : Cannot relax 4 bytes for symbol 'cannot_qc_li' in section .text+0x18 file {{.*}}.o -VERBOSE: RISCV_QC_E_LI_GP : Deleting 2 bytes for symbol 'can_addi_gprel' in section .text+0x22 file {{.*}}.o -VERBOSE: RISCV_QC_E_LI_C_LUI : Cannot relax 2 bytes for symbol 'can_addi_gprel' in section .text+0x1e file {{.*}}.o -VERBOSE: RISCV_QC_E_LI_C_LUI : Cannot relax 4 bytes for symbol 'cannot_addi_gprel' in section .text+0x22 file {{.*}}.o +VERBOSE: RISCV_QC_E_LI_QC_LI : Deleting 2 bytes for symbol 'can_c_lui' in section .text+0x18 file {{.*}}.o +VERBOSE: RISCV_QC_E_LI_C_LUI : Cannot relax 2 bytes for symbol 'can_c_lui' in section .text+0x14 file {{.*}}.o +VERBOSE: RISCV_QC_E_LI_QC_LI : Deleting 2 bytes for symbol 'can_qc_li' in section .text+0x1c file {{.*}}.o +VERBOSE: RISCV_QC_E_LI_C_LUI : Cannot relax 2 bytes for symbol 'can_qc_li' in section .text+0x18 file {{.*}}.o +VERBOSE: RISCV_QC_E_LI_C_LUI : Cannot relax 4 bytes for symbol 'cannot_qc_li' in section .text+0x1c file {{.*}}.o +VERBOSE: RISCV_QC_E_LI_GP : Deleting 2 bytes for symbol 'can_addi_gprel' in section .text+0x26 file {{.*}}.o +VERBOSE: RISCV_QC_E_LI_C_LUI : Cannot relax 2 bytes for symbol 'can_addi_gprel' in section .text+0x22 file {{.*}}.o +VERBOSE: RISCV_QC_E_LI_C_LUI : Cannot relax 4 bytes for symbol 'cannot_addi_gprel' in section .text+0x26 file {{.*}}.o +VERBOSE: RISCV_QC_E_LI_LUI : Deleting 2 bytes for symbol 'can_lui' in section .text+0x30 file {{.*}}.o +VERBOSE: RISCV_QC_E_LI_C_LUI : Cannot relax 2 bytes for symbol 'can_lui' in section .text+0x2c file {{.*}}.o +VERBOSE: RISCV_QC_E_LI_C_LUI : Cannot relax 4 bytes for symbol 'cannot_lui' in section .text+0x30 file {{.*}}.o RUN: %filecheck %s --input-file=%t.1.map --check-prefix=MAP MAP: # LinkStats Begin -MAP: # RelaxationBytesDeleted : 12 -MAP: # RelaxationBytesMissed : 20 +MAP: # RelaxationBytesDeleted : 16 +MAP: # RelaxationBytesMissed : 28 MAP: # LinkStats End MAP: .text {{.+}}, Alignment: 0x2, Flags: SHF_ALLOC|SHF_EXECINSTR, Type: SHT_PROGBITS -MAP: # RelaxationBytesDeleted : 12 -MAP: # RelaxationBytesMissed : 20 +MAP: # RelaxationBytesDeleted : 16 +MAP: # RelaxationBytesMissed : 28 MAP: .text {{.+}}.o #SHT_PROGBITS,SHF_ALLOC|SHF_EXECINSTR,2 RUN: %objdump --no-print-imm-hex -d -M no-aliases %t.1.out 2>&1 | %filecheck %s --check-prefix=EXE EXE:
: EXE-NEXT: 657d c.lui a0, 31 -EXE-NEXT: 0800051b qc.li a0, 2048 -EXE-NEXT: 0000851b qc.li a0, 262144 +EXE-NEXT: 0801051b qc.li a0, 2049 EXE-NEXT: 7000311b qc.li sp, 126976 +EXE-NEXT: 0000851b qc.li a0, 262144 EXE-NEXT: 657d c.lui a0, 31 -EXE-NEXT: 0800051b qc.li a0, 2048 +EXE-NEXT: 0801051b qc.li a0, 2049 +EXE-NEXT: 7000311b qc.li sp, 126976 EXE-NEXT: 0000851b qc.li a0, 262144 -EXE-NEXT: 051f 0000 0008 qc.e.li a0, 524288 +EXE-NEXT: 051f 0001 0008 qc.e.li a0, 524289 EXE-NEXT: 02018513 addi a0, gp, 32 -EXE-NEXT: 051f 2000 0100 qc.e.li a0, 16785408 +EXE-NEXT: 051f 2001 0100 qc.e.li a0, 16785409 +EXE-NEXT: 1100f537 lui a0, 69647 +EXE-NEXT: 051f f001 1100 qc.e.li a0, 285274113 ## Link with Xqci and GP relaxations enabled, C disabled. RUN: %link %linkopts --relax-xqci --no-relax-c -MapStyle txt -Map %t.2.map --verbose %t.o -o %t.2.out -T %p/Inputs/x.t 2>&1 | %filecheck %s --check-prefix=VERBOSE-NO-C VERBOSE-NO-C: RISCV_QC_LI_C_LUI : Cannot relax 2 bytes for symbol 'can_c_lui' in section .text+0x0 file {{.*}}.o VERBOSE-NO-C: RISCV_QC_LI_C_LUI : Cannot relax 2 bytes for symbol 'cannot_c_lui' in section .text+0x4 file {{.*}}.o -VERBOSE-NO-C: RISCV_QC_LI_C_LUI : Cannot relax 2 bytes for symbol 'can_qc_li' in section .text+0x8 file {{.*}}.o -VERBOSE-NO-C: RISCV_QC_LI_C_LUI : Cannot relax 2 bytes for symbol 'can_c_lui' in section .text+0xc file {{.*}}.o +VERBOSE-NO-C: RISCV_QC_LI_C_LUI : Cannot relax 2 bytes for symbol 'can_c_lui' in section .text+0x8 file {{.*}}.o +VERBOSE-NO-C: RISCV_QC_LI_C_LUI : Cannot relax 2 bytes for symbol 'can_qc_li' in section .text+0xc file {{.*}}.o VERBOSE-NO-C: RISCV_QC_E_LI_QC_LI : Deleting 2 bytes for symbol 'can_c_lui' in section .text+0x14 file {{.*}}.o VERBOSE-NO-C: RISCV_QC_E_LI_C_LUI : Cannot relax 2 bytes for symbol 'can_c_lui' in section .text+0x10 file {{.*}}.o VERBOSE-NO-C: RISCV_QC_E_LI_QC_LI : Deleting 2 bytes for symbol 'cannot_c_lui' in section .text+0x18 file {{.*}}.o VERBOSE-NO-C: RISCV_QC_E_LI_C_LUI : Cannot relax 2 bytes for symbol 'cannot_c_lui' in section .text+0x14 file {{.*}}.o -VERBOSE-NO-C: RISCV_QC_E_LI_QC_LI : Deleting 2 bytes for symbol 'can_qc_li' in section .text+0x1c file {{.*}}.o -VERBOSE-NO-C: RISCV_QC_E_LI_C_LUI : Cannot relax 2 bytes for symbol 'can_qc_li' in section .text+0x18 file {{.*}}.o -VERBOSE-NO-C: RISCV_QC_E_LI_C_LUI : Cannot relax 4 bytes for symbol 'cannot_qc_li' in section .text+0x1c file {{.*}}.o -VERBOSE-NO-C: RISCV_QC_E_LI_GP : Deleting 2 bytes for symbol 'can_addi_gprel' in section .text+0x26 file {{.*}}.o -VERBOSE-NO-C: RISCV_QC_E_LI_C_LUI : Cannot relax 2 bytes for symbol 'can_addi_gprel' in section .text+0x22 file {{.*}}.o -VERBOSE-NO-C: RISCV_QC_E_LI_C_LUI : Cannot relax 4 bytes for symbol 'cannot_addi_gprel' in section .text+0x26 file {{.*}}.o +VERBOSE-NO-C: RISCV_QC_E_LI_QC_LI : Deleting 2 bytes for symbol 'can_c_lui' in section .text+0x1c file {{.*}}.o +VERBOSE-NO-C: RISCV_QC_E_LI_C_LUI : Cannot relax 2 bytes for symbol 'can_c_lui' in section .text+0x18 file {{.*}}.o +VERBOSE-NO-C: RISCV_QC_E_LI_QC_LI : Deleting 2 bytes for symbol 'can_qc_li' in section .text+0x20 file {{.*}}.o +VERBOSE-NO-C: RISCV_QC_E_LI_C_LUI : Cannot relax 2 bytes for symbol 'can_qc_li' in section .text+0x1c file {{.*}}.o +VERBOSE-NO-C: RISCV_QC_E_LI_C_LUI : Cannot relax 4 bytes for symbol 'cannot_qc_li' in section .text+0x20 file {{.*}}.o +VERBOSE-NO-C: RISCV_QC_E_LI_GP : Deleting 2 bytes for symbol 'can_addi_gprel' in section .text+0x2a file {{.*}}.o +VERBOSE-NO-C: RISCV_QC_E_LI_C_LUI : Cannot relax 2 bytes for symbol 'can_addi_gprel' in section .text+0x26 file {{.*}}.o +VERBOSE-NO-C: RISCV_QC_E_LI_C_LUI : Cannot relax 4 bytes for symbol 'cannot_addi_gprel' in section .text+0x2a file {{.*}}.o +VERBOSE-NO-C: RISCV_QC_E_LI_LUI : Deleting 2 bytes for symbol 'can_lui' in section .text+0x34 file {{.*}}.o +VERBOSE-NO-C: RISCV_QC_E_LI_C_LUI : Cannot relax 2 bytes for symbol 'can_lui' in section .text+0x30 file {{.*}}.o +VERBOSE-NO-C: RISCV_QC_E_LI_C_LUI : Cannot relax 4 bytes for symbol 'cannot_lui' in section .text+0x34 file {{.*}}.o RUN: %filecheck %s --input-file=%t.2.map --check-prefix=MAP-NO-C MAP-NO-C: # LinkStats Begin -MAP-NO-C: # RelaxationBytesDeleted : 8 -MAP-NO-C: # RelaxationBytesMissed : 24 +MAP-NO-C: # RelaxationBytesDeleted : 12 +MAP-NO-C: # RelaxationBytesMissed : 32 MAP-NO-C: # LinkStats End MAP-NO-C: .text {{.+}}, Alignment: 0x2, Flags: SHF_ALLOC|SHF_EXECINSTR, Type: SHT_PROGBITS -MAP-NO-C: # RelaxationBytesDeleted : 8 -MAP-NO-C: # RelaxationBytesMissed : 24 +MAP-NO-C: # RelaxationBytesDeleted : 12 +MAP-NO-C: # RelaxationBytesMissed : 32 MAP-NO-C: .text {{.+}}.o #SHT_PROGBITS,SHF_ALLOC|SHF_EXECINSTR,2 RUN: %objdump --no-print-imm-hex -d -M no-aliases %t.2.out 2>&1 | %filecheck %s --check-prefix=EXE-NO-C EXE-NO-C:
: EXE-NO-C-NEXT: 7000351b qc.li a0, 126976 -EXE-NO-C-NEXT: 0800051b qc.li a0, 2048 -EXE-NO-C-NEXT: 0000851b qc.li a0, 262144 +EXE-NO-C-NEXT: 0801051b qc.li a0, 2049 EXE-NO-C-NEXT: 7000311b qc.li sp, 126976 +EXE-NO-C-NEXT: 0000851b qc.li a0, 262144 EXE-NO-C-NEXT: 7000351b qc.li a0, 126976 -EXE-NO-C-NEXT: 0800051b qc.li a0, 2048 +EXE-NO-C-NEXT: 0801051b qc.li a0, 2049 +EXE-NO-C-NEXT: 7000311b qc.li sp, 126976 EXE-NO-C-NEXT: 0000851b qc.li a0, 262144 -EXE-NO-C-NEXT: 051f 0000 0008 qc.e.li a0, 524288 +EXE-NO-C-NEXT: 051f 0001 0008 qc.e.li a0, 524289 EXE-NO-C-NEXT: 02018513 addi a0, gp, 32 -EXE-NO-C-NEXT: 051f 2000 0100 qc.e.li a0, 16785408 +EXE-NO-C-NEXT: 051f 2001 0100 qc.e.li a0, 16785409 +EXE-NO-C-NEXT: 1100f537 lui a0, 69647 +EXE-NO-C-NEXT:051f f001 1100 qc.e.li a0, 285274113 ## Link with Xqci and C relaxations enabled, GP disabled. @@ -102,42 +118,51 @@ RUN: %link %linkopts --relax-xqci --no-relax-gp -MapStyle txt -Map %t.3.map --ve VERBOSE-NO-GP: RISCV_QC_LI_C_LUI : Deleting 2 bytes for symbol 'can_c_lui' in section .text+0x2 file {{.*}}.o VERBOSE-NO-GP: RISCV_QC_LI_C_LUI : relaxing instruction 0x0000051b to compressed instruction 0x6501 for symbol can_c_lui in section .text+0x0 file {{.*}}.o VERBOSE-NO-GP: RISCV_QC_LI_C_LUI : Cannot relax 2 bytes for symbol 'cannot_c_lui' in section .text+0x2 file {{.*}}.o -VERBOSE-NO-GP: RISCV_QC_LI_C_LUI : Cannot relax 2 bytes for symbol 'can_qc_li' in section .text+0x6 file {{.*}}.o -VERBOSE-NO-GP: RISCV_QC_LI_C_LUI : Cannot relax 2 bytes for symbol 'can_c_lui' in section .text+0xa file {{.*}}.o +VERBOSE-NO-GP: RISCV_QC_LI_C_LUI : Cannot relax 2 bytes for symbol 'can_c_lui' in section .text+0x6 file {{.*}}.o +VERBOSE-NO-GP: RISCV_QC_LI_C_LUI : Cannot relax 2 bytes for symbol 'can_qc_li' in section .text+0xa file {{.*}}.o VERBOSE-NO-GP: RISCV_QC_E_LI_C_LUI : Deleting 4 bytes for symbol 'can_c_lui' in section .text+0x10 file {{.*}}.o +VERBOSE-NO-GP: RISCV_QC_E_LI_C_LUI : relaxing instruction 0x00000000051f to compressed instruction 0x6501 for symbol can_c_lui in section .text+0xe file {{.*}}.o VERBOSE-NO-GP: RISCV_QC_E_LI_QC_LI : Deleting 2 bytes for symbol 'cannot_c_lui' in section .text+0x14 file {{.*}}.o VERBOSE-NO-GP: RISCV_QC_E_LI_C_LUI : Cannot relax 2 bytes for symbol 'cannot_c_lui' in section .text+0x10 file {{.*}}.o -VERBOSE-NO-GP: RISCV_QC_E_LI_QC_LI : Deleting 2 bytes for symbol 'can_qc_li' in section .text+0x18 file {{.*}}.o -VERBOSE-NO-GP: RISCV_QC_E_LI_C_LUI : Cannot relax 2 bytes for symbol 'can_qc_li' in section .text+0x14 file {{.*}}.o -VERBOSE-NO-GP: RISCV_QC_E_LI_C_LUI : Cannot relax 4 bytes for symbol 'cannot_qc_li' in section .text+0x18 file {{.*}}.o -VERBOSE-NO-GP: RISCV_QC_E_LI_C_LUI : Cannot relax 4 bytes for symbol 'can_addi_gprel' in section .text+0x1e file {{.*}}.o -VERBOSE-NO-GP: RISCV_QC_E_LI_C_LUI : Cannot relax 4 bytes for symbol 'cannot_addi_gprel' in section .text+0x24 file {{.*}}.o +VERBOSE-NO-GP: RISCV_QC_E_LI_QC_LI : Deleting 2 bytes for symbol 'can_c_lui' in section .text+0x18 file {{.*}}.o +VERBOSE-NO-GP: RISCV_QC_E_LI_C_LUI : Cannot relax 2 bytes for symbol 'can_c_lui' in section .text+0x14 file {{.*}}.o +VERBOSE-NO-GP: RISCV_QC_E_LI_QC_LI : Deleting 2 bytes for symbol 'can_qc_li' in section .text+0x1c file {{.*}}.o +VERBOSE-NO-GP: RISCV_QC_E_LI_C_LUI : Cannot relax 2 bytes for symbol 'can_qc_li' in section .text+0x18 file {{.*}}.o +VERBOSE-NO-GP: RISCV_QC_E_LI_C_LUI : Cannot relax 4 bytes for symbol 'cannot_qc_li' in section .text+0x1c file {{.*}}.o +VERBOSE-NO-GP: RISCV_QC_E_LI_C_LUI : Cannot relax 4 bytes for symbol 'can_addi_gprel' in section .text+0x22 file {{.*}}.o +VERBOSE-NO-GP: RISCV_QC_E_LI_C_LUI : Cannot relax 4 bytes for symbol 'cannot_addi_gprel' in section .text+0x28 file {{.*}}.o +VERBOSE-NO-GP: RISCV_QC_E_LI_LUI : Deleting 2 bytes for symbol 'can_lui' in section .text+0x32 file {{.*}}.o +VERBOSE-NO-GP: RISCV_QC_E_LI_C_LUI : Cannot relax 2 bytes for symbol 'can_lui' in section .text+0x2e file {{.*}}.o +VERBOSE-NO-GP: RISCV_QC_E_LI_C_LUI : Cannot relax 4 bytes for symbol 'cannot_lui' in section .text+0x32 file {{.*}}.o RUN: %filecheck %s --input-file=%t.3.map --check-prefix=MAP-NO-GP MAP-NO-GP: # LinkStats Begin -MAP-NO-GP: # RelaxationBytesDeleted : 10 -MAP-NO-GP: # RelaxationBytesMissed : 22 +MAP-NO-GP: # RelaxationBytesDeleted : 14 +MAP-NO-GP: # RelaxationBytesMissed : 30 MAP-NO-GP: # LinkStats End MAP-NO-GP: .text {{.+}}, Alignment: 0x2, Flags: SHF_ALLOC|SHF_EXECINSTR, Type: SHT_PROGBITS -MAP-NO-GP: # RelaxationBytesDeleted : 10 -MAP-NO-GP: # RelaxationBytesMissed : 22 +MAP-NO-GP: # RelaxationBytesDeleted : 14 +MAP-NO-GP: # RelaxationBytesMissed : 30 MAP-NO-GP: .text {{.+}}.o #SHT_PROGBITS,SHF_ALLOC|SHF_EXECINSTR,2 RUN: %objdump --no-print-imm-hex -d -M no-aliases %t.3.out 2>&1 | %filecheck %s --check-prefix=EXE-NO-GP EXE-NO-GP:
: EXE-NO-GP-NEXT: 657d c.lui a0, 31 -EXE-NO-GP-NEXT: 0800051b qc.li a0, 2048 -EXE-NO-GP-NEXT: 0000851b qc.li a0, 262144 +EXE-NO-GP-NEXT: 0801051b qc.li a0, 2049 EXE-NO-GP-NEXT: 7000311b qc.li sp, 126976 +EXE-NO-GP-NEXT: 0000851b qc.li a0, 262144 EXE-NO-GP-NEXT: 657d c.lui a0, 31 -EXE-NO-GP-NEXT: 0800051b qc.li a0, 2048 +EXE-NO-GP-NEXT: 0801051b qc.li a0, 2049 +EXE-NO-GP-NEXT: 7000311b qc.li sp, 126976 EXE-NO-GP-NEXT: 0000851b qc.li a0, 262144 -EXE-NO-GP-NEXT: 051f 0000 0008 qc.e.li a0, 524288 +EXE-NO-GP-NEXT: 051f 0001 0008 qc.e.li a0, 524289 EXE-NO-GP-NEXT: 051f 0020 0100 qc.e.li a0, 16777248 -EXE-NO-GP-NEXT: 051f 2000 0100 qc.e.li a0, 16785408 +EXE-NO-GP-NEXT: 051f 2001 0100 qc.e.li a0, 16785409 +EXE-NO-GP-NEXT: 1100f537 lui a0, 69647 +EXE-NO-GP-NEXT: 051f f001 1100 qc.e.li a0, 285274113 ## Link with C and GP relaxations enabled, Xqci disabled. RUN: %link %linkopts --no-relax-xqci -MapStyle txt -Map %t.4.map --verbose %t.o -o %t.4.out -T %p/Inputs/x.t 2>&1 | %filecheck %s --check-prefix=VERBOSE-NO-XQCI @@ -155,12 +180,15 @@ RUN: %objdump --no-print-imm-hex -d -M no-aliases %t.4.out 2>&1 | %filecheck %s EXE-NO-XQCI:
: EXE-NO-XQCI-NEXT: 7000351b qc.li a0, 126976 -EXE-NO-XQCI-NEXT: 0800051b qc.li a0, 2048 -EXE-NO-XQCI-NEXT: 0000851b qc.li a0, 262144 +EXE-NO-XQCI-NEXT: 0801051b qc.li a0, 2049 EXE-NO-XQCI-NEXT: 7000311b qc.li sp, 126976 +EXE-NO-XQCI-NEXT: 0000851b qc.li a0, 262144 EXE-NO-XQCI-NEXT: 051f f000 0001 qc.e.li a0, 126976 -EXE-NO-XQCI-NEXT: 051f 0800 0000 qc.e.li a0, 2048 +EXE-NO-XQCI-NEXT: 051f 0801 0000 qc.e.li a0, 2049 +EXE-NO-XQCI-NEXT: 011f f000 0001 qc.e.li sp, 126976 EXE-NO-XQCI-NEXT: 051f 0000 0004 qc.e.li a0, 262144 -EXE-NO-XQCI-NEXT: 051f 0000 0008 qc.e.li a0, 524288 +EXE-NO-XQCI-NEXT: 051f 0001 0008 qc.e.li a0, 524289 EXE-NO-XQCI-NEXT: 051f 0020 0100 qc.e.li a0, 16777248 -EXE-NO-XQCI-NEXT: 051f 2000 0100 qc.e.li a0, 16785408 +EXE-NO-XQCI-NEXT: 051f 2001 0100 qc.e.li a0, 16785409 +EXE-NO-XQCI-NEXT: 051f f000 1100 qc.e.li a0, 285274112 +EXE-NO-XQCI-NEXT: 051f f001 1100 qc.e.li a0, 285274113