File: legalize-mul-rv32.mir

package info (click to toggle)
swiftlang 6.1.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,791,604 kB
  • sloc: cpp: 9,901,740; ansic: 2,201,431; asm: 1,091,827; python: 308,252; objc: 82,166; f90: 80,126; lisp: 38,358; pascal: 25,559; sh: 20,429; ml: 5,058; perl: 4,745; makefile: 4,484; awk: 3,535; javascript: 3,018; xml: 918; fortran: 664; cs: 573; ruby: 396
file content (162 lines) | stat: -rw-r--r-- 6,554 bytes parent folder | download | duplicates (6)
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -mtriple=riscv32 -run-pass=legalizer %s -o - \
# RUN: | FileCheck %s
---
name:            mul_i7
body:             |
  bb.0.entry:
    ; CHECK-LABEL: name: mul_i7
    ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
    ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
    ; CHECK-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
    ; CHECK-NEXT: $x10 = COPY [[COPY]](s32)
    ; CHECK-NEXT: $x11 = COPY [[COPY1]](s32)
    ; CHECK-NEXT: PseudoCALL target-flags(riscv-call) &__mulsi3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit-def $x10
    ; CHECK-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
    ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $x10
    ; CHECK-NEXT: $x10 = COPY [[COPY2]](s32)
    ; CHECK-NEXT: PseudoRET implicit $x10
    %0:_(s32) = COPY $x10
    %1:_(s32) = COPY $x11
    %2:_(s7) = G_TRUNC %0(s32)
    %3:_(s7) = G_TRUNC %1(s32)
    %4:_(s7) = G_MUL %2, %3
    %5:_(s32) = G_ANYEXT %4(s7)
    $x10 = COPY %5(s32)
    PseudoRET implicit $x10

...
---
name:            mul_i8
body:             |
  bb.0.entry:
    ; CHECK-LABEL: name: mul_i8
    ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
    ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
    ; CHECK-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
    ; CHECK-NEXT: $x10 = COPY [[COPY]](s32)
    ; CHECK-NEXT: $x11 = COPY [[COPY1]](s32)
    ; CHECK-NEXT: PseudoCALL target-flags(riscv-call) &__mulsi3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit-def $x10
    ; CHECK-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
    ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $x10
    ; CHECK-NEXT: $x10 = COPY [[COPY2]](s32)
    ; CHECK-NEXT: PseudoRET implicit $x10
    %0:_(s32) = COPY $x10
    %1:_(s32) = COPY $x11
    %2:_(s8) = G_TRUNC %0(s32)
    %3:_(s8) = G_TRUNC %1(s32)
    %4:_(s8) = G_MUL %2, %3
    %5:_(s32) = G_ANYEXT %4(s8)
    $x10 = COPY %5(s32)
    PseudoRET implicit $x10

...
---
name:            mul_i16
body:             |
  bb.0.entry:
    ; CHECK-LABEL: name: mul_i16
    ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
    ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
    ; CHECK-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
    ; CHECK-NEXT: $x10 = COPY [[COPY]](s32)
    ; CHECK-NEXT: $x11 = COPY [[COPY1]](s32)
    ; CHECK-NEXT: PseudoCALL target-flags(riscv-call) &__mulsi3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit-def $x10
    ; CHECK-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
    ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $x10
    ; CHECK-NEXT: $x10 = COPY [[COPY2]](s32)
    ; CHECK-NEXT: PseudoRET implicit $x10
    %0:_(s32) = COPY $x10
    %1:_(s32) = COPY $x11
    %2:_(s16) = G_TRUNC %0(s32)
    %3:_(s16) = G_TRUNC %1(s32)
    %4:_(s16) = G_MUL %2, %3
    %5:_(s32) = G_ANYEXT %4(s16)
    $x10 = COPY %5(s32)
    PseudoRET implicit $x10

