7
7
package codegen
8
8
9
9
//go:noinline
10
- func testIfxZero (a , b int ) int {
11
- r := b
10
+ func testNoZicondUnderRva20u64 (a , b int ) int {
11
+ result := b
12
12
if a == 0 {
13
- r = a
13
+ result = a
14
+ }
15
+ // riscv64/rva20u64:-`CZEROEQZ`, -`CZERONEZ`
16
+ return result
17
+ }
18
+
19
+ //go:noinline
20
+ func testNoZicondUnderRva22u64 (a , b int ) int {
21
+ result := b
22
+ if a == 0 {
23
+ result = a
24
+ }
25
+ // riscv64/rva22u64:-`CZEROEQZ`, -`CZERONEZ`
26
+ return result
27
+ }
28
+
29
+ //go:noinline
30
+ func testGenZicondUnderRva23u64 (a , b int ) int {
31
+ result := b
32
+ if a == 0 {
33
+ result = a
14
34
}
15
35
// riscv64/rva23u64:`CZEROEQZ`, -`CZERONEZ`
16
- return r
36
+ return result
17
37
}
18
38
19
39
//go:noinline
20
- func testZicond (a , b int ) int {
21
- var c int
40
+ func testGenZicond (a , b int ) int {
41
+ var result int
22
42
if a > b {
23
- c = a
43
+ result = a
24
44
} else {
25
- c = b
45
+ result = b
26
46
}
27
47
// riscv64/rva23u64:`CZERONEZ`,`CZEROEQZ`
28
- return c
48
+ return result
29
49
}
30
50
31
51
//go:noinline
32
52
func selectIfZero (cond , a , b int ) int {
33
- r := a
53
+ result := a
34
54
if cond == 0 {
35
- r = b
55
+ result = b
36
56
}
37
57
// riscv64/rva23u64:`CZERONEZ`,`CZEROEQZ`, `OR`
38
58
// riscv64/rva23u64:-`SEQZ`
39
- return r
59
+ return result
40
60
}
41
61
42
62
//go:noinline
43
63
func testSelectIfNotZero (cond , a , b int ) int {
44
- r := a
64
+ result := a
45
65
if cond != 0 {
46
- r = b
66
+ result = b
47
67
}
48
68
// riscv64/rva23u64:`CZERONEZ`,`CZEROEQZ`, `OR`
49
69
// riscv64/rva23u64:-`SNEZ`
50
- return r
70
+ return result
51
71
}
52
72
53
73
//go:noinline
@@ -60,7 +80,7 @@ func testCondAddZero(cond, a, b int) int {
60
80
// riscv64/rva23u64:-`SEQZ`, -`CZEROEQZ`, -`OR`
61
81
return result
62
82
}
63
-
83
+
64
84
//go:noinline
65
85
func testCondAddNonZero (cond , a , b int ) int {
66
86
var result int
@@ -102,11 +122,11 @@ func testCondSubNonZero(cond, a, b int) int {
102
122
103
123
//go:noinline
104
124
func testCondOrZero (cond , a , b int ) int {
105
- var result int
106
- if cond == 0 {
125
+ var result int
126
+ if cond == 0 {
107
127
result = a | b
108
- } else {
109
- result = a
128
+ } else {
129
+ result = a
110
130
}
111
131
// riscv64/rva23u64:`CZERONEZ`, `OR`
112
132
// riscv64/rva23u64:-`SEQZ`, -`CZEROEQZ`
@@ -115,16 +135,16 @@ func testCondOrZero(cond, a, b int) int {
115
135
116
136
//go:noinline
117
137
func testCondOrNonZero (cond , a , b int ) int {
118
- var result int
119
- if cond != 0 {
138
+ var result int
139
+ if cond != 0 {
120
140
result = a | b
121
- } else {
122
- result = a
141
+ } else {
142
+ result = a
123
143
}
124
144
// riscv64/rva23u64:`CZEROEQZ`, `OR`
125
145
// riscv64/rva23u64:-`SNEZ`, -`CZERONEZ`
126
146
return result
127
- }
147
+ }
128
148
129
149
//go:noinline
130
150
func testCondXorZero (cond , a , b int ) int {
@@ -138,7 +158,7 @@ func testCondXorZero(cond, a, b int) int {
138
158
// riscv64/rva23u64:-`SEQZ`, -`CZEROEQZ`, -`OR`
139
159
return result
140
160
}
141
-
161
+
142
162
//go:noinline
143
163
func testCondXorNonZero (cond , a , b int ) int {
144
164
var result int
@@ -164,7 +184,7 @@ func testCondAndZero(cond, a, b int) int {
164
184
// riscv64/rva23u64:-`SEQZ`, -`CZERONEZ`
165
185
return result
166
186
}
167
-
187
+
168
188
//go:noinline
169
189
func testCondAndNonZero (cond , a , b int ) int {
170
190
var result int
@@ -177,4 +197,3 @@ func testCondAndNonZero(cond, a, b int) int {
177
197
// riscv64/rva23u64:-`SNEZ`, -`CZEROEQZ`
178
198
return result
179
199
}
180
-
0 commit comments