1## The file testing Nop insertion with R_LARCH_ALIGN for relaxation. 2 3# RUN: llvm-mc --filetype=obj --triple=loongarch64 --mattr=-relax %s -o %t 4# RUN: llvm-objdump -d %t | FileCheck %s --check-prefix=INSTR 5# RUN: llvm-readobj -r %t | FileCheck %s --check-prefix=RELOC 6# RUN: llvm-mc --filetype=obj --triple=loongarch64 --mattr=+relax %s -o %t.r 7# RUN: llvm-objdump -d %t.r | FileCheck %s --check-prefixes=INSTR,RELAX-INSTR 8# RUN: llvm-readobj -r %t.r | FileCheck %s --check-prefixes=RELOC,RELAX-RELOC 9 10.text 11break 0 12# INSTR: break 0 13 14## Not emit R_LARCH_ALIGN if alignment directive is less than or equal to 15## minimum code alignment(a.k.a 4). 16.p2align 2 17.p2align 1 18.p2align 0 19 20## Not emit instructions if max emit bytes less than min nop size. 21.p2align 4, , 2 22 23## Not emit R_LARCH_ALIGN if alignment directive with specific padding value. 24## The behavior is the same as GNU assembler. 25break 1 26.p2align 4, 1 27# INSTR-NEXT: break 1 28# INSTR-COUNT-2: 01 01 01 01 29 30break 2 31.p2align 4, 1, 12 32# INSTR-NEXT: break 2 33# INSTR-COUNT-3: 01 01 01 01 34 35break 3 36.p2align 4 37# INSTR-NEXT: break 3 38# INSTR-COUNT-3: nop 39 40break 4 41.p2align 5 42.p2align 4 43# INSTR-NEXT: break 4 44# INSTR-COUNT-3: nop 45# RELAX-INSTR-COUNT-7: nop 46 47break 5 48.p2align 4, , 11 49# INSTR-NEXT: break 5 50# RELAX-INSTR-COUNT-3: nop 51 52break 6 53## Not emit the third parameter. 54.p2align 4, , 12 55# INSTR-NEXT: break 6 56# INSTR-NEXT: nop 57# INSTR-NEXT: nop 58# RELAX-INSTR-NEXT: nop 59 60ret 61# INSNR-NEXT: ret 62 63## Test the symbol index is different from .text. 64.section .text2, "ax" 65.p2align 4 66.p2align 4, , 4 67break 7 68 69# RELOC: Relocations [ 70# RELAX-RELOC-NEXT: Section ({{.*}}) .rela.text { 71# RELAX-RELOC-NEXT: 0x24 R_LARCH_ALIGN - 0xC 72# RELAX-RELOC-NEXT: 0x34 R_LARCH_ALIGN - 0x1C 73# RELAX-RELOC-NEXT: 0x50 R_LARCH_ALIGN - 0xC 74# RELAX-RELOC-NEXT: 0x60 R_LARCH_ALIGN .Lla-relax-align0 0xB04 75# RELAX-RELOC-NEXT: 0x70 R_LARCH_ALIGN - 0xC 76# RELAX-RELOC-NEXT: } 77# RELAX-RELOC-NEXT: Section ({{.*}}) .rela.text2 { 78# RELAX-RELOC-NEXT: 0x0 R_LARCH_ALIGN - 0xC 79# RELAX-RELOC-NEXT: 0xC R_LARCH_ALIGN .Lla-relax-align1 0x404 80# RELAX-RELOC-NEXT: } 81# RELOC-NEXT: ] 82