Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / ELF / riscv-relax-align-rvc.s
blob4efce68e85d5b2889985acfb35253b651ededa7d
1 # REQUIRES: riscv
3 # RUN: rm -rf %t && mkdir %t && cd %t
5 # RUN: llvm-mc -filetype=obj -triple=riscv32 -mattr=+c,+relax %s -o 32.o
6 # RUN: ld.lld -Ttext=0x10000 32.o -o 32
7 # RUN: llvm-objdump -td --no-show-raw-insn -M no-aliases 32 | FileCheck %s
8 ## R_RISCV_ALIGN is handled regarldess of --no-relax.
9 # RUN: ld.lld -Ttext=0x10000 --no-relax 32.o -o 32.norelax
10 # RUN: llvm-objdump -td --no-show-raw-insn -M no-aliases 32.norelax | FileCheck %s
12 # RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+c,+relax %s -o 64.o
13 # RUN: ld.lld -Ttext=0x10000 64.o -o 64
14 # RUN: llvm-objdump -td --no-show-raw-insn -M no-aliases 64 | FileCheck %s
15 # RUN: ld.lld -Ttext=0x10000 --no-relax 64.o -o 64.norelax
16 # RUN: llvm-objdump -td --no-show-raw-insn -M no-aliases 64.norelax | FileCheck %s
18 # CHECK-DAG: 00010002 l .text {{0*}}1e a
19 # CHECK-DAG: 00010010 l .text {{0*}}22 b
20 # CHECK-DAG: 00010012 l .text {{0*}}1e c
21 # CHECK-DAG: 00010020 l .text {{0*}}16 d
22 # CHECK-DAG: 00010000 g .text {{0*}}36 _start
24 # CHECK: <_start>:
25 # CHECK-NEXT: c.addi a0, 1
26 # CHECK-EMPTY:
27 # CHECK-NEXT: <a>:
28 # CHECK-NEXT: c.nop
29 # CHECK-NEXT: addi zero, zero, 0
30 # CHECK-NEXT: addi zero, zero, 0
31 # CHECK-NEXT: addi zero, zero, 0
32 # CHECK-EMPTY:
33 # CHECK-NEXT: <b>:
34 # CHECK-NEXT: 10010: c.addi a0, 2
35 # CHECK-EMPTY:
36 # CHECK-NEXT: <c>:
37 # CHECK-NEXT: c.addi a0, 3
38 # CHECK-NEXT: addi zero, zero, 0
39 # CHECK-NEXT: addi zero, zero, 0
40 # CHECK-NEXT: addi zero, zero, 0
41 # CHECK-EMPTY:
42 # CHECK-NEXT: <d>:
43 # CHECK-NEXT: 10020: c.addi a0, 4
44 # CHECK-NEXT: c.addi a0, 5
45 # CHECK-NEXT: addi zero, zero, 0
46 # CHECK-NEXT: addi zero, zero, 0
47 # CHECK-NEXT: addi zero, zero, 0
48 # CHECK-NEXT: 10030: c.addi a0, 6
49 # CHECK-NEXT: c.addi a0, 7
50 # CHECK-NEXT: c.addi a0, 8
51 # CHECK-EMPTY:
53 # CHECK: <.text2>:
54 # CHECK-NEXT: addi a0, a1, 1
55 # CHECK-NEXT: c.addi a0, 1
56 # CHECK-NEXT: c.nop
57 # CHECK-NEXT: c.addi a0, 2
59 .global _start
60 _start:
61 c.addi a0, 1
63 .balign 16
65 c.addi a0, 2
67 c.addi a0, 3
68 .balign 32
69 .size a, . - a
71 c.addi a0, 4
72 c.addi a0, 5
73 .balign 16
74 .size c, . - c
75 c.addi a0, 6
76 .size b, . - b
77 c.addi a0, 7
78 .balign 4
79 c.addi a0, 8
80 .size d, . - d
81 .size _start, . - _start
83 .section .text2,"ax"
84 .balign 16
85 addi a0, a1, 1
86 c.addi a0, 1
87 .balign 8
88 c.addi a0, 2