xref: /llvm-project/llvm/test/CodeGen/RISCV/cmp-bool.ll (revision 1456b68686808fa7c6ed7327aba65b639f81d5b8)
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc -mtriple=riscv32 < %s | FileCheck --check-prefix=RV32 %s
3; RUN: llc -mtriple=riscv64 < %s | FileCheck --check-prefix=RV64 %s
4
5define void @bool_eq(i1 zeroext %a, i1 zeroext %b, ptr nocapture %c) nounwind {
6; RV32-LABEL: bool_eq:
7; RV32:       # %bb.0: # %entry
8; RV32-NEXT:    beq a0, a1, .LBB0_2
9; RV32-NEXT:  # %bb.1: # %if.end
10; RV32-NEXT:    ret
11; RV32-NEXT:  .LBB0_2: # %if.then
12; RV32-NEXT:    jr a2
13;
14; RV64-LABEL: bool_eq:
15; RV64:       # %bb.0: # %entry
16; RV64-NEXT:    beq a0, a1, .LBB0_2
17; RV64-NEXT:  # %bb.1: # %if.end
18; RV64-NEXT:    ret
19; RV64-NEXT:  .LBB0_2: # %if.then
20; RV64-NEXT:    jr a2
21entry:
22  %0 = xor i1 %a, %b
23  br i1 %0, label %if.end, label %if.then
24
25if.then:
26  tail call void %c() #1
27  br label %if.end
28
29if.end:
30  ret void
31}
32
33define void @bool_ne(i1 zeroext %a, i1 zeroext %b, ptr nocapture %c) nounwind {
34; RV32-LABEL: bool_ne:
35; RV32:       # %bb.0: # %entry
36; RV32-NEXT:    beq a0, a1, .LBB1_2
37; RV32-NEXT:  # %bb.1: # %if.then
38; RV32-NEXT:    jr a2
39; RV32-NEXT:  .LBB1_2: # %if.end
40; RV32-NEXT:    ret
41;
42; RV64-LABEL: bool_ne:
43; RV64:       # %bb.0: # %entry
44; RV64-NEXT:    beq a0, a1, .LBB1_2
45; RV64-NEXT:  # %bb.1: # %if.then
46; RV64-NEXT:    jr a2
47; RV64-NEXT:  .LBB1_2: # %if.end
48; RV64-NEXT:    ret
49entry:
50  %cmp = xor i1 %a, %b
51  br i1 %cmp, label %if.then, label %if.end
52
53if.then:
54  tail call void %c() #1
55  br label %if.end
56
57if.end:
58  ret void
59}
60