...
---
name:            mul_i32
body:             |
  bb.0.entry:
    ; CHECK-LABEL: name: mul_i32
    ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
    ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
    ; CHECK-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
    ; CHECK-NEXT: $x10 = COPY [[COPY]](s32)
    ; CHECK-NEXT: $x11 = COPY [[COPY1]](s32)
    ; CHECK-NEXT: PseudoCALL target-flags(riscv-call) &__mulsi3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit-def $x10
    ; CHECK-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
    ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $x10
    ; CHECK-NEXT: $x10 = COPY [[COPY2]](s32)
    ; CHECK-NEXT: PseudoRET implicit $x10
    %0:_(s32) = COPY $x10
    %1:_(s32) = COPY $x11
    %2:_(s32) = G_MUL %0, %1
    $x10 = COPY %2(s32)
    PseudoRET implicit $x10

...
---
name:            mul_i64
body:             |
  bb.0.entry:
    ; CHECK-LABEL: name: mul_i64
    ; CHECK: %lo1:_(s32) = COPY $x10
    ; CHECK-NEXT: %hi1:_(s32) = COPY $x11
    ; CHECK-NEXT: %lo2:_(s32) = COPY $x12
    ; CHECK-NEXT: %hi2:_(s32) = COPY $x13
    ; CHECK-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
    ; CHECK-NEXT: $x10 = COPY %lo1(s32)
    ; CHECK-NEXT: $x11 = COPY %hi1(s32)
    ; CHECK-NEXT: $x12 = COPY %lo2(s32)
    ; CHECK-NEXT: $x13 = COPY %hi2(s32)
    ; CHECK-NEXT: PseudoCALL target-flags(riscv-call) &__muldi3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit $x12, implicit $x13, implicit-def $x10, implicit-def $x11
    ; CHECK-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
    ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
    ; CHECK-NEXT: $x10 = COPY [[COPY]](s32)
    ; CHECK-NEXT: $x11 = COPY [[COPY1]](s32)
    ; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11
    %lo1:_(s32) = COPY $x10
    %hi1:_(s32) = COPY $x11
    %lo2:_(s32) = COPY $x12
    %hi2:_(s32) = COPY $x13
    %x1:_(s64) = G_MERGE_VALUES %lo1(s32), %hi1(s32)
    %x2:_(s64) = G_MERGE_VALUES %lo2(s32), %hi2(s32)
    %y:_(s64) = G_MUL %x1, %x2
    %loy:_(s32), %hiy:_(s32) = G_UNMERGE_VALUES %y(s64)
    $x10 = COPY %loy(s32)
    $x11 = COPY %hiy(s32)
    PseudoRET implicit $x10, implicit $x11

...
---
name:            smulh_i32
body:             |
  bb.0.entry:
    ; CHECK-LABEL: name: smulh_i32
    ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
    ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
    ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 31
    ; CHECK-NEXT: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[COPY]], [[C]](s32)
    ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 31
    ; CHECK-NEXT: [[ASHR1:%[0-9]+]]:_(s32) = G_ASHR [[COPY1]], [[C1]](s32)
    ; CHECK-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
    ; CHECK-NEXT: $x10 = COPY [[COPY]](s32)
    ; CHECK-NEXT: $x11 = COPY [[ASHR]](s32)
    ; CHECK-NEXT: $x12 = COPY [[COPY1]](s32)
    ; CHECK-NEXT: $x13 = COPY [[ASHR1]](s32)
    ; CHECK-NEXT: PseudoCALL target-flags(riscv-call) &__muldi3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit $x12, implicit $x13, implicit-def $x10, implicit-def $x11
    ; CHECK-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
    ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $x11
    ; CHECK-NEXT: $x10 = COPY [[COPY2]](s32)
    ; CHECK-NEXT: PseudoRET implicit $x10
    %0:_(s32) = COPY $x10
    %1:_(s32) = COPY $x11
    %2:_(s32) = G_SMULH %0, %1
    $x10 = COPY %2(s32)
    PseudoRET implicit $x10

...