[llvm] f27dc23 - Sparc: Test WDISP16/WDISP19/WDISP22 and data relocations

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sun May 4 21:36:05 PDT 2025


Author: Fangrui Song
Date: 2025-05-04T21:36:00-07:00
New Revision: f27dc238698041da5e35a2a6f252c63c5b69838d

URL: https://github.com/llvm/llvm-project/commit/f27dc238698041da5e35a2a6f252c63c5b69838d
DIFF: https://github.com/llvm/llvm-project/commit/f27dc238698041da5e35a2a6f252c63c5b69838d.diff

LOG: Sparc: Test WDISP16/WDISP19/WDISP22 and data relocations

Added: 
    

Modified: 
    llvm/test/MC/Sparc/Relocations/relocation.s

Removed: 
    


################################################################################
diff  --git a/llvm/test/MC/Sparc/Relocations/relocation.s b/llvm/test/MC/Sparc/Relocations/relocation.s
index aa24198f2cf5b..30c2b9409e765 100644
--- a/llvm/test/MC/Sparc/Relocations/relocation.s
+++ b/llvm/test/MC/Sparc/Relocations/relocation.s
@@ -1,7 +1,7 @@
 ## Test relocations without specifiers. See also relocation-specifier.s for relocations with specifiers.
 # RUN: llvm-mc %s -triple=sparcv9 | FileCheck %s --check-prefix=ASM
 # RUN: llvm-mc %s -triple=sparcv9 -filetype=obj -o %t
-# RUN: llvm-objdump -dr %t | FileCheck %s --check-prefix=OBJDUMP
+# RUN: llvm-objdump -Dr %t | FileCheck %s --check-prefix=OBJDUMP
 
 # ASM:      call local
 # ASM:      call local1
@@ -26,13 +26,50 @@ or %g1, (sym+4), %g3
 
 local:
 
+# ASM:      brz %g1, undef
+# ASM:      brlz %g1, .Ltmp{{.}}-8
+# OBJDUMP:      brz %g1, 0x0
+# OBJDUMP-NEXT:   R_SPARC_WDISP16 undef
+# OBJDUMP-NEXT: brlz %g1, 0xfffe
+# OBJDUMP-NEXT: bg %icc, 0x0
+# OBJDUMP-NEXT:   R_SPARC_WDISP19 undef
+# OBJDUMP-NEXT: bg %icc, 0x7fffe
+# OBJDUMP-NEXT: cbn 0x0
+# OBJDUMP-NEXT:   R_SPARC_WDISP22 undef
+# OBJDUMP-NEXT: cbn 0x3ffffe
+brz %g1, undef
+brlz %g1, .-8
+bg %icc, undef
+bg %icc, .-8
+cbn undef
+cbn .-8
+
 .section .text1,"ax"
 nop
 local1:
 
+# OBJDUMP-LABEL: .data:
+# OBJDUMP:      0: R_SPARC_32 .text1+0x8
+# OBJDUMP:      4: R_SPARC_DISP32 .text1+0x8
+# OBJDUMP:      8: R_SPARC_64 .text1+0x8
+# OBJDUMP:     10: R_SPARC_DISP64 .text1+0x8
 .data
+.word local1+4
+.word local1+4-.
+.xword local1+4
+.xword local1+4-.
+
+# OBJDUMP:     18: R_SPARC_8 .text1+0x8
+# OBJDUMP:     19: R_SPARC_DISP8 .text1+0x8
+# OBJDUMP:     1a: R_SPARC_16 .text1+0x8
+# OBJDUMP:     1c: R_SPARC_DISP16 .text1+0x8
+.byte local1+4
+.byte local1+4-.
+.half local1+4
+.half local1+4-.
+
 # This test needs to placed last in the file
-# ASM: .half	a-.Ltmp0
+# ASM: .half	a-.Ltmp{{.}}{{$}}
 .half a - .
 .byte a - .
 a:


        


More information about the llvm-commits mailing list