File: riscv-relax-align-rvc.s

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (88 lines) | stat: -rw-r--r-- 2,492 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# REQUIRES: riscv

# RUN: rm -rf %t && mkdir %t && cd %t

# RUN: llvm-mc -filetype=obj -triple=riscv32 -mattr=+c,+relax %s -o 32.o
# RUN: ld.lld -Ttext=0x10000 32.o -o 32
# RUN: llvm-objdump -td --no-show-raw-insn -M no-aliases 32 | FileCheck %s
## R_RISCV_ALIGN is handled regarldess of --no-relax.
# RUN: ld.lld -Ttext=0x10000 --no-relax 32.o -o 32.norelax
# RUN: llvm-objdump -td --no-show-raw-insn -M no-aliases 32.norelax | FileCheck %s

# RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+c,+relax %s -o 64.o
# RUN: ld.lld -Ttext=0x10000 64.o -o 64
# RUN: llvm-objdump -td --no-show-raw-insn -M no-aliases 64 | FileCheck %s
# RUN: ld.lld -Ttext=0x10000 --no-relax 64.o -o 64.norelax
# RUN: llvm-objdump -td --no-show-raw-insn -M no-aliases 64.norelax | FileCheck %s

# CHECK-DAG: 00010002 l       .text  {{0*}}1e a
# CHECK-DAG: 00010010 l       .text  {{0*}}22 b
# CHECK-DAG: 00010012 l       .text  {{0*}}1e c
# CHECK-DAG: 00010020 l       .text  {{0*}}16 d
# CHECK-DAG: 00010000 g       .text  {{0*}}36 _start

# CHECK:      <_start>:
# CHECK-NEXT:           c.addi    a0, 1
# CHECK-EMPTY:
# CHECK-NEXT: <a>:
# CHECK-NEXT:           c.nop
# CHECK-NEXT:           addi    zero, zero, 0
# CHECK-NEXT:           addi    zero, zero, 0
# CHECK-NEXT:           addi    zero, zero, 0
# CHECK-EMPTY:
# CHECK-NEXT: <b>:
# CHECK-NEXT:   10010:  c.addi  a0, 2
# CHECK-EMPTY:
# CHECK-NEXT: <c>:
# CHECK-NEXT:           c.addi  a0, 3
# CHECK-NEXT:           addi    zero, zero, 0
# CHECK-NEXT:           addi    zero, zero, 0
# CHECK-NEXT:           addi    zero, zero, 0
# CHECK-EMPTY:
# CHECK-NEXT: <d>:
# CHECK-NEXT:   10020:  c.addi  a0, 4
# CHECK-NEXT:           c.addi  a0, 5
# CHECK-NEXT:           addi    zero, zero, 0
# CHECK-NEXT:           addi    zero, zero, 0
# CHECK-NEXT:           addi    zero, zero, 0
# CHECK-NEXT:   10030:  c.addi  a0, 6
# CHECK-NEXT:           c.addi  a0, 7
# CHECK-NEXT:           c.addi  a0, 8
# CHECK-EMPTY:

# CHECK:      <.text2>:
# CHECK-NEXT:           addi    a0, a1, 1
# CHECK-NEXT:           c.addi  a0, 1
# CHECK-NEXT:           c.nop
# CHECK-NEXT:           c.addi  a0, 2

.global _start
_start:
  c.addi a0, 1
a:
.balign 16
b:
  c.addi a0, 2
c:
  c.addi a0, 3
.balign 32
.size a, . - a
d:
  c.addi a0, 4
  c.addi a0, 5
.balign 16
.size c, . - c
  c.addi a0, 6
.size b, . - b
  c.addi a0, 7
.balign 4
  c.addi a0, 8
.size d, . - d
.size _start, . - _start

.section .text2,"ax"
.balign 16
  addi a0, a1, 1
  c.addi a0, 1
.balign 8
  c.addi a0, 2