@@ -239,3 +239,45 @@ 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_ret (i32 %x ) {
244
+ ; RV32-LABEL: xor_branch_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: .cfi_def_cfa_offset 16
254
+ ; RV32-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
255
+ ; RV32-NEXT: .cfi_offset ra, -4
256
+ ; RV32-NEXT: call abort
257
+ ;
258
+ ; RV64-LABEL: xor_branch_ret:
259
+ ; RV64: # %bb.0: # %entry
260
+ ; RV64-NEXT: sext.w a1, a0
261
+ ; RV64-NEXT: li a2, -1365
262
+ ; RV64-NEXT: beq a1, a2, .LBB11_2
263
+ ; RV64-NEXT: # %bb.1: # %if.then
264
+ ; RV64-NEXT: xori a0, a0, -1365
265
+ ; RV64-NEXT: ret
266
+ ; RV64-NEXT: .LBB11_2: # %if.end
267
+ ; RV64-NEXT: addi sp, sp, -16
268
+ ; RV64-NEXT: .cfi_def_cfa_offset 16
269
+ ; RV64-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
270
+ ; RV64-NEXT: .cfi_offset ra, -8
271
+ ; RV64-NEXT: call abort
272
+ entry:
273
+ %cmp.not = icmp eq i32 %x , -1365
274
+ br i1 %cmp.not , label %if.end , label %if.then
275
+ if.then:
276
+ %xor = xor i32 %x , -1365
277
+ ret i32 %xor
278
+ if.end:
279
+ tail call void @abort () #2
280
+ unreachable
281
+ }
282
+
283
+ declare void @abort ()
0 commit comments