|
| 1 | +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5 |
| 2 | +; RUN: llc -mtriple=riscv32 -verify-machineinstrs < %s \ |
| 3 | +; RUN: | FileCheck %s -check-prefixes=RV32I |
| 4 | +; RUN: llc -mtriple=riscv32 --mattr=+zba -verify-machineinstrs < %s \ |
| 5 | +; RUN: | FileCheck %s -check-prefixes=RV32IZBA |
| 6 | +; RUN: llc -mtriple=riscv32 -mattr=+zba,+experimental-xqcisls -verify-machineinstrs < %s \ |
| 7 | +; RUN: | FileCheck %s -check-prefixes=RV32IZBAXQCISLS |
| 8 | + |
| 9 | +define i32 @lb_ri(i8* %a, i32 %b) { |
| 10 | +; RV32I-LABEL: lb_ri: |
| 11 | +; RV32I: # %bb.0: |
| 12 | +; RV32I-NEXT: slli a1, a1, 3 |
| 13 | +; RV32I-NEXT: add a0, a0, a1 |
| 14 | +; RV32I-NEXT: lb a0, 0(a0) |
| 15 | +; RV32I-NEXT: ret |
| 16 | +; |
| 17 | +; RV32IZBA-LABEL: lb_ri: |
| 18 | +; RV32IZBA: # %bb.0: |
| 19 | +; RV32IZBA-NEXT: sh3add a0, a1, a0 |
| 20 | +; RV32IZBA-NEXT: lb a0, 0(a0) |
| 21 | +; RV32IZBA-NEXT: ret |
| 22 | +; |
| 23 | +; RV32IZBAXQCISLS-LABEL: lb_ri: |
| 24 | +; RV32IZBAXQCISLS: # %bb.0: |
| 25 | +; RV32IZBAXQCISLS-NEXT: qc.lrb a0, a0, a1, 3 |
| 26 | +; RV32IZBAXQCISLS-NEXT: ret |
| 27 | + %shl = shl i32 %b, 3 |
| 28 | + %1 = getelementptr i8, i8* %a, i32 %shl |
| 29 | + %2 = load i8, i8* %1 |
| 30 | + %3 = sext i8 %2 to i32 |
| 31 | + ret i32 %3 |
| 32 | +} |
| 33 | + |
| 34 | +define i32 @lbu_ri(i8* %a, i32 %b) { |
| 35 | +; RV32I-LABEL: lbu_ri: |
| 36 | +; RV32I: # %bb.0: |
| 37 | +; RV32I-NEXT: slli a1, a1, 2 |
| 38 | +; RV32I-NEXT: add a0, a0, a1 |
| 39 | +; RV32I-NEXT: lbu a0, 0(a0) |
| 40 | +; RV32I-NEXT: ret |
| 41 | +; |
| 42 | +; RV32IZBA-LABEL: lbu_ri: |
| 43 | +; RV32IZBA: # %bb.0: |
| 44 | +; RV32IZBA-NEXT: sh2add a0, a1, a0 |
| 45 | +; RV32IZBA-NEXT: lbu a0, 0(a0) |
| 46 | +; RV32IZBA-NEXT: ret |
| 47 | +; |
| 48 | +; RV32IZBAXQCISLS-LABEL: lbu_ri: |
| 49 | +; RV32IZBAXQCISLS: # %bb.0: |
| 50 | +; RV32IZBAXQCISLS-NEXT: qc.lrbu a0, a0, a1, 2 |
| 51 | +; RV32IZBAXQCISLS-NEXT: ret |
| 52 | + %shl = shl i32 %b, 2 |
| 53 | + %1 = getelementptr i8, i8* %a, i32 %shl |
| 54 | + %2 = load i8, i8* %1 |
| 55 | + %3 = zext i8 %2 to i32 |
| 56 | + ret i32 %3 |
| 57 | +} |
| 58 | + |
| 59 | +define i32 @lh_ri(i16* %a, i32 %b) { |
| 60 | +; RV32I-LABEL: lh_ri: |
| 61 | +; RV32I: # %bb.0: |
| 62 | +; RV32I-NEXT: slli a1, a1, 5 |
| 63 | +; RV32I-NEXT: add a0, a0, a1 |
| 64 | +; RV32I-NEXT: lh a0, 0(a0) |
| 65 | +; RV32I-NEXT: ret |
| 66 | +; |
| 67 | +; RV32IZBA-LABEL: lh_ri: |
| 68 | +; RV32IZBA: # %bb.0: |
| 69 | +; RV32IZBA-NEXT: slli a1, a1, 5 |
| 70 | +; RV32IZBA-NEXT: add a0, a0, a1 |
| 71 | +; RV32IZBA-NEXT: lh a0, 0(a0) |
| 72 | +; RV32IZBA-NEXT: ret |
| 73 | +; |
| 74 | +; RV32IZBAXQCISLS-LABEL: lh_ri: |
| 75 | +; RV32IZBAXQCISLS: # %bb.0: |
| 76 | +; RV32IZBAXQCISLS-NEXT: qc.lrh a0, a0, a1, 5 |
| 77 | +; RV32IZBAXQCISLS-NEXT: ret |
| 78 | + %shl = shl i32 %b, 4 |
| 79 | + %1 = getelementptr i16, i16* %a, i32 %shl |
| 80 | + %2 = load i16, i16* %1 |
| 81 | + %3 = sext i16 %2 to i32 |
| 82 | + ret i32 %3 |
| 83 | +} |
| 84 | + |
| 85 | +define i32 @lhu_ri(i16* %a, i32 %b) { |
| 86 | +; RV32I-LABEL: lhu_ri: |
| 87 | +; RV32I: # %bb.0: |
| 88 | +; RV32I-NEXT: slli a1, a1, 6 |
| 89 | +; RV32I-NEXT: add a0, a0, a1 |
| 90 | +; RV32I-NEXT: lhu a0, 0(a0) |
| 91 | +; RV32I-NEXT: ret |
| 92 | +; |
| 93 | +; RV32IZBA-LABEL: lhu_ri: |
| 94 | +; RV32IZBA: # %bb.0: |
| 95 | +; RV32IZBA-NEXT: slli a1, a1, 6 |
| 96 | +; RV32IZBA-NEXT: add a0, a0, a1 |
| 97 | +; RV32IZBA-NEXT: lhu a0, 0(a0) |
| 98 | +; RV32IZBA-NEXT: ret |
| 99 | +; |
| 100 | +; RV32IZBAXQCISLS-LABEL: lhu_ri: |
| 101 | +; RV32IZBAXQCISLS: # %bb.0: |
| 102 | +; RV32IZBAXQCISLS-NEXT: qc.lrhu a0, a0, a1, 6 |
| 103 | +; RV32IZBAXQCISLS-NEXT: ret |
| 104 | + %shl = shl i32 %b, 5 |
| 105 | + %1 = getelementptr i16, i16* %a, i32 %shl |
| 106 | + %2 = load i16, i16* %1 |
| 107 | + %3 = zext i16 %2 to i32 |
| 108 | + ret i32 %3 |
| 109 | +} |
| 110 | + |
| 111 | +define i32 @lw_ri(i32* %a, i32 %b) { |
| 112 | +; RV32I-LABEL: lw_ri: |
| 113 | +; RV32I: # %bb.0: |
| 114 | +; RV32I-NEXT: slli a1, a1, 6 |
| 115 | +; RV32I-NEXT: add a0, a0, a1 |
| 116 | +; RV32I-NEXT: lw a0, 0(a0) |
| 117 | +; RV32I-NEXT: ret |
| 118 | +; |
| 119 | +; RV32IZBA-LABEL: lw_ri: |
| 120 | +; RV32IZBA: # %bb.0: |
| 121 | +; RV32IZBA-NEXT: slli a1, a1, 6 |
| 122 | +; RV32IZBA-NEXT: add a0, a0, a1 |
| 123 | +; RV32IZBA-NEXT: lw a0, 0(a0) |
| 124 | +; RV32IZBA-NEXT: ret |
| 125 | +; |
| 126 | +; RV32IZBAXQCISLS-LABEL: lw_ri: |
| 127 | +; RV32IZBAXQCISLS: # %bb.0: |
| 128 | +; RV32IZBAXQCISLS-NEXT: qc.lrw a0, a0, a1, 6 |
| 129 | +; RV32IZBAXQCISLS-NEXT: ret |
| 130 | + %shl = shl i32 %b, 4 |
| 131 | + %1 = getelementptr i32, i32* %a, i32 %shl |
| 132 | + %2 = load i32, i32* %1 |
| 133 | + ret i32 %2 |
| 134 | +} |
| 135 | + |
| 136 | +define void @sb_ri(i8* %a, i8 %b, i32 %c) { |
| 137 | +; RV32I-LABEL: sb_ri: |
| 138 | +; RV32I: # %bb.0: |
| 139 | +; RV32I-NEXT: slli a2, a2, 7 |
| 140 | +; RV32I-NEXT: add a0, a0, a2 |
| 141 | +; RV32I-NEXT: sb a1, 0(a0) |
| 142 | +; RV32I-NEXT: ret |
| 143 | +; |
| 144 | +; RV32IZBA-LABEL: sb_ri: |
| 145 | +; RV32IZBA: # %bb.0: |
| 146 | +; RV32IZBA-NEXT: slli a2, a2, 7 |
| 147 | +; RV32IZBA-NEXT: add a0, a0, a2 |
| 148 | +; RV32IZBA-NEXT: sb a1, 0(a0) |
| 149 | +; RV32IZBA-NEXT: ret |
| 150 | +; |
| 151 | +; RV32IZBAXQCISLS-LABEL: sb_ri: |
| 152 | +; RV32IZBAXQCISLS: # %bb.0: |
| 153 | +; RV32IZBAXQCISLS-NEXT: qc.srb a1, a0, a2, 7 |
| 154 | +; RV32IZBAXQCISLS-NEXT: ret |
| 155 | + %shl = shl i32 %c, 7 |
| 156 | + %1 = getelementptr i8, i8* %a, i32 %shl |
| 157 | + store i8 %b, i8* %1 |
| 158 | + ret void |
| 159 | +} |
| 160 | + |
| 161 | +define void @sh_ri(i16* %a, i16 %b, i32 %c) { |
| 162 | +; RV32I-LABEL: sh_ri: |
| 163 | +; RV32I: # %bb.0: |
| 164 | +; RV32I-NEXT: slli a2, a2, 3 |
| 165 | +; RV32I-NEXT: add a0, a0, a2 |
| 166 | +; RV32I-NEXT: sh a1, 0(a0) |
| 167 | +; RV32I-NEXT: ret |
| 168 | +; |
| 169 | +; RV32IZBA-LABEL: sh_ri: |
| 170 | +; RV32IZBA: # %bb.0: |
| 171 | +; RV32IZBA-NEXT: sh3add a0, a2, a0 |
| 172 | +; RV32IZBA-NEXT: sh a1, 0(a0) |
| 173 | +; RV32IZBA-NEXT: ret |
| 174 | +; |
| 175 | +; RV32IZBAXQCISLS-LABEL: sh_ri: |
| 176 | +; RV32IZBAXQCISLS: # %bb.0: |
| 177 | +; RV32IZBAXQCISLS-NEXT: qc.srh a1, a0, a2, 3 |
| 178 | +; RV32IZBAXQCISLS-NEXT: ret |
| 179 | + %shl = shl i32 %c, 2 |
| 180 | + %1 = getelementptr i16, i16* %a, i32 %shl |
| 181 | + store i16 %b, i16* %1 |
| 182 | + ret void |
| 183 | +} |
| 184 | + |
| 185 | +define void @sw_ri(i32* %a, i32 %b, i32 %c) { |
| 186 | +; RV32I-LABEL: sw_ri: |
| 187 | +; RV32I: # %bb.0: |
| 188 | +; RV32I-NEXT: slli a2, a2, 3 |
| 189 | +; RV32I-NEXT: add a0, a0, a2 |
| 190 | +; RV32I-NEXT: sw a1, 0(a0) |
| 191 | +; RV32I-NEXT: ret |
| 192 | +; |
| 193 | +; RV32IZBA-LABEL: sw_ri: |
| 194 | +; RV32IZBA: # %bb.0: |
| 195 | +; RV32IZBA-NEXT: sh3add a0, a2, a0 |
| 196 | +; RV32IZBA-NEXT: sw a1, 0(a0) |
| 197 | +; RV32IZBA-NEXT: ret |
| 198 | +; |
| 199 | +; RV32IZBAXQCISLS-LABEL: sw_ri: |
| 200 | +; RV32IZBAXQCISLS: # %bb.0: |
| 201 | +; RV32IZBAXQCISLS-NEXT: qc.srw a1, a0, a2, 3 |
| 202 | +; RV32IZBAXQCISLS-NEXT: ret |
| 203 | + %shl = shl i32 %c, 1 |
| 204 | + %1 = getelementptr i32, i32* %a, i32 %shl |
| 205 | + store i32 %b, i32* %1 |
| 206 | + ret void |
| 207 | +} |
0 commit comments