@@ -239,3 +239,79 @@ define i32 @oneusecmp(i32 %a, i32 %b, i32 %d) {
239
239
%x = add i32 %s , %s2
240
240
ret i32 %x
241
241
}
242
+
243
+ define i32 @xor_branch_imm_ret (i32 %x ) nounwind {
244
+ ; RV32-LABEL: xor_branch_imm_ret:
245
+ ; RV32: # %bb.0: # %entry
246
+ ; RV32-NEXT: li a1, -1365
247
+ ; RV32-NEXT: beq a0, a1, .LBB11_2
248
+ ; RV32-NEXT: # %bb.1: # %if.then
249
+ ; RV32-NEXT: xori a0, a0, -1365
250
+ ; RV32-NEXT: ret
251
+ ; RV32-NEXT: .LBB11_2: # %if.end
252
+ ; RV32-NEXT: addi sp, sp, -16
253
+ ; RV32-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
254
+ ; RV32-NEXT: call abort
255
+ ;
256
+ ; RV64-LABEL: xor_branch_imm_ret:
257
+ ; RV64: # %bb.0: # %entry
258
+ ; RV64-NEXT: sext.w a1, a0
259
+ ; RV64-NEXT: li a2, -1365
260
+ ; RV64-NEXT: beq a1, a2, .LBB11_2
261
+ ; RV64-NEXT: # %bb.1: # %if.then
262
+ ; RV64-NEXT: xori a0, a0, -1365
263
+ ; RV64-NEXT: ret
264
+ ; RV64-NEXT: .LBB11_2: # %if.end
265
+ ; RV64-NEXT: addi sp, sp, -16
266
+ ; RV64-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
267
+ ; RV64-NEXT: call abort
268
+ entry:
269
+ %cmp.not = icmp eq i32 %x , -1365
270
+ br i1 %cmp.not , label %if.end , label %if.then
271
+ if.then:
272
+ %xor = xor i32 %x , -1365
273
+ ret i32 %xor
274
+ if.end:
275
+ tail call void @abort () #2
276
+ unreachable
277
+ }
278
+
279
+ define i32 @xor_branch_ret (i32 %x ) nounwind {
280
+ ; RV32-LABEL: xor_branch_ret:
281
+ ; RV32: # %bb.0: # %entry
282
+ ; RV32-NEXT: li a1, 1
283
+ ; RV32-NEXT: slli a1, a1, 11
284
+ ; RV32-NEXT: beq a0, a1, .LBB12_2
285
+ ; RV32-NEXT: # %bb.1: # %if.then
286
+ ; RV32-NEXT: xor a0, a0, a1
287
+ ; RV32-NEXT: ret
288
+ ; RV32-NEXT: .LBB12_2: # %if.end
289
+ ; RV32-NEXT: addi sp, sp, -16
290
+ ; RV32-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
291
+ ; RV32-NEXT: call abort
292
+ ;
293
+ ; RV64-LABEL: xor_branch_ret:
294
+ ; RV64: # %bb.0: # %entry
295
+ ; RV64-NEXT: sext.w a2, a0
296
+ ; RV64-NEXT: li a1, 1
297
+ ; RV64-NEXT: slli a1, a1, 11
298
+ ; RV64-NEXT: beq a2, a1, .LBB12_2
299
+ ; RV64-NEXT: # %bb.1: # %if.then
300
+ ; RV64-NEXT: xor a0, a0, a1
301
+ ; RV64-NEXT: ret
302
+ ; RV64-NEXT: .LBB12_2: # %if.end
303
+ ; RV64-NEXT: addi sp, sp, -16
304
+ ; RV64-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
305
+ ; RV64-NEXT: call abort
306
+ entry:
307
+ %cmp.not = icmp eq i32 %x , 2048
308
+ br i1 %cmp.not , label %if.end , label %if.then
309
+ if.then:
310
+ %xor = xor i32 %x , 2048
311
+ ret i32 %xor
312
+ if.end:
313
+ tail call void @abort () #2
314
+ unreachable
315
+ }
316
+
317
+ declare void @abort ()
0 commit comments