blob: 53092c3756172716026acb9bf5acfcda8629a84b [file] [log] [blame]
Alex Bradbury74913e12017-11-08 13:31:40 +00001; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc -mtriple=riscv32 -verify-machineinstrs < %s \
3; RUN: | FileCheck -check-prefix=RV32I %s
4
5define void @foo(i32 %a, i32 *%b, i1 %c) {
6; RV32I-LABEL: foo:
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +00007; RV32I: # %bb.0:
Alex Bradbury74913e12017-11-08 13:31:40 +00008; RV32I-NEXT: lw a3, 0(a1)
9; RV32I-NEXT: beq a3, a0, .LBB0_12
Alex Bradburye027c932018-01-10 20:47:00 +000010; RV32I-NEXT: # %bb.1: # %test2
Alex Bradbury74913e12017-11-08 13:31:40 +000011; RV32I-NEXT: lw a3, 0(a1)
12; RV32I-NEXT: bne a3, a0, .LBB0_12
Alex Bradburye027c932018-01-10 20:47:00 +000013; RV32I-NEXT: # %bb.2: # %test3
Alex Bradbury74913e12017-11-08 13:31:40 +000014; RV32I-NEXT: lw a3, 0(a1)
15; RV32I-NEXT: blt a3, a0, .LBB0_12
Alex Bradburye027c932018-01-10 20:47:00 +000016; RV32I-NEXT: # %bb.3: # %test4
Alex Bradbury74913e12017-11-08 13:31:40 +000017; RV32I-NEXT: lw a3, 0(a1)
18; RV32I-NEXT: bge a3, a0, .LBB0_12
Alex Bradburye027c932018-01-10 20:47:00 +000019; RV32I-NEXT: # %bb.4: # %test5
Alex Bradbury74913e12017-11-08 13:31:40 +000020; RV32I-NEXT: lw a3, 0(a1)
21; RV32I-NEXT: bltu a3, a0, .LBB0_12
Alex Bradburye027c932018-01-10 20:47:00 +000022; RV32I-NEXT: # %bb.5: # %test6
Alex Bradbury74913e12017-11-08 13:31:40 +000023; RV32I-NEXT: lw a3, 0(a1)
24; RV32I-NEXT: bgeu a3, a0, .LBB0_12
Alex Bradburye027c932018-01-10 20:47:00 +000025; RV32I-NEXT: # %bb.6: # %test7
Alex Bradbury74913e12017-11-08 13:31:40 +000026; RV32I-NEXT: lw a3, 0(a1)
27; RV32I-NEXT: blt a0, a3, .LBB0_12
Alex Bradburye027c932018-01-10 20:47:00 +000028; RV32I-NEXT: # %bb.7: # %test8
Alex Bradbury74913e12017-11-08 13:31:40 +000029; RV32I-NEXT: lw a3, 0(a1)
30; RV32I-NEXT: bge a0, a3, .LBB0_12
Alex Bradburye027c932018-01-10 20:47:00 +000031; RV32I-NEXT: # %bb.8: # %test9
Alex Bradbury74913e12017-11-08 13:31:40 +000032; RV32I-NEXT: lw a3, 0(a1)
33; RV32I-NEXT: bltu a0, a3, .LBB0_12
Alex Bradburye027c932018-01-10 20:47:00 +000034; RV32I-NEXT: # %bb.9: # %test10
Alex Bradbury74913e12017-11-08 13:31:40 +000035; RV32I-NEXT: lw a3, 0(a1)
36; RV32I-NEXT: bgeu a0, a3, .LBB0_12
Alex Bradburye027c932018-01-10 20:47:00 +000037; RV32I-NEXT: # %bb.10: # %test11
Alex Bradbury74913e12017-11-08 13:31:40 +000038; RV32I-NEXT: lw a0, 0(a1)
39; RV32I-NEXT: andi a0, a2, 1
Alex Bradbury59136ff2017-12-15 09:47:01 +000040; RV32I-NEXT: bnez a0, .LBB0_12
Alex Bradburye027c932018-01-10 20:47:00 +000041; RV32I-NEXT: # %bb.11: # %test12
Alex Bradbury74913e12017-11-08 13:31:40 +000042; RV32I-NEXT: lw a0, 0(a1)
43; RV32I-NEXT: .LBB0_12: # %end
Alex Bradbury59136ff2017-12-15 09:47:01 +000044; RV32I-NEXT: ret
Alex Bradbury74913e12017-11-08 13:31:40 +000045
46 %val1 = load volatile i32, i32* %b
47 %tst1 = icmp eq i32 %val1, %a
48 br i1 %tst1, label %end, label %test2
49
50test2:
51 %val2 = load volatile i32, i32* %b
52 %tst2 = icmp ne i32 %val2, %a
53 br i1 %tst2, label %end, label %test3
54
55test3:
56 %val3 = load volatile i32, i32* %b
57 %tst3 = icmp slt i32 %val3, %a
58 br i1 %tst3, label %end, label %test4
59
60test4:
61 %val4 = load volatile i32, i32* %b
62 %tst4 = icmp sge i32 %val4, %a
63 br i1 %tst4, label %end, label %test5
64
65test5:
66 %val5 = load volatile i32, i32* %b
67 %tst5 = icmp ult i32 %val5, %a
68 br i1 %tst5, label %end, label %test6
69
70test6:
71 %val6 = load volatile i32, i32* %b
72 %tst6 = icmp uge i32 %val6, %a
73 br i1 %tst6, label %end, label %test7
74
75; Check for condition codes that don't have a matching instruction
76
77test7:
78 %val7 = load volatile i32, i32* %b
79 %tst7 = icmp sgt i32 %val7, %a
80 br i1 %tst7, label %end, label %test8
81
82test8:
83 %val8 = load volatile i32, i32* %b
84 %tst8 = icmp sle i32 %val8, %a
85 br i1 %tst8, label %end, label %test9
86
87test9:
88 %val9 = load volatile i32, i32* %b
89 %tst9 = icmp ugt i32 %val9, %a
90 br i1 %tst9, label %end, label %test10
91
92test10:
93 %val10 = load volatile i32, i32* %b
94 %tst10 = icmp ule i32 %val10, %a
95 br i1 %tst10, label %end, label %test11
96
97; Check the case of a branch where the condition was generated in another
98; function
99
100test11:
101 %val11 = load volatile i32, i32* %b
102 br i1 %c, label %end, label %test12
103
104test12:
105 %val12 = load volatile i32, i32* %b
106 br label %end
107
108end:
109 ret void
110